edickie / ciftify

The tools of the Human Connectome Project (HCP) adapted for working with non-HCP datasets
https://edickie.github.io/ciftify/
MIT License
112 stars 158 forks source link

ciftify_recon_all error #163

Open StephDocTUM opened 3 years ago

StephDocTUM commented 3 years ago

runngin ciftify_recon_all in a docker container leads to: Traceback (most recent call last): File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 1570, in main() File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 1567, in main run_ciftify_recon_all(tmpdir, settings) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 123, in run_ciftify_recon_all run_default_workflow(temp_dir, settings, meshes, expected_labels, fs_version) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 155, in run_default_workflow create_cifti_subcortical_ROIs(subject.atlas_space_dir, settings, temp_dir) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 765, in create_cifti_subcortical_ROIs via_file='Atlas_ROIs.{}.nii.gz'.format(grayord_res)) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 533, in link_to_template_file subject_file) OSError: [Errno 38] Function not implemented: '../../../zz_templates/Atlas_ROIs.2.nii.gz' -> '/ciftify/sub-10/MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz'

Registration Sphere /ciftify/sub-10/MNINonLinear/Native/sub-10.L.sphere.MSMSulc.native.surf.gii not found

        .|';   ||          .|';
   ''   ||     ||     ''   ||

.|'', || '||' ''||'' || '||' '|| || || || || || || |||..|| |..' .||. .||.|..' .||. .||. || , |' ''


2021-08-12 14:03:23.607210 : Starting cifti_recon_all

Creating tempdir:/tmp/tmp5p81v25i on host:19d788b2c090 Arguments: freesurfer SUBJECTS_DIR: /data/derivatives/freesurfer CIFTIFY_WORKDIR directory: /ciftify Subject: sub-10 MSM config file: /home/code/ciftify/ciftify/data/hcp_config/MSMSulcStrainFinalconf

---### Environment Settings ###--- Username: root System Info: OS: Linux Hostname: 19d788b2c090 Release: 5.4.0-80-generic Version: #90~18.04.1-Ubuntu SMP Tue Jul 13 19:40:02 UTC 2021 Machine: x86_64 ciftify: Path: /home/code/ciftify/ciftify/bin Commit: ce1876b22747ef76b797de5056ec38cab8fc5e66 Author: Erin W Dickie edickie@users.noreply.github.com Last commit for ciftify_recon_all: Commit: a2f653b92df346cc615347d61de0a22a5cef8ddc Date: Mon Jul 24 17:34:42 2017 -0400 wb_command: Path: /usr/bin/wb_command Version: 1.3.2 Commit Date: unknown Operating System: Linux freesurfer: Path: /opt/freesurfer/bin Build Stamp: freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.1-f53a55a FSL: Path: /usr/share/fsl/5.0 Version: 5.0.9 ---### End of Environment Settings ###---

recon_all was run Wed Mar 10 08:25:41 CET 2021 with settings: Build Stamp: freesurfer-Linux-centos6_x86_64-stable-pub-v6.0.0-2beb96c Version parsed as: v6.0.0 CMD args: -all -subjid sub-100010 -parallel -openmp 8 -cw256 -no-isrunning


2021-08-12 14:03:23.852403 : Converting T1wImage and Segmentations from freesurfer

Running: mri_convert /data/derivatives/freesurfer/sub-10/mri/T1.mgz /ciftify/sub-10/T1w/T1w.nii.gz mri_convert.bin /data/derivatives/freesurfer/sub-10/mri/T1.mgz /ciftify/sub-10/T1w/T1w.nii.gz $Id: mri_convert.c,v 1.226 2016/02/26 16:15:24 mreuter Exp $ reading from /data/derivatives/freesurfer/sub-10/mri/T1.mgz... TR=1000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, 1.86265e-09, 0) j_ras = (7.45058e-09, -3.72529e-09, -1) k_ras = (-1.86265e-09, 1, 0) writing to /ciftify/sub-10/T1w/T1w.nii.gz...

Running: fslreorient2std /ciftify/sub-10/T1w/T1w.nii.gz /ciftify/sub-10/T1w/T1w.nii.gz Running: mri_convert -rt nearest -rl /ciftify/sub-10/T1w/T1w.nii.gz /data/derivatives/freesurfer/sub-10/mri/wmparc.mgz /ciftify/sub-10/T1w/wmparc.nii.gz mri_convert.bin -rt nearest -rl /ciftify/sub-10/T1w/T1w.nii.gz /data/derivatives/freesurfer/sub-10/mri/wmparc.mgz /ciftify/sub-10/T1w/wmparc.nii.gz $Id: mri_convert.c,v 1.226 2016/02/26 16:15:24 mreuter Exp $ reading from /data/derivatives/freesurfer/sub-10/mri/wmparc.mgz... TR=1000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, 1.86265e-09, 0) j_ras = (7.45058e-09, -3.72529e-09, -1) k_ras = (-1.86265e-09, 1, 0) reading template info from volume /ciftify/sub-10/T1w/T1w.nii.gz... changing data type from int to float (noscale = 0)... Reslicing using nearest writing to /ciftify/sub-10/T1w/wmparc.nii.gz...

Running: wb_command -logging SEVERE -volume-label-import /ciftify/sub-10/T1w/wmparc.nii.gz /home/code/ciftify/ciftify/data/hcp_config/FreeSurferAllLut.txt /ciftify/sub-10/T1w/wmparc.nii.gz -drop-unused-labels Running: mri_convert -rt nearest -rl /ciftify/sub-10/T1w/T1w.nii.gz /data/derivatives/freesurfer/sub-10/mri/aparc.a2009s+aseg.mgz /ciftify/sub-10/T1w/aparc.a2009s+aseg.nii.gz mri_convert.bin -rt nearest -rl /ciftify/sub-10/T1w/T1w.nii.gz /data/derivatives/freesurfer/sub-10/mri/aparc.a2009s+aseg.mgz /ciftify/sub-10/T1w/aparc.a2009s+aseg.nii.gz $Id: mri_convert.c,v 1.226 2016/02/26 16:15:24 mreuter Exp $ reading from /data/derivatives/freesurfer/sub-10/mri/aparc.a2009s+aseg.mgz... TR=1000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, 1.86265e-09, 0) j_ras = (7.45058e-09, -3.72529e-09, -1) k_ras = (-1.86265e-09, 1, 0) reading template info from volume /ciftify/sub-10/T1w/T1w.nii.gz... changing data type from int to float (noscale = 0)... Reslicing using nearest writing to /ciftify/sub-10/T1w/aparc.a2009s+aseg.nii.gz...

Running: wb_command -logging SEVERE -volume-label-import /ciftify/sub-10/T1w/aparc.a2009s+aseg.nii.gz /home/code/ciftify/ciftify/data/hcp_config/FreeSurferAllLut.txt /ciftify/sub-10/T1w/aparc.a2009s+aseg.nii.gz -drop-unused-labels Running: mri_convert -rt nearest -rl /ciftify/sub-10/T1w/T1w.nii.gz /data/derivatives/freesurfer/sub-10/mri/aparc+aseg.mgz /ciftify/sub-10/T1w/aparc+aseg.nii.gz mri_convert.bin -rt nearest -rl /ciftify/sub-10/T1w/T1w.nii.gz /data/derivatives/freesurfer/sub-10/mri/aparc+aseg.mgz /ciftify/sub-10/T1w/aparc+aseg.nii.gz $Id: mri_convert.c,v 1.226 2016/02/26 16:15:24 mreuter Exp $ reading from /data/derivatives/freesurfer/sub-10/mri/aparc+aseg.mgz... TR=1000.00, TE=0.00, TI=0.00, flip angle=0.00 i_ras = (-1, 1.86265e-09, 0) j_ras = (7.45058e-09, -3.72529e-09, -1) k_ras = (-1.86265e-09, 1, 0) reading template info from volume /ciftify/sub-10/T1w/T1w.nii.gz... changing data type from int to float (noscale = 0)... Reslicing using nearest writing to /ciftify/sub-10/T1w/aparc+aseg.nii.gz...

Running: wb_command -logging SEVERE -volume-label-import /ciftify/sub-10/T1w/aparc+aseg.nii.gz /home/code/ciftify/ciftify/data/hcp_config/FreeSurferAllLut.txt /ciftify/sub-10/T1w/aparc+aseg.nii.gz -drop-unused-labels


2021-08-12 14:03:38.820609 : Creating brainmask from freesurfer wmparc segmentation

Running: fslmaths /ciftify/sub-10/T1w/wmparc.nii.gz -bin -dilD -dilD -dilD -ero -ero /ciftify/sub-10/T1w/brainmask_fs.nii.gz Running: wb_command -volume-fill-holes /ciftify/sub-10/T1w/brainmask_fs.nii.gz /ciftify/sub-10/T1w/brainmask_fs.nii.gz Running: fslmaths /ciftify/sub-10/T1w/brainmask_fs.nii.gz -bin /ciftify/sub-10/T1w/brainmask_fs.nii.gz Running: fslmaths /ciftify/sub-10/T1w/T1w.nii.gz -mul /ciftify/sub-10/T1w/brainmask_fs.nii.gz /ciftify/sub-10/T1w/T1w_brain.nii.gz


2021-08-12 14:05:45.184760 : Registering T1wImage to MNI template using FSL FNIRT

Running: flirt -interp spline -dof 12 -in /ciftify/sub-10/T1w/T1w_brain.nii.gz -ref /usr/share/fsl/5.0/data/standard/MNI152_T1_2mm_brain.nii.gz -omat /ciftify/sub-10/MNINonLinear/xfms/T1w2StandardLinear.mat -o /tmp/tmp5p81v25i/T1w2StandardLinearImage.nii.gz Running: fnirt --in=/tmp/tmp5p81v25i/T1w2StandardLinearImage.nii.gz --ref=/usr/share/fsl/5.0/data/standard/MNI152_T1_2mm.nii.gz --refmask=/usr/share/fsl/5.0/data/standard/MNI152_T1_2mm_brain_mask_dil.nii.gz --fout=/ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz --logout=/ciftify/sub-10/MNINonLinear/xfms/NonlinearReg_fromlinear.log --config=/usr/share/fsl/5.0/etc/flirtsch/T1_2_MNI152_2mm.cnf Running: invwarp -w /ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz -o /ciftify/sub-10/MNINonLinear/xfms/Standard2T1w_warp_noaffine.nii.gz -r /usr/share/fsl/5.0/data/standard/MNI152_T1_2mm.nii.gz Running: applywarp --rel --interp=trilinear -i /ciftify/sub-10/T1w/T1w.nii.gz -r /usr/share/fsl/5.0/data/standard/MNI152_T1_2mm.nii.gz -w /ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz --premat=/ciftify/sub-10/MNINonLinear/xfms/T1w2StandardLinear.mat -o /ciftify/sub-10/MNINonLinear/T1w.nii.gz


2021-08-12 14:11:01.248414 : Applying MNI transform to label files

Running: applywarp --rel --interp=nn -i /ciftify/sub-10/T1w/wmparc.nii.gz -r /ciftify/sub-10/MNINonLinear/T1w.nii.gz -w /ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz --premat=/ciftify/sub-10/MNINonLinear/xfms/T1w2StandardLinear.mat -o /ciftify/sub-10/MNINonLinear/wmparc.nii.gz Running: wb_command -volume-label-import -logging SEVERE /ciftify/sub-10/MNINonLinear/wmparc.nii.gz /home/code/ciftify/ciftify/data/hcp_config/FreeSurferAllLut.txt /ciftify/sub-10/MNINonLinear/wmparc.nii.gz -drop-unused-labels Running: applywarp --rel --interp=nn -i /ciftify/sub-10/T1w/aparc.a2009s+aseg.nii.gz -r /ciftify/sub-10/MNINonLinear/T1w.nii.gz -w /ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz --premat=/ciftify/sub-10/MNINonLinear/xfms/T1w2StandardLinear.mat -o /ciftify/sub-10/MNINonLinear/aparc.a2009s+aseg.nii.gz Running: wb_command -volume-label-import -logging SEVERE /ciftify/sub-10/MNINonLinear/aparc.a2009s+aseg.nii.gz /home/code/ciftify/ciftify/data/hcp_config/FreeSurferAllLut.txt /ciftify/sub-10/MNINonLinear/aparc.a2009s+aseg.nii.gz -drop-unused-labels Running: applywarp --rel --interp=nn -i /ciftify/sub-10/T1w/aparc+aseg.nii.gz -r /ciftify/sub-10/MNINonLinear/T1w.nii.gz -w /ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz --premat=/ciftify/sub-10/MNINonLinear/xfms/T1w2StandardLinear.mat -o /ciftify/sub-10/MNINonLinear/aparc+aseg.nii.gz Running: wb_command -volume-label-import -logging SEVERE /ciftify/sub-10/MNINonLinear/aparc+aseg.nii.gz /home/code/ciftify/ciftify/data/hcp_config/FreeSurferAllLut.txt /ciftify/sub-10/MNINonLinear/aparc+aseg.nii.gz -drop-unused-labels Running: applywarp --rel --interp=nn -i /ciftify/sub-10/T1w/brainmask_fs.nii.gz -r /ciftify/sub-10/MNINonLinear/T1w.nii.gz -w /ciftify/sub-10/MNINonLinear/xfms/T1w2Standard_warp_noaffine.nii.gz --premat=/ciftify/sub-10/MNINonLinear/xfms/T1w2StandardLinear.mat -o /ciftify/sub-10/MNINonLinear/brainmask_fs.nii.gz Running: wb_command -add-to-spec-file /ciftify/sub-10/T1w/Native/sub-10.native.wb.spec INVALID /ciftify/sub-10/T1w/T1w.nii.gz Running: wb_command -add-to-spec-file /ciftify/sub-10/MNINonLinear/Native/sub-10.native.wb.spec INVALID /ciftify/sub-10/MNINonLinear/T1w.nii.gz Running: wb_command -add-to-spec-file /ciftify/sub-10/MNINonLinear/sub-10.164k_fs_LR.wb.spec INVALID /ciftify/sub-10/MNINonLinear/T1w.nii.gz Running: wb_command -add-to-spec-file /ciftify/sub-10/MNINonLinear/fsaverage_LR32k/sub-10.32k_fs_LR.wb.spec INVALID /ciftify/sub-10/MNINonLinear/T1w.nii.gz Running: wb_command -add-to-spec-file /ciftify/sub-10/T1w/fsaverage_LR32k/sub-10.32k_fs_LR.wb.spec INVALID /ciftify/sub-10/T1w/T1w.nii.gz Running: mkdir -p /ciftify/zz_templates Running: cp /home/code/ciftify/ciftify/data/91282_Greyordinates/Atlas_ROIs.2.nii.gz /ciftify/zz_templates/Atlas_ROIs.2.nii.gz

Here it stops

edickie commented 3 years ago

From the Error message - it's makes me wonder if you have run out the tmp storage space during the pipeline? (so it's stopped copying templates into temp)

How much temp space do you have available for this pipeline?

StephDocTUM commented 3 years ago

do you mean I should give the docker more space? I think standard is 10GB. So increase it to 20GB?

edickie commented 3 years ago

it's worth a try

StephDocTUM commented 2 years ago

I think the problem is that this file: /home/code/ciftify/ciftify/data/91282_Greyordinates/Atlas_ROIs.2.nii.gz does not exist for copying. ciftify is a path specified in the docker container I created.

How does the ciftify code come up with /home/code.... ?

edickie commented 2 years ago

weird - so if you built the container yourself - a clone of the ciftify github repo needs to be in the ciftify path (in this case - /home/code/ciftify) the repo contains a data folder with some template files (including the 91282_Greyordinates/Atlas_ROIs.2.nii.gz).

StephDocTUM commented 2 years ago

Yes, because this is used to build the docker container:

setting up an install of ciftify (manual version) inside the container

ADD https://api.github.com/repos/edickie/ciftify/git/refs/heads/master version.json RUN mkdir /home/code && git clone -b master https://github.com/edickie/ciftify.git /home/code/ciftify

ENV PATH=/home/code/ciftify/ciftify/bin:${PATH} \ PYTHONPATH=/home/code/ciftify:${PYTHONPATH} \ CIFTIFY_TEMPLATES=/home/code/ciftify/ciftify/data

WORKDIR /HOME/Pipeline/

ENTRYPOINT []

StephDocTUM commented 2 years ago

but still it works until here: Running: wb_command -add-to-spec-file /ciftify/sub-68/MNINonLinear/fsaverage_LR32k/sub-68.32k_fs_LR.wb.spec INVALID /ciftify/sub-68/MNINonLinear/T1w.nii.gz Running: wb_command -add-to-spec-file /ciftify/sub-68/T1w/fsaverage_LR32k/sub-68.32k_fs_LR.wb.spec INVALID /ciftify/sub-68/T1w/T1w.nii.gz Running: mkdir -p /ciftify/zz_templates Running: cp /home/code/ciftify/ciftify/data/91282_Greyordinates/Atlas_ROIs.2.nii.gz /ciftify/zz_templates/Atlas_ROIs.2.nii.gz

so it copies the Atlas_ROIs.2. into the zz_template folder.

In the terminal it says then: Traceback (most recent call last): File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 1570, in main() File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 1567, in main run_ciftify_recon_all(tmpdir, settings) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 123, in run_ciftify_recon_all run_default_workflow(temp_dir, settings, meshes, expected_labels, fs_version) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 155, in run_default_workflow create_cifti_subcortical_ROIs(subject.atlas_space_dir, settings, temp_dir) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 765, in create_cifti_subcortical_ROIs via_file='Atlas_ROIs.{}.nii.gz'.format(grayord_res)) File "/home/code/ciftify/ciftify/bin/ciftify_recon_all", line 533, in link_to_template_file subject_file) OSError: [Errno 38] Function not implemented: '../../../zz_templates/Atlas_ROIs.2.nii.gz' -> '/ciftify/sub-68/MNINonLinear/ROIs/Atlas_ROIs.2.nii.gz'

so the Atlas_ROIs.2.nii.gz is not linked into the subjects ROI folder.

code from ciftify_recon_all line 533 is the last line inhere:

def link_to_template_file(settings, subject_file, global_file, via_file): ''' The original hcp pipelines would copy atlas files into each subject's directory, which had the benefit of making the atlas files easier to find and copy across systems but created many redundant files. This function instead will copy the atlas files into a templates directory in the CIFTIFY_WORKDIR Folder and then link from each subject's individual directory to this file ''' if settings.no_symlinks: run(['cp', global_file, subject_file], dryrun=DRYRUN) else:

copy from ciftify template to the HCP_DATA if via_file does not exist

    via_folder = os.path.join(settings.work_dir, 'zz_templates')
    via_path = os.path.join(via_folder, via_file)
    if not os.path.isfile(via_path):
        if not os.path.exists(via_folder):
                run(['mkdir','-p',via_folder], dryrun=DRYRUN)
        run(['cp', global_file, via_path], dryrun=DRYRUN)
    ## link the subject_file to via_file
    if not DRYRUN:
        os.symlink(os.path.relpath(via_path, os.path.dirname(subject_file)),
                   subject_file)

Do you have any idea?