Dear Iain,
I had a very brief look at suit_reslice_dartel.m and I can see that the
variable Data is used twice in the for-loop over subjects and not
initialised explicitly in its first use. Would adding `Data = [];` at
the beginning of the loop be of any help?
Best regards,
Guillaume.
On 03/04/2019 14:48, Iain Croall wrote:
> Hello all,
>
> Any help on this really appreciated.
>
> I'm using the SUIT toolbox to perform cerebellar segmentation. There's a handful of steps in this pipeline and I've completed half of them so far. The toolbox uses SPM's typical "batch" interface and so far I've done the processing so that each step is batch set-up to run through all my subjects in the one go (270 - it would take far too long to do one by one!).
>
> The step I'm currently at is called "reslicing into atlas space (DARTEL)". As the name suggests in the previous step I estimated a transformation from subject space > SUIT space for each participant, and have now affine matrix files as well as DARTEL flowfields.
>
> I'm encountering a bizarre error in this step, where the batch interface will successfully process any ONE subject of mine at a time, but if I set it up to do more than one then it throws up an error. In the following example I have set up the batch window to process 2 subjects. These subjects have been loaded in as separate "subject" fields by clicking on the "New Subject" option when highlighting the "Data" tab. Within each subject field I have specified 1. Affine transformation matrix; 2. DARTEL flowfield; 3. an image in subject space to write out in SUIT space; 4. a previously-processed binary mask of the cerebellum. I have confirmed beforehand that each of these are processed without error if entered alone. Doing both at once gets me this:
>
> -----------------------------------------------------------------------------------------------------------------------------------
> Running 'Reslice into SUIT space using Dartel flowfield'
>
> SPM12: suit_reslice_dartel (v3.0) 14:28:38 - 03/04/2019
> ========================================================================
> u_a_c_C001_1382472_T1_Oriented_N4_seg1: atemp_c1C001_1382472_T1_Oriented_N4 1,1,1
> Failed 'Reslice into SUIT space using Dartel flowfield'
> Subscripted assignment dimension mismatch.
> In file "C:\Users\UOS\Documents\MATLAB\SPM12\toolbox\suit\suit_reslice_dartel.m" (???), function "suit_reslice_dartel" at line 115.
>
> The following modules did not run:
> Failed: Reslice into SUIT space using Dartel flowfield
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Line 115 in the referenced function refers to a for loop that is written as such. I have some familiarity with MATLAB, but I'm afraid I'm a little too novice with the coding half of SPM to confidently interrogate this. (line 115 is the one immediately before END).
>
> -----------------------------------------------------------------------------------------------------------------------------------
> %---------------------------------------------------
> % Resample all images into affine space first
> N=length(S.resample);
> for i=1:N
> [image_dir,image_name,image_ext,image_num]=spm_fileparts(S.resample{i});
> V(i)=spm_vol(S.resample{i});
> [Xm,Ym,Zm]=spmj_affine_transform(X,Y,Z,inv(Affine*V(i).mat)*Vff.mat);
> for z=1:num_slice
> Data(:,:,z)=spm_sample_vol(V(i),Xm(:,:,z),Ym(:,:,z),Zm(:,:,z),job.interp);
> end;
> -----------------------------------------------------------------------------------------------------------------------------------
>
>
> Incidentally, despite the error implying it failed on the first subject it actually completes the first reslicing step and writes out the result file into subject #1's directory. It doesn't do anything with subject #2. Needless to say the problem extends to if I try and manipulate a jobfile to include the full list of subjects, and load that jobfile into the batch window.
>
> Any help would be really appreciated, thanks,
> Iain
>
--
Guillaume Flandin, PhD
Wellcome Centre for Human Neuroimaging
UCL Queen Square Institute of Neurology
London WC1N 3BG
|