Skip to content

Commit

Permalink
Merge pull request #563 from dkuegler/feature/license_freesurferhome
Browse files Browse the repository at this point in the history
The FreeSurfer license is often in the FREESURFER_HOME directory, but FastSurfer does not detect it there.
  • Loading branch information
dkuegler authored Aug 27, 2024
2 parents 80f4e2a + ca46f7a commit bf5dc15
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Add FreeSurfer and python Environment variables
# DO_NOT_SEARCH_FS_LICENSE_IN_FREESURFER_HOME=true deactivates the search for FS_LICENSE in FREESURFER_HOME
ENV OS=Linux \
FS_OVERRIDE=0 \
FIX_VERTEX_AREA="" \
Expand All @@ -171,7 +172,8 @@ ENV OS=Linux \
PYTHONUNBUFFERED=0 \
MPLCONFIGDIR=/tmp \
PATH=/venv/bin:/opt/freesurfer/bin:$PATH \
MPLCONFIGDIR=/tmp/matplotlib-config
MPLCONFIGDIR=/tmp/matplotlib-config \
DO_NOT_SEARCH_FS_LICENSE_IN_FREESURFER_HOME="true"

# create matplotlib config dir; make sure we use bash and activate conda env
# (in case someone starts this interactively)
Expand Down
20 changes: 18 additions & 2 deletions run_fastsurfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,24 @@ then
msg="The surface pipeline and the talairach-registration in the segmentation pipeline require a FreeSurfer License"
if [[ -z "$FS_LICENSE" ]]
then
echo "ERROR: $msg, but no license was provided via --fs_license or the FS_LICENSE environment variable."
exit 1;
msg="$msg, but no license was provided via --fs_license or the FS_LICENSE environment variable."
if [[ "$DO_NOT_SEARCH_FS_LICENSE_IN_FREESURFER_HOME" != "true" ]] && [[ -n "$FREESURFER_HOME" ]]
then
echo "WARNING: $msg Checking common license files in \$FREESURFER_HOME."
for filename in "license.dat" "license.txt" ".license"
do
if [[ -f "$FREESURFER_HOME/$filename" ]]
then
echo "Trying with '$FREESURFER_HOME/$filename', specify a license with --fs_license to overwrite."
export FS_LICENSE="$FREESURFER_HOME/$filename"
break
fi
done
if [[ -z "$FS_LICENSE" ]]; then echo "ERROR: No license found..." ; exit 1 ; fi
else
echo "ERROR: $msg"
exit 1;
fi
elif [[ ! -f "$FS_LICENSE" ]]
then
echo "ERROR: $msg, but the provided path is not a file: $FS_LICENSE."
Expand Down

0 comments on commit bf5dc15

Please sign in to comment.