Print

Print


Dear Anders, Vy,

W.r.t. Vy reply I suggest it is worthwhile writing matlab code to
automatically read in TR, voxel res etc as you do not really want to hand
code functionA(TR, slice, ...) in (2). You will need to write 1000 lines of
functionA().

Alternatively, there are a lot of matlab batch scripts out there that will
automatically extract information such as TR, voxel res from the header file
of NifTI or your DICOM file and adjust the appropriate values in SPM
accordingly.

Since your TR, time points etc are different, presumably you will still
probably need to write script to convert your button press or related
information into the design matrix. There is no shortcut here I'm afraid.

HTH
Cinly

On 4 August 2011 16:58, Vy Dinh <[log in to unmask]> wrote:

> HI Anders,
>
> I'm curious as to why you have a ~1000 fMRI datasets with different TR,
> voxel res, etc but to answer your question, it is possible to batch the
> analysis, given that you know how to program in Matlab.
>
> Here are some things you will need to know:
>
> 1. How to convert a batch job in SPM(8) to a .m file (This part is easy:
> File: save as .m file)
>
> 2. How to convert this .m file into a Matlab function so that you can
> specify TR, slices, etc as inputs.
>
> Depending on the value that is different for each dataset...you will set
> that Matlabbatch structure field description in the .m file to a variable.
>
> $---------------------------------------------
> (overview of a sample function)
> function  function_A(TR, slices,dim,timepoints)
> matlabbatch.field1.field2.field3.TR = TR;
> % run the matlabbatch job
> spm_jobman('run',matlabbatch); % <--use this command to run the batch job
> $---------------------------------------------
> Conversely, you can follow the directions in the SPM manual for running a
> batch job in the command line. Check the forum too, it has lots of
> suggestions on how to create a batch file!
>
> 3. How to create a .mat file or structure for each dataset that specifies
> each condition (which you can specify as an input when calling the
> function). Create a .mat for each dataset with the variables defined.
>
> Example:
> A.mat has the variables:
> TR = 2.0
> slices =21
> dim = [3 3 3]
> timepoints = 300
>
> 4. How to create a batch code that will load the variables from the .mat
> file in 3 and call the function with these variables as inputs.
>
> --------------------------------------------------------
> % Overview of a sample batch script:
> % go to dataset directory
> % load A.mat
>  function_A(TR,slices,dim,time-points)
> --------------------------------------------------------
>
> Good luck with the rest.
>
>
> Vy T.U. Dinh
> Research Assistant, Neurological Sciences
> Rush University Medical Center
> Phone: (312) 563-3853
> Fax: (312) 563-4660
> Email: [log in to unmask]
>
> ________________________________________
> From: SPM (Statistical Parametric Mapping) [[log in to unmask]] on behalf
> of Anders Eklund [[log in to unmask]]
> Sent: Thursday, August 04, 2011 6:34 AM
> To: [log in to unmask]
> Subject: [SPM] Analyze 1000 datasets
>
> Hello,
>
> I have ~ 1000 fMRI datasets (each stored as one *.nii file) that I would
> like to analyze with SPM. These datasets have different number of
> timepoints, TR, voxel resolution and slices. For each dataset I only
> want to save the number of significantly active voxels. Is it possible
> to do this as a batch job in SPM or do I have to do it manually for each
> file?
>
> /Anders
>
> --
> --
> -----------------------------------------------------------------------
>
> Anders Eklund
> Phd student
>
> Department of Biomedical Engineering, Linköping University
> CMIV, Center for Medical Image Science and Visualization
>



-- 
Best Regards,
Cinly

*****
Don't bother with footer please. I don't read them and will not be bounded
by them.
It cannot be enforced legally anyway. If it can, then remember this: This
footer always triumph yours.