Hi
You must be careful when changing SPM.xY.P or SPM.xY.VY because you can
change the scaling parameters for the images and corrupt your plots. What
you really want to do is to change SPM.xY.P AND change SPM.xY.VY.fname
but not change anything else.
From the SPM history books: (Fri, 24 Sep 2004) by Matthew Brett
> ------------------- snip -------------------- <
The point is, that spm will remap the volumes if the .VY vol_structs are no
longer valid, but just remapping:
SPM.xY.VY = spm_vol(SPM.xY.P);
will not reproduce the original spm scaling, so will give you different
results. This only applies to plots (using the spm_graph function);
contrast images etc will be OK.
To solve this, you could add an edit to your script to give something like
the following. You can also use Marsbar which has a path remapping utility,
or the volumes toolbox.
========= function modified by drg, any errors are mine not matthew's
============
function h_relocate;
% path to SPM.mat
newloc=spm_get(1,'SPM.mat','Please enter SPM.mat file to work on');
% load SPM.mat into wksp
load(newloc);
% save a copy in case something goes wrong (give it a time stamp in case we
repeat the error)
save(['SPM-',datestr(clock,30),'.mat'],'SPM')
% change working dir to path of current SPM.mat
[SPM.swd ans ans]=fileparts(newloc);
% get example image file to remind user of what images to pick now:
[ans old ans]=fileparts(SPM.xY.P(1,:));
% Now get all the images (note this will be problematic if the images come
from multiple
% remapped directories unless you remember the order)
SPM.xY.P=spm_get(size(SPM.xY.P,1),'.img',['Imgs corresp. to ' old '?']);
cP = cellstr(SPM.xY.P);
[SPM.xY.VY(:).fname] = deal(cP{:});
save('SPM.mat', 'SPM');
=================================
>-----Original Message-----
>From: SPM (Statistical Parametric Mapping)
>[mailto:[log in to unmask]] On Behalf Of Zou, Ping
>Sent: Friday, September 08, 2006 4:32 PM
>To: [log in to unmask]
>Subject: Re: [SPM] New SPM5 installation. .
>
>
>SPM.xY.P stores the full path name of the image files. In
>Linux it may look like "/work/subj/date/imag1.img", and in
>Windows the same files and directory may look like
>"C:\work\subj\date\imag1.img". Note the drive letter in the
>windows, and backward/forward slashes. You may change your
>SPM.xY.P by load SPM into your matlab, then change the
>SPM.xY.P, and save SPM again.
>E.g.
>(in matlab)
>>> clear
>>> load SPM
>>> %%% see tip below %%%
>>> SPM.xY.P = ['C:\work\subj\date\imag1.img';
> 'C:\work\subj\date\imag2.img';
> 'C:\work\subj\date\imag3.img'];
>>> save SPM
>
>
>Tip, instead of typing the windows path, you may get the list
>of all files by typing SPM.xY.P, and grab the list of files
>into a text editor, and replace the all the "/" with "\", and
>add drive letter in front of each line. Then copy - paste back
>the new list to assign to SPM.xY.P.
>
>Hope this helps,
>Ping
>-------------------------------------
>Ping Zou, Ph.D.
>Neuroimaging Scientist
>Radiological Sciences
>St. Jude Children's Research Hospital
>Memphis, TN 38105
>(901)495-2892
>[log in to unmask]
>-------------------------------------
>
>-----Original Message-----
>From: SPM (Statistical Parametric Mapping)
>[mailto:[log in to unmask]] On Behalf Of Xu, Ben (NIH/NINDS) [E]
>Sent: Friday, September 08, 2006 3:29 PM
>To: [log in to unmask]
>Subject: Re: [SPM] New SPM5 installation. .
>
>Hi,
>
>I hope someone can help us out with the following data
>transfer problem:
>
>We copied from our Linux workstation to a PC a set of SPM2
>processed data including all the preprocessed image files and
>the results. We got the following error message when we try to
>plot the data in Results:
>
> "Original data have been moved or renamed. Recommendation: please
> update SPM.xY.P"
>
> "Error reading information...(smoothed).img. Please check that it
> is in the correct format."
>
>We did not change any name or directory of the files. Is this
>a compatibility (Linux to PC) problem? How can we update "SPM.xY.P"
>without having to re-analyze/creating a new design matrix for the data?
>
>Thanks in advance for your help!
>
>Ben
>
|