[Insight-developers] Problem with PermuteAxesFilter and VectorImage types

Karthik Krishnan Karthik.Krishnan at kitware.com
Wed Dec 7 06:32:04 EST 2005


Thanks for the bug report. This has been fixed. As you mentioned the
problem was that the VectorLength wasn't being propagated down the
pipeline.

On Tue, 2005-12-06 at 18:24 -0600, Kent Williams wrote:
> Vince Magnotta flushed a problem with filters, (or with 
> ImageRegionIterators) with respect to VectorImage types.
> The enclosed short program illustrates the problem: It reads a Nrrd file 
> (tmp.nhdr) into an itk::VectorImage<short,3>.  This appears to work 
> fine. Then it re-orients the VectorImage using itk::OrientImageFilter.
> 
> itk::PermuteImageFilter doesn't properly set the pixels in the output 
> image:
> 
>    outIt.Set( inputPtr->GetPixel(inputIndex) ); // line 260 
> itkPermuteAxesImageFilter.txx version 1.12
> 
> I think I know exactly what the problem is:  itk::VectorImage<> requires 
> that you call SetVectorLength sometime before accessing the pixels -- 
> otherwise the length of every Pixel vector stays as zero.
> 
> The question, I guess, is where the heck would this call to 
> SetVectorLength properly occur? The filters don't know the difference 
> between an itk::Image or an itk::VectorImage.  They create and allocate 
> the output images, but in the case of itk::VectorImage, they can't know 
> that VectorImage makes no sense unless you set the vector length.

True. This is why the dataobject (and its derived classes) provide a
method CopyInformation( DataObject * ) that will copy meta-data
information from another data-object of the same type.

The ProcessObject calls
outputDataObject->CopyInformation( inputDataObject0 )
and expects the meta-data to be copied from the 0th input to each of the
outputs and does not care what the inputs/outputs themselves are. This
is how spacing etc is propagated. As you mentioned I forgot to propagate
the VectorLength.

Sorry for the trouble the bug might have caused.

Please update Code/Common/itkImageBase, Code/Common/itkVectorImage and
Code/Common/itkImageConstIteratorWithIndex

thanks
karthik
> 
> Or that's what I've gathered. Insight filters represent some pretty 
> subtle C++ design, and they're more than a little confusing to a simple 
> caveman programmer like myself.
> 
> The test program, input data, and an instrumented version of 
> itkOrientImageFilter are in
> 
> http://www.cornwarning.com/xfer/vectorimagetest.tar.gz
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list