MATLAB: Image Segmentation and Classification

imageimage analysisImage Processing Toolboximage segmentationkmeansStatistics and Machine Learning Toolbox

I have recently been tasked to a project which primarily deals with image segmentation. I am supposed to read in an MR brain image and apply k-means clustering on the image with k = 5. Obtain segmented regions through pixel classification using the clustered classes. Compare the segmented regions with those obtained from the optimal gray value thresholding method.
I know k-means clustering is not too difficult but I'm not sure how to "Obtain segmented regions through pixel classification using the clustered classes" and I would like to seek some professional advice from the community to point me in the right direction on what I should be looking at or doing.
Feel free to drop me any comments. Any help rendered is deeply appreciated.
Best Regards Westin Messer

Best Answer

See my attached kmeans demo for a gray scale image. Adapt as needed.
By the way, kmeans is a dumb (bad) method for tumor detection. I assume it's just for an illustrative student exercise rather than a real world situation.