Skip to content

Commit

Permalink
run_fastsurfer.sh
Browse files Browse the repository at this point in the history
- Fix for bash-3.2 (|& => 2&>1 |)
- Add warning if T2 is passed, but biasfield is skipped --no_biasfield
  • Loading branch information
dkuegler committed Jun 20, 2024
1 parent ca1d06a commit 5982172
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions run_fastsurfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ if [[ "$run_seg_pipeline" == "1" ]]
then
printf "INFO: Copying T2 file to %s..." "${t2_copy_file}" | tee -a "$seg_log"
cmd=("nib-convert" "$t2" "$t2_copy_file")
"${cmd[@]}" |& tee -a "$seg_log"
"${cmd[@]}" 2>&1 | tee -a "$seg_log"
echo "Done." | tee -a "$seg_log"
fi

Expand Down Expand Up @@ -918,7 +918,7 @@ if [[ "$run_seg_pipeline" == "1" ]]
echo "INFO: Running N4 bias-field correction of the t2" | tee -a "$seg_log"
cmd=($python "${reconsurfdir}/N4_bias_correct.py" "--in" "$t2"
--out "$norm_name_t2" --threads "$threads" --uchar)
echo "${cmd[@]}" |& tee -a "$seg_log"
echo "${cmd[@]}" | tee -a "$seg_log"
"${cmd[@]}"
if [[ "${PIPESTATUS[0]}" -ne 0 ]]
then
Expand All @@ -933,7 +933,11 @@ if [[ "$run_seg_pipeline" == "1" ]]
echo "INFO: Robustly rescaling $t2 to uchar ($norm_name_t2), which is assumed to already be biasfield corrected." | tee -a "$seg_log"
cmd=($python "${fastsurfercnndir}/data_loader/conform.py" --no_force_lia
--no_force_vox_size --no_force_img_size "$t2" "$norm_name_t2")
"${cmd[@]}" |& tee -a "$seg_log"
echo "WARNING: --no_biasfield is activated, but FastSurfer does not check, if "
echo " passed T2 image is properly scaled and typed. T2 needs to be uchar and"
echo " robustly scaled (see FastSurferCNN/utils/data_loader/conform.py)!"
# TODO implement/validate no changes to affine parameters for conform
# "${cmd[@]}" 2>&1 | tee -a "$seg_log"
fi
fi

Expand Down Expand Up @@ -978,11 +982,11 @@ if [[ "$run_seg_pipeline" == "1" ]]
cmd+=("$t1")
if [[ -n "$t2" ]] ; then cmd+=(--t2 "$t2"); fi
fi
echo "${cmd[@]}" |& tee -a "$seg_log"
echo "${cmd[@]}" 2>&1 | tee -a "$seg_log"
"${cmd[@]}"
if [[ "${PIPESTATUS[0]}" -ne 0 ]]
then
echo "ERROR: Hypothalamus Segmentation failed" |& tee -a "$seg_log"
echo "ERROR: Hypothalamus Segmentation failed" | tee -a "$seg_log"
exit 1
fi
fi
Expand Down

0 comments on commit 5982172

Please sign in to comment.