Bug in canlab_glm_publish

22 views
Skip to first unread message

Jessica Mollick

unread,
Jan 25, 2017, 2:12:46 PM1/25/17
to wagerl...@googlegroups.com
Hi Canlab tools list

I am running into an error using canlab_glm_publish('g') in a robust results directory, and have run into an error with part of canlab_glm_publish where it prints the contrast images and was wondering if anyone would have any ideas on what's going wrong. I am running the code "canlab_glm_publish('g',pwd)" after cding to a directory where I have just run robust regression. The part where it prints out the histograms of each subject and the mask is working fine, but the printing of the contrast images with mediation_brain_results is where it's running into trouble. 

Let me know if you have any ideas on how to fix this. Another wrinkle is that I'm using the version of canlab tools on the blanca university server - if this has been fixed in a more recent version I'm happy to check the most recent version out and try again.

Here is the error I'm getting. Also, I never ran into this error previously using the canlab_glm_publish script.
Error in iimg_mask (line 59)
dat(~maskindx) = 0;

Error in iimg_threshold (line 169)
        dat = iimg_mask(mask,dat,volInfo);

Error in iimg_multi_threshold (line 278)
    [dat, volInfo] = iimg_threshold(inname, 'thr', current_thresh, 'k', szthresh(1), 'imgtype', imgtype, 'threshtype', threshtype, 'mask', mask);

Error in mediation_brain_results/doorthviews (line 638)
        [clpos,tmp, clpos_extent] = iimg_multi_threshold(this_p_img, ...

Error in mediation_brain_results (line 278)
        doorthviews();

Error in robust_results_batch (line 215)
    [clpos, clneg, clpos_data, clneg_data, clpp2, clnn2] = mediation_brain_results ...

Error in robfit_results (line 21)
robust_results_batch('thresh', thresh, 'size', size, 'prune', 'mask', 'robust0003/rob_tmap_0001.img
Error in evalmxdom>instrumentAndRun (line 89)
text = evalc(evalstr);
Error in evalmxdom (line 20)
[data,text,laste] = instrumentAndRun(file,cellBoundaries,imageDir,imagePrefix,options);

Error in publish (line 164)
    dom = evalmxdom(file,dom,cellBoundaries,prefix,imageDir,outputDir,options);

Error in canlab_glm_publish_group_levels (line 59)
fout = publish(scriptfile, p);

Error in canlab_glm_publish>robfit_report (line 162)
    canlab_glm_publish_group_levels

Error in canlab_glm_publish (line 81)
                robfit_report(STARTINGDIR,robfitdirs,thresh,size); 

Thanks,

Jessica Mollick

Tor Wager

unread,
Jan 26, 2017, 6:45:08 AM1/26/17
to Jessica Mollick, wagerl...@googlegroups.com
Hi Jess, sorry, it’s hard to tell - perhaps you could include the actual error message from iimg_mask (line 59). I would use dbstop if error and dbup/dbdown/dbstack and check whether your images files are non-empty and the sizes.

Tor

--
You received this message because you are subscribed to the Google Groups "WagerlabTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wagerlabtool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luka

unread,
Jan 26, 2017, 12:40:45 PM1/26/17
to Tor Wager, Jessica Mollick, wagerl...@googlegroups.com
Hi Jess,

Debugging your original canlab_glm_publish will probably be annoying since it's passing variables around workspaces, writing a script and executing it with publish.m, that script uses try/catch statements, etc.

canlab_glm_publish should have produced the script that gets published, robfit_results.m, and you could run the robust_results_batch commands there directly, including the appropriate (i.e., preceding) cd command. Those commands do assume that the variables thresh and size exist in the current workspace, though, so either set them as desired or remove those arguments from the function call to have robust_results_reg use its defaults (same as canlab_glm_publish's defaults when the latter was written).

All in all it'd look something like this:
>> thresh = [.001 .005 .05];
>> size = [5 1 1];
>> cd robust0003
>> dbstop if error
>> robust_results_batch('thresh', thresh, 'size', size, 'prune', 'mask', 'robust0003/rob_tmap_0001.img');

-- Luka



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

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "WagerlabTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wagerlabtools+unsubscribe@googlegroups.com.

Jessica Mollick

unread,
Jan 26, 2017, 3:44:57 PM1/26/17
to Luka, Tor Wager, wagerl...@googlegroups.com
Thanks, I have been running the script below to test this out:

dbstop if error

cd(my robust dir)

thresh = [.001 .005 .05];

size = [5 1 1];

robust_results_batch('thresh', thresh, 'size', size, 'prune', 'mask', 'rob_tmap_0001.img');


I believe I fixed it by editing the script locally on my laptop on the most up-to-date version of CanlabCore (using Matlab R2016b). Locally, I get an error saying "std::exception" around line 64 of iimg_mask. 

 The line causing the error seemed to be line 64 of iimg_mask:

dat(~maskindx) = 0;

However, maskindx is a float matrix , not an int8 matrix which I believe is usually used for indexing. I converted it to an int8 matrix and it works ok. 

My change to line 64 which fixes this and allows the script to finish running is: dat(~int8(maskindx)) = 0;

The errors on the server seem to be resulting from the same line of robust_results_batch, but it seems to be an older version. To fix it there, I will probably just check out the latest version of the repo and make the same change that fixed it on my laptop.

This is the full traceback of the error on the server:

>> NaN's cannot be converted to logicals.


Error in iimg_mask (line 59)
dat(~maskindx) = 0;

Error in iimg_threshold (line 169)
        dat = iimg_mask(mask,dat,volInfo);

Error in iimg_multi_threshold (line 278)
    [dat, volInfo] = iimg_threshold(inname, 'thr', current_thresh, 'k',
    szthresh(1), 'imgtype', imgtype, 'threshtype', threshtype, 'mask',
    mask);

Error in mediation_brain_results/doorthviews (line 638)
        [clpos,tmp, clpos_extent] = iimg_multi_threshold(this_p_img, ...

Error in mediation_brain_results (line 278)
        doorthviews();

Error in robust_results_batch (line 215)
    [clpos, clneg, clpos_data, clneg_data, clpp2, clnn2] =
    mediation_brain_results ...
Reply all
Reply to author
Forward
0 new messages