Dear Matthew,
By default, SPM12 will not open the Graphics window to display results
if it is not already available. So you could start your script with:
spm_figure('GetWin','Graphics');
to force the Graphics window to open. Realign&Unwarp will then save the
content of the figure automatically (spm_print is called by
spm_uw_estimate).
Best regards,
Guillaume.
On 09/11/17 15:27, Heard, Matt wrote:
> Hello experts,
>
> I am trying to develop my own Matlab pipeline to handle pre-processing.
> At the moment I am struggling to use a script to save output that would
> typically appear in the "Graphics" window--particularly when I try to
> save output from the "Realign & Unwarp function".
>
> I saw a previous solution in the archives
> (https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=SPM;7ce84652.0803) which
> recommended using the following code, in which realign_figure is the
> path\filename.ps which I would like to name the figure:
>
> fg=spm_figure('FindWin','Graphics');
> saveas(fg, realign_figure)
>
> Unfortunately this throws an error when I run it:
>
> Error using saveas (line 81)
> Invalid figure handle.
>
> Sure enough, when I check what the figure handle "fg" is after running
> the spm_figure command, it comes back as an empty GraphicsPlaceholder
> array. I also noticed when I start my script no SPM Graphics windows
> open, and any open Graphics windows close. When I run my script
> line-by-line with the SPM Graphics window open, I do not have the error
> and the images successfully save; my error only replicates when I run
> the entire script.
>
> Has anyone run into this problem before? I am running my code on Windows
> 10 Enterprise version, Matlab 2017a, and the most recent version of SPM12.
>
> Thanks much,
>
> Matthew Heard
> Laboratory Manager
> *The Ohio State University*
> Arts and Sciences Speech and Hearing Science
> 004 Pressey Hall, 1070 Carmack Road, Columbus, OH 43201
> 614-247-8320 Office / 214-458-7255 Mobile
> [log in to unmask] <mailto:[log in to unmask]> https://osu-slam.github.io/
> <http://https://osu-slam.github.io/.osu.edu>
>
> /Buckeyes consider the environment before printing./
>
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|