How can I remove inside area from an ROI to analyse the outer area only?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
molly jane fitches
am 7 Aug. 2017
Kommentiert: molly jane fitches
am 8 Aug. 2017
I have recently started using MATLAB for image processing with MR images, and so far have found previously asked questions and examples to be a great help - but with this I am a little stuck! I have created an ROI on my dicom image using imfreehand() I have then dilated this ROI using the imdilate(I, strel('square',n)) function to create a new ROI. Ideally, I would now like to subtract the original ROI from the new ROI so that I am left with only the new area. Any help would be greatly appreciated!
0 Kommentare
Akzeptierte Antwort
KSSV
am 7 Aug. 2017
I = imread('cameraman.tif') ;
imshow(I)
h = imfreehand ;
pos = wait(h);
%%Extract the ROI
[ny,nx] = size(I) ;
[X,Y] = meshgrid(1:nx,1:ny) ;
idx = inpolygon(X(:),Y(:),pos(:,1),pos(:,2)) ;
Z = I ;
Z(idx) = NaN ;
imshow(Z) ;
4 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!