[Insight-users] Vector field images

Luis Ibanez luis . ibanez at kitware . com
Mon, 12 May 2003 09:26:12 -0400


Hi Peter,

You also have the option of defining an image of vnl_vector
or std::vector. Both of which have variable size.  The drawback
of this option is that the vector has an overload of 8 bytes
required to hold the counter of elements and the pointer to the
elements.  This may not be a problem if you are dealing with
vector of say 10 elements.

---

About avoiding to manage a copy of the 3D image for visualization,
you may want to consider the use of ImageAdaptors. With them, you
can do things like presenting an RGB image as being a scalar image
with only the G component.  There are examples of ImageAdaptors for
extracting a single element from a vector image.


Regards,


   Luis


---------------------
Peter Lorenzen wrote:
> Hi All,
> 
> Has anyone done much work with 3D vector field images in ITK? The 
> example in
> InsightToolkit-1.2.0/Examples/DataRepresentation/Image/VectorImage.cxx 
> suggests constructing a 3D image of type itkVector.  This seems like a 
> reasonable plan if one knows, a priori, the depth of said vector (e.g. 
> nD for a velocity field in nD space).
> 
> The project on which I am working requires that a vector in the vector 
> field be of size 'n' where 'n' is determined at run time.  This 
> precludes the itk::Vector solution. Another approach involves defining a 
> 4D images. For example,
> 
> typedef itk::Image<float,4> ImageType4D;
> 
> SizeType size;
> size[0]     // X
> size[1]     // Y
> size[2]     // Z
> size[3]     //  'n'  which is the depth of the vector, if you will
> 
> This approach seems to work fine.  I am, however, trying to use 
> GLSliceView (from InsightApplications/Auxiliary/FltkImageViewer) to 
> display a 3D volume from the 4D image (e.g. the 3D volume where 'n=2'). 
>  Conceptually, I would to be able to extract such a 3D volume as follows:
> 
> typedef itk::Image<float,3> ImageType3D;
> 
> ImageType4D::Pointer image4D;  // Somehow given
> 
> ImageType3D::Pointer  image3D = (ImageType3D::Pointer) image4D[2];
> 
> I would then use this image3D as input to GLSliceView for display 
> purposes.  Does anyone know how this can be done without allocating new 
> memory for an ImageType3D?
> 
> Thanks,
> 
> - Peter
> 
> -- 
> Peter J. Lorenzen
> Ph.D. Student
> Department of Computer Science
> University of North Carolina at Chapel Hill
> Sitterson Hall 268, Campus Box 3175
> Chapel Hill, NC  27599-3175
> 
> TEL (919) 962-1879
> FAX (919) 962-1699
> E-MAIL lorenzen@cs.unc.edu
> WEB PAGE http://www.cs.unc.edu/~lorenzen
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>