function initializeButton(obj) autoPanel = uipanel(obj.fig,... 'Title','Auto (in blue)',... 'units','pixels',... 'Position',[10 340 190 170]); for i = 1:length(obj.options)-1 try obj.buttonHandle.auto(i) = uicontrol(autoPanel,... 'Style','checkbox',... 'Value',1,... 'String',obj.options{i},... 'position',[10,150-i*20,150,20],... 'Callback',{@setDataVisibility,obj.plotHandle.auto(obj.options{i})}); end end obj.buttonHandle.auto(i+1) = uicontrol(autoPanel,... 'Style','pushbutton',... 'String','check/uncheck all other buttons',... 'position',[10,150-(i+1)*20,170,20],... 'Callback',{@checkUncheckAllButtons,obj.buttonHandle.auto,obj.plotHandle.auto}); manualPanel = uipanel(obj.fig,... 'Title','Manual (in red)',... 'units','pixels',... 'Position',[10 160 190 170]); for i = 1:length(obj.options)-1 try obj.buttonHandle.manual(i) = uicontrol(manualPanel,... 'Style','checkbox',... 'Value',1,... 'String',obj.options{i},... 'position',[10,150-i*20,150,20],... 'Callback',{@setDataVisibility,obj.plotHandle.manual(obj.options{i})}); end end obj.buttonHandle.manual(i+1) = uicontrol(manualPanel,... 'Style','pushbutton',... 'String','check/uncheck all other buttons',... 'position',[10,150-(i+1)*20,170,20],... 'Callback',{@checkUncheckAllButtons,obj.buttonHandle.manual,obj.plotHandle.manual}); try obj.buttonHandle.difference = uicontrol(obj.fig,... 'Style','checkbox',... 'Value',1,... 'String','auto/manual difference',... 'position',[20,130,150,20],... 'Callback',{@setDataVisibility,obj.plotHandle.difference('difference')}); end cameraPanel = uipanel(obj.fig,... 'Title','Camera',... 'units','pixels',... 'Position',[10 60 220 60]); obj.buttonHandle.camera(1) = uicontrol(cameraPanel,... 'Style','pushbutton',... 'String','ML view',... 'position',[10,10,60,30],... 'Callback',{@setCameraView,obj.axesHandle,... obj.SCase.shoulders.(obj.shoulderSide).auto.scapula.coordSys.ML,... obj.SCase.shoulders.(obj.shoulderSide).auto.scapula.coordSys.IS}); obj.buttonHandle.camera(2) = uicontrol(cameraPanel,... 'Style','pushbutton',... 'String','IS view',... 'position',[80,10,60,30],... 'Callback',{@setCameraView,obj.axesHandle,... obj.SCase.shoulders.(obj.shoulderSide).auto.scapula.coordSys.IS,... -obj.SCase.shoulders.(obj.shoulderSide).auto.scapula.coordSys.ML}); obj.buttonHandle.camera(3) = uicontrol(cameraPanel,... 'Style','pushbutton',... 'String','PA view',... 'position',[150,10,60,30],... 'Callback',{@setCameraView,obj.axesHandle,... obj.SCase.shoulders.(obj.shoulderSide).auto.scapula.coordSys.PA,... obj.SCase.shoulders.(obj.shoulderSide).auto.scapula.coordSys.IS}); end function setDataVisibility(button,event,dataHandle) for i = 1:length(dataHandle) set(dataHandle(i),'Visible',logical(button.Value)); end end function checkUncheckAllButtons(button,event,buttonHandle,plotHandle) buttonState = logical([buttonHandle(:).Value]); if all(buttonState) newValue = false; else newValue = true; end for i = 1:length(buttonHandle) set(buttonHandle(i),'Value',newValue); setDataVisibility(buttonHandle(i),[],plotHandle(buttonHandle(i).String)); end end function setCameraView(button,event,axesHandle,viewAxis,upAxis) axes(axesHandle('scapula')); target = get(gca,'CameraTarget'); view(viewAxis); set(axesHandle('scapula'),'CameraUpVector',upAxis); set(axesHandle('scapula'),'CameraTarget',target); end