Open VisionShilin opened 4 years ago
Thanks for this. Could you provide the nib-ls
outputs for all of your input images?
The real fix will probably be in nilearn, but understanding how we got to this point would be helpful.
I don't know what "the nib-ls outputs" means.
I used this command.
docker run --rm -it -v C:\Users\shili\Desktop\t\fitlins_data\raw:/bids:ro -v C:\Users\shili\Desktop\t\fitlins_data\prep\fmriprep:/prep:ro -v C:\Users\shili\Desktop\t\fitlins_data\analyzed:/out poldracklab/fitlins /bids /out dataset -d /prep -m /bids/models/model-ChineseArrangment_smdl.json --drop-missing
If you have nibabel
installed, the nib-ls
command should be available. Then you can run nib-ls C:\prep\fmriprep\*\func\*_bold.nii.gz
.
Here is one of subject's image data.
C:\Users\shili\Desktop\t\fitlins_data>nib-ls C:\Users\shili\Desktop\t\fitlins_data\prep\fmriprep\sub-LXY\func\sub-LXY_task-ViewChineseArrangment_space-MNI152NLin2009cAsym_boldref.nii.gz C:\Users\shili\Desktop\t\fitlins_data\prep\fmriprep\sub-LXY\func\sub-LXY_task-ViewChineseArrangment_space-MNI152NLin2009cAsym_boldref.nii.gz float32 [ 57, 68, 43] 3.44x3.44x4.60
Is this error caused by someone's image data if the out is (57, 68, 43, 1)?
I don't really know. Just trying to get a sense of what the inputs are. Can you run nib-ls
on the bold.nii.gz
files, rather than boldref
?
Also, what version of FitLins are you using?
C:\Users\shili\Desktop\t\fitlins_data>nib-ls C:\Users\shili\Desktop\t\fitlins_data\prep\fmriprep\sub-LY\func\sub-LY_task-ViewChineseArrangment_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz C:\Users\shili\Desktop\t\fitlins_data\prep\fmriprep\sub-LY\func\sub-LY_task-ViewChineseArrangment_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz float32 [ 57, 68, 43, 240] 3.44x3.44x4.60x2.00
I run latest version of FitLins using docker image.
And what's your model?
{
"Name": "Chinese_Arrangment",
"Description": "Visual Aesthetic View of Vertical and Horizental Chinese Arrangement",
"Input": {
"task": "ViewChineseArrangment"
},
"Steps": [
{
"Level": "run",
"Transformations": [
{
"Name": "Factor",
"Input": [
"trial_type"
]
},
{
"Name": "Convolve",
"Input": ["trial_type.N", "trial_type.R","trial_type.V","trial_type.H"],
"Model": "spm"
}
],
"Model": {
"X": [
"trial_type.N",
"trial_type.R",
"trial_type.V",
"trial_type.H"
]
},
"Contrasts": [
{
"Name": "R_vs_N",
"ConditionList": [
"trial_type.R",
"trial_type.N"
],
"Weights": [1, -1],
"Type": "t"
},
{
"Name": "H_vs_V",
"ConditionList": [
"trial_type.H",
"trial_type.V"
],
"Weights": [1, -1],
"Type": "t"
},
{
"Name": "HV_vs_R",
"ConditionList": [
"trial_type.H",
"trial_type.V",
"trial_type.R"
],
"Weights": [0.5, 0.5, -1],
"Type": "t"
},
{
"Name": "HV_vs_N",
"ConditionList": [
"trial_type.H",
"trial_type.V",
"trial_type.N"
],
"Weights": [0.5, 0.5, -1],
"Type": "t"
},
{
"Name": "H_vs_R",
"ConditionList": [
"trial_type.H",
"trial_type.R"
],
"Weights": [1, -1],
"Type": "t"
},
{
"Name": "V_vs_R",
"ConditionList": [
"trial_type.V",
"trial_type.R"
],
"Weights": [1, -1],
"Type": "t"
}
]
},
{
"Level": "dataset",
"DummyContrasts": {
"Conditions": ["R_gt_N", "H_vs_V", "HV_vs_R", "HV_vs_N", "H_vs_R", "V_vs_R"],
"Type": "t"
}
}
]
}
By the way, I can get the report even the command reported errors. Can I trust the report?
I suggest the FitLins reports errors in the report html file like the fMRIPrep did.
The report should show valid results for the first level.
Here is the content of file crash-20200926-031309-neuro-l2_model-71564ebe-b94c-4057-912b-1614d9710c3f.txt Hope it will be helpful for debugging.
Node: fitlins_wf.l2_model Working directory: /work/fitlins_wf/l2_model
Node inputs:
contrast_info = [[{'name': 'H_vs_V', 'weights': [{'H_vs_V': 1}], 'type': 't', 'entities': {'task': 'ViewChineseArrangment', 'space': 'MNI152NLin2009cAsym'}}, {'name': 'HV_vs_R', 'weights': [{'HV_vs_R': 1}], 'type': 't', 'entities': {'task': 'ViewChineseArrangment', 'space': 'MNI152NLin2009cAsym'}}, {'name': 'HV_vs_N', 'weights': [{'HV_vs_N': 1}], 'type': 't', 'entities': {'task': 'ViewChineseArrangment', 'space': 'MNI152NLin2009cAsym'}}, {'name': 'H_vs_R', 'weights': [{'H_vs_R': 1}], 'type': 't', 'entities': {'task': 'ViewChineseArrangment', 'space': 'MNI152NLin2009cAsym'}}, {'name': 'V_vs_R', 'weights': [{'V_vs_R': 1}], 'type': 't', 'entities': {'task': 'ViewChineseArrangment', 'space': 'MNI152NLin2009cAsym'}}]]
effect_maps =
Traceback (most recent call last): File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context, TypeError: init() got an unexpected keyword argument 'initializer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run result = self._run_interface(execute=True) File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1386, in _run_interface self.config["execution"]["stop_on_first_crash"] File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1295, in _collate_results "Subnodes of node: %s failed:\n%s" % (self.name, "\n".join(msg)) Exception: Subnodes of node: l2_model failed: Subnode 0 failed Error: Traceback (most recent call last):
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context,
TypeError: init() got an unexpected keyword argument 'initializer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 94, in nodelist_runner result = node.run(updatehash=updatehash)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run result = self._run_interface(execute=True)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface return self._run_command(execute)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command result = self._interface.run(cwd=outdir)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 397, in run runtime = self._run_interface(runtime)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/fitlins/interfaces/nistats.py", line 370, in _run_interface output_type='all'
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nistats/second_level_model.py", line 483, in computecontrast Y = self.masker.transform(effect_maps)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/input_data/base_masker.py", line 177, in transform return self.transform_single_imgs(imgs, confounds)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/input_data/nifti_masker.py", line 405, in transform_single_imgs dtype=self.dtype
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/joblib/memory.py", line 352, in call return self.func(*args, **kwargs)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/input_data/nifti_masker.py", line 41, in filter_and_mask imgs = _utils.check_niimg(imgs, atleast_4d=True, ensure_ndim=4)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/_utils/niimg_conversions.py", line 260, in check_niimg return concat_niimgs(niimg, ensure_ndim=ensure_ndim, dtype=dtype)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/_utils/niimg_conversions.py", line 459, in concat_niimgs memory=memory, memory_level=memory_level))):
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/_utils/niimg_conversions.py", line 150, in _iter_check_niimg niimg.shape))
ValueError: Field of view of image #6 is different from reference FOV. Reference affine: array([[ 3.43700004, 0. , 0. , -96.5 ], [ 0. , 3.43799996, 0. , -132.5 ], [ 0. , 0. , 4.5999999 , -78.5 ], [ 0. , 0. , 0. , 1. ]]) Image affine: array([[ 3.43799996, 0. , 0. , -96.5 ], [ 0. , 3.43799996, 0. , -132.5 ], [ 0. , 0. , 4.5999999 , -78.5 ], [ 0. , 0. , 0. , 1. ]]) Reference shape: (57, 68, 43) Image shape: (57, 68, 43, 1)
Hi @VisionShilin,
I have run into the same problem in my own work... although I got the error from running the masker.fit_transform
function to a list of statistic maps. Did you manage to find a solution in the end?
My solution for this problem is giving up the FitLins and choosing a better one ;-)
Apologies for dropping the ball on this. I'm hoping to get back to working on FitLins soon.
Hi,
The fitlins can’t treat reference shape (57, 68, 43) and image shape (57, 68, 43, 1) correctly. I got the following messages.
200924-00:30:32,776 nipype.workflow WARNING: Storing result file without outputs 200924-00:30:32,780 nipype.workflow WARNING: [Node] Error on "_l2_model0" (/tmp/tmpircjz52a/fitlins_wf/l2_model/mapflow/_l2_model0) 200924-00:30:32,784 nipype.workflow WARNING: Storing result file without outputs 200924-00:30:32,787 nipype.workflow WARNING: [Node] Error on "fitlins_wf.l2_model" (/tmp/tmpircjz52a/fitlins_wf/l2_model) 200924-00:31:17,378 nipype.workflow ERROR: Node l2_model failed to run on host 79b3412349f8. 200924-00:31:17,378 nipype.workflow ERROR: Saving crash info to /work/crash-20200924-003117-neuro-l2_model-4d50a1fc-73ab-468f-88c9-d0a1f5f3f94c.txt Traceback (most recent call last): File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context, TypeError: init() got an unexpected keyword argument 'initializer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node result["result"] = node.run(updatehash=updatehash) File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run result = self._run_interface(execute=True) File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1386, in _run_interface self.config["execution"]["stop_on_first_crash"] File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 1295, in _collate_results "Subnodes of node: %s failed:\n%s" % (self.name, "\n".join(msg)) Exception: Subnodes of node: l2_model failed: Subnode 0 failed Error: Traceback (most recent call last):
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/plugins/multiproc.py", line 148, in init mp_context=mp_context,
TypeError: init() got an unexpected keyword argument 'initializer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 94, in nodelist_runner result = node.run(updatehash=updatehash)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 516, in run result = self._run_interface(execute=True)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 635, in _run_interface return self._run_command(execute)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 741, in _run_command result = self._interface.run(cwd=outdir)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nipype/interfaces/base/core.py", line 397, in run runtime = self._run_interface(runtime)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/fitlins/interfaces/nistats.py", line 370, in _run_interface output_type='all'
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nistats/second_level_model.py", line 483, in computecontrast Y = self.masker.transform(effect_maps)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/input_data/base_masker.py", line 177, in transform return self.transform_single_imgs(imgs, confounds)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/input_data/nifti_masker.py", line 405, in transform_single_imgs dtype=self.dtype
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/joblib/memory.py", line 352, in call return self.func(*args, **kwargs)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/input_data/nifti_masker.py", line 41, in filter_and_mask imgs = _utils.check_niimg(imgs, atleast_4d=True, ensure_ndim=4)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/_utils/niimg_conversions.py", line 260, in check_niimg return concat_niimgs(niimg, ensure_ndim=ensure_ndim, dtype=dtype)
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/_utils/niimg_conversions.py", line 459, in concat_niimgs memory=memory, memory_level=memory_level))):
File "/opt/miniconda-latest/envs/neuro/lib/python3.6/site-packages/nilearn/_utils/niimg_conversions.py", line 150, in _iter_check_niimg niimg.shape))
ValueError: Field of view of image #6 is different from reference FOV. Reference affine: array([[ 3.43700004, 0. , 0. , -96.5 ], [ 0. , 3.43799996, 0. , -132.5 ], [ 0. , 0. , 4.5999999 , -78.5 ], [ 0. , 0. , 0. , 1. ]]) Image affine: array([[ 3.43799996, 0. , 0. , -96.5 ], [ 0. , 3.43799996, 0. , -132.5 ], [ 0. , 0. , 4.5999999 , -78.5 ], [ 0. , 0. , 0. , 1. ]]) Reference shape: (57, 68, 43) Image shape: (57, 68, 43, 1)