[MATLAB] How can modify my axes for my differents sequences with a function returning a figure ?

4 views (last 30 days)
Good morning everyone ! It's my first time here, so i hope i'll get some help :) ! I'm working on CT scanners, and i did some steps for my internship like registering, eroding, dilating, apply a segmentation algorithm etc. I want to allow the display of each step thanks to my GUI. I have made a function which can display a figure with a scanner and a slider .
function h_fig = display_myCT(StructRGB,numpat)
numpat = numpat + 2;
%%%%%%%%%%%%%
% figure
%%%%%%%%%%%%%
sz = length(StructRGB(numpat,:));
h_fig = figure('Name','image and layers','NumberTitle','Off','Toolbar','figure',...
'MenuBar','figure','NextPlot','Add');
sl_min = 1;
sl_max = sz;
sl_val = ceil(sz/2);
h_slider = uicontrol(h_fig,'style','slider','Min',sl_min,'Max',sl_max,'Value',sl_val,...
'SliderStep',[1/sl_max 1/sl_max],'units','normalized','Position',[0 0 0.9 0.05],...
'Callback',@ResultsSliderCallback);
h_text = uicontrol(h_fig,'style','text','units','normalized','String',num2str(sl_val),...
'Position',[0.9 0 0.1 0.05]);
hx(1) = axes('parent',h_fig,'Units','Normalized','OuterPosition',[0.0 0.2 0.7 0.7]);
%%%%%%%%%%%
function ResultsSliderCallback(hObject,eventdata)
cur_serial = ceil(get(hObject,'Value'));
set(h_text,'String',num2str(cur_serial));
mysubplot(hx(1),StructRGB{numpat,cur_serial},cur_serial);
end
function mysubplot(hx,MonImageRGB,cur_serial)
if cur_serial==0
return;
end
h_curCurve = findobj([get(hx,'Children');get(h_fig,'Children')],'Type','line',...
'-or','Type','hggroup','-or','Type','Text','-or','Type','image','-or','Tag','legend');
if ~isempty(h_curCurve)
delete(h_curCurve);
end
Im = MonImageRGB ;
imshow(Im,'Parent',hx);
end
end
My idea was to create a main, where , at first, we could see the scanners registered, then , modify the axes of this figure, to display the erosion and dilation etc. I don't know if you see my problem. I want that when we carry out each step of my main ( registering etc ) , the scan is modified on the same figure. I am debutant in matlab, i don't know how to organize myself very well in GUI.
Thank you in advance for your help :)

Answers (0)

Community Treasure Hunt

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

Start Hunting!