benniatli / BrainAgePredictionResNet

3D residual neural network that predicts age based on brain MRI images (implemented using TensorFlow 2).
57 stars 17 forks source link

Cat12 and Jacobian Map #1

Closed RDoerfel closed 2 years ago

RDoerfel commented 2 years ago

Good Day!

I am currently trying to get your software running on our setup, and I am running into some issues with the preprocessing. I'm running:

cat_batch_cat('files.txt','Code/CAT12_brain_age_parameters.m')

with files.txt be the file containing the path to all the raw T1s, and Code/CAT12_brain_age_parameters.m be the settings file that is provided. Everything goes well, except that one output file is missing, namely the Jacobian Determinant starting with wj.

Did you use cat_batch_cat.m as well, or something else? And have you any idea on what might be the issue here?

Thanks in advance, Ruben.

benniatli commented 2 years ago

No, we wrote a batch script specifically for our setup to run the preprocessing. I haven't used cat_batch_cat(), so I can't comment on any possible issues/pitfalls. But it sounds to me like it should work.

While looking into the issue, I noticed that l accidentally left a quotation mark in the last line of CAT12_brain_age_parameters.m. It's been removed in the newest version. Did you remove the quotation mark before running cat_batch_cat()? And if not, can you check if it resolves the issue?

RDoerfel commented 2 years ago

Yes, I removed the quotation mark, but unfortunately, it did not help.

Here is part of what I tried as well. All paths were changed to point to the correct position, so that is not part of the issue.

% define settings
matlabbatch{1}.spm.tools.cat.estwrite.data = {'inputFileHere,1'};
matlabbatch{1}.spm.tools.cat.estwrite.nproc = 0;
matlabbatch{1}.spm.tools.cat.estwrite.opts.tpm = {'/spm12/tpm/TPM.nii'};
matlabbatch{1}.spm.tools.cat.estwrite.opts.affreg = 'mni';
...

% start pre-processing
spm('defaults', 'FMRI');
spm_jobman('initcfg');
spm_jobman('run', matlabbatch);

When I try via GUI with one of the standard settings for CAT Segmentation, it actually spills out the Jacobian Map as well. But when I load your settings, it crashes at some point. Not that important for now, especially since I am more interested in a scripted solution.

However, how did you put your defined settings into spm/cat? You used a script as well, so somehow you must have passed matlabbatch to spm and cat.

benniatli commented 2 years ago

Each image was processed using spm12 in standalone mode:

sh /spm12_standalone_des16/run_spm12.sh /MATLAB_Runtime_2016a/v901 batch CAT12_brain_age_parameters.m

I tested this command on a single image from IXI, using the released parameters (with some minor changes to the file paths):

%-----------------------------------------------------------------------
% Job saved on 30-Jan-2018 16:10:39 by cfg_util (rev \$Rev: 6460 \$)
% spm SPM - SPM12 (6906)
%-----------------------------------------------------------------------
matlabbatch{1}.spm.tools.cat.estwrite.data = {'/IXI-Dataset/tmp/T1.nii,1'};
matlabbatch{1}.spm.tools.cat.estwrite.nproc = 0;
matlabbatch{1}.spm.tools.cat.estwrite.opts.tpm = {'/spm12_standalone_des16/spm12_mcr/home/mou/spm12_beta/spm12/tpm/TPM.nii'};
matlabbatch{1}.spm.tools.cat.estwrite.opts.affreg = 'mni';
matlabbatch{1}.spm.tools.cat.estwrite.extopts.APP = 1;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.LASstr = 0.5;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.gcutstr = 0.5;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.cleanupstr = 0.5;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.darteltpm = {'/spm12_beta/spm12/toolbox/cat12/templates_1.50mm/Template_1_IXI555_MNI152.nii'};

matlabbatch{1}.spm.tools.cat.estwrite.extopts.vox = 1.5;
matlabbatch{1}.spm.tools.cat.estwrite.output.ROI = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.surface = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.GM.native = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.GM.mod = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.GM.dartel = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.WM.native = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.WM.mod = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.WM.dartel = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.bias.warped = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.jacobian.warped = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.warps = [0 0];

Running the command produces four NIfTI files, including /IXI-Dataset/tmp/mri/wj_T1.nii.

I can confirm that the parameters are sufficient when using the CAT12 version used for the original analysis (Version 1092 (CAT12) 2016-11-30). I was notified by users having problems with the newest release of CAT12 (Template_1_IXI555_MNI152.nii seems to be no longer included), that Version 12.4 also works. However, I haven't confirmed it myself.

benniatli commented 2 years ago

I'm closing the issue because it is inactive and it relates to CAT12, but not specifically to the BrainAgePredictionResNet.