JoramSoch / MACS

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

error when performing cvBMS #10

Closed lukasvo76 closed 2 years ago

lukasvo76 commented 2 years ago

Hi Joram,

Thanks for the great toolbox!

I am running cvBMS as specified in chapter 11 of the manual on 30 subjects, with 20 models per subject, on data which are version controlled using DataLad (i.e. git and git-annex for large files).

Contrary to a test run on fewer subjects and fewer models, I get the following error when running the batch.

Please note I have concatenated runs to take care of the unequal amount of regressors per run, but this was also the case in my test run, so unlikely to cause the problem?

Maybe this could be caused by @bogpetre's issue #9 - see my comment there, but I do not have any other indications of the SPM.mat file being corrupt (I can open it in spm to review the design etc)?

We could easily test this though as his solution is very easy to implement.

Do you have any idea of what may be the problem and how to solve it?

Thanks a lot in advance.

Best wishes,

Lukas


28-Jun-2022 18:06:54 - Running job #1

28-Jun-2022 18:06:54 - Running 'MA: define model space' 28-Jun-2022 18:06:54 - Done 'MA: define model space' 28-Jun-2022 18:06:54 - Running 'MA: calculate cvLME (automatic)'

-> Subject 1 (1 out of 30):

28-Jun-2022 18:06:55 - Running 'MS: perform BMS (automatic)' 28-Jun-2022 18:06:55 - Failed 'MS: perform BMS (automatic)' Unrecognized field name "MACS". In file "/opt/KUL_apps/spm12/toolbox/MACS/batch_MS_BMS_group_auto.m" (???), function "run_module" at line 100.

No executable modules, but still unresolved dependencies or incomplete module inputs. The following modules did not run: Failed: MA: calculate cvLME (automatic) Failed: MS: perform BMS (automatic) Skipped: MS: generate SMM from BMS

JoramSoch commented 2 years ago

Dear Lukas,

thanks for using the toolbox and for your error report!

This

Failed 'MS: perform BMS (automatic)' Unrecognized field name "MACS".

indicates that there's no field "SPM.MACS" in the SPM.mat file which is usually created during first-level model assessment, e.g. "SPM.MACS.cvLME" would contain the header of the cross-validated log model evidence (cvLME) image for this particular model. This is why line 100 of "batch_MS_BMS_group_auto.m" fails: eval(strcat('H = SPM.MACS.',job.LME_map,';'));

This

Subject 1 (1 out of 30): Model model_10_long_12hmp_can_deriv_noar1 (1 out of 20): Failed 'MA: calculate cvLME (automatic)' Error using spm_slice_vol Cant open image file.

indicates that first-level model assessment does not succeed, i.e. calculation of the cvLME for the first model for the first subject fails. The error message shows that this failure occurs in line 142 of "MA_cvLME_single.m" and line 38 of "MA_load_mask.m", respetively: [M m_dim m_ind] = MA_load_mask(SPM); m_img = spm_read_vols(SPM.VM);

This would mean that something is wrong with the mask image from that subject and model. I would assume that this response is not very satisfying for you, as you said that everything worked in a test run with fewer subjects and fewer models, but based on the error message, I can't say much more and would first check the mask file. (Have all models been estimated?)

Cheers Joram

lukasvo76 commented 2 years ago

Dear Joram,

I identified the problem and solved it.

It did not have anything to do with the toolbox code, but with SPM.swd being misspecified in some of my models.

Sorry for having bothered you with this.

It is hence also unrelated to @bogpetre's issue #9, which could and should however be fixed easily I guess.

Cheers and thanks again for this very helpful toolkit!

Lukas

JoramSoch commented 2 years ago

Dear @lukasvo76,

thanks for letting me know.

For adapting the filepaths in SPM.mat files, I suggest to use spm_changepath, see here.

Cheers, Joram.