⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rest_sliceviewer.m

📁 While resting-state fMRI is drawing more and more attention, there has not been a software for its d
💻 M
📖 第 1 页 / 共 5 页
字号:
	theLeft =OffsetX+MarginX; theBottom =OffsetY+MarginY+20 +20+MarginY/2 +10 +MarginY;
	hYoke =uicontrol(theFig, 'Style','checkbox', 'Units','pixels', ...
					'String', 'Yoke', ...
					'BackgroundColor', get(theFig,'Color'), ...
					'Position',[theLeft, theBottom+75, 80,15]);
	theLeft =OffsetX+MarginX+56+MarginX; theBottom =OffsetY+MarginY+20 +20+MarginY/2 +10 +MarginY;	
	hCrosshair =uicontrol(theFig, 'Style','checkbox', 'Units','pixels', ...
					'String', 'Crosshair', 'Value', 1,...
					'Callback', sprintf('rest_sliceviewer(''Repaint'', %g);',theFig) , ...
					'BackgroundColor', get(theFig,'Color'), ...
					'Position',[theLeft, theBottom+75, 70,15]);
	
	
	theEditCallbackFcn =sprintf('rest_sliceviewer(''SetPosition'', %g);', theFig);
	theLeft =OffsetX+MarginX-5; theBottom =OffsetY+MarginY+35+MarginY/2;
	uicontrol(theFig, 'Style','text', 'Units','pixels', ...
			  'String', 'X(mm)', ...
			  'BackgroundColor', get(theFig,'Color'), ...			  
			  'Position',[theLeft, theBottom+85, 46,15]);
	theLeft =OffsetX+MarginX-5; theBottom =OffsetY+MarginY+20;		  
	hEditPositionX =uicontrol(theFig, 'Style','edit', 'Units','pixels', ...
							  'String', '0', ...
							  'BackgroundColor', 'white', ...
							  'Callback', theEditCallbackFcn, ...
							  'Position',[theLeft, theBottom+85, 46,20]);
		  
	theLeft =OffsetX+MarginX+36+MarginX-5; theBottom =OffsetY+MarginY+35+MarginY/2;					  
	uicontrol(theFig, 'Style','text', 'Units','pixels', ...
			  'String', 'Y(mm)', ...
			  'BackgroundColor', get(theFig,'Color'), ...
			  'Position',[theLeft, theBottom+85, 46,15]);
	theLeft =OffsetX+MarginX+36+MarginX-5; theBottom =OffsetY+MarginY+20;			  
	hEditPositionY =uicontrol(theFig, 'Style','edit', 'Units','pixels', ...
							  'String', '0', ...
							  'BackgroundColor', 'white', ...
							  'Callback', theEditCallbackFcn, ...
							  'Position',[theLeft, theBottom+85, 46,20]);
			
	theLeft =OffsetX+MarginX+36+MarginX+36+MarginX-5; theBottom =OffsetY+MarginY+35+MarginY/2;		
	uicontrol(theFig, 'Style','text', 'Units','pixels', ...
			  'String', 'Z(mm)', ...
			  'BackgroundColor', get(theFig,'Color'), ...
			  'Position',[theLeft, theBottom+85, 46,15]);
	theLeft =OffsetX+MarginX+36+MarginX+36+MarginX-5; theBottom =OffsetY+MarginY+20;		  
	hEditPositionZ =uicontrol(theFig, 'Style','edit', 'Units','pixels', ...
							  'String', '0', ...
							  'BackgroundColor', 'white', ...
							  'Callback', theEditCallbackFcn, ...
							  'Position',[theLeft, theBottom+85, 46,20]);
	
	theLeft =OffsetX+MarginX-5; theBottom =OffsetY+MarginY+20;
	hMagnify =uicontrol(theFig, 'Style','popupmenu', 'Units','pixels', ...
						'String', {'x0.5', 'x1', 'x2', 'x3'}, ...
						'Value', 2, ...
						'BackgroundColor', get(theFig,'Color'), ...
						'Enable', 'off', ...
						'Callback', sprintf('rest_sliceviewer(''Magnify'', %g);',theFig), ...
						'Position',[theLeft, theBottom+70, 70,10]);
	if license('test','image_toolbox')
		set(hMagnify, 'Enable', 'on');
	else
		warning('image_toolbox not valid');
	end
	
	theLeft =OffsetX+MarginX+60+MarginX-5; theBottom =OffsetY+MarginY+20;
	hMniTal =uicontrol(theFig, 'Style','popupmenu', 'Units','pixels', ...
						'String', {'MNI/Talairach Coordinates', 'From Talairach to MNI', 'From MNI to Talairach'}, ...
						'Value', 1, ...
						'BackgroundColor', get(theFig,'Color'), ...
						'Enable', 'on', ...
						'Callback', sprintf('rest_sliceviewer(''MNI/Talairach'', %g);',theFig), ...
						'Position',[theLeft, theBottom+70, 68,10]);
	
	
	%OffsetY =OffsetY +30;%20070911, for complete information display	
	theLeft =OffsetX+MarginX; theBottom =OffsetY+MarginY;
	hVoxelIntensity=uicontrol(theFig, 'Style','text', 'Units','pixels', ...
						  'String', '', 'TooltipString', 'Intensity of the current point', ...
						  'BackgroundColor', get(theFig,'Color'), ...
						  'HorizontalAlignment', 'left', ...  % 'Visible', 'off', ...						  
						  'Position',[theLeft-5, theBottom+42, 110,32]);
			  
	%Create a Message label to display some specific message, dawnsong 20070526
	theLeft =OffsetX+MarginX; theBottom =OffsetY +100 +MarginY;
	hMsgLabel =uicontrol(theFig, 'Style','text', 'Units','pixels', ...
			  'String', sprintf('Dawnwei.Song Copyright 2007-2010, all rights reserved'), ...
			  'BackgroundColor', get(theFig,'Color'), ...
			  'HorizontalAlignment', 'left', 'Enable', 'inactive',...
			  'ButtonDownFcn', sprintf('rest_sliceviewer(''ToggleInfoDisplay'', %g);',theFig), ...
			  'Position',[theLeft, theBottom, 130,10]);	
			  
	% Create a Callback Button to do sth.
	theLeft =OffsetX+MarginX; theBottom =OffsetY +100 +MarginY +10;
	% hDoCallbackBtn =-1;
	% if ~isempty(ACallback) && ischar(ACallback)
		% hDoCallbackBtn =uicontrol(theFig, 'Style','pushbutton',  ...
							  % 'Units','pixels', 'String', 'Do sth.', ...
							  % 'Callback', ACallback, ...
							  % 'Position',[theLeft, theBottom, 130,10]);
	% end
	%View Buttons
	theLeft =OffsetX+MarginX-4; theBottom =OffsetY +MarginY-2;
	theIcon =imread(fullfile(rest_misc( 'WhereIsREST'), 'icoTransverse.jpg'));
	hViewTransverse =uicontrol(theFig, 'Style','pushbutton',  ...
							  'Units','pixels', ...
							  'Callback', sprintf('rest_sliceviewer(''TransverseView'', %g);',theFig) , ...
							  'CData', theIcon,...
							  'Position',[theLeft, theBottom, 34,36]);
	theLeft =OffsetX+MarginX+30; theBottom =OffsetY +MarginY-2;
	theIcon =imread(fullfile(rest_misc( 'WhereIsREST'), 'icoSagittal.jpg'));
	hViewSagittal =uicontrol(theFig, 'Style','pushbutton',  ...
							  'Units','pixels', ...
							  'Callback', sprintf('rest_sliceviewer(''SagittalView'', %g);',theFig) , ...
							  'CData', theIcon,...
							  'Position',[theLeft, theBottom, 34,36]);
	theLeft =OffsetX+MarginX+34+30; theBottom =OffsetY +MarginY-2;
	theIcon =imread(fullfile(rest_misc( 'WhereIsREST'), 'icoCoronal.jpg'));
	hViewCoronal =uicontrol(theFig, 'Style','pushbutton',  ...
							  'Units','pixels', ...
							  'Callback', sprintf('rest_sliceviewer(''CoronalView'', %g);',theFig) , ...
							  'CData', theIcon,...
							  'Position',[theLeft, theBottom, 34,36]);
	theLeft =OffsetX+MarginX+34+34+30; theBottom =OffsetY +MarginY-2;
	theIcon =imread(fullfile(rest_misc( 'WhereIsREST'), 'icoOrthogonal.jpg'));
	hViewOrthogonal =uicontrol(theFig, 'Style','pushbutton',  ...
							  'Units','pixels', ...
							  'Callback', sprintf('rest_sliceviewer(''OrthogonalView'', %g);',theFig) , ...
							  'CData', theIcon,...
							  'Position',[theLeft, theBottom, 34,36]);
	theLeft =OffsetX+MarginX+34+30; theBottom =OffsetY +MarginY+34;	
	hViewMontage =uicontrol(theFig, 'Style','pushbutton',  ...
							  'Units','pixels', ...
							  'Callback', sprintf('rest_sliceviewer(''Montage'', %g);',theFig) , ...
							  'String', 'Montage','TooltipString', 'Montage: Multislice',...
							  'Position',[theLeft, theBottom, 68,24]);
							  
	
	
	%Add Underlay file selection directly
	theLeft =OffsetX; theBottom =MarginY+180;
	hUnderlayRecent =uicontrol(theFig, 'Style','popupmenu', 'Units','pixels', ...
			  'String', {'Underlay: '}, 'Value', 1, ...
			  'Callback', sprintf('rest_sliceviewer(''ClickRecentUnderlay'', %g);',theFig), ...
			  'BackgroundColor', get(theFig,'Color'), ...			  
			  'Position',[theLeft, theBottom, 75,20]);	 
	theLeft =OffsetX; theBottom =MarginY+160;
	hUnderlayFile =uicontrol(theFig, 'Style','edit', 'Units','pixels', ...
							  'String', '', ...
							  'BackgroundColor', 'white', ...
							  'Callback', sprintf('rest_sliceviewer(''ChangeUnderlay'', %g);',theFig), ...
							  'Position',[theLeft, theBottom, 150,20]);
	theLeft =OffsetX+116; theBottom =MarginY+180;
	uicontrol(theFig, 'Style','pushbutton', 'Units','pixels', ...
		  'Callback', sprintf('rest_sliceviewer(''UnderlaySelection'', %g);',theFig) , ...
		  'String', '...', 'FontWeight', 'bold', ...
		  'Position',[theLeft, theBottom, 34,15]);
	%Add Overlay file selection directly
	theLeft =OffsetX; theBottom =MarginY+140;
	hOverlayRecent =uicontrol(theFig, 'Style','popupmenu', 'Units','pixels', ...
			  'String', {'Overlay: '}, 'Value', 1, ...
			  'Callback', sprintf('rest_sliceviewer(''ClickRecentOverlay'', %g);',theFig), ...
			  'BackgroundColor', get(theFig,'Color'), ...			  
			  'Position',[theLeft, theBottom, 75,20]);	 
	theLeft =OffsetX; theBottom =MarginY+120;
	hOverlayFile =uicontrol(theFig, 'Style','edit', 'Units','pixels', ...
					  'String', '', ...					  
					  'BackgroundColor', 'white', ...
					  'Callback', sprintf('rest_sliceviewer(''ChangeOverlay'', %g);',theFig), ...
					  'Position',[theLeft, theBottom, 150,20]);
	theLeft =OffsetX+116; theBottom =MarginY+140;
	uicontrol(theFig, 'Style','pushbutton', 'Units','pixels', ...
		  'Callback', sprintf('rest_sliceviewer(''OverlaySelection'', %g);',theFig) , ...
		  'String', '...','FontWeight', 'bold', ...
		  'Position',[theLeft, theBottom, 34,15]); 
	%Add Overlay  Options, 20070913
	theLeft =OffsetX; theBottom =MarginY;
	hFrameOverlay=uicontrol(theFig, 'Style','Frame', 'Units','pixels', ...
							'BackgroundColor', get(theFig,'Color'), ...
							'Position', [theLeft,theBottom,150,100]);	
	hSeeOverlay =uicontrol(theFig, 'Style','checkbox', 'Units','pixels', ...
					'String', 'See Overlay', ...
					'Callback', sprintf('rest_sliceviewer(''Repaint'', %g);',theFig), ...
					'BackgroundColor', get(theFig,'Color'), ...
					'Position',[theLeft+35, theBottom+95, 80,15]);
	uicontrol(theFig, 'Style','text', 'Units','pixels', ...
			'String', 'Threshold', ...								
			 'BackgroundColor', get(theFig,'Color'), ...
			'Position',[theLeft+5, theBottom+75, 50,18]);
	hEdtThrdValue =uicontrol(theFig, 'Style','edit', 'Units','pixels', ...
					'String', '', ...					
					'Callback', sprintf('rest_sliceviewer(''Overlay_SetThrdAbsValue'', %g);',theFig), ...	
					 'BackgroundColor', 'white', ...
					'Position',[theLeft+75, theBottom+75, 70,18]);	
	
	hSliderThrdValue =uicontrol(theFig, 'Style','slider', 'Units','pixels', ...
					'TooltipString', 'Absolute Value for thresholding the overlay', ...
					'Callback', sprintf('rest_sliceviewer(''Overlay_SetThrdAbsValue'', %g);',theFig), ...
					'BackgroundColor', get(theFig,'Color'), ...
					'Position',[theLeft+5, theBottom+56, 140,15]);	
	uicontrol(theFig, 'Style','pushbutton', 'Units','pixels', ...
			'String', 'Clusterize', ...
			'Callback', sprintf('rest_sliceviewer(''Overlay_SetThrdClusterSize'', %g);',theFig),...			
			'Position',[theLeft+75, theBottom+30, 70,24]);
	hOverlayMisc =uicontrol(theFig, 'Style','popupmenu', 'Units','pixels', ...
					'String', {'Misc', 'Set Overlay''s Opacity', ...
					'Set Range of Threshold', 'Set Label Color', 'Set Overlay''s Color bar'}, ...
					'Value', 1, ...
					'BackgroundColor', get(theFig,'Color'), ...
					'Enable', 'on', ...
					'Callback', sprintf('rest_sliceviewer(''Overlay_Misc'', %g);',theFig), ...
					'Position',[theLeft+5, theBottom+30, 70,24]);
	hTemplate =uicontrol(theFig, 'Style','popupmenu', 'Units','pixels', ...
					'String', {'Template', 'Open AAL', 'Open Brodmann','Open Ch2'}, ...
					'Value', 1, ...
					'BackgroundColor', get(theFig,'Color'), ...
					'Enable', 'on', ...
					'Callback', sprintf('rest_sliceviewer(''Open_Template'', %g);',theFig), ...
					'Position',[theLeft+5, theBottom+5, 70,24]);
	uicontrol(theFig, 'Style','pushbutton', 'Units','pixels', ...
			'String', 'Save2Mask', ...
			'Callback', sprintf('rest_sliceviewer(''CurrentCluster2Mask'', %g);',theFig),...			
			'Position',[theLeft+75, theBottom+5, 70,24]);
	% uicontrol(theFig, 'Style','pushbutton', 'Units','pixels', ...
			% 'String', 'Thrd2Mask', ...
			% 'Callback', sprintf('rest_sliceviewer(''Overlay_SetThrdClusterSize'', %g);',theFig),...			
			% 'Position',[theLeft+75, theBottom+5, 70,24]);
			
	%Colorbar for overlay, do as AFNI, 20070921
	theAxesButtonDownFcn =sprintf('rest_sliceviewer(''ChangeColorElement'', %g);',theFig);
	hAxesColorbar =axes('Parent', theFig, 'Box', 'on', ...
				  'Units', 'pixel', 'DrawMode','fast', 'Visible', 'off', ...
				  'Position', [1 1 1 1], ...
				  'YDir','normal', 'XTickLabel',[],'XTick',[], ...
				  'YTickLabel',[],'YTick',[], ...
				  'ButtonDownFcn', theAxesButtonDownFcn);
	hImageColorbar =image('Tag','OverlayColorbar',  'Parent', hAxesColorbar);
	set(hAxesColorbar,'YDir','normal','ButtonDownFcn', theAxesButtonDownFcn, 'XTickLabel',[],'XTick',[], 'YTickLabel',[],'YTick',[]);
	
	clear theLeft theBottom;
		
	%Save to config
	AConfig.hFig			=theFig;			%handle of the config
	
	%Save parameters handles
	AConfig.hFrameSetPos   =hFrameSetPos;
	AConfig.hYoke 		   =hYoke;
	AConfig.hCrosshair	   =hCrosshair;
	AConfig.hMagnify	   =hMagnify;
	AConfig.hMniTal		   =hMniTal;	
	AConfig.hEditPositionX =hEditPositionX;
	AConfig.hEditPositionY =hEditPositionY;
	AConfig.hEditPositionZ =hEditPositionZ;
	%Save Voxel intensity label handle
	AConfig.hVoxelIntensity=hVoxelIntensity;
	%Save message handle
	AConfig.hMsgLabel =hMsgLabel;
	AConfig.Message	 ='';
	%Save Do Callback button's handle
	% AConfig.hDoCallbackBtn =hDoCallbackBtn;
			
	%Save important variables
	AConfig.Filename =AFilename;	%Default for underlay
	%AConfig.Callback =ACallback;	%Default for click callback	
	%Callback define series, 20070924
	AConfig.Callback.ChangingPosition =ACallback;
	AConfig.Callback.Save2Mask ='';
	
	%View Mode, 20070911
	AConfig.ViewMode ='Orthogonal';	%Default View mode
	AConfig.ViewSeries =[];			%Default no any view series
	AConfig.Montage.Across =1;
	AConfig.Montage.Down   =1;
	AConfig.Montage.Spacing=3;
	AConfig.Montage.WantLabel=1;	
	
	%Underlay and Overlay, handles
	AConfig.hUnderlayFile =hUnderlayFile;
	AConfig.hUnderlayRecent =hUnderlayRecent;
	AConfig.hOverlayFile  =hOverlayFile;
	AConfig.hOverlayRecent =hOverlayRecent;
	
	AConfig.hSeeOverlay =hSeeOverlay;
	AConfig.hSliderThrdValue =hSliderThrdValue;
	AConfig.hEdtThrdValue =hEdtThrdValue;	
	AConfig.hOverlayMisc =hOverlayMisc;
	AConfig.hTemplate =hTemplate;	
	AConfig.hFrameOverlay  =hFrameOverlay;
	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -