<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> <<a href="mailto:mengchen.zhu@hotmail.com">mengchen.zhu@hotmail.com</a>> 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> </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> </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> </div>
<div>
<div>Write out the 3D image in matlab in raw format. For instance a CT image may be writtten as</div>
<div> </div>
<div>fid=fopen('image.raw','w+');<br>cnt=fwrite(fid,mymatrix,'short');<br>fclose(fid);<br> </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. Here's an example. </div>
<div> </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> </div>
<div>You should be able to load image.mhd 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>> Date: Sun, 25 Nov 2007 18:30:26 +0100
<br>> From: <a href="mailto:mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a><br>> To: <a href="mailto:mengchen.zhu@hotmail.com">
mengchen.zhu@hotmail.com</a><br>> Subject: Re: [Insight-users] Convert 3D image data from Matlab .mat file<br>> CC: <a href="mailto:insight-users@itk.org">
insight-users@itk.org</a><br>> <br>> On Nov 25, 2007 9:19 AM, Mengchen Zhu <<a href="mailto:mengchen.zhu@hotmail.com">mengchen.zhu@hotmail.com
</a>> wrote:<br>> ><br>> > Hi folks,<br>> ><br>> > I have some 3D CT and Ultrasound volume data saved as .mat files, with voxel<br>> > data type int16; what is the best way to export them into ITK for
<br>> > processing? I guess I could export them as DICOM, but not sure.<br>> <br>> Matlab has built-in support for DICOM (read/write). For writing a<br>> DICOM file, just go to:<br>> <br>> <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>> <br>> The question that remains, is where do these images come from ?<br>> Without knowing the modalities or the proper DICOM object you will not
<br>> be able to create the correct meta data info for the header. This<br>> would be better to investigate where is the source for those .mat<br>> files.<br>> <br>> HTH<br>> <br>> -- <br>> 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>