"Index in position 1 exceeds array bounds" error in batch_fitting.

483 views
Skip to first unread message

Iain Croall

unread,
May 14, 2020, 9:50:33 AM5/14/20
to NODDI
Hello everybody.

I'm trying to get NODDI set up, and am running through the tutorial on this page to process the example dataset it comes with - http://mig.cs.ucl.ac.uk/index.php?n=Tutorial.NODDImatlab

Things generally seem to be working, but while I can get batch_fitting_single to run, batch_fitting encounters an error which reads "Error using batch_fitting (line 89) Index in position 1 exceeds array bounds."

It is worth mentioning that this is after I have modified the batch_fitting script according to advice given in this other thread on this forum - https://groups.google.com/forum/#!topic/noddi/OVjAy4OL_DM . Like Blake in that thread I was initially getting that error around the "roi" term in the same script, and modified it so that I now include " roi=[]; " on a line immediately before the line reading " voxel = roi(i,:)'; ". Doing this appeared to fix that initial error, and now I get this new one instead. I do not know if this modification has anything to do with the issue I am posting about. For completeness sake, I'm including below the entirety of this modified / problematic section as it currently is. The line tagged as causing the current "array bounds" error is in bold, and my inserted "roi" line shortly follows:

% start the parallel fitting
for split_start=current_split_start:progressStepSize:numOfVoxels
    % set up the split end
    split_end = split_start + progressStepSize - 1;
    if split_end > numOfVoxels
        split_end = numOfVoxels;
    end
    
    % fit the split
    parfor i=split_start:split_end
        
        % get the MR signals for the voxel i
        roi=[];
        voxel = roi(i,:)';
        
        % fit the voxel
        if model.noOfStages == 2
            [gsps(i,:), fobj_gs(i), mlps(i,:), fobj_ml(i), error_code(i)] = ThreeStageFittingVoxel(voxel, protocol, model);
        else
            [gsps(i,:), fobj_gs(i), mlps(i,:), fobj_ml(i), error_code(i), mcmcps(i,:,:)] = ThreeStageFittingVoxel(voxel, protocol, model);
        end
        
        % report to the progress monitor
        if mod(i, progressStepSize)==0
            ppm.increment();
        end
        
    end
    
    % save the temporary results of the split
    if model.noOfStages == 2
        save(outputfile, 'split_end', 'model', 'gsps', 'fobj_gs', 'mlps', 'fobj_ml', 'error_code');
    else
        save(outputfile, 'split_end', 'model', 'gsps', 'fobj_gs', 'mlps', 'fobj_ml', 'mcmcps', 'error_code');
    end
    
end

Thank you very much in advance for any help,
Iain

Hui Zhang

unread,
May 14, 2020, 11:27:14 AM5/14/20
to no...@googlegroups.com
Hi Iain,

What version of Matlab are you using at the moment?

Gary

--
You received this message because you are subscribed to the Google Groups "NODDI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to noddi+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noddi/735f2726-9820-4f9a-b295-4a722cbaf934%40googlegroups.com.

Iain Croall

unread,
May 14, 2020, 12:00:48 PM5/14/20
to NODDI
Hi Gary.

I am running 2020a.

Iain
To unsubscribe from this group and stop receiving emails from it, send an email to no...@googlegroups.com.

Hui Zhang

unread,
May 14, 2020, 4:52:32 PM5/14/20
to no...@googlegroups.com
Thanks for confirming Iain.  That is what I thought.  I have been working on a fix for this issue and have just released a new version that I hope will work for you.  Please give it a try.

Gary

To unsubscribe from this group and stop receiving emails from it, send an email to noddi+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noddi/a8f685ea-7499-4e8e-a38b-17a3a82825ed%40googlegroups.com.

Iain Croall

unread,
May 16, 2020, 6:49:58 AM5/16/20
to NODDI
Dear Gary,

Don't think I've ever posted a help thread that resulted in a software update on the same day - talk about customer service!

I've just grabbed the update but unfortunately am still experiencing an error when running the batch_fitting script (but a different one now). I'm new to parallel processing in Matlab so kind of hesitant to just tinker around with the script myself in case I apparently make it run but also manage to somehow invalidate the modelling process. I'm copying the text below. If it's relevant I'm still running this on the example data, am using a 6 core processor, and I am initialising the batch_fitting command with: batch_fitting('NODDI_roi.mat', protocol, noddi, 'TestParams.mat', 6);

Error message:

Warning: The following error was caught while executing 'ParforProgMon' class
destructor:
Dot indexing is not supported for variables of this type.

Error in ParforProgMon/delete (line 65)
            o.JavaBit.done();

Error in ParforProgMon (line 31)
            if nargin == 1 && iscell( s )

Error in batch_fitting (line 80)
ppm = ParforProgMon(['Fitting ' roifile, ' : '], numOfVoxels-current_split_start+1,... 
> In ParforProgMon (line 31)
  In batch_fitting (line 80) 
Unable to resolve the name ParforProgressMonitor.createServer.

Error in ParforProgMon (line 37)
                o.JavaBit   = ParforProgressMonitor.createServer( s, N,
                progressStepSize, width, height );

Error in batch_fitting (line 80)
ppm = ParforProgMon(['Fitting ' roifile, ' : '], numOfVoxels-current_split_start+1,...
 
 Thanks very much again in advance of any help,

Iain

Hui Zhang

unread,
May 16, 2020, 12:10:06 PM5/16/20
to no...@googlegroups.com
Thanks Iain for trying the update.  I had to replace the Parfor Progress Monitor version 2 with version 3 but that change did not make it into the updated release.  I have now re-issued the version.  Let me know if it works for you now.

Gary

To unsubscribe from this group and stop receiving emails from it, send an email to noddi+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noddi/61b0ee3a-7b11-48bc-8dc7-9df4f5647af0%40googlegroups.com.

Iain Croall

unread,
May 16, 2020, 12:49:32 PM5/16/20
to NODDI
I've just set up the new one and it works great, thank you very much for all the quick responses.

Just FYI the fitting completed successfully but the final line (delete pool) did not complete, as "pool" was not recognised. I'm guessing this is meant to shut down the parallel processing mode. I've modified it to:

poolobj=gcp('nocreate');
delete(poolobj);

Which completes it without an error.

Thanks again and all the best,
Iain

Hui Zhang

unread,
May 16, 2020, 12:56:35 PM5/16/20
to no...@googlegroups.com
Great.  Thanks for confirming.

Gary

To unsubscribe from this group and stop receiving emails from it, send an email to noddi+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noddi/f5e6451d-2fcb-47d4-acd5-b2e84ade8f20%40googlegroups.com.

Hui Zhang

unread,
May 16, 2020, 2:25:34 PM5/16/20
to no...@googlegroups.com
Hi Iain,

About the error you found, I think a simpler fix will be replacing the line 136

delete pool;

with

delete(pool);

This should do exactly the same thing as your changes.

Gary

Iain Croall

unread,
May 21, 2020, 5:06:36 AM5/21/20
to no...@googlegroups.com
Hi again Gary,

Thanks for the tip. I've managed to successfully execute the toolbox on a full dataset of my own last night so everything seems to be running smoothly now.

I was wondering out of interest if there's any plans to add GPU support to this toolbox in the near future? Or as Matlab seems to have a lot of built-in GPU support, if diverting the processing to run on one is something that would be realistic for me to look into? e.g. There seem to be a lot of functions that can be executed on a GPU instead of the processor if run using the "gpuArray" function, although I'm guessing that the nuts and bolts of the NODDI toolbox are more exotic than this and it would probably be considerably more complicated?

Iain

Hui Zhang

unread,
May 21, 2020, 10:53:25 AM5/21/20
to no...@googlegroups.com
Hi Iain,

Actually, if you don't have access to a large CPU computing cluster, I recommend that you use AMICO with NODDI.


Gary

Reply all
Reply to author
Forward
0 new messages