Deep-MI / FastSurfer

PyTorch implementation of FastSurferCNN
Apache License 2.0
459 stars 119 forks source link

Only run --surfreg from docker #227

Closed iamjoostjanssen closed 1 year ago

iamjoostjanssen commented 1 year ago

Question/Support Request

Hi,

We ran: docker run -v /Data:/data -v /Data/ouput:/output -v /Data/license_dir:/fs60 --rm --user 1000 deepmi/fastsurfer:cpu-v1.1.1 --fs_license /fs60/license.txt --t1 /data/${ID}/mri/orig.mgz --sid ${ID} --sd /output --parallel --surf_only --threads 4

and it worked fine. Now we are interested in adding the sphere.reg for vertex-wise (cross-subject) analyses (--surfreg). What would be the correct docker command for creating the sphere.reg without rerunning the entire surface recon pipeline?

Thnx

Screenshots

...

Environment

Execution

Run Command:

m-reuter commented 1 year ago

Hi @iamjoostjanssen , that is also on my wishlist. Also permitting edits in the surface pipeline and re-running from specific locations in the stream. Currently you have three options:

  1. fully re-running with the flag switched on (I know, not great)
  2. directly running that step with FreeSurfer for both lh and rh hemis: recon-all -subject $subject -hemi $hemi -sphere -surfreg -no-isrunning $fsthreads
  3. running our improved approach:
    recon-all -subject $subject -hemi $hemi -sphere -no-isrunning $fsthreads`
    python3.8 ${binpath}/rotate_sphere.py \
       --srcsphere $sdir/${hemi}.sphere \
       --srcaparc $ldir/$hemi.aparc.DKTatlas.mapped.annot \
       --trgsphere $FREESURFER_HOME/subjects/fsaverage/surf/${hemi}.sphere \
       --trgaparc $FREESURFER_HOME/subjects/fsaverage/label/${hemi}.aparc.annot \
       --out $sdir/${hemi}.angles.txt
    mris_register -curv -norot -rotate \`cat $sdir/${hemi}.angles.txt\` \
       $sdir/${hemi}.sphere \
       $FREESURFER_HOME/average/${hemi}.folding.atlas.acfb40.noaparc.i12.2016-08-02.tif \
       $sdir/${hemi}.sphere.reg

The latter helps in situations where FreeSurfer misaligns the pre and post-central gyrii (which happens once in a while), by initialising the spherical registration with a rotation obtained from our cortical segmentation. While 2.) is the easiest to call and is what FreeSurfer would do.

You can run our dockers interactively by specifying /bin/bash as entry point, or you just run this outside of docker with a native install of FreeSurfer and our rotate_sphere.py script from GitHub.

iamjoostjanssen commented 1 year ago

Hi Martin, Thanks! That worked fine.