[Insight-users] map the colours from the eigenvector

alba garin albagarin1986 at hotmail.com
Mon Feb 14 06:09:09 EST 2011


Hi again,
the problem is that i got an error at doing itRGB.Set(rgbPixel).why is that happening?Thanks,





From: albagarin1986 at hotmail.com
To: seth at mech.ubc.ca; insight-users at itk.org
Date: Mon, 14 Feb 2011 07:52:29 +0000
Subject: Re: [Insight-users] map the colours from the eigenvector









Thanks, I needed to save each component in RGB pixels so your pseudo code is useful. 





From: seth at mech.ubc.ca
Date: Fri, 11 Feb 2011 13:25:25 -0800
Subject: [Insight-users] map the colours from the eigenvector
To: insight-users at itk.org; albagarin1986 at hotmail.com

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);
}


 		 	   		  

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.html

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110214/43e8f6f5/attachment.htm>


More information about the Insight-users mailing list