Dear Javier:
There should be a button for this, .... but there isn't.
I have often needed to do the same thing so this prompted me to make
a function that will do just this. The function (CBMGcross) will
setup a tiny crosshair button just below and at the right end of the
toolbar. Pressing the button will alternately show and hide the
crosshairs. To delete the button type CBMGcross('delete')
The function listing is below. If it does something weird like the
button doesn't appear in the figure window let me know.
If you really want to just type commands in the matlab command window
then type:
hcross = findobj(1,'color',[0 0 1]);
set(hcross,'visible','off')
to make them reappear set(hcross,'visible','on').
you will need to re-find the handles everytime to recreate the
orthogonal slice views. (the button does that automatically).
Note the graphics window must be 1, and the crosshairs must be blue.
Darren
At 8:54 PM -0500 8/15/2000, Quintana, Javier wrote:
>When using SPM96 I could hide the crosshairs on a specific set of orthogonal
>sections/overlays before exporting the images for presentation, but I don't
>know how to do it in SPM99 (other than moving the crosshairs somewhere out
>of the brain template section, one plane at the time). Could anybody tell
>me of a simple way to hide the crosshairs on the overlays all at once?
>
>Many thanks,
>
>Xavier Quintana
===========================================================
function CBMGcross(Action)
% function to show/hide a crosshairs
% Action: setup or empty will setup button.
% delete will delete the crosshair button
% must enter action as a string, e.g., CBMGcross('delete')
% the function depends on the crosshairs being blue since they
% don't have a tag
% Darren Gitelman v1.0 08/15/00
if nargin == 0 | strcmp(Action,'setup')
% find the graphics window
%----------------------------------------------------------------
Fgraph = spm_figure('findwin','Graphics');
% show hidden object handles in order to locate the toolbar for positioning
% save the original status for cleanup
%----------------------------------------------------------------
handlestatus = get(0,'showhiddenhandles');
if strcmp(handlestatus,'off')
set(0,'showhiddenhandles','on')
end
% find location of toolbar frame (do this in pixels)
%------------------------------------------------------------------
FgraphUnits = get(Fgraph,'units');
set(Fgraph,'units','pixels')
tbframe = intersect(findobj(1,'tag','ToolBar'),findobj(1,'style','frame'));
tbframeloc = get(tbframe,'position');
chloc = [(tbframeloc(1)+tbframeloc(3))-17 tbframeloc(2)-14 12 12];
if isempty(tbframe) | length(tbframe) > 1
%something weird in figure setup, exit
error('cannot figure out how to place button, exiting')
return
end
%get current crosshair visibility
%------------------------------------------------------------------
hcross = findobj(1,'color',[0 0 1]);
if strcmp(get(hcross(1),'visible'),'on')
chcolor = [0 0 1];
else
chcolor = [0 0 0];
end
% setup crosshairs pushbutton
% color of button mirrors visibility of crosshairs
%------------------------------------------------------------------
uicontrol(1,'style','pushbutton','string','+',...
'foregroundcolor',chcolor,'position',chloc,...
'tag','crosshairbutt',...
'callback',['me = gco;',...
'hcross = findobj(1,''color'',''blue'');',...
'if isempty(hcross),',...
'return,',...
'end,',...
'if strcmp(get(hcross,''visible''),''on''),',...
'set(hcross,''visible'',''off''),',...
'set(me,''foregroundcolor'',[0 0 0]),',...
'else,',...
'set(hcross,''visible'',''on''),',...
'set(me,''foregroundcolor'',[0 0 1]),',...
'end']);
%cleanup
%------------------------------------------------------------------
set(0,'showhiddenhandles',handlestatus)
set(Fgraph,'units',FgraphUnits)
elseif strcmp(Action,'delete')
try
delete(findobj(1,'tag','crosshairbutt'))
catch
end
else
error('unknown action string')
end
-------------------------------------------------------------------------
Darren R. Gitelman, M.D.
Cognitive Neurology and Alzheimer's Disease Center
E-mail: [log in to unmask] WWW:
http://www.brain.northwestern.edu
Voice: (312) 908-9023 Fax: (312) 908-8789
Northwestern Univ., 320 E. Superior St., Searle 11-470, Chicago, IL 60611
-------------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|