Conversion of .mha file to grayscale for segmentation

Hi, I am trying to convert a .mha image to grayscale. When I used rgb2gray I got this error Error using rgb2gray>parse_inputs (line 89) RGB must be a m x n x 3 array.
Error in rgb2gray (line 37) X = parse_inputs(X); I tried looking into the other question forums to understand this error. But couldn't quite understand the problem.

 Accepted Answer

I don't know what format that is. What does this say, before that line:
whos X

4 Comments

I got this. Name Size Bytes Class Attributes
V 160x216x176 12165120 int16
The images I am using are from the BRATS 2012. I am trying to segment a brain tumor. It is MRI image. (Metaimage Medical format)
You do not have a 3D RGB true color image. You have a volumetric image where each of the 176 slices represents a plane though the subject at a different spatial location (level). Hence, you cannot use rgb2gray() since you do not have an RGB image.
Thank you for your answer.
Do we need to use all the 176 slices for preprocessing and segmentation? if so how to do it and all my 176 slices are .png format is the format ok for further process or should we change it?

Sign in to comment.

More Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!