<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<br><div>Thanks, I needed to save each component in RGB pixels so your pseudo code is useful. </div><div><br>
<p align="center"><font color="#000000"><img height="2" src="http://graphics.hotmail.com/greypixel.gif" width="100%" vspace="9"></font></p></div><br><br><br><br><hr id="stopSpelling">From: seth@mech.ubc.ca<br>Date: Fri, 11 Feb 2011 13:25:25 -0800<br>Subject: [Insight-users] map the colours from the eigenvector<br>To: insight-users@itk.org; albagarin1986@hotmail.com<br><br>Hi Alba,<br>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!<br>
<br>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).<br>
<br>RBGIteratorType itRGB(rbgImage, vectorImage->GetLargestPossibleRegion());<br>ConstVectorIteratorType constItVec(vectorImage, vectorImage->GetLargestPossibleRegion());<br><br>for ([the whole region])<br>{<br> VectorImageType::PixelType currentVectorPixel = constItVec.Get();<br>
<br> RGBImageType::PixelType currentRGBPixel;<br> currentRGBPixel->SetBlue(currentVectorPixel[0]); // make sure your vector component type and pixel type match<br> currentRGBPixel->SetGreen(currentVectorPixel[1]); // you will also want to normalize your vector components by the largest in the image. <br>
currentRGBPixel->SetRed(currentVectorPixel[2]);<br> <br> itRGB.Set(currentRGBPixel);<br>}<br><br><br>                                            </body>
</html>