[Insight-developers] Re: design problem with VectorImage and ImageAdaptor ?

Luis Ibanez luis.ibanez at kitware.com
Tue Mar 14 08:49:23 EST 2006


Hi Gaetan,

You are right, the filter is not checking for the
index value to be valid.

That check could be done if we use this filter with
images whose pixel type is defined at compile time.
(e.g. Vector, RGBPixel). However, if we do it for
pixels whose vector length is defined at run time,
then we may face the following difficulties:


1) A use can invoke the SetIndex() method, before
    connecting an input image, and at that point we
    do not know how many components are available
    in that image.

2) A previous filter may produce a VectorImage
    with a different number of components.


It seems that the only safe way to do it would be to
overload the GenerateData() method, check there for
the number of components, and verify that the index
is valid. Then invoke the GenerateData() method of
the superclass (the UnaryFunctorFilter).

Could you please create a bug entry for this issue ?

In that way we will make sure a fix will be committed
soon.



     Thanks


       Luis



-----------------------
Gaetan Lehmann wrote:
> 
> Hi Luis,
> 
> Thanks for you answer.
> Is there also a filter to create a VectorImage from several scalar images ?
> Also, VectorIndexSelectionCastImageFilter seems to not check the number 
> of  components. Is there a possibility to get invalid data, or to get a  
> segmentation fault with that filter ?
> 
> Regards,
> 
> Gaetan
> 
> On Sat, 11 Mar 2006 22:10:59 +0100, Luis Ibanez 
> <luis.ibanez at kitware.com>  wrote:
> 
>>
>> Hi Gaetan,
>>
>> The filter that you can use for extracting a scalar image
>> from a channel of a vector image is the following:
>>
>>             VectorIndexSelectionCastImageFilter
>>
>> http://www.itk.org/Insight/Doxygen/html/classitk_1_1VectorIndexSelectionCastImageFilter.html 
>>
>>
>>
>> Regards,
>>
>>
>>      Luis
>>
>>
>>
>> -----------------------
>> Gaetan Lehmann wrote:
>> ...
>>
>>>  I don't like too much adaptor, but it seem that the only class able  
>>> to  extract a scalar image from a VectorImage for now.
>>> I guess I have to write a filter to extract the channel I'm 
>>> interested  in.  It would also avoid the efficiency problem your 
>>> talking about.
>>>
>> ...
>>
>>>  Gaetan
>>>
> 
> 
> 



More information about the Insight-developers mailing list