저는 GUI를 사용하고 GUIDE를 사용하고 있습니다. 로드하고 이미지화하여 사용자가 점 (입자 ROI) 주위에 ROI를 그립니다. 그런 다음 사용자가 슬라이더를 사용하여 두 번째 ROI의 너비와 높이를 설정하고 이미지에서 업데이트 된 것을 볼 수있는 두 번째 ROI (스캔 ROI)를 만드는 데 두 개의 슬라이더가 필요합니다. 슬라이더는 정상적으로 작동하는 것처럼 보이지만 내 gui는 이미지 위에 새로운 roi를 그려 넣기 때문에 지저분 해 보이는 느낌이납니다. 이미지에 원래 입자의 ROI를 유지하면서 이미지를 다시 그리기 전에 사용자가 사용할 수있는 roi를 제거하고 싶습니다. 현재 다음과 같은 방식으로 수행합니다 :이미지에 크기를 조정할 수있는 상자 그리기
setroi 크기 버튼에 대한 콜백 내부입니다.
handles=guidata(hObject);
particleroiSize=imrect;% - draw a rectagle around the particle to get a meausr eof ROI size
roiPoints=getPosition(particleroiSize); %-get tha parameters fo the rectanlge
partX1 = round(roiPoints(1));
partY1 = round(roiPoints(2));
partX2 = round(partX1 + roiPoints(3));
partY2 = round(partY1 + roiPoints(4)); % these are the ROi positions in pixels
roiHeight = round(roiPoints(3)); % - these are just the ROI width and height
roiWidth = round(roiPoints(4));
handles=guidata(hObject); %_ update all the handles...
handles.partX1=partX1;
handles.partX2=partX2;
handles.partY1=partY1;
handles.partY2=partY2;
handles.roicenterX = (partX1 + round(roiPoints(3))/2);
handles.roicenterY= (partY1 + round(roiPoints(4))/2);
handles.roiHeight = roiHeight;
handles.roiWidth = roiWidth;
current_slice = round(get(handles.Image_Slider,'Value'));
particleImage=handles.Image_Sequence_Data(partY1:partY2,partX1:partX2,current_slice);
handles.particleImage=particleImage;
set(handles.RoiSizeDisplay,'String',strcat('Particle ROI is ',' ',num2str(roiHeight),' ', ' by ',num2str(roiWidth)));
guidata(hObject,handles);
)를 particel의 ROI에 대해하고 다시 스캔 ROI의 크기를 설정 슬라이더 I이 두 가지 슬라이더 한 내부 (하였 호 내부 폭을 조정 높이 : 핸들 = guidata (hObject);
try
delete(handles.ScanArea);
% plus any cleanup code you want
catch
end
WidthValue = get(handles.ScanAreaSliderWidth,'value');
HeightValue = get(handles.ScanAreaSliderHeight,'value');
set(handles.ScanAreaWidthDisplay,'String',strcat('Scan Area Width is ',' ', num2str(WidthValue))); % sets the display..now to do the drawing...
%h = imrect(hparent, position);
%position = [Xmin Ymin Width Heigth];
position = [ round(handles.roicenterX-WidthValue/2) round(handles.roicenterY-HeightValue/2) WidthValue HeightValue];
handles.ScanArea = imrect(handles.Image_Sequence_Plot,position);
%h = imrect(hparent, position)
handles=guidata(hObject);
guidata(hObject, handles);
하지만 스캔 영역 ROI를 삭제하지 않고 다시 그리기를 계속합니다. 나는 try ... catch가 작동한다고 생각했지만 doens't는 그렇게 보입니다. 투자 수익 (ROI) 또는 추가 사본을 만들고 있습니까? 도와주세요 .. 감사.
hfindROI = findobj(gca,'Type','hggroup');
delete(hfindROI)
을하고 그것을 수행해야합니다 당신이 imrect으로 그려진 투자 수익 (ROI)을 삭제해야하는 경우
Mhh 솔직히 나는 (2 : end)가 맞을 것이라고 추측했을 것입니다. 기본적으로 숫자 목록은 축 (handle.Image_Sequence_Plot)에 포함 된 주어진 유형 (사용자의 경우 hggroup)의 모든 개체 핸들에 해당합니다. 축에서 생성 된 순서에 따라 핸들이 정렬 될 것이라고 생각했습니다. –
오, 내 대답이 도움이된다면 허용으로 표시 할 수 있습니까? 감사와 행운을! –
모든 ROI의 핸들을 제거해야합니다. 이미지에서 ROI를 삭제하고 싶지만 ROI 정보에 대한 핸들을 유지하고 싶습니다 (즉, 스캔 면적 높이와 너비)이 방법이 있습니까? –