[Insight-developers] VectorImage class in the pipeline

Karthik Krishnan karthik.krishnan at kitware.com
Thu Feb 8 14:40:38 EST 2007


On 2/8/07, Jim Miller <millerjv at gmail.com> wrote:
>
> It looks to me like the VectorImage class has not been integrated in the
> ITK pipeline.  For example, one cannot put a VectorImage through a
> CastImageFilter to


You can now. For most filters (on which it makes sense), VectorImages do
work.

The ProcessObject propagates VectorLength through the pipeline via the
following line in its GenerateOutputInformation() method :
  output->CopyInformation(input)
and ImageBase copies the VectorLength over in line 244.
  SetNumberOfComponentsPerPixel(imgData->GetNumberOfComponentsPerPixel() )

I overlooked UnaryFunctorImageFilters, which override the
GenerateOutputInformation() method and unlike most other filters, do not
call the superclass GenerateOutputInformation() method. Is there a reason, I
wonder ?

So I added just added this line in UnaryFunctorImageFilter and they work
fine for VectorImage.
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/BasicFilters/itkUnaryFunctorImageFilter.txx?root=Insight&r1=1.30&r2=1.31

The CastImageFilter is a simple subclass of the UnaryFunctorImageFilter, so
> I am guessing that none of the subclasses of UnaryFunctorImageFilter,
> BinaryFunctorImageFilter, etc. can handle a VectorImage.


Subclasses of BinaryFunctorImageFilter do work fine. I just tried
itk::AddImageFilter. The ProcessObject::GenerateOuptutInformation takes care
of it.

This is very disappointing since we have many such subclasses and they
> provide the very basics of pixel manipulation. (No neighborhoods are
> evaluated, etc.)


Karthik, I though you went through a large number of the filters to make to
> make them work for VectorImage.  Are these filters on the roadmap?


Generally speaking, if a filter works on
Image< itk::Array< T >, N >, it should work with VectorImages as well, since
they are supposed to provide the same external API as the former, internally
maintaining a non-fragmented memory layout. If it doesn't, that's bad.

The basis of the issue is that the vector length is not part of the
> information configured by a filter when GenerateOutputInformation is called.
> So the output image is never configured with an appropriate VectorLength and
> the Allocate() method ends making vectors which are zero length).


You're right. For filters that override GenerateOutputInformation and do not
call the superclass method, its a problem. Most filters called the
superclass method. There are a few filters that don't and they need to
propagate VectorLength down just as they propagate regions down themselves.
It just requires one additional line on all filters that don't:

 outputPtr->SetNumberOfComponentsPerPixel(inputPtr->GetNumberOfComponentsPerPixel());

I'll add that.

Sorry for the overlook and thanks for pointing this out.

Thanks
-- 
karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20070208/dfd31d33/attachment.html


More information about the Insight-developers mailing list