<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><div style="text-align: left;"><br>Perhaps this is not the most efficient way, is it possible to get the pointer to <br>the image data and pass it to the matrix? If there is no such a class to convert <br>images and matrices, then how is the vnl matrix class used in itk?!<br></div><blockquote style="border-left: #008080 2px solid; padding-left: 5px; margin-left: 5px; margin-right: 0px;"><br><br><font class="EC_Apple-style-span" face="Tahoma" size="4"><span class="EC_Apple-style-span" style="font-size: 13.3px;">&gt;&gt;&nbsp;</span></font>Can you tell me how it is possible to covert images to matrices and vice vera?<div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><br class="EC_khtml-block-placeholder"></div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">I'm not sure if there is an ITK class for this, but I imagine that you could:</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">1. Instantiate a vnl matrix that is of the same size as your 2D image.&nbsp;</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">2. Iterate the image.</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">3. As the iterator traverses the image, grab the pixel index and value.</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">4. Set the pixel value in the matrix at the corresponding index.</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><br class="EC_khtml-block-placeholder"></div><br><div><div>On Feb 2, 2007, at 11:15 AM, Ali - wrote:</div><br class="EC_Apple-interchange-newline"><blockquote><br>&gt; <br>&gt; &gt; It is strange how ITK can perform so many elaborated image processings,  <br>&gt; &gt; but it takes hours to figure out how to implement some elementary matrix  <br>&gt; &gt; manipulations. I thought the inclusion of VXL in ITK means having a fast  <br>&gt; &gt; MATLAB-style image processing toolkit in c++.<br>&gt; <br>&gt; That's right that many filters are missing to perform simple tasks.<br>&gt; ITK is open source, and open to contributions. Feel free to contribute  <br>&gt; contribute new code to the insight journal :-)<br><br>Even if the community provides it, I think it is not a good idea to <br>create a 'database' of all operations for images and I have at least 2 reasons for that.<br>&nbsp;<br>First, it is really hard to find out which class does what operation simply by guessing <br>from its name. Secondly, not all the operations can be created as a linear combination <br>of the simple operations. This means you have to write filters forever, many of them may be <br>used only once.<br><br>For example, the slice-by-slice filter you provides does not accept binary filters <br>to operate on each slice. So, if I want to divide an N x N image A to a 1 x N image B <br>row-by-row, I have to modify the slice-by-slice filter. In the matrix form, this can be <br>down simply by 'literally' one line: B-&gt;GetTranspose() * A. <br><br>Can you tell me how it is possible to covert images to matrices and vice vera? I know ITK <br>uses VNL matrices but I cannot see where this is used to maniplulate image pixels directly. <br>If this can be done, we won't need hundereds of image operation classes.<br><br>&gt; <br>&gt; Gaetan<br>&gt; <br>&gt; <br>&gt; <br>&gt; -- <br>&gt; Gaëtan Lehmann<br>&gt; Biologie du Développement et de la Reproduction<br>&gt; INRA de Jouy-en-Josas (France)<br>&gt; tel: +33 1 34 65 29 66    fax: 01 34 65 29 09<br>&gt; <a href="http://voxel.jouy.inra.fr" target="_blank">http://voxel.jouy.inra.fr</a><br><br><hr>Personalize your Live.com homepage with the news, weather, and photos you care about. <a href="http://www.live.com/getstarted.aspx?icid=T001MSN30A0701" target="_blank">Try it!</a><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">_______________________________________________</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;">Insight-users mailing list</div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a></div><div style="margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a></div> </blockquote></div><br></blockquote><br /><hr />Live Search: Better results, fast <a href='http://get.live.com/search/overview' target='_new'>Try it now!</a></body>
</html>