I have mha file, how to do image segmentation of this data

6 views (last 30 days)
This is in continuation to a previous que which I already asked regarding readdata3d. dont know how to proceed further.....
Sir here is the data attached of brain mri scan. It's in mha format and is a 3d Image. We have to convert this 3d into a 2d image and use watershed algorithm to detect the tumor in the brain. The mha format is not being supported. Hence I am not able to upload it. If any email id is given I would send it.
I've used the following code:
[V,info]=ReadData3D
for slice = 1 : numberOfSlices
thisSlice = V(:,:, slice);
baseFileName = sprintf('Slice %d.png', slice);
fullFileName = fullfile('F:\final yr project', baseFileName);
imwrite(thisSlice, fullFileName);
end
The final image should be like the one I attached above.
The image should be gray scale analysed. So how to use these mha files to covert the 3d to above mentioned like pic. For further analysis using watershed
Can you please suggest me how this can be done and also can you please help me with the code if possible
  31 Comments
Image Analyst
Image Analyst on 16 Jan 2018
How do you want to convert it? Take the mean along the slice direction? Take the maximum intensity projection? Take just one slice? I have no idea.
rohith bharadwaj
rohith bharadwaj on 16 Jan 2018
how to take just one slice from middle and convert it to grayscale

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Jan 2018
Your data is not black and white. It is, however, in CT units, with values from 0 to 1509. To make visual sense out of that you need to rescale it. Use this:
V = mat2gray(V);
after you read the data in. That will scale the values in the array so that the maximum value is 1 and the minimum is 0. You can then extract slices and imshow() or image() them.
  13 Comments
Walter Roberson
Walter Roberson on 17 Mar 2018
The researchers I worked with generally normalized the brain images, and then after that trained on a bunch of normal brains and a bunch with tumors. They did not use segmentation and preprocessing that I recall. But it has been over 15 years since I did any brain related work, and I was not much involved with the brain analysis theory (I was more responsible for interface and graphics and general program structure for the brain work.)
Image Analyst
Image Analyst on 17 Mar 2018
Because of your ambiguous posts, we don't know if you want to segment the 3-D volume, or if you want to segment out a 2-D region in just one slice. Why don't you start your own question, rather than keep bugging rohith, and post some of your slice images? click here

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 15 Jan 2018
It looks like you got the mha reading part working so now you just need to find the tumor. Assuming it's bright, just threshold and call regionprops. It works in 2-D or 3-D. See attached demo.

Community Treasure Hunt

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

Start Hunting!