File Exchange

image thumbnail

Medical Image Processing Toolbox

version 1.3 (166 KB) by

Classes and functions for N-dimensional medical image processing, inspired by ITK

4.14286
7 Ratings

115 Downloads

Updated

View License

This package contains a collection of classes and functions, which allow to comfortably work with medical images and meshes. It provides a intuitive and transparent way of dealing with spacing, origin, image orientation, etc. The package includes functions for input-output with common image formats (mhd, gipl) and mesh formats (vtk, stl), and basic (although not necessarily simple) image processing operations such as image resample, image reslice and image transform.
Please do not hesitate to propose new features, examples or any constructive comments!

Comments and Ratings (23)

R Lin

R Lin (view profile)

I tried to load mhd files, it was going well but I got the following error for some mhd files:
Undefined function or variable 'zlibdecode'.

Error in read_mhd>read_raw (line 75)
                rawData =zlibdecode(uint8(rawData));

Error in read_mhd (line 20)
    data = read_raw([ path filesep info.DataFile ], info.Dimensions,info.DataType,'native',0,ndims, info);

Did I do something wrong?

Hi,
I try to write mhd/mha image using the write_mhd() function, but it fails.
My image is a 3D matrix of double values.
I get this type of error: Attempt to reference field on non-structure array.
Because my image is not a struct, then it fails to reach the image.size and image.orientation fields.

Is there any restriction on the input data? And which format should I use?

Thank you

Hi,
in this awesome tool box you're depending on Frustum as an already built class.
But unfortunately I couldn't find it.
any one has can help me find the frustum class?
Best Regards

hosse

Hello,

I have data format as .img and .hrd. and i want to use this tool (http://www.mathworks.com/help/images/examples/registering-multimodal-3-d-medical-images.html)

But it support .bin and .header format.

Would you let me know how to convert .img and .hrd or .raw and .mhd to .bin and .header format so that i can use the above mentioned tool for my data for 3d to 3D rigid image registration. I have knee MRI data, not brain MRI

revathi t

Will this toolbox work with my matlab2014a?

ANGAJA K

Can we use this for mha files??

mehdi

mehdi (view profile)

how can i trannsform mhd image by 4*4 matrix??
my code:
matrix=[ -0.9357 0.2129 0.2815 -424.3918
    0.2370 -0.2120 0.9481 -329.0604
    0.2615 0.9538 0.1479 363.3647
         0 0 0 1.0000];
       inputImg='E:\patient0020.mhd'%imageMoving;
referenceImage='E:patient0003.mhd'%imageFixed
      
outputImage = transformImage(matrix,volinputImg,volreferenceImage,'debug' );

error=
% % % Error is appeared in ImageType(referenceImage) function; inputImg=Vol_moving;
% % % Error is appeared in sub function ImageType(referenceImage);referenceImage=Vol_fixed;

You can currently import meshes in VTK ASCII format. For vtk images, you need to convert them to mhd first. You can use Paraview for that.

AMol

AMol (view profile)

Hi Guys, I have to import data from VTK file to Matlab and show them. Do you have some tutorial for it ? Thx

Thanks!

Alberto Gomez

Alberto Gomez (view profile)

The toolbox currently supports gipl and mhd only.

I have added some mising files like vtkMathPerpendiculars.m

Thanks for rating

And is it possible to open analyze(.hdr and .img)? NiFTi (.nii) and .nrrd files with your code?

Hi! Thanks for sharing code!
When I try to run test_image.m I get a message "Undefined function 'vtkMathPerpendiculars'". Where I can get it?

Alberto Gomez

Hi,
you can display the image by doing imshow(im.data)

hth

Shruti naik

hi alberto, thanks! :) do we directly need to run read_mhd and how exactly display the .mha files using imshow()? do revert :) waiting!! regards

RÜZGAR YANIK

first of all thanks sharing code

i want to ask a question

i have dwi brain image .gipl format.i want to tick on .gipl image with roi and then want to make logic one in roi area and logic zero outside of roi area

if someone knows how it is done, kindly help me

waiting feedback

thanks

Alberto Gomez

Alberto Gomez (view profile)

Hi Noha,
You do not need to change paths for this package in particular. You will need to add the files to your matlab path (as you would do for any other package) or put the file in your working directory. Usually it is enough to right click in the folder where the files are from the matlab file browser and click on "add to path"-> "selected folders and subfolders".

Noha Asas

How could I deploy that package, so as to use the functions immediately without the need to change paths??

Alberto Gomez

Unfortunately it currently reads/writes ASCII vtk mesh files only. Mhd binary files are supported though.

Arso

Arso (view profile)

Can it read binary VTK?

Alberto Gomez

Yes Akshay, among several other functionalities that is exactly what it does

Akshay Gore

Akshay Gore (view profile)

Is this function used to read raw/mhd file?

Bo Sun

Bo Sun (view profile)

Could this toolbox read and write '.mha' files? Since i only found the function used to read and write '.mhd' files.Thanks

Updates

1.3

* Some bug fixing and extended features for neighbourhood operations
* Extended image I/O
* Improved visualization

1.2

Some bug fixing
Added some missing functions

MATLAB Release
MATLAB 8.0 (R2012b)
Acknowledgements

Inspired by: Read Medical Data 3D

Inspired: Simple Viewer 3D

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

MedicalImageProcessingToolbox/class_image/

MedicalImageProcessingToolbox/class_mesh/

MedicalImageProcessingToolbox/

MedicalImageProcessingToolbox/processing/Basic/

MedicalImageProcessingToolbox/processing/Geometry/

MedicalImageProcessingToolbox/processing/IO/

MedicalImageProcessingToolbox/processing/Meshes/

MedicalImageProcessingToolbox/processing/Misc/

MedicalImageProcessingToolbox/processing/Sources/

MedicalImageProcessingToolbox/processing/Visu/