Clear Filters
Clear Filters

How can I mark voxels inside of an ROI with a class label?

2 views (last 30 days)
Hi, I have medical knee MRIs with dicom format. I am going to apply a machine learning algorithm to classify voxels; however, I don't have any training set to train the classifier. I have sequences of MRI for each patient that an ROI has been extracted in each slice by expert (as ground truth). My idea is to label voxels inside of ROI as one class, and outside of ROI as another class to create the training set. Does anyone know how can I add a class label (attribute) to voxels inside of ROI as a class(1) and outside of ROI as background class(0)? Or my idea isn't correct!? How can i create my train set for classification? IS there any code that can label the voxels inside of an ROI as 1 and outside as 0? Your help is appreciated.

Answers (1)

Matt J
Matt J on 13 Dec 2015
Edited: Matt J on 13 Dec 2015
It depends on what form the ROI exists in now, i.e, what data do you currently possess about the ROI's size, shape, and location within the image? If you had used an IMROI object, it would be very easy. You would just use its createMask() method.
  2 Comments
Sara Salimi
Sara Salimi on 14 Dec 2015
Edited: Sara Salimi on 14 Dec 2015
Dear Matt J,
Many thanks for your help. yes I have also an excel file of the points of ROI of sequences of ROI for each patient I have attached one text file that is related to the image that I have attached. Is it possible I extract a column which indicates the class of voxels (as 1/0)? I am beginner in MATLAB, and I will be thankful if you guide me.
Once again Thanks a lot for your help.
Matt J
Matt J on 14 Dec 2015
Edited: Matt J on 14 Dec 2015
You can use xlsread() to read in the point coordinates from the excel file. Once you have the coordinates as vectors I and J you can create a binary map of the ROI pixels by doing
map=full(sparse(I,J,1,m,n);
where [m,n] is the size of the image. Or, you can omit full() and save memory by keeping the map in sparse form.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!