[Insight-users] How do you get a MATLAB variable to ITK?

Akiko Campbell adcampbell at shaw.ca
Mon Apr 11 15:51:29 EDT 2005


I normally write the MATLAB variable into a raw file and read it into
ITK with the MHD header.

For example,

***MATLAB***
Name    Size          Bytes     Class
v1      256x256x130   68157440  double array

fid=fopne('v1.raw','wl')
fwrite(fid,v1,'double');

***v1.mhd***
NDims = 3
DimSize = 256 256 130
ElementType = MET_DOUBLE
ElementSpacing = 1 1 1
ElementByteOrderMSB = False
ElementDataFile = v1.raw
 
***ITK***
typedef itk::Image< itk::Vector<double,3>, 3 > VectorImageType;
typedef itk::ImageFileReader< VectorImageType > VectorReaderType;
VectorReaderType::Pointer reader = VectorReaderType::New();
reader ->SetFileName("v1.mhd");
reader ->Update();


I don't read the variable back from ITK to MATLAB but I think something
similar to the above might work.  I hope this helps.

Akiko

-----Original Message-----
From: insight-users-bounces at itk.org
[mailto:insight-users-bounces at itk.org] On Behalf Of Craig Davis
Sent: Monday, April 11, 2005 10:02 AM
To: insight-users at itk.org
Subject: [Insight-users] How do you get a MATLAB variable to ITK?

Hello everyone,

I have a question concerning Matlab and ITK.  How can one get a variable
(i.e. image) from Matlab into ITk and then from ITK back into Matlab. 
Any helpful advice on this would be greatly appreciated.

Thanks : )

Craig Davis
840 Twin Forks Avenue
Auburn, AL 36830
phone: 334-524-7672
email: davisc3 at auburn.edu
_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users

-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.6 - Release Date: 2005-04-11
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.6 - Release Date: 2005-04-11
 



More information about the Insight-users mailing list