connectomicslab / connectomemapper3

Connectome Mapper 3 is a BIDS App that implements full anatomical, diffusion, resting/state functional MRI, and recently EEG processing pipelines, from raw T1 / DWI / BOLD , and preprocessed EEG data to multi-resolution brain parcellation with corresponding connection matrices.
https://connectome-mapper-3.readthedocs.io
Other
68 stars 28 forks source link

FileNotFoundError in CMP GUI: failed to create DTI derivative #64

Closed dualon closed 3 years ago

dualon commented 3 years ago

Hi

CMP3 seems to fail to create the DTI derivative. Steps to reproduce:

  1. Start CMP3 GUI RC2
  2. Click on the first brain, config
  3. Click on the second brain -> a FileNotFoundError appears immediately in the terminal, see below.

RC1 worked before I reinstalled my PC, which makes the whole story more cryptic. RC1 does not function now either. File permissions are OK. The "code" subdirectory with the config files is also created flawlessly.

How to fix it? :)

See the system info below. I am happy to provide further information upon request.

(py37cmp-gui) dualon@alpha-neuron:/mnt/wdred1/Research/connectomemapper3$ cmpbidsappmanager     
Graphical Backend : qt4

Connectome Mapper v3.0.0-RC2 - BIDS App Manager 
Copyright (C) 2009-2020, Ecole Polytechnique Federale de Lausanne (EPFL)
                the University Hospital Center and University of Lausanne (UNIL-CHUV), Switzerland,
& Contributors

                All rights reserved.

QXcbConnection: XCB error: 3 (BadWindow), sequence: 1084, resource id: 14728032, major code: 40 (TranslateCoords), minor code: 0
BIDS Layout: .../Research/Apraxia-cTBS/BIDS-02 | Subjects: 1 | Sessions: 0 | Runs: 0
sub: 02
Available subjects : 
['sub-02']
sub-02
Sessions: 
[]
    ... Check for available input modalities...
T1w available: ['sub-02_T1w.nii.gz']
DWI available: ['sub-02_dwi.nii.gz']
Created directory /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code
Config file (anat) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.ini
Config json file (anat) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.json
>> Created reference anatomical config file :  /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.ini
/mnt/wdred1/Research/Apraxia-cTBS/BIDS-02
{'Preprocessing': <cmp.stages.preprocessing.preprocessing.PreprocessingStage object at 0x7fb03c1c0fb0>, 'Registration': <cmp.stages.registration.registration.RegistrationStage object at 0x7fb03c1c3c50>, 'Diffusion': <cmp.stages.diffusion.diffusion.DiffusionStage object at 0x7fb03c1c3d10>, 'Connectome': <cmp.stages.connectome.connectome.ConnectomeStage object at 0x7fb03c1c6230>}
QXcbConnection: XCB error: 3 (BadWindow), sequence: 1137, resource id: 14728027, major code: 40 (TranslateCoords), minor code: 0
['process_type', 'diffusion_imaging_model', 'subjects', 'subject', 'subject_session', 'modalities', 'dmri_bids_acq']
Config file (dwi) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.ini
Config json file (dwi) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.json
>> Created reference diffusion config file :  /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.ini
QXcbConnection: XCB error: 3 (BadWindow), sequence: 1304, resource id: 14728037, major code: 40 (TranslateCoords), minor code: 0
Anatomical config file : /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.ini
Diffusion config file : /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.ini
QXcbConnection: XCB error: 3 (BadWindow), sequence: 2563, resource id: 14728047, major code: 40 (TranslateCoords), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 2746, resource id: 14728053, major code: 40 (TranslateCoords), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 3101, resource id: 14728058, major code: 40 (TranslateCoords), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 3266, resource id: 14728063, major code: 40 (TranslateCoords), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 3407, resource id: 14728068, major code: 40 (TranslateCoords), minor code: 0
QXcbConnection: XCB error: 3 (BadWindow), sequence: 3656, resource id: 14728073, major code: 40 (TranslateCoords), minor code: 0
Saving pipeline configuration files...
Config file (anat) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.ini
Config json file (anat) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.json
Anatomical config saved as  /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_anatomical_config.ini
['process_type', 'diffusion_imaging_model', 'subjects', 'subject', 'subject_session', 'modalities', 'dmri_bids_acq']
Config file (dwi) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.ini
Config json file (dwi) saved as /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.json
Diffusion config saved as  /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/code/ref_diffusion_config.ini
/mnt/wdred1/Research/Apraxia-cTBS/BIDS-02
{'Preprocessing': <cmp.stages.preprocessing.preprocessing.PreprocessingStage object at 0x7fb03fcc4290>, 'Registration': <cmp.stages.registration.registration.RegistrationStage object at 0x7fb03c460b90>, 'Diffusion': <cmp.stages.diffusion.diffusion.DiffusionStage object at 0x7fb03c460230>, 'Connectome': <cmp.stages.connectome.connectome.ConnectomeStage object at 0x7fb03c4ee9b0>}
**** Check Inputs  ****
> Looking for....
WARNING : Diffusion json sidecar not found for subject 02.
... dwi_file : /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/sub-02/dwi/sub-02_dwi.nii.gz
... json_file : NotFound
... bvecs_file : /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/sub-02/dwi/sub-02_dwi.bvec
... bvals_file : /mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/sub-02/dwi/sub-02_dwi.bval
Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: <cmp.bidsappmanager.gui.CMP_MainWindow object at 0x7fb03ff657d0>, trait: bidsapp, old value: <undefined>, new value: 0
Traceback (most recent call last):
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/traits/trait_notifiers.py", line 381, in __call__
    self.handler(*args)
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/bidsappmanager/gui.py", line 2277, in _bidsapp_fired
    fmri_config=fmri_config
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/bidsappmanager/gui.py", line 919, in __init__
    gui=False)
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/pipelines/diffusion/diffusion.py", line 516, in check_input
    shutil.copy(src=dwi_file, dst=out_dwi_file)
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/wdred1/Research/Apraxia-cTBS/BIDS-02/derivatives/cmp/sub-02/dwi/sub-02_desc-cmp_dwi.nii.gz'

Kubuntu 20.10. Docker and CMP were installed as described in the documentation. The home folder sits on a different drive as the connectomemapper3 directory.

(py37cmp-gui) dualon@alpha-neuron:/mnt/wdred1/Research/connectomemapper3$ cat /proc/version
Linux version 5.8.0-40-generic (buildd@lcy01-amd64-013) (gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0, GNU ld (GNU Binutils for Ubuntu) 2.35.1) #45-Ubuntu SMP Fri Jan 15 11:05:36 UTC 2021

(py37cmp-gui) dualon@alpha-neuron:/mnt/wdred1/Research/connectomemapper3$ git log -1     
commit 10e78d98d9a4a25c8872c7c5be7a873cc55438ab (HEAD -> master, origin/master, origin/HEAD)
Author: Sebastien Tourbier <sebastien.tourbier1@gmail.com>
Date:   Wed Jan 13 09:09:54 2021 +0100

    FIX: enabled/disabled gray-out button "Run BIDS App" with Qt Style sheet [skip ci]
sebastientourbier commented 3 years ago

@dualon Thanks for reporting this!

Indeed, right after the release of v3.0.0-RC2, there was a bug in checking the availability of modalities that I corrected in commit 80fbee226e64d8e7fe72bfa9639eaffd73c0939c , where I use now pybids instead the DiffusionPipeline.check_inputs() to check for modalities: https://github.com/connectomicslab/connectomemapper3/blob/10e78d98d9a4a25c8872c7c5be7a873cc55438ab/cmp/bidsappmanager/gui.py#L913-L961

Looking at the error traceback

  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/bidsappmanager/gui.py", line 919, in __init__
    gui=False)
  File "/home/dualon/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/cmp/pipelines/diffusion/diffusion.py", line 516, in check_input
    shutil.copy(src=dwi_file, dst=out_dwi_file)

make me think you are the commit tagged with v3.0.0-RC2 where the check_input() function is still being used.

Moving to the latest commit 10e78d98d9a4a25c8872c7c5be7a873cc55438ab on the master branch (git checkout 10e78d98d9a4a25c8872c7c5be7a873cc55438ab) and reinstalling the GUI ((py37cmp-gui) $python setup_gui.py install) should make it working.

Let me know.

dualon commented 3 years ago

Dear Sébastien, Thanks a lot for the prompt support. I was indeed on RC2, checking out the fix and reinstalling the GUI (this part I missed earlier) has fixed the problem. I closed the issue with my comment, hopefully that's okay with you.

sebastientourbier commented 3 years ago

@dualon Great! You're welcome !