%SI_DETTACH_DISPLAY Dettach an additional display to the spectral image % % SI_DETTACH_DISPLAY(SIH,IMH) % % INPUT % SIH spectral image handle (see showsi) % IMH figure handle to be dettached % % Copyright: Pavel Paclik, pavel@ph.tn.tudelft.nl % Faculty of Applied Physics, Delft University of Technology % P.O. Box 5046, 2600 GA Delft, The Netherlands function si_dettach_display(sih,imh) udpim=get(sih,'userdata'); udim=get(imh,'userdata'); if udim.hpim ~= udpim.hpim error('the display is attached to a different spectral image'); end % remove added fields udim=rmfield(udim,{'hpim','hspec','si_ax'}); % what figure we attach? tag=get(imh,'tag'); if strcmp(tag,'scatterdui') % update callbacks set(imh,'CloseRequestFcn','closereq'); % remove the point delete(udim.si_point); udim=rmfield(udim,{'si_point'}); % remove the link to this display from the list in pim udpim.si_attached_scatters=setdiff(udpim.si_attached_scatters,imh); else % remove all the points from this figure h=findobj(get(imh,'children'),'type','line'); delete(h); % remove spectral menus h = findobj(imh,'Type','uimenu','tag','actions'); h = findobj(gcf,'Type','uimenu','tag','mouse_si_visualisation'); delete(h); udim.state = 'none'; dipfig_set_action_check(imh,'none'); set(imh,'pointer','arrow') % update callbacks set(imh,'WindowButtonMotionFcn',''); set(imh,'WindowButtonDownFcn',''); set(imh,'CloseRequestFcn','closereq'); % remove the link to this display from the list in pim udpim.si_attached_displays=setdiff(udpim.si_attached_displays,imh); end % update user data set(sih,'UserData',[]); set(sih,'UserData',udpim); set(imh,'UserData',[]); set(imh,'UserData',udim); return