spatialtopology / spacetop-prep

code for transferring data and preprocessing
MIT License
0 stars 3 forks source link

Duplicated data file #56

Closed feilong closed 7 months ago

feilong commented 7 months ago

The path of the file was /dartfs-hpc/rc/lab/C/CANlab/labdata/data/spacetop/dartmouth/sub-0010/ses-03/func/sub-0010_ses-03_task-social_acq-mb8_run-02_bold.nii.

It causes fMRIPrep crash:

    retval["workflow"] = init_fmriprep_wf()
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/workflows/base.py", line 94, in init_fmriprep_wf
    single_subject_wf = init_single_subject_wf(subject_id)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/fmriprep/workflows/base.py", line 655, in init_single_subject_wf
    workflow.connect([
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/workflows.py", line 161, in connect
    self._check_nodes(newnodes)
  File "/opt/conda/envs/fmriprep/lib/python3.10/site-packages/nipype/pipeline/engine/workflows.py", line 769, in _check_nodes
    raise IOError('Duplicate node name "%s" found.' % node.name)
OSError: Duplicate node name "bold_ses_03_task_social_acq_mb8_run_02_wf" found.

The file had the same content of the .nii.gz file that has the same base name, and the .nii.gz file has been archived with DataLad properly. So I removed the .nii file.

In [1]: a = nib.load('sub-0010_ses-03_task-social_acq-mb8_run-02_bold.nii')

In [2]: b = nib.load('sub-0010_ses-03_task-social_acq-mb8_run-02_bold.nii.gz')

In [3]: np.testing.assert_array_equal(a.affine, b.affine)

In [4]: np.testing.assert_array_equal(a.dataobj, b.dataobj)

In [5]: import gzip

In [6]: with gzip.open('sub-0010_ses-03_task-social_acq-mb8_run-02_bold.nii.gz', 'rb') as f:
   ...:     a = f.read()
   ...: 

In [7]: with open('sub-0010_ses-03_task-social_acq-mb8_run-02_bold.nii', 'rb') as f:
   ...:     b = f.read()
   ...: 

In [8]: a == b
Out[8]: True
jungheejung commented 7 months ago

Thanks @feilong!