Hello.<br>As an alternative to mhd files, Matlab can read .nii files (NIFTI/ANALYZE), although I&#39;m not 100% sure if it can actually write them and I don&#39;t have a matlab right here to test it now.<br>And ITK can load nii files. 3D wise, of course.<br>
<br>Regards<br><br><br><div class="gmail_quote">On Mon, May 10, 2010 at 8:23 AM, Dirk Boye <span dir="ltr">&lt;<a href="mailto:body@nabla.org">body@nabla.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Oh i forgot:<br>
In Matlab fwrite(fid,test,&#39;uint8&#39;)<br>
will write the image test to the file fid with PixelType uint8 = unsigned<br>
char<br>
<br>
Cheers,<br>
<font color="#888888">Dirk<br>
</font><div><div></div><div class="h5"><br>
&gt; Hi Daniela,<br>
&gt;<br>
&gt; within Matlab save the image as a raw image.<br>
&gt; Matlab commands:<br>
&gt; ----------------<br>
&gt; rawFilename=[&#39;test.raw&#39;];<br>
&gt; fid=fopen(rawFilename,&#39;w+&#39;);<br>
&gt; fwrite(fid,test,&#39;uint8&#39;);<br>
&gt; fclose(fid);<br>
&gt;<br>
&gt;<br>
&gt; In ITK you can read in raw files the following way:<br>
&gt; Set the pixeltype according to your US data!<br>
&gt;<br>
&gt; typedef unsigned char                   PixelType;<br>
&gt; typedef itk::Image&lt;PixelType, 3&gt;        ImageType;<br>
&gt; typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<br>
&gt; typedef itk::RawImageIO&lt; PixelType, 3 &gt; RawIOType;<br>
&gt;<br>
&gt; ReaderType::Pointer reader = ReaderType::New();<br>
&gt; RawIOType::Pointer rawio = RawIOType::New();<br>
&gt; rawio-&gt;SetByteOrderToBigEndian(); //Could be LittleEndian as well,<br>
&gt; depending on your machine<br>
&gt; rawio-&gt;SetFileDimensionality(3);<br>
&gt; rawio-&gt;SetHeaderSize(0);<br>
&gt; int dimension[3]={{1,1,1}}; // Set your image dimensions here<br>
&gt; double spacing[3]={{0.5,0.5,0.5}}; // Set your spacing here<br>
&gt; for (int i=0;i&lt;3;++i){<br>
&gt;    rawio-&gt;SetDimensions(i,dimension[i]);<br>
&gt;    rawio-&gt;SetSpacing(i,spacing[i]);<br>
&gt; }<br>
&gt; reader-&gt;SetImageIO(rawio);<br>
&gt; reader-&gt;SetFileName(&#39;test.raw&#39;);<br>
&gt; reader-&gt;Update();<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi everyone,<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m trying to work in ITK with a multislice US image pre-processed in<br>
&gt;&gt; Matlab: I&#39;m not able to save that in a useful format to process it with<br>
&gt;&gt; ITK.<br>
&gt;&gt;<br>
&gt;&gt; I know that I can use Matlab routine dicomwrite to save an image as .dcm<br>
&gt;&gt; (and then process it in ITK); unluckily I think that dicomwrite is good<br>
&gt;&gt; only for 2D image and so I don&#39;t know how to save my 3D image....<br>
&gt;&gt;<br>
&gt;&gt; Could someone help me?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Thanks all<br>
&gt;&gt;<br>
&gt;&gt; Daniela<br>
&gt;&gt;<br>
&gt;&gt; _________________________________________________________________<br>
&gt;&gt; MSN ti offre esattamente quello che cerchi: il tuo browser personale<br>
&gt;&gt; <a href="http://www.pimpit.it/ie8msn/_____________________________________" target="_blank">http://www.pimpit.it/ie8msn/_____________________________________</a><br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt;&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com">www.alma3d.com</a><br>