[Insight-developers] Problem with PermuteAxesFilter and VectorImage types

Kent Williams kent at psychiatry.uiowa.edu
Tue Dec 6 19:24:52 EST 2005


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.

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



More information about the Insight-developers mailing list