[Insight-users] Direct memory access to a vector field

Demian Wassermann demian at bwh.harvard.edu
Tue Oct 26 15:03:26 EDT 2010


Hi to all,

I have a small problem, I want to interface ITK with python, I've used some of Steve Pieper's code ( http://www.slicer.org/slicerWiki/index.php/Slicer3:Python:pitky ) and I've been successful in the scalar case however I need to interface a vector field.

More precisely:

  typedef itk::Image< double, Dimension >     ImageType;
  ImageType::Pointer fixedImage = ImageType::New();
  image->GetPixelContainer()->SetImportPointer( bufferImage, bufferImageSize, false );

works like a charm. However if the image type changes to:

 typedef itk::Vector< double, Dimension >    VectorPixelType;
 typedef itk::Image   < VectorPixelType, Dimension >              VectorFieldType;

The line
 
image->GetPixelContainer()->SetImportPointer( bufferVectorImage, bufferVectorImageSize, false );

does not seem to work as the element on each of the voxels is a VectorPixelType and not a straight double.

hence bufferVectorImage must be of type VectorPixelType* and not double*

Any ideas?

Thanks!

Demian


-- 
Demian Wassermann, PhD
demian at bwh.harvard.edu
LMI / PNL / SPL Labs
Harvard Medical School
Brigham and Women's Hospital
1249 Boylston, Boston, MA, USA



More information about the Insight-users mailing list