JoramSoch / MACS

MACS – a new SPM toolbox for model assessment, comparison and selection
GNU General Public License v3.0
23 stars 6 forks source link

Cannot run MACS: Error using spm_slice_vol #5

Closed carolfs closed 4 years ago

carolfs commented 4 years ago

I'm new to this toolbox and cannot get it to work. The error I get is the following:

Running 'MA: inspect goodness of fit'
Failed  'MA: inspect goodness of fit'
Error using spm_slice_vol
Cant open image file.
In file "/Users/cfeher/Applications/spm12/spm_read_vols.m" (v6918), function "spm_read_vols" at line 34.
In file "/Users/cfeher/Applications/spm12/toolbox/MACS/MA_load_mask.m" (???), function "MA_load_mask" at line 38.
In file "/Users/cfeher/Applications/spm12/toolbox/MACS/MA_inspect_GoF.m" (???), function "MA_inspect_GoF" at line 234.
In file "/Users/cfeher/Applications/spm12/toolbox/MACS/MA_inspect_GoF.m" (???), function "MA_inspect_GoF" at line 154.
In file "/Users/cfeher/Applications/spm12/toolbox/MACS/batch_MA_inspect_GoF.m" (???), function "run_module" at line 66.

The following modules did not run:
Failed: MA: inspect goodness of fit

Am I doing anything wrong?

carolfs commented 4 years ago

I found the problem. The mask file created by SPM mask.nii was being automatically deleted.

munoztd0 commented 4 years ago

Hello, could I know how did you fixed it ?

JoramSoch commented 4 years ago

@munoztd0: Did you get the exact same error message as the one above? If yes, as indicated by @carolfs comment, the mask.nii in the GLM folder might be missing (and preventing your pipeline from deleting it should help). If no, could you post your entire error message, so that I know coming from where spm_slice_vol threw an error?

munoztd0 commented 4 years ago

@JoramSoch Thanks for you quick response. I found what was the bug but it wasn't because of the mask so I'm all good now! (for posteriority the spm.mat files where done on a server and it took the absolute path on the server instead of my computer's and since spm_slice_vol is the first command that run by your script it raises an error on the unfound masks)

JoramSoch commented 4 years ago

@munoztd0: OK, cool! Thanks for letting me know. You might consider using spm_changepath: https://en.wikibooks.org/wiki/SPM/How-to#How_to_change_file_paths_in_a_batch_file_or_SPM.mat? https://github.com/spm/spm12/blob/master/spm_changepath.m

FioritoAnna commented 4 months ago

Hi, I also have a problem during goodness of fit, but with a different error message, any suggestion? Thanks a lot!


SPM12: spm_spm (v7738)                             11:58:02 - 28/05/2024
========================================================================
Chunk   1/1                             :                        ...done
Spatial non-sphericity (over scans)     :                        ...done
Saving SPM.mat                          :                        ...done
Completed                               :          11:58:07 - 28/05/2024
Done
28-May-2024 11:58:07 - Done    'Model estimation'
28-May-2024 11:58:07 - Running 'MA: inspect goodness of fit'
28-May-2024 11:58:09 - Failed  'MA: inspect goodness of fit'
Index exceeds the number of array elements (0).
In file "/crnldata/psyr2/Anna/SchizEmo_Project/fMRI_analysis/Schizemo_BIDSpm/code/lib/bidspm/lib/MACS/MA_inspect_GoF.m" (???), function "MA_inspect_GoF" at line 283.
In file "/crnldata/psyr2/Anna/SchizEmo_Project/fMRI_analysis/Schizemo_BIDSpm/code/lib/bidspm/lib/MACS/MA_inspect_GoF.m" (???), function "MA_inspect_GoF" at line 155.
In file "/crnldata/psyr2/Anna/SchizEmo_Project/fMRI_analysis/Schizemo_BIDSpm/code/lib/spm12/toolbox/MACS/batch_MA_inspect_GoF.m" (???), function "run_module" at line 66.
JoramSoch commented 3 months ago

Dear @FioritoAnna, apologies for the late reply! I cannot fully work out what went wrong here. Line 155 of MA_inspect_GoF calls the function for loading the dataset of the GLM. Line 283 of MA_inspect_GoF is a comment (% Calculate GoF as overlay). Possibly, you have edited the script MA_inspect_GoF.m? Could you tell me which line of code threw the error and what the exact error message from MATLAB was? I suspect it could have been line 285?

FioritoAnna commented 3 months ago

Hi @JoramSoch, thank you for your response! I've managed to resolve the issue, and upon reflection, I realized that the problem was not related to the MACS toolbox. Instead, it stemmed from an error in constructing my design matrix. Specifically, due to a typo in my json model I had failed to include all the experimental conditions convolved with the hemodynamic response function. For posterity: I lately also run into the Error using spm_slice_vol Cant open image file and could solved it with spm_changepath!