Borrar filtros
Borrar filtros

SPM12 Batch Editor automation

44 visualizaciones (últimos 30 días)
Veronica Kidwell
Veronica Kidwell el 7 de Ag. de 2023
Editada: Alan el 31 de Ag. de 2023
I'm very new to Matlab, so please forgive me for any misused terms or dumb questions.
The lab I'm currently in is using SPM12's batch editor to process fMRI data. Since I'm only an undergrad, my job is just to fill in all of the necessary fields and press go. I'm looking to see if there's a way to automate this process. Each patient's data takes about 10 minutes to run, then I have to manually clear and repopulate the File Set field in the Named File Selector module. I still have a little over 100 subjects left, so this is a very tedious and time consuming process since I'm not actively doing something while it's running, but I still have to keep an eye on it to enter the next patient. I'm hoping to find a way to automate it so that I can let it run on its own overnight and continue to the next step.
I'm trying to learn Matlab, so I'm just looking to know if this is possible and be pointed in the right direction.
  1 comentario
Walter Roberson
Walter Roberson el 7 de Ag. de 2023
It has been at least a dozen years since I used SPM (SPM8 days). If I recall correctly, the batch editor is creating files, and then you ask to process the files. If that memory is correct, then any way that generated the same kind of files should work. And that implies that it should be possible to create code that copied one of the files, changed the data file name, and wrote out the revised file.
However, I do not recall whether SPM provided any code to do that for you -- and I haven't looked at SPM12 to see what tools it provides.

Iniciar sesión para comentar.

Respuestas (2)

Ninad
Ninad el 31 de Ag. de 2023
It is possible to automate the process of running SPM12's batch editor using MATLAB. MATLAB provides a scripting environment that allows you to write code to automate repetitive tasks.
To automate the process, create a MATLAB script that interacts with SPM12's batch editor.
SPM12 is compatible with MATLAB versions ranging from R2007a (7.4) to R2023a (9.14). However, it is not compatible with earlier versions of MATLAB. Additionally, SPM12 can run with just the core MATLAB installation, without the need for any additional toolboxes.
To learn more about MATLAB and how to interact with SPM12, you can refer to the SPM12 documentation:

Alan
Alan el 31 de Ag. de 2023
Editada: Alan el 31 de Ag. de 2023
Hi,
If I understand correctly, you are trying to iteratively analyse patient image data through SPM12. It seems like it is possible to automate the process using a MATLAB script. I’ve found a resource you could check out, but I’ve not tried it out myself and hence cannot guarantee its accuracy: https://andysbrainbook.readthedocs.io/en/latest/SPM/SPM_Short_Course/SPM_06_Scripting.html
The above resource is a part of a series of tutorials. The following is a short summary:
  1. It starts off with adding preprocessing modules to the batch editor for a single file. The tutorial also has a step containing the “Named File Selector” module which you might be focussed on.
  2. Once all modules are added, the batch is run for one file, and the “Save Batch and Script” option is used to create a MATLAB script for that specific file.
  3. Move the script to the directory containing the patients’ data.
  4. Edit the script to iterate through all patient records.
  5. Run the MATLAB script.
A point to note is that the tutorial is made in Linux, so you might have to substitute the environment variables and take care of file path syntax.
Here is another article you could check out (once again I haven’t verified if it would work): https://myguide.bagarinao.com/batch-processing-in-spm/
Also, as Ninad pointed out, ensure that MATLAB is setup properly to interact with SPM12.

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by