Hello.<br>As an alternative to mhd files, Matlab can read .nii files (NIFTI/ANALYZE), although I'm not 100% sure if it can actually write them and I don'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"><<a href="mailto:body@nabla.org">body@nabla.org</a>></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,'uint8')<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>
> Hi Daniela,<br>
><br>
> within Matlab save the image as a raw image.<br>
> Matlab commands:<br>
> ----------------<br>
> rawFilename=['test.raw'];<br>
> fid=fopen(rawFilename,'w+');<br>
> fwrite(fid,test,'uint8');<br>
> fclose(fid);<br>
><br>
><br>
> In ITK you can read in raw files the following way:<br>
> Set the pixeltype according to your US data!<br>
><br>
> typedef unsigned char PixelType;<br>
> typedef itk::Image<PixelType, 3> ImageType;<br>
> typedef itk::ImageFileReader<ImageType> ReaderType;<br>
> typedef itk::RawImageIO< PixelType, 3 > RawIOType;<br>
><br>
> ReaderType::Pointer reader = ReaderType::New();<br>
> RawIOType::Pointer rawio = RawIOType::New();<br>
> rawio->SetByteOrderToBigEndian(); //Could be LittleEndian as well,<br>
> depending on your machine<br>
> rawio->SetFileDimensionality(3);<br>
> rawio->SetHeaderSize(0);<br>
> int dimension[3]={{1,1,1}}; // Set your image dimensions here<br>
> double spacing[3]={{0.5,0.5,0.5}}; // Set your spacing here<br>
> for (int i=0;i<3;++i){<br>
> rawio->SetDimensions(i,dimension[i]);<br>
> rawio->SetSpacing(i,spacing[i]);<br>
> }<br>
> reader->SetImageIO(rawio);<br>
> reader->SetFileName('test.raw');<br>
> reader->Update();<br>
><br>
><br>
>><br>
>> Hi everyone,<br>
>><br>
>> I'm trying to work in ITK with a multislice US image pre-processed in<br>
>> Matlab: I'm not able to save that in a useful format to process it with<br>
>> ITK.<br>
>><br>
>> I know that I can use Matlab routine dicomwrite to save an image as .dcm<br>
>> (and then process it in ITK); unluckily I think that dicomwrite is good<br>
>> only for 2D image and so I don't know how to save my 3D image....<br>
>><br>
>> Could someone help me?<br>
>><br>
>><br>
>><br>
>> Thanks all<br>
>><br>
>> Daniela<br>
>><br>
>> _________________________________________________________________<br>
>> MSN ti offre esattamente quello che cerchi: il tuo browser personale<br>
>> <a href="http://www.pimpit.it/ie8msn/_____________________________________" target="_blank">http://www.pimpit.it/ie8msn/_____________________________________</a><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>
>><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>
><br>
><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>