PennLINC / qsirecon

Reconstruction of preprocessed q-space images (dMRI)
https://qsirecon.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Mrtrix hsvs ACT reconstruction - convert_fs_brain error #25

Open Shade- opened 1 year ago

Shade- commented 1 year ago

Hello, after processing my data using Freesurfer and trying the ACT-hsvs pipeline, I get the following error:

[Node] Error on "qsirecon_wf.sub-xxx_mrtrix_singleshell_ss3_hsvst.anat_ingress_wf.register_fs_to_qsiprep_wf.convert_fs_brain" (/scratch/qsirecon_wf/sub-xxx_mrtrix_singleshell_ss3_hsvst/anat_ingress_wf/register_fs_to_qsiprep_wf/convert_fs_brain)
exception calling callback for <Future at 0x7fa6477c1340 state=finished raised FileNotFoundError>
concurrent.futures.process._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 722, in _run_command
    result = self._interface.run(cwd=outdir, ignore_exception=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 388, in run
    self._check_mandatory_inputs()
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 275, in _check_mandatory_inputs
    raise ValueError(msg)
ValueError: MRConvert requires a value for input 'in_file'. For a list of required inputs, see MRConvert.help()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/concurrent/futures/process.py", line 239, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 70, in run_node
    result["result"] = node.result
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 223, in result
    return _load_resultfile(
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/utils.py", line 291, in load_resultfile
    raise FileNotFoundError(results_file)
FileNotFoundError: /scratch/qsirecon_wf/sub-xxx_mrtrix_singleshell_ss3_hsvst/anat_ingress_wf/register_fs_to_qsiprep_wf/convert_fs_brain/result_convert_fs_brain.pklz
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/concurrent/futures/_base.py", line 328, in _invoke_callbacks
    callback(self)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 159, in _async_callback
    result = args.result()
  File "/usr/local/miniconda/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/usr/local/miniconda/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
FileNotFoundError: /scratch/qsirecon_wf/sub-xxx_mrtrix_singleshell_ss3_hsvst/anat_ingress_wf/register_fs_to_qsiprep_wf/convert_fs_brain/result_convert_fs_brain.pklz

I'm on QSIPrep 0.18.1, data has been elaborated on Freesurfer 7.3.2 and all the files are there.

Shade- commented 1 year ago

I believe this line is the culprit, it doesn't seem to have any input but just the output to me?

https://github.com/PennLINC/qsiprep/blob/6900a0b33d0c907c2ee606a07ad4f16019727ffc/qsiprep/workflows/recon/anatomical.py#L281

Shade- commented 1 year ago

Sorry, turns out my freesurfer-input folder structure was wrong.

I still think this is a bug as you can use a freesurfer-input flag pointing to a valid Freesurfer output, but encounter issues if the folder doesn't have a sub-ID subfolder containing all the files. I believe letting the user choose the actual folder containing the derivatives would be better.

mattcieslak commented 1 year ago

Are you working with multi-session data?

Shade- commented 1 year ago

What do you mean?

mattcieslak commented 1 year ago

One of the big problems with the hsvs workflow happens when you split up a subject into multiple sessions and process the sessions separately. We do this all the time with developmental data (where you can't make a rigid T1w space for a subject). If you have a different freesurfer result for each session it's not clear how to set up the --freesurfer-input generically

Shade- commented 1 year ago

I am piping QSIPrep's processed T1w to FastSurfer, then I run the recon pipeline. Worked like a charm when I put FastSurfer's output in the derivatives/freesurfer/sub-ID folder and pointed QSIPrep to use --freesurfer-input derivatives/freesurfer. This should be either changed in the docs (explicitly say you need a subfolder named sub-ID) or the behavior changed to accommodate any folder, IMHO.

mattcieslak commented 1 year ago

oh wow, that's very cool to hear that fastsurfer works directly with the hsvs workflow. It's been on my list to try that out. In the meantime I'll add to the docs to make it clear what to put as the --freesurfer-input

Shade- commented 1 year ago

I mean I'm still trying the pipeline out, I have yet to inspect the actual result. But it went through without issues. I had to change the aliases FastSurfer generates and use the original files, but as far as I am concerned, the hsvs pipeline completed without issues.

Shade- commented 1 year ago

Works perfectly. I'm impressed, this is a 1.5T acquisition.

With ACT:

Screenshot 2023-07-21 alle 06 40 03

No ACT:

Screenshot 2023-07-21 alle 06 39 55

Detail with ACT:

Screenshot 2023-07-21 alle 06 40 59

Detail without ACT:

Screenshot 2023-07-21 alle 06 40 39