Dear SPM'ers,
Based on an example, I've written a script to do a batch DICOM import for a group of subjects. I use SPM8. The first part of the script (correctly) produces a cellstr containing all files that have to be converted (with their full path), called "ppfilelist".
Subsequently, I to make job files (seems to be executed fine), and then run them, using the following code (part of the loop for one participant):
------------------------------------------------------------------
dicomcells = {};
for i = 1:numel(ppfilelist);
dicomcells{i} = ppfilelist(i);
end
%Clear the variable "jobs" before filling it in again
jobs = {};
%Create the necessary elements of jobs
jobs{1}.spm.util.dicom.data = dicomcells;
jobs{1}.spm.util.dicom.root = 'flat';
jobs{1}.spm.util.dicom.outdir = cellstr(godirectory);
jobs{1}.spm.util.dicom.convopts.format = 'img';
jobs{1}.spm.util.dicom.convopts.icedims = 0;
%Save the batch file
batchfilename = strcat(char(varpart),'_dicom_import_batch');
fclose('all');
save(batchfilename,'jobs');
%Run it
spm('Defaults','fMRI');
spm_jobman('initcfg')
spm_jobman('run', jobs);
-----------------------------------------------------------------------------
("godirectory" is the output directory, and "varpart" the subject ID.)
It runs fine, just until the last command (spm_jobman('run', jobs);). I get the following error:
----------------------------------------------------------------------------------
Item 'DICOM files', field 'val': Value must be either empty, a cellstr or a cfg_dep object.
------------------------------------------------------------------------
Running job #1
------------------------------------------------------------------------
No executable modules, but still unresolved dependencies or incomplete module inputs.
The following modules did not run:
Skipped: DICOM Import
??? Error using ==> cfg_util at 835
Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines
(look for the line showing the exact #job as displayed in this error message)
------------------
Running job #1
------------------
Error in ==> spm_jobman at 217
Error in ==> FinalBatchDicomImport at 91
-------------------------------------------------------------------------------
I would be very grateful if anybody could shed light on this (for me) mysterious error.
Thank you in advance,
Kris
|