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

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Oct 22 09:44:15 EDT 2014


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
> _____________________________________
> 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

_____________________________________
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