[Insight-users] map the colours from the eigenvector

Seth Gilchrist seth at mech.ubc.ca
Fri Feb 11 16:25:25 EST 2011


Hi Alba,
I'm not sure if I understand, is it the magnitude that you want mapped or
the direction?  You can use ParaView to create visualizations of both from
an image of vectors, and that my be the best way to go.  ParaView makes some
very pretty pictures!

If you want to save each component of the vector to the components of an RGB
pixel, you could use iterators to move through the image and save each
component of the eigenvector to an RGB pixel as in the following pseudo code
(more details in the Software Guide, page 738 on).

RBGIteratorType itRGB(rbgImage, vectorImage->GetLargestPossibleRegion());
ConstVectorIteratorType constItVec(vectorImage,
vectorImage->GetLargestPossibleRegion());

for ([the whole region])
{
   VectorImageType::PixelType currentVectorPixel = constItVec.Get();

   RGBImageType::PixelType currentRGBPixel;
   currentRGBPixel->SetBlue(currentVectorPixel[0]); // make sure your vector
component type and pixel type match
   currentRGBPixel->SetGreen(currentVectorPixel[1]);  // you will also want
to normalize your vector components by the largest in the image.
   currentRGBPixel->SetRed(currentVectorPixel[2]);

   itRGB.Set(currentRGBPixel);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110211/66dc1019/attachment.htm>


More information about the Insight-users mailing list