| Author |
Topic  |
|
|
vvs4
Junior Member
 
USA
40 Posts |
Posted - Mar 02 2010 : 08:11:45 AM
|
Hi,
I set up a simple batch to convert from dicom to nifti, and from 3D to 4D images, and I'm having some trouble getting it to work from qsub.
What I did is create a batch file, save it as a .m script, and then replace the paths with variable names, to be filled in by my bash script. When I run it, the subject specific .m script is created successfully, but it doesn't look like anything happens with SPM. If anyone could help me figure out why it isn't working, it would be greatly appreciated!
I will include below my bash script, template script, output file, and subject specific script (created from the template.)
THIS IS THE BASH SCRIPT!
#!/bin/sh
# --------------MATLAB SPM JOB SUBMIT ---------------- # # This script is an attempt to launch a matlab script from the head node # # ----------------------------------------------------
# # > qsub -v EXPERIMENT=Dummy.01 test.sh $SUBJECT $RUN $FUNC # # There are 2 USER sections # 1. USER DIRECTIVE: If you want mail notifications when # your job is completed or fails you need to set the # correct email address. # # 2. USER SCRIPT: Add the user script in this section. # Within this section you can access your experiment # folder using $EXPERIMENT. All paths are relative to this variable # eg: $EXPERIMENT/Data $EXPERIMENT/Analysis # By default all terminal output is routed to the " Analysis " # folder under the Experiment directory i.e. $EXPERIMENT/Analysis # To change this path, set the OUTDIR variable in this section # to another location under your experiment folder # eg: OUTDIR=$EXPERIMENT/Analysis/GridOut # By default on successful completion the job will return 0 # If you need to set another return code, set the RETURNCODE # variable in this section. To avoid conflict with system return # codes, set a RETURNCODE higher than 100. # eg: RETURNCODE=110 # Arguments to the USER SCRIPT are accessible in the usual fashion # eg: $1 $2 $3 # The remaining sections are setup related and don't require # modifications for most scripts. They are critical for access # to your data
# --- BEGIN GLOBAL DIRECTIVE -- #$ -S /bin/sh #$ -o $HOME/$JOB_NAME.$JOB_ID.out #$ -e $HOME/$JOB_NAME.$JOB_ID.out #$ -m ea # -- END GLOBAL DIRECTIVE --
# -- BEGIN PRE-USER -- #Name of experiment whose data you want to access EXPERIMENT=${EXPERIMENT:?"Experiment not provided"}
source /etc/biac_sge.sh
EXPERIMENT=`biacmount $EXPERIMENT` EXPERIMENT=${EXPERIMENT:?"Returned NULL Experiment"}
if [ $EXPERIMENT = "ERROR" ] then exit 32 else #Timestamp echo "----JOB [$JOB_NAME.$JOB_ID] START [`date`] on HOST [$HOSTNAME]----" # -- END PRE-USER -- # **********************************************************
# -- BEGIN USER DIRECTIVE -- # Send notifications to the following address #$ -M youremail@duke.edu
# -- END USER DIRECTIVE --
# -- BEGIN USER SCRIPT -- # User script goes here
# Initialize input variables (Later have these fed in via python script) SUBJ=$1 # This is the full subject folder name under Data RUN=$2 # This is a run number, if applicable FUNCFOLDER=$3 # This is the name of the functional folder run (run004_04) ANATFOLDER=$4 # This is the name of the anatomical folder (series002) TASK=$5 # This is the functional task, either faces or cards SCRIPTNAME=$6 # This is the name of the template script
# First we create a directory for the subjects SPM data mkdir -p $EXPERIMENT/Analysis/SPM/$SUBJ
# Now we create directories to put the anatomical and functional processed data mkdir -p $EXPERIMENT/Analysis/SPM/$SUBJ/anat mkdir -p $EXPERIMENT/Analysis/SPM/$SUBJ/$TASK # Initialize other variables to pass on to matlab template script FUNCOUTPUT=$EXPERIMENT/Analysis/SPM/$SUBJ/$TASK # This is the functional output directory ANATDIRECTORY=$EXPERIMENT/Data/Anat/$SUBJ/$ANATFOLDER # This is the location of the anatomical data OUTDIR=$EXPERIMENT/Analysis/SPM/$SUBJ # This is the subject output directory top SCRIPTDIR=$EXPERIMENT/Scripts/SPM # This is the location of our MATLAB script templates BIACROOT=/usr/local/packages/MATLAB/BIAC # This is where matlab is installed on the custer PATHDEFS=/home/vvs4/matlab # This is where my pathdefs are
# Go to the subject anatomical data directory to pull prefix of the image names and shove into a variable cd $ANATDIRECTORY
# This prepares the file path if we are using dicoms that end in ,dcm if [ $ANATFOLDER == 'series002' ]; then
ANATFILE=*01.dcm ANATPRE=$(echo $ANATFILE | cut -c1-27)
fi
# Change into directory where template exists, save subject specific script cd $SCRIPTDIR
# Loop through template script replacing keywords for i in 'convert.m'; do sed -e 's@SUB_FUNCOUTPUT_SUB@'$FUNCOUTPUT'@g' \ -e 's@SUB_FUNCFOLDER_SUB@'$FUNCFOLDER'@g' \ -e 's@SUB_FUNCTYPE_SUB@'$TASK'@g' \ -e 's@SUB_MOUNT_SUB@'$EXPERIMENT'@g' \ -e 's@SUB_DICOM_SUB@'$ANATPRE'@g' \ -e 's@SUB_ANATFOLDER_SUB@'$ANATFOLDER'@g' \ -e 's@SUB_BIACROOT_SUB@'$BIACROOT'@g' \ -e 's@SUB_SCRIPTDIR_SUB@'$SCRIPTDIR'@g' \ -e 's@SUB_SUBJECT_SUB@'$SUBJ'@g' \ -e 's@SUB_PATHDEFS_SUB@'$PATHDEFS'@g' <$i> $OUTDIR/convert_${RUN}.m done # Change to output directory and run matlab on input script cd $OUTDIR
/usr/local/matlab2009a/bin/matlab -nodisplay < convert_${RUN}.m
# -- END USER SCRIPT -- #
# ********************************************************** # -- BEGIN POST-USER -- echo "----JOB [$JOB_NAME.$JOB_ID] STOP [`date`]----" OUTDIR=${OUTDIR:-$EXPERIMENT/Analysis/SPM8/$SUBJ} mv $HOME/$JOB_NAME.$JOB_ID.out $OUTDIR/$JOB_NAME.$JOB_ID.out RETURNCODE=${RETURNCODE:-0} exit $RETURNCODE fi # -- END POST USER--
THIS IS THE TEMPLATE SCRIPT %----------------------------------------------------------------------- % PREPROCESS.M % % A test script to do a simple SPM8 function from Einstein % %-----------------------------------------------------------------------
% Add necessary paths BIACroot = 'SUB_BIACROOT_SUB'; PathDefs = 'SUB_PATHDEFS_SUB';
startm=fullfile(BIACroot,'startup.m'); if exist(startm,'file') run(startm); else warning(sprintf(['Unable to locate central BIAC startup.m file\n (%s).\n' ... ' Connect to network or set BIACMATLABROOT environment variable.\n'],startm)); end clear startm BIACroot addpath('SUB_SCRIPTDIR_SUB');
%----------------------------------------------------------------------- % MATLAB SCIPT FOR RUNNING SPM WITHOUT GUI % Job configuration created by cfg_util (rev $Rev: 2787 $) %----------------------------------------------------------------------- %% % add variables that checks for number of dicom images, and number of % functionals, and runs below commands for correct data!
% Add necessary paths
if strcmp('SUB_ANATFOLDER_SUB', 'series002') matlabbatch{1}.spm.util.dicom.data = { 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00001.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00002.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00003.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00004.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00005.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00006.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00007.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00008.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00009.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00010.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00011.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00012.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00013.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00014.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00015.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00016.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00017.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00018.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00019.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00020.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00021.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00022.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00023.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00024.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00025.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00026.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00027.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00028.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00029.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00030.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00031.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00032.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00033.dcm' 'SUB_MOUNT_SUB/Data/Anat/SUB_SUBJECT_SUB/SUB_ANATFOLDER_SUB/SUB_DICOM_SUB_00034.dcm' }; end %% matlabbatch{1}.spm.util.dicom.root = 'flat'; matlabbatch{1}.spm.util.dicom.outdir = {'SUB_MOUNT_SUB/Analysis/SPM/SUB_SUBJECT_SUB/Preprocess/anat/'}; matlabbatch{1}.spm.util.dicom.convopts.format = 'img'; matlabbatch{1}.spm.util.dicom.convopts.icedims = 0; %% %% Make sure that we are in the subjects functional output directory foldertogoto=['SUB_FUNCOUTPUT_SUB']; cd(foldertogoto);
%% Now we select the correct functional conversion to do based on task name if strcmp('SUB_FUNCTYPE_SUB', 'faces') matlabbatch{2}.spm.util.cat.vols = { 'SUB_MOUNT_SUB/Data/Func/SUB_SUBJECT_SUB/SUB_FUNCFOLDER_SUB/V0001.img,1' 'SUB_MOUNT_SUB/Data/Func/SUB_SUBJECT_SUB/SUB_FUNCFOLDER_SUB/V0002.img,1' 'SUB_MOUNT_SUB/Data/Func/SUB_SUBJECT_SUB/SUB_FUNCFOLDER_SUB/V0003.img,1' 'SUB_MOUNT_SUB/Data/Func/SUB_SUBJECT_SUB/SUB_FUNCFOLDER_SUB/V0004.img,1' 'SUB_MOUNT_SUB/Data/Func/SUB_SUBJECT_SUB/SUB_FUNCFOLDER_SUB/V0005.img,1'
...this is the output file it looks like matlab starts up, but nothing else.
----JOB [spm_preprocess.sh.1355204] START [Tue Mar 2 07:50:00 EST 2010] on HOST [node8]----
< M A T L A B (R) > Copyright 1984-2009 The MathWorks, Inc. Version 7.8.0.347 (R2009a) 64-bit (glnxa64) February 12, 2009
To get started, type one of these: helpwin, helpdesk, or demo. For product information, visit www.mathworks.com. >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> {Warning: Function /usr/local/packages/MATLAB/BIAC/general/beep.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.} > In path at 110 In addpath at 87 In startup at 43 In run at 57 >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> ----JOB [spm_preprocess.sh.1355204] STOP [Tue Mar 2 07:50:02 EST 2010]----
and this is the subject script (created from template and bash)
%----------------------------------------------------------------------- % PREPROCESS.M % % A test script to do a simple SPM8 function from Einstein % %-----------------------------------------------------------------------
% Add necessary paths BIACroot = '/usr/local/packages/MATLAB/BIAC'; PathDefs = '/home/vvs4/matlab';
startm=fullfile(BIACroot,'startup.m'); if exist(startm,'file') run(startm); else warning(sprintf(['Unable to locate central BIAC startup.m file\n (%s).\n' ... ' Connect to network or set BIACMATLABROOT environment variable.\n'],startm)); end clear startm BIACroot addpath('/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Scripts/SPM');
%----------------------------------------------------------------------- % MATLAB SCIPT FOR RUNNING SPM WITHOUT GUI % Job configuration created by cfg_util (rev $Rev: 2787 $) %----------------------------------------------------------------------- %% % add variables that checks for number of dicom images, and number of % functionals, and runs below commands for correct data!
% Add necessary paths
if strcmp('series002', 'series002') matlabbatch{1}.spm.util.dicom.data = { '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00001.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00002.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00003.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00004.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00005.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00006.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00007.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00008.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00009.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00010.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00011.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00012.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00013.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00014.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00015.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00016.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00017.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00018.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00019.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00020.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00021.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00022.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00023.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00024.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00025.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00026.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00027.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00028.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00029.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00030.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00031.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00032.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00033.dcm' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Anat/TEST91/series002/bia5_20100225_10391_002_01__00034.dcm' }; end %% matlabbatch{1}.spm.util.dicom.root = 'flat'; matlabbatch{1}.spm.util.dicom.outdir = {'/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Analysis/SPM/TEST91/Preprocess/anat/'}; matlabbatch{1}.spm.util.dicom.convopts.format = 'img'; matlabbatch{1}.spm.util.dicom.convopts.icedims = 0; %% %% Make sure that we are in the subjects functional output directory foldertogoto=['/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Analysis/SPM/TEST91/faces']; cd(foldertogoto);
%% Now we select the correct functional conversion to do based on task name if strcmp('faces', 'faces') matlabbatch{2}.spm.util.cat.vols = { '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Func/TEST91/run004_03/V0001.img,1' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Func/TEST91/run004_03/V0002.img,1' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Func/TEST91/run004_03/V0003.img,1' '/mnt/users.q.shares/vvs4.U1TuOemiiswJNCQOTMvz/Data/Func/TEST91/run004_03/V0004.img,1'
..... (not copy pasting rest of image files to not take up space!)
}; end %%
|
-Vanessa |
Edited by - petty on Apr 22 2021 10:54:08 AM |
|
|
vvs4
Junior Member
 
USA
40 Posts |
Posted - Mar 02 2010 : 08:15:21 AM
|
| opa, just saw one mistake now, an extra "_" at the end of my dicom images, but that shouldn't be relevant to nothing running I don't think... |
-Vanessa |
 |
|
|
dvsmith
Advanced Member
    
USA
218 Posts |
Posted - Mar 02 2010 : 10:11:07 AM
|
| Sorry -- I don't see the error... If you're just looking to convert DICOM to NIFTI and make the output 4D, you could try dcm2nii (http://www.cabiatl.com/mricro/mricron/dcm2nii.html), which is on the cluster. I think there are also some BXH tools for this. |
 |
|
|
vvs4
Junior Member
 
USA
40 Posts |
Posted - Mar 02 2010 : 10:14:54 AM
|
No, I know how to do the conversion with MriCrons dcm2nii, and I can do it with the FSL tools too - the main challenge here is that our lab is making a parallel SPM8 processing pipeline - and right now there is no solution other than to run all analysis on a local machine (eww!) I'm trying to get it to work on the cluster, because it will be so much faster. So the actual conversion isn't the important part, it's getting the functionality of running spm8 batch jobs from the head node.
Best,
Vanessa |
-Vanessa |
 |
|
|
petty
BIAC Staff
    
USA
453 Posts |
Posted - Mar 02 2010 : 10:21:29 AM
|
I haven't done this, but just looking at the above, it would seem that if you are putting all the dicoms into an array, they need some sort of separator like the functional array.
Notice your functionals are separated by ",1" .. but your entire dicom array just runs together with no comma. |
 |
|
|
philip.kragel
Starting Member
USA
2 Posts |
Posted - Mar 02 2010 : 10:28:59 AM
|
| It looks like you are specifying a job but not running it. Try adding spm_jobman('run_nogui',matlabbatch) to the end of the subject script. |
Edited by - philip.kragel on Mar 02 2010 10:48:05 AM |
 |
|
|
vvs4
Junior Member
 
USA
40 Posts |
Posted - Mar 02 2010 : 1:10:39 PM
|
I think that we're on to something! But we perhaps need a little tweaking.
I added the spm_jobman line to the end of the subject script, and saw the following in my output file, after the Matlab initilization:
??? Undefined function or method 'spm_jobman' for input arguments of type 'cell'.
Is it the case that I need to run the jobman command right after setting up each matlabbatch? Should I not be using cells, or put each matlabbatch into its own cell? I noticed for the jobs that I'm setting up, I specific "matlabbatch{1}" and matlabbatch{2} - I'm guessing these are two iterations of matlabbatch? Do I need to so something along the lines of spm_jobman('spm_nogui',matlabbatch{1}) and spm_jobman('spm_nogui',matlabbatch{2})?
I think that we are close! I'm going to try playing in the GUI and seeing if it spits out anything useful in the matlab window.
Best,
Vanessa |
-Vanessa |
 |
|
|
philip.kragel
Starting Member
USA
2 Posts |
Posted - Mar 02 2010 : 1:25:26 PM
|
spm_jobman should be on your MATLAB path within the SPM8 directory. The error you posted would suggest a pathing problem.
There are multiple ways to specify jobs in spm_jobman. Pulling from the documentation in the script:
job - can be the name of a jobfile (as a .m, .mat or a .xml), a cellstr of filenames, a 'jobs'/'matlabbatch' variable or a cell of 'jobs'/'matlabbatch' variables loaded from a jobfile.
In your case you have cell of matlabbatch variables. You should be able to run both jobs indicated your matlabbatch cell array with one call.
|
 |
|
|
vvs4
Junior Member
 
USA
40 Posts |
Posted - Mar 03 2010 : 09:01:19 AM
|
Hi team!
We hit the nail on the head - it was a pathdef issue, and there was one error in an output path. As soon as I fiddled around with those two things, everything worked!
This is so exciting! Now I'm going to move on to the preprocessing. Thanks for everyone's help :O)
Best,
Vanessa |
-Vanessa |
 |
|
| |
Topic  |
|
|
|