<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<br><font class="Apple-style-span" face="Tahoma" size="2">Hello Seth</font><div style="font-family: Tahoma; font-size: 10pt; "><br></div><div><font class="Apple-style-span" face="Tahoma" size="2">the error is "Unhandled exception at 0x012cb166 in tesImageReaderExample.exe: 0xC0000094: Integer division by zero." now in doing like this&nbsp;</font></div><div><font class="Apple-style-span" face="Tahoma" size="2">&lt;code&gt;</font></div><div><font class="Apple-style-span" face="Tahoma" size="2"><div><span class="Apple-tab-span" style="white-space:pre">        </span>rgb.SetRed(x);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>rgb.SetGreen(y);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>rgb.SetBlue(z);</div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>indexIt=itRGB.GetIndex();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>rgbImage-&gt;SetPixel(indexIt,rgb);</div></div></font></div><div><font class="Apple-style-span" face="Tahoma" size="2">&lt;/code&gt;</font></div><div><font class="Apple-style-span" face="Tahoma" size="2">but first i tried like this</font></div><div><font class="Apple-style-span" face="Tahoma" size="2">&lt;code&gt;</font></div><div><font class="Apple-style-span" face="Tahoma" size="2"><span class="Apple-tab-span" style="white-space:pre">        rgb.SetRed(x);
        rgb.SetGreen(y);
        rgb.SetBlue(z);</span></font></div><div><font class="Apple-style-span" face="Tahoma" size="2"><span class="Apple-tab-span" style="white-space:pre">        itRGB.Set(rgb);</span></font></div><div><font class="Apple-style-span" face="Tahoma" size="2">&lt;/code&gt;<br></font>where rgb is&nbsp;itk::RGBPixel&lt;double&gt;, x,y and z are the values extracted from the eigenvector, itRGB is the iterator that goes through the itk::Image&lt;RGBPixelType,3&gt;.</div><div>thanks,<br><br><br><br><div id="SkyDrivePlaceholder" style="font-family: Tahoma; font-size: 10pt; "></div><hr id="stopSpelling" style="font-family: Tahoma; font-size: 10pt; "><font class="Apple-style-span" face="Tahoma" size="2">From: seth@mech.ubc.ca</font><br><font class="Apple-style-span" face="Tahoma" size="2">Date: Mon, 14 Feb 2011 08:14:57 -0800</font><br><font class="Apple-style-span" face="Tahoma" size="2">Subject: Re: [Insight-users] map the colours from the eigenvector</font><br><font class="Apple-style-span" face="Tahoma" size="2">To: albagarin1986@hotmail.com</font><br><font class="Apple-style-span" face="Tahoma" size="2">CC: insight-users@itk.org</font><br><br><font class="Apple-style-span" face="Tahoma" size="2">Hi alba,</font><br><font class="Apple-style-span" face="Tahoma" size="2">What's the error?</font><br><br><font class="Apple-style-span" face="Tahoma" size="2">Seth</font><br><br><div class="ecxgmail_quote" style="font-family: Tahoma; font-size: 10pt; ">On Mon, Feb 14, 2011 at 3:09 AM, alba garin <span dir="ltr">&lt;<a href="mailto:albagarin1986@hotmail.com">albagarin1986@hotmail.com</a>&gt;</span> wrote:<br>

<blockquote class="ecxgmail_quote" style="padding-left:1ex">



<div>
Hi again,<div><br></div><div>the problem is that i got an error at doing itRGB.Set(rgbPixel).</div><div>why is that happening?</div><div>Thanks,</div><div><br><div>
<p align="center"><font color="#000000"><img src="http://" height="2" vspace="9" width="100%"></font></p></div><br><br><br><br><hr>From: <a href="mailto:albagarin1986@hotmail.com">albagarin1986@hotmail.com</a><br>

To: <a href="mailto:seth@mech.ubc.ca">seth@mech.ubc.ca</a>; <a href="mailto:insight-users@itk.org">insight-users@itk.org</a><br>Date: Mon, 14 Feb 2011 07:52:29 +0000<br>Subject: Re: [Insight-users] map the colours from the eigenvector<div class="ecxim">

<br><br>






<br><div>Thanks, I needed to save each component in RGB pixels so your pseudo code is useful.&nbsp;</div><div><br>
<p align="center"><font color="#000000"><img src="http://" height="2" vspace="9" width="100%"></font></p></div><br><br><br><br><hr>From: <a href="mailto:seth@mech.ubc.ca">seth@mech.ubc.ca</a><br>Date: Fri, 11 Feb 2011 13:25:25 -0800<br>

Subject: [Insight-users] map the colours from the eigenvector<br>To: <a href="mailto:insight-users@itk.org">insight-users@itk.org</a>; <a href="mailto:albagarin1986@hotmail.com">albagarin1986@hotmail.com</a><br>

<br></div><div><div></div><div class="h5">Hi Alba,<br>I'm not sure if I understand, is it the magnitude that you want mapped or the direction?&nbsp; You can use ParaView to create visualizations of both from an image of vectors, and that my be the best way to go.&nbsp; 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-&gt;GetLargestPossibleRegion());<br>ConstVectorIteratorType constItVec(vectorImage, vectorImage-&gt;GetLargestPossibleRegion());<br><br>for ([the whole region])<br>{<br>&nbsp;&nbsp; VectorImageType::PixelType currentVectorPixel = constItVec.Get();<br>



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



&nbsp;&nbsp; currentRGBPixel-&gt;SetRed(currentVectorPixel[2]);<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; itRGB.Set(currentRGBPixel);<br>}<br><br><br>                                               
<br></div></div>_____________________________________
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>

Visit other Kitware open-source projects at
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>

Kitware offers ITK Training Courses, for more information visit:
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a>

Please keep messages on-topic and check the ITK FAQ at:
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></div>                                               </div>

</blockquote></div><br></div>                                               </body>
</html>