Dear Haibo,
if you jut want to save a copy of some images under a different name in a
different directory, then you probably can do that without using
matlab. If you
are working under Linux, them mcp (multiple copy) will help you solve
your task.
For Windows/MacOS you can probably google for some equivalent tool.
If you dome want to do some transformation on the images then you can use
something along the following lines (in Matlab) (you probably need to adapt
a few things):
indir = '/path/to/folder/with/input/images';
outdir = '/path/to/output/folder';
newprefix = 'a'; % the prefix for the new images names
V = spm_vol(spm_select(inf,'image','Select images',[],indir);
% now read images: y = spm_read_vols(V);
% ===> do some transformation on the images
% nY = transformed image data (4-dimensional matrix, 4th dim = input images)
Vout = V;
for i = 1:length(V)
[pth,nam,ext] = fileparts(V(f).fname;
Vout(f).fname = fullfile(outdir,strcat(newprefix,nam,ext));
spm_write_vol(Vout(f),nY(:,:,:,f));
end
Cheers,
Jan
Quoting xuhaibo <[log in to unmask]>:
>
> Dear Jan,
>
> Many thanks. One more question: how to use a script saving the name
> of Analyze format images(.hdr/.img or .nii) as other name.img or
> name.nii in other dirctory in matlab? Thanks in advance.
>
> Haibo.> Date: Fri, 18 Jul 2008 09:45:55 -0700> From:
> [log in to unmask]> Subject: Re: [SPM] Script for estimating a
> lot of SPM.mat> To: [log in to unmask]> > Dear Haibo,> > if you are
> using SPM5 you can do the following for> n *configured* SPM.mat
> files:> > %1. collect your SPM.mat files in a cell array> spmmat{1} =
> '/path/to/1st/folder/SPM.mat';> ...> spmmat{n} =
> '/path/to/nth/folder/SPM.mat';> > % setup jobs struct> for j =
> 1:length(spmmat)> jobs{1}.stats{j}.fmri_est.spmmat = spmmat(j);>
> jobs{1}.stats{j}.fmri_est.method.Classical = 1;> end> > % estimate
> via job manager> spm_jobman('run',jobs')> > NOTE1:
> jobs{1}.stats{j}.fmri_est.spmmat has to be a cell array.> NOTE2: I
> think it doesn't matter whether the loop runs over> jobs{1}.stats{j}
> or jobs{j}.stats{1}.> > Cheers,> Jan> > > <Haibo> <Xu> wrote:> > Dear
> SPM list:> > > > I have a stupid question: how to write a script in
> matlab for estimating a > > lot of SPM.mat sequantially after making
> a lot of design matrix? Thanks in > > advance.> > > > Haibo> > > > --
> > Jan Gläscher, Ph.D. Div. Humanities & Social Sciences> +1 (626)
> 395-3898 (office) Caltech, Broad Center, M/C 114-96> +1 (626)
> 395-2000 (fax) 1200 E. California Blvd> [log in to unmask]
> Pasadena, CA 91125
> _________________________________________________________________
> MSN 中文网,最新时尚生活资讯,白领聚集门户。
> http://cn.msn.com
|