This is my output image imshow(imIDX,[]); .How can i read this image into variable and how can i make it a binary image?

2 views (last 30 days)
figure
imshow(imIDX,[]),title('Image after applying k-means Clustering Algorithm');
How can i read the image into a single variable ? how can i make it a binary image?
  2 Comments
Stephen23
Stephen23 on 26 Feb 2017
Edited: Stephen23 on 26 Feb 2017
imIDX is already a variable which you already have and use. imIDX is a single variable which contains the image data. Why not use imIDX?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 26 Feb 2017
imIDX is already a variable. To create a binary (logical) image from it, or a processed/filtered version of it, you can threshold to get values above or below some special value
binaryImage = imIDX < someThreshold;
  5 Comments
sam  CP
sam CP on 26 Feb 2017
Edited: sam CP on 26 Feb 2017
Actually this tumor detection is a two step procedure..first i will get a ouput image with tumor after kmeans..Sometimes it will detect the tumor with sorrounding healthy tissue..Then HCSD method is used to remove such healthy tissue and seperate thee tumor section alone..
I got this idea from a IEEE paper. The tumor section is segmented in this ..check this code
Image Analyst
Image Analyst on 26 Feb 2017
If you use kmeans, you're finding different gray level ranges all the time. So if you stripped off the skull and ignored the pure black mask, then you have normal gray and black in the brain, and possibly a tumor, but possibly not. So if you used a k of 3 and there was a big tumor, it could find it. However if there was no tumor, it will still find 3 classes. But unlike before, one of those classes will NOT be a tumor - it will be normal tissue. So now you're going to have to examine that class and see if that class is a real tumor or just normal tissue. For example, you could look at the absolute gray level and see if it's white or gray. Well, if you're going to do that, then why not just do that from the start and not do kmeans()? That said, I haven't read the paper and perhaps kmeans plays some role in the complete tumor segmentation process, I just don't know what it could be and still be robust enough to handle all cases from 0% tumor to 100% tumor.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!