Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding FreeSurfer commands (for validation tests) #362

Merged
merged 5 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ SHELL ["/bin/bash", "--login", "-c"]

# install freesurfer and point to new python location
RUN /install/install_fs_pruned.sh /opt --upx && \
rm /opt/freesurfer/bin/fspython && \
rm -R /install && \
ln -s /venv/bin/python3 /opt/freesurfer/bin/fspython
rm /opt/freesurfer/bin/fspython && \
rm -R /install && \
ln -s /venv/bin/python3 /opt/freesurfer/bin/fspython


# =======================================================
Expand Down Expand Up @@ -175,7 +175,7 @@ COPY /Docker/python-s /venv/bin/

# Copy fastsurfer over from the build context and add PYTHONPATH
COPY . /fastsurfer/
ENV PYTHONPATH=/fastsurfer:$PYTHONPATH \
ENV PYTHONPATH=/fastsurfer:/opt/freesurfer/python/package:$PYTHONPATH \
FASTSURFER_HOME=/fastsurfer

# Download all remote network checkpoints already, compile all FastSurfer scripts into bytecode and update
Expand Down
19 changes: 16 additions & 3 deletions Docker/install_fs_pruned.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ wget --no-check-certificate -qO- $fslink | tar zxv --no-same-owner -C $where \
--exclude='freesurfer/python/bin' \
--exclude='freesurfer/python/include' \
--exclude='freesurfer/python/lib' \
--exclude='freesurfer/python/packages' \
--exclude='freesurfer/python/share' \
--exclude='freesurfer/subjects/bert' \
--exclude='freesurfer/subjects/cvs_avg35_inMNI152' \
Expand All @@ -106,6 +105,7 @@ mkdir -p $fsd/bin
mkdir -p $fsd/etc
mkdir -p $fsd/lib/bem
mkdir -p $fsd/python/scripts
mkdir -p $fsd/python/packages/fsbindings
mkdir -p $fsd/subjects/fsaverage/label
mkdir -p $fsd/subjects/fsaverage/surf

Expand Down Expand Up @@ -146,15 +146,21 @@ copy_files="
average/rh.folding.atlas.acfb40.noaparc.i12.2016-08-02.tif
bin/analyzeto4dfp
bin/AntsDenoiseImageFs
bin/asegstats2table
bin/aparcstats2table
bin/avi2talxfm
bin/compute_vox2vox
bin/defect2seg
bin/fname2stem
bin/fspython
bin/fs_temp_dir
bin/fs_temp_file
bin/fs-check-version
bin/fsr-getxopts
bin/gauss_4dfp
bin/imgreg_4dfp
bin/isanalyze
bin/isnifti
bin/lta_convert
bin/mpr2mni305
bin/mri_add_xform_to_header
Expand All @@ -169,6 +175,7 @@ copy_files="
bin/mri_edit_wm_with_aseg
bin/mri_fill
bin/mri_fuse_segmentations
bin/mri_glmfit
bin/mri_info
bin/mri_label2label
bin/mri_label2vol
Expand All @@ -182,6 +189,7 @@ copy_files="
bin/mri_robust_template
bin/mri_segment
bin/mri_segstats
bin/mri_surf2surf
bin/mri_surf2volseg
bin/mri_tessellate
bin/mri_vol2surf
Expand All @@ -203,6 +211,7 @@ copy_files="
bin/mris_jacobian
bin/mris_label2annot
bin/mris_place_surface
bin/mris_preproc
bin/mris_register
bin/mris_remesh
bin/mris_remove_intersection
Expand All @@ -222,6 +231,9 @@ copy_files="
etc/recon-config.yaml
lib/bem/ic4.tri
lib/bem/ic7.tri
python/packages/fsbindings/legacy.py
python/scripts/asegstats2table
python/scripts/aparcstats2table
python/scripts/rca-config
python/scripts/rca-config2csh
subjects/fsaverage/label/lh.aparc.annot
Expand Down Expand Up @@ -308,9 +320,11 @@ echo
for file in $copy_files
do
echo "copying $file"
cp $fss/$file $fsd/$file
cp -r $fss/$file $fsd/$file
done

# Modify fsbindings Python package to allow calling scripts like asegstats2table directly:
echo "from . import legacy" > "$fsd/python/packages/fsbindings/__init__.py"

# FS looks for them, but does not call them
touch_files="/average/RB_all_2020-01-02.gca"
Expand Down Expand Up @@ -341,7 +355,6 @@ link_files="
bin/mri_relabel_nonwm_hypos
bin/mri_remove_neck
bin/mri_stats2seg
bin/mri_surf2surf
bin/mri_surf2vol
bin/mri_surfcluster
bin/mri_vol2vol
Expand Down