<div dir="ltr"><div><div><div><div><div>zhq,<br><br></div>In order for the data to be read by File Readers in ITK, it must be formatted in the manner that conforms with the reader format.<br></div>In order to use the .vtk format, you would need to find or write your own save code in matlab.<br>
</div>Like you said, the command "save('MRI.vtk', ...)" saves data in the .mat format. I would suggest a google search for "matlab write vtk", which will bring up a number of options from the matlab community(Matlab Central File Exchange) which could help with formatting and writing your data to the .vtk format.<br>
<br></div>Good luck,<br></div>Andrew<br><div><div><div><div><div><div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 12, 2013 at 6:43 AM, <span dir="ltr"><<a href="mailto:insight-users-request@itk.org" target="_blank">insight-users-request@itk.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Date: Thu, 12 Dec 2013 21:12:14 +0800 (CST)<br>
From: zhq <<a href="mailto:15891495523@126.com">15891495523@126.com</a>><br>
Subject: [Insight-users] I hope ITK read data from matlab , what<br>
should I do ?<br>
To: ITK?? <<a href="mailto:insight-users@itk.org">insight-users@itk.org</a>><br>
Message-ID: <<a href="mailto:47c48c50.3bc3a.142e6efa607.Coremail.15891495523@126.com">47c48c50.3bc3a.142e6efa607.Coremail.15891495523@126.com</a>><br>
Content-Type: text/plain; charset="gbk"<br>
<br>
Dear all :<br>
I run matlab code , and get a data which is save as mat format file . Then , I wish segment the data with ITK . How can I read the data with ITK .<br>
Can I save the data as vtk format file and then to read it with ITK ?<br>
The follow is what I has done :<br>
( In matlab :)<br>
save('MRI.vtk','MRAImgs') % the MRAImgs is the mat format data , I want to save the data as vtk format<br>
( In ITK :)<br>
typedef itk::ImageFileReader<InternalImageType> ReaderType ;<br>
ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName("G:\\Graduation Design\\ITK code\\MRI.vtk");<br>
try<br>
{<br>
reader->Update();<br>
}<br>
catch( itk::ExceptionObject & excep )<br>
{<br>
std::cerr << "Exception caught !" << std::endl;<br>
std::cerr << excep << std::endl;<br>
system("pause");<br>
}<br>
But a error appears:<br>
<br>
What should I do ?<br>
Thanks in advance !<br>
zhq<br>
<br>
</blockquote></div><br></div></div></div></div></div></div></div></div></div></div>