How can I load and view medical image .mha ?

Hi,
I would like to read a medical image with extension .mha and store it in variable I. And then view I using imshow.
I need the simplest code source possible to start working on. Thank you
ps:I am using Matlab 2009 under Mac OS X 10.6.8.

 Accepted Answer

Makrim
Makrim on 26 Mar 2014
Read Medical Data 3D by Dirk-Jan Kroon 10 Nov 2010, worked for me.

7 Comments

I used the code and it displaying error; Undefined function or variable 'exp1a'.
Error in convert (line 8) [V,info]=ReadData3D(exp1a);
Please include a complete copy of the error messages.
The code in that link has no routine named "convert", and there is no MATLAB routine named "convert".
It appears to me that you wrote your own convert.m and have a bug in it. You should be passing a file name (as a string) to ReadData3D . If convert is your own routine we are going to need the source for it; if not then you are going to need to tell us where we can find it.
thanks, convert is just the workspace name. this is the code: Undefined function 'ReadData3D' for input arguments of type 'char'.
Error in convert (line 9) [V,info]=ReadData3D('exp1a.mha');
and this is the error that was displayed
Undefined function 'ReadData3D' for input arguments of type 'char'.
Error in convert (line 9) [V,info]=ReadData3D('exp1a.mha');
Visit the page http://www.mathworks.com/matlabcentral/fileexchange/29344-read-medical-data-3d . On the upper right side, click on Download ZIP. Save the file on your system. Extract it into a convenient directory that is not on your MATLAB path. Now go into MATLAB and use pathtool to add that directory to your MATLAB path.
Alternately if you have a version from about R2014a onwards, then you could click on "Resources" (older versions) or "Add Ons", request add-ons, wait for the add-on manager page to come up, search and find the Read Medical Data 3D entry there, click on it, and in the page that comes up, tell MATLAB that you want to install it.
Thanks for your help. I tried it and it is no more giving me error. Pls i need to preview the image because it is not showing, i guess it has to do with rescaling. this is the message in the command window.
RescaleSlope not available, assuming 1 RescaleIntercept not available, assuming 0
thanks for your help
I'm using this file exchange to read my database, I'm using MATLAB Version: 9.0.0.341360 (R2016a). When I give the input
if true
[V,info]=ReadData3D('Normal001-DTI.mha');
end
I get the error Undefined function or variable 'ReadData3D'.
https://www.mathworks.com/matlabcentral/fileexchange/29344-read-medical-data-3d is not installed or it is not on your MATLAB path

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 20 Mar 2014

Commented:

on 19 Feb 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!