Skip to content

Commit

Permalink
Improved functionality of mrvNewGraphWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
francopestilli committed Jul 17, 2014
1 parent 15b187c commit 25afa13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
11 changes: 6 additions & 5 deletions mrDiffusion/preprocess/dtiCheckMotion.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@

% We make a plot of the motion correction during eddy current correction
% but we do not show the figure. We only save i to disk.
fh = mrvNewGraphWin('visibility',visibility);
keyboard
fh = mrvNewGraphWin([],[],'visibility',visibility);
subplot(2,1,1);
plot(t(:,1:3));
title('Translation');
xlabel('image');
xlabel('Diffusion image number (diffusion direction)');
ylabel('translation (voxels)');
legend({'x','y','z'});

subplot(2,1,2);
plot(t(:,4:6)/(2*pi)*360);
title('Rotation');
xlabel('image');
xlabel('Diffusion image number (diffusion direction)');
ylabel('rotation (degrees)');
legend({'pitch','roll','yaw'});

Expand All @@ -59,11 +60,11 @@
sprintf('print(%s, ''-painters'',''-dpng'', ''-noui'', ''%s'')', ...
num2str(fh),figurename);
fprintf('[%s] Saving Eddy Currenct correction figure: \n %s \n', ...
mfilename,figurename)
mfilename,figurename);
eval(printCommand);

% Delete output if it was nto requested
if (nargout < 1), close fh;end
if (nargout < 1), close(fh); clear fh figurename; end

return;

24 changes: 14 additions & 10 deletions utilities/plot/mrvNewGraphWin.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function figHdl = mrvNewGraphWin(ftitle,fType)
function figHdl = mrvNewGraphWin(ftitle,fType,visibility)
% Open a new graph window
%
% figHdl = mrvNewGraphWin([title],[fType])
% figHdl = mrvNewGraphWin([title],[fType],[visibility])
%
% A stanford mrVIsta graph window figure is opened and its handle is
% returned.
Expand All @@ -17,29 +17,33 @@
% mrvNewGraphWin;
% mrvNewGraphWin('myTitle','tall')
% mrvNewGraphWin('wideTitle','wide')
% mrvNewGraphWin('wideTitle','wide')
%
% (c) Stanford VISTA Team
% Franco Pestilli & Brian Wandell Stanford University

figHdl = figure;
if notDefined('visibility'), visibility = 'on'; end

if notDefined('ftitle'), ftitle = 'mrVista: ';
else ftitle = sprintf('mrVista: %s',ftitle);
end
if notDefined('fType'), fType = 'upper left'; end

set(figHdl,'Name',ftitle,'NumberTitle','off');
set(figHdl,'Color',[1 1 1]);

% Position the figure
fType = mrvParamFormat(fType);
switch(fType)
case 'upperleft'
set(figHdl,'Units','normalized','Position',[0.007 0.55 0.28 0.36]);
position = [0.007 0.55 0.28 0.36];
case 'tall'
set(figHdl,'Units','normalized','Position',[0.007 0.055 0.28 0.85]);
position = [0.007 0.055 0.28 0.85];
case 'wide'
set(figHdl,'Units','normalized','Position',[0.007 0.62 0.7 0.3]);
position = [0.007 0.62 0.7 0.3];
otherwise % default
end

figHdl = figure('Name',ftitle, ...
'NumberTitle','off', ...
'visible', visibility, ...
'Color',[1 1 1], ...
'Units','normalized', ...
'Position',position);
return;

0 comments on commit 25afa13

Please sign in to comment.