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

📄 view_nii.m

📁 Please read your package and describe it at least 40 bytes. System will automatically delete the di
💻 M
📖 第 1 页 / 共 5 页
字号:
      'TooltipString','Histogram Equalization',...
      'String','Hist EQ',...
      'visible','off', ...
      'Callback','view_nii(''hist_eq'');');

   if usepanel
%      set(handles.hist_eq, 'visible', 'on');
   end

   x = x + w;
   w = info_pos(3)*0.2;

   pos = [x y w h];

   handles.hist_plot = uicontrol('Parent',fig,'Style','push', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'TooltipString','Histogram Plot',...
      'String','Hist Plot',...
      'visible','off', ...
      'Callback','view_nii(''hist_plot'');');

   if usepanel
%      set(handles.hist_plot, 'visible', 'on');
   end

   x = info_pos(1) + info_pos(3)*0.025;
   w = info_pos(3)*0.4;

   pos = [x y w h];

   handles.coord = uicontrol('Parent',fig,'Style','popupmenu', ...
      'Units','Normalized', Font, ...
      'Position',pos, ...
      'BackgroundColor', [1 1 1], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'TooltipString','Choose Voxel or Millimeter',...
      'String',{'Voxel','Millimeter'},...
      'visible','off', ...
      'Callback','view_nii(''coordinates'');');

%      'TooltipString','Choose Voxel, MNI or Talairach Coordinates',...
%      'String',{'Voxel','MNI (mm)','Talairach (mm)'},...

   if usepanel
      set(handles.coord, 'visible', 'on');
   end

   x = info_pos(1) + info_pos(3)*0.5;
   w = info_pos(3)*0.2;

   pos = [x y w h];

   handles.neg_color = uicontrol('Parent',fig,'Style','toggle', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'TooltipString','Negative Colormap',...
      'String','Negative',...
      'visible','off', ...
      'Callback','view_nii(''neg_color'');');

   if usepanel
      set(handles.neg_color, 'visible', 'on');
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      set(handles.neg_color, 'enable', 'off');
   end

   x = info_pos(1) + info_pos(3)*0.7;
   w = info_pos(3)*0.275;

   pos = [x y w h];

   handles.colorindex = uicontrol('Parent',fig,'Style','popupmenu', ...
      'Units','Normalized', Font, ...
      'Position',pos, ...
      'BackgroundColor', [1 1 1], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'TooltipString','Change Colormap',...
      'String',{'Custom','Bipolar','Gray','Jet','Cool','Bone','Hot','Copper','Pink'},...
      'value', colorindex, ...
      'visible','off', ...
      'Callback','view_nii(''color'');');

   if usepanel
      set(handles.colorindex, 'visible', 'on');
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      set(handles.colorindex, 'enable', 'off');
   end

   x = info_pos(1) + info_pos(3)*0.1;
   y = y + inputline_space;
   w = info_pos(3)*0.28;
   h = inputline_space*0.6;

   pos = [x y w h];

   Font.FontSize   = 8;

   handles.Thist = uicontrol('Parent',fig,'Style','text', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'BackgroundColor', [0.8 0.8 0.8], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'visible','off', ...
      'String','Histogram');

   handles.Tcoord = uicontrol('Parent',fig,'Style','text', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'BackgroundColor', [0.8 0.8 0.8], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'visible','off', ...
      'String','Axes Unit');

   if usepanel
%      set(handles.Thist, 'visible', 'on');
      set(handles.Tcoord, 'visible', 'on');
   end

   x = info_pos(1) + info_pos(3)*0.60;
   w = info_pos(3)*0.28;

   pos = [x y w h];

   handles.Tcolor = uicontrol('Parent',fig,'Style','text', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'BackgroundColor', [0.8 0.8 0.8], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'visible','off', ...
      'String','Colormap');

   if usepanel
      set(handles.Tcolor, 'visible', 'on');
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      set(handles.Tcolor, 'enable', 'off');
   end

   %  Contrast Frame
   %
   x = info_pos(1);
   w = info_pos(3)*0.45;
   h = inputline_space * 2;

   pos = [x,  y+inputline_space*0.8,  w,  h];

   handles.contrast_frame = uicontrol('Parent',fig, ...	
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'Position',pos, ...
        'visible','off', ...
   	'Style','frame');

   if usepanel
      set(handles.contrast_frame, 'visible', 'on');
   end

   if colorindex < 2 | colorindex > 3
      set(handles.contrast_frame, 'visible', 'off');
   end

   %  Brightness Frame
   %
   x = info_pos(1) + info_pos(3)*0.475;
   w = info_pos(3)*0.525;

   pos = [x,  y+inputline_space*0.8,  w,  h];

   handles.brightness_frame = uicontrol('Parent',fig, ...	
   	'Units','normal', ...
   	'BackgroundColor',[0.8 0.8 0.8], ...
   	'Position',pos, ...
        'visible','off', ...
   	'Style','frame');

   if usepanel
      set(handles.brightness_frame, 'visible', 'on');
   end

   %  Contrast
   %
   x = info_pos(1) + info_pos(3)*0.025;
   y = y + inputline_space;
   w = info_pos(3)*0.4;
   h = inputline_space*0.6;

   pos = [x y w h];

   Font.FontSize   = 12;

   slider_step(1) = 5/255;
   slider_step(2) = 5.00001/255;

   handles.contrast = uicontrol('Parent',fig, ...
      'Style','slider','Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'left',...
      'BackgroundColor',[0.5 0.5 0.5],'ForegroundColor',[0 0 0],...
      'BusyAction','queue',...
      'TooltipString','Change contrast',...
      'Min',1,'Max',256,'SliderStep',slider_step, ...
      'Value',1, ...
      'visible','off', ...
      'Callback','view_nii(''contrast'');');

   if usepanel
      set(handles.contrast, 'visible', 'on');
   end

   if (nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511) & nii_view.numscan <= 1
      set(handles.contrast, 'enable', 'off');
   end

   if nii_view.numscan > 1
      set(handles.contrast, 'min', 1, 'max', nii_view.numscan, ...
         'sliderstep',[1/(nii_view.numscan-1) 1.00001/(nii_view.numscan-1)], ...
         'Callback', 'view_nii(''slider_change_scan'');');
   elseif colorindex < 2 | colorindex > 3
      set(handles.contrast, 'visible', 'off');
   elseif colorindex == 2
      set(handles.contrast,'value',128);
   end

   set(handles.contrast,'position',pos);	% linux66

   %  Brightness
   %
   x = info_pos(1) + info_pos(3)*0.5;
   w = info_pos(3)*0.475;

   pos = [x y w h];

   Font.FontSize   = 12;

   slider_step(1) = 1/50;
   slider_step(2) = 1.00001/50;

   handles.brightness = uicontrol('Parent',fig, ...
      'Style','slider','Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'left',...
      'BackgroundColor',[0.5 0.5 0.5],'ForegroundColor',[0 0 0],...
      'BusyAction','queue',...
      'TooltipString','Change brightness',...
      'Min',-1,'Max',1,'SliderStep',slider_step, ...
      'Value',0, ...
      'visible','off', ...
      'Callback','view_nii(''brightness'');');

   if usepanel
      set(handles.brightness, 'visible', 'on');
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      set(handles.brightness, 'enable', 'off');
   end

   set(handles.brightness,'position',pos);	% linux66

   %  Contrast text/def
   %
   x = info_pos(1) + info_pos(3)*0.025;
   y = y + inputline_space;
   w = info_pos(3)*0.22;

   pos = [x y w h];

   handles.Tcontrast = uicontrol('Parent',fig,'Style','text', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'left',...
      'BackgroundColor', [0.8 0.8 0.8], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'visible','off', ...
      'String','Contrast:');

   if usepanel
      set(handles.Tcontrast, 'visible', 'on');
   end

   if (nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511) & nii_view.numscan <= 1
      set(handles.Tcontrast, 'enable', 'off');
   end

   if nii_view.numscan > 1
      set(handles.Tcontrast, 'string', 'Scan ID:');
   elseif colorindex < 2 | colorindex > 3
      set(handles.Tcontrast, 'visible', 'off');
   end

   x = x + w;
   w = info_pos(3)*0.18;

   pos = [x y w h];

   Font.FontSize   = 8;

   handles.contrast_def = uicontrol('Parent',fig,'Style','push', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'TooltipString','Restore initial contrast',...
      'String','Reset',...
      'visible','off', ...
      'Callback','view_nii(''contrast_def'');');

   if usepanel
      set(handles.contrast_def, 'visible', 'on');
   end

   if (nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511) & nii_view.numscan <= 1
      set(handles.contrast_def, 'enable', 'off');
   end

   if nii_view.numscan > 1
      set(handles.contrast_def, 'style', 'edit', 'background', 'w', ...
         'TooltipString','Scan (or volume) index in the time series',...
         'string', '1', 'Callback', 'view_nii(''edit_change_scan'');');
   elseif colorindex < 2 | colorindex > 3
      set(handles.contrast_def, 'visible', 'off');
   end

   %  Brightness text/def
   %
   x = info_pos(1) + info_pos(3)*0.5;
   w = info_pos(3)*0.295;

   pos = [x y w h];

   Font.FontSize   = 12;

   handles.Tbrightness = uicontrol('Parent',fig,'Style','text', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'left',...
      'BackgroundColor', [0.8 0.8 0.8], 'ForegroundColor', [0 0 0],...
      'BusyAction','queue',...
      'visible','off', ...
      'String','Brightness:');

   if usepanel
      set(handles.Tbrightness, 'visible', 'on');
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      set(handles.Tbrightness, 'enable', 'off');
   end

   x = x + w;
   w = info_pos(3)*0.18;

   pos = [x y w h];

   Font.FontSize   = 8;

   handles.brightness_def = uicontrol('Parent',fig,'Style','push', ...
      'Units','Normalized', Font, ...
      'Position',pos, 'HorizontalAlignment', 'center',...
      'TooltipString','Restore initial brightness',...
      'String','Reset',...
      'visible','off', ...
      'Callback','view_nii(''brightness_def'');');

   if usepanel
      set(handles.brightness_def, 'visible', 'on');
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      set(handles.brightness_def, 'enable', 'off');
   end

   %  init image handles
   %
   handles.axial_image = [];
   handles.coronal_image = [];
   handles.sagittal_image = [];

   %  plot axial view
   %
   if ~isempty(nii_view.bgimg)
      bg_slice = squeeze(bgimg(:,:,nii_view.slices.axi));
      h1 = plot_view(fig, xdim, ydim, top_ax, bg_slice', clim, cbarminmax, ...
		handles, useimagesc, colorindex, color_map, ...
		colorlevel, highcolor, useinterp, nii_view.numscan);
      handles.axial_bg = h1;
   else
      handles.axial_bg = [];
   end

   if nii.hdr.dime.datatype == 128 | nii.hdr.dime.datatype == 511
      img_slice = squeeze(nii.img(:,:,nii_view.slices.axi,:,setscanid));
      img_slice = permute(img_slice, [2 1 3]);
   else
      img_slice = squeeze(nii.img(:,:,nii_view.slices.axi,setscanid));
      img_slice = img_slice';
   end
   h1 = plot_view(fig, xdim, ydim, top_ax, img_slice, clim, cbarminmax, ...
	handles, useimagesc, colorindex, color_map, ...
	colorlevel, highcolor, useinterp, nii_view.numscan);
   set(h1,'buttondown','view_nii(''axial_image'');');
   handles.axial_image = h1;
   handles.axial_axes = top_ax;

   if size(img_slice,1) == 1 | size(img_slice,2) == 1
      set(top_ax,'visible','off');

      if isfield(handles,'sagittal_slider') & ishandle(handles.sagittal_slider)
         set(handles.sagittal_slider, 'visible', 'off');
      end

      if isfield(handles,'coronal_slider') & ishandle(handles.coronal_slider)
         set(handles.coronal_slider, 'visible', 'off');
      end

      if isfield(handles,'axial_slider') & ishandle(handles.axial_slider)
         set(handles.axial_slider, 'visible', 'off');
      end
   end

   %  plot coronal view
   %
   if ~isempty(nii_view.bgimg)
      bg_slice = squeeze(bgimg(:,nii_view.slices.cor,:));
      h1 = plot_view(fig, xdim, zdim, front_ax, bg_slice', clim, cbarminmax, ...
		handles, usei

⌨️ 快捷键说明

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