<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi,<br><br>Thanks a lot. I have temporarily adopted the DICOM I/O in Matlab and Image Series File I/O in ITK for the task. It is not very efficient, but is easier to track. In the real application, I will switch to the meta image as suggested by Karthik.<br><br>Regards,<br>Mengchen<br><br><blockquote><hr>Date: Sun, 25 Nov 2007 20:32:43 -0500<br>From: karthik.krishnan@kitware.com<br>To: mengchen.zhu@hotmail.com<br>Subject: Re: [Insight-users] Convert 3D image data from Matlab .mat file<br>CC: mathieu.malaterre@gmail.com; insight-users@itk.org<br><br><div><span class="EC_gmail_quote">On 11/25/07, <b class="EC_gmail_sendername">Mengchen Zhu</b> &lt;<a href="mailto:mengchen.zhu@hotmail.com">mengchen.zhu@hotmail.com</a>&gt; wrote:</span></div>
<div>
<blockquote class="EC_gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>Hi,<br><br>Thanks Mathieu. The problem is, the 3D data are not "images" in the first place. The ultrasound data are reconstructed from RF signal directly; the CT, I don't know - </div></blockquote>
<div>&nbsp;</div>
<div>Of course, you need to find a way to interpret the data. Images are really just data stored on a regular grid.</div>
<div>&nbsp;</div>
<blockquote class="EC_gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><br>So the question should be, can I use the matrix in Matlab to construct image in ITK? I have the physical dimension of voxels by the way, so the data indeed can be treated as images, without header that is. </div>
</blockquote>
<div>&nbsp;</div>
<div>
<div>Write out the 3D image in matlab in raw format. For instance a CT image may be writtten as</div>
<div>&nbsp;</div>
<div>fid=fopen('image.raw','w+');<br>cnt=fwrite(fid,mymatrix,'short');<br>fclose(fid);<br>&nbsp;</div>
<div>Create a metaimage header in ITK for the raw data : image.mhd . Look in ITK's testing tree, you should find plenty of examples.&nbsp; Here's an example. </div>
<div>&nbsp;</div>
<div>NDims = 3<br>DimSize = 100 100 100<br>ElementSize = 4.000000e+000 4.000000e+000 4.000000e+000<br>ElementSpacing = 4.000000e+000 4.000000e+000 4.000000e+000<br>ElementType = MET_SHORT<br>ElementByteOrderMSB = False<br>
ElementDataFile = image.raw</div>
<div><br>&nbsp;</div>
<div>You should be able to load image.mhd&nbsp;in ITK.</div></div><br>
<blockquote class="EC_gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>If no apparent way exists, I will probably use fprintf() to export the mat as text file and construct my image in ITK using the data in the text.<br><br>Thanks,<br>MC<br><br>&gt; Date: Sun, 25 Nov 2007 18:30:26 +0100
<br>&gt; From: <a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a><br>&gt; To: <a href="mailto:mengchen.zhu@hotmail.com">
mengchen.zhu@hotmail.com</a><br>&gt; Subject: Re: [Insight-users] Convert 3D image data from Matlab .mat file<br>&gt; CC: <a href="mailto:insight-users@itk.org">
insight-users@itk.org</a><br>&gt; <br>&gt; On Nov 25, 2007 9:19 AM, Mengchen Zhu &lt;<a href="mailto:mengchen.zhu@hotmail.com">mengchen.zhu@hotmail.com
</a>&gt; wrote:<br>&gt; &gt;<br>&gt; &gt; Hi folks,<br>&gt; &gt;<br>&gt; &gt; I have some 3D CT and Ultrasound volume data saved as .mat files, with voxel<br>&gt; &gt; data type int16; what is the best way to export them into ITK for
<br>&gt; &gt; processing? I guess I could export them as DICOM, but not sure.<br>&gt; <br>&gt; Matlab has built-in support for DICOM (read/write). For writing a<br>&gt; DICOM file, just go to:<br>&gt; <br>&gt; <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/images/index.html?/access/helpdesk/help/toolbox/images/dicomwrite.html" target="_blank">
http://www.mathworks.com/access/helpdesk/help/toolbox/images/index.html?/access/helpdesk/help/toolbox/images/dicomwrite.html</a><br>&gt; <br>&gt; The question that remains, is where do these images come from ?<br>&gt; Without knowing the modalities or the proper DICOM object you will not
<br>&gt; be able to create the correct meta data info for the header. This<br>&gt; would be better to investigate where is the source for those .mat<br>&gt; files.<br>&gt; <br>&gt; HTH<br>&gt; <br>&gt; -- <br>&gt; Mathieu
<br><br>
<hr>
Express yourself with free Messenger emoticons. <a href="http://www.freemessengeremoticons.ca/?icid=EMENCA122" target="_blank">Get them today!</a></div><br>_______________________________________________
<br>Insight-users mailing list<br><a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">
http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div>
</blockquote><br /><hr />Have fun while connecting on Messenger! <a href='http://entertainment.sympatico.msn.ca/WindowsLiveMessenger' target='_new'>Click here to learn more.</a></body>
</html>