[ITK] [ITK-users] Possible missing method in itkImageSource

Joël Schaerer joel.schaerer at laposte.net
Wed Jan 7 06:31:41 EST 2015


I just noticed that the problem is fixed in the latest release. Thanks 
for the fix, and sorry for the noise!

Joel

On 07/01/2015 11:36, Joël Schaerer wrote:
> Any plans on fixing this? I've run into this issue again when 
> attempting a DisconnectPipeline() on a named output. It crashes 
> because the SetOutput() method attempts to create a new output after 
> detaching the old one using the faulty MakeOutput(key) method:
>
> 0x000000000063a3dc in itk::ProcessObject::SetOutput (this=0x1b2e060, 
> name=..., output=<optimized out>) at 
> ../Modules/Core/Common/src/itkProcessObject.cxx:484
> 483        DataObjectPointer newOutput = this->MakeOutput(key);
> 484        this->SetOutput(key, newOutput); // Segfault
>
> Thanks,
>
> Joël
>
> On 22/10/2014 15:44, Bradley Lowekamp wrote:
>> Hello,
>>
>> I'm going to take a look at this issue.
>>
>> Brad
>>
>> On Oct 17, 2014, at 5:01 PM, Jim Miller <millerjv at gmail.com> wrote:
>>
>>> At first glance it looks like an oversight. I would expect, however, 
>>> that we should be seeing warnings about the named version of 
>>> MakeOutput in ProcessObject being hidden.
>>>
>>> Jim
>>>
>>>> On Oct 17, 2014, at 12:03 PM, Joël Schaerer 
>>>> <joel.schaerer at laposte.net> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I've run into a problem with named outputs, which I believe could 
>>>> be a bug in ITK.
>>>>
>>>> When using named outputs, one is supposed to create the output data 
>>>> objects in the constructor using the MakeOutput method (see 
>>>> http://www.itk.org/Wiki/ITK/Examples/Developer/ImageFilterMultipleOutputs 
>>>> for an example). The MakeOutput method exists for both indexed and 
>>>> named outputs.
>>>> .
>>>> These methods are declared and defined first in itkProcessObject:
>>>>
>>>> .h:
>>>>   * ...
>>>>   * ProcessObject::MakeOutput. Note that MakeOutput always returns a
>>>>   * itkSmartPointer to a DataObject. ImageSource and MeshSource 
>>>> override
>>>>   * this method to create the correct type of image and mesh 
>>>> respectively.
>>>>   * If a filter has multiple outputs of different types, then that
>>>>   * filter must provide an implementation of MakeOutput(). */
>>>> virtual DataObjectPointer MakeOutput( const 
>>>> DataObjectIdentifierType & );
>>>> virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType 
>>>> idx);
>>>>
>>>> .cxx
>>>> DataObject::Pointer
>>>> ProcessObject
>>>> ::MakeOutput( const DataObjectIdentifierType & name )
>>>> {
>>>> itkDebugMacro("MakeOutput(" << name << ")");
>>>> if( this->IsIndexedOutputName(name) )
>>>>    {
>>>>    return this->MakeOutput( this->MakeIndexFromOutputName(name) );
>>>>    }
>>>> return static_cast<DataObject *>(DataObject::New().GetPointer());
>>>> }
>>>>
>>>> DataObject::Pointer
>>>> ProcessObject
>>>> ::MakeOutput(DataObjectPointerArraySizeType)
>>>> {
>>>> return static_cast<DataObject *>(DataObject::New().GetPointer());
>>>> }
>>>>
>>>>
>>>> For indexed outputs, it is redefined in ImageSource in order to 
>>>> create an image object of the correct type.
>>>>
>>>> template< typename TOutputImage >
>>>> ProcessObject::DataObjectPointer
>>>> ImageSource< TOutputImage >
>>>> ::MakeOutput(ProcessObject::DataObjectPointerArraySizeType)
>>>> {
>>>> return TOutputImage::New().GetPointer();
>>>> }
>>>>
>>>> So far, so good. However, the named output version of MakeOutput is 
>>>> not redefined in ImageSource, contrary to what the comment in 
>>>> itkProcessObject.h says. And so if someone tries to use it in an 
>>>> ImageToImageFilter, it will crash.
>>>>
>>>> Any reason for this behavior? Is this an oversight?
>>>>
>>>> Thanks,
>>>>
>>>> Joël
>>>> _____________________________________
>>>>
>

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list