[Insight-users] map the colours from the eigenvector

alba garin albagarin1986 at hotmail.com
Mon Feb 14 11:42:53 EST 2011



Hello Seth
the error is "Unhandled exception at 0x012cb166 in tesImageReaderExample.exe: 0xC0000094: Integer division by zero." now in doing like this <code>	rgb.SetRed(x);	rgb.SetGreen(y);	rgb.SetBlue(z);	indexIt=itRGB.GetIndex();	rgbImage->SetPixel(indexIt,rgb);</code>but first i tried like this<code>	rgb.SetRed(x);
	rgb.SetGreen(y);
	rgb.SetBlue(z);	itRGB.Set(rgb);</code>
where rgb is itk::RGBPixel<double>, x,y and z are the values extracted from the eigenvector, itRGB is the iterator that goes through the itk::Image<RGBPixelType,3>.thanks,



From: seth at mech.ubc.ca
Date: Mon, 14 Feb 2011 08:14:57 -0800
Subject: Re: [Insight-users] map the colours from the eigenvector
To: albagarin1986 at hotmail.com
CC: insight-users at itk.org

Hi alba,
What's the error?

Seth

On Mon, Feb 14, 2011 at 3:09 AM, alba garin <albagarin1986 at hotmail.com> wrote:







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/8b5cb51d/attachment.htm>


More information about the Insight-users mailing list