How can I remove inside area from an ROI to analyse the outer area only?

조회 수: 2 (최근 30일)
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!

채택된 답변

KSSV
KSSV 2017년 8월 7일
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
Image Analyst
Image Analyst 2017년 8월 7일
In what form is your existing ROI?
molly jane fitches
molly jane fitches 2017년 8월 8일
I thought so, thought it would be very easy to adjust but rather than returning an error it executes and displays the original image. I drew the ROI using imfreehand, then tried it as a double, and then tried using the column and row vectors from the boundary.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 DICOM Format에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by