<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><FONT class="Apple-style-span" face="Tahoma" size="4"><SPAN class="Apple-style-span" style="font-size: 13.3px;">&gt;&gt; </SPAN></FONT>Can you tell me how it is possible to covert images to matrices and vice vera?<DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; 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-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">1. Instantiate a vnl matrix that is of the same size as your 2D image. </DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">2. Iterate the image.</DIV><DIV style="margin-top: 0px; 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-top: 0px; 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-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><BR class="khtml-block-placeholder"></DIV><BR><DIV><DIV>On Feb 2, 2007, at 11:15 AM, Ali - wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><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> <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">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="_new">Try it!</A><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Insight-users mailing list</DIV><DIV style="margin-top: 0px; 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-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</A></DIV> </BLOCKQUOTE></DIV><BR></BODY></HTML>