Skip to content

Commit

Permalink
Fix deepseg threshold (again) (#2490)
Browse files Browse the repository at this point in the history
* deepseg_sc/core: Fixed binarization after resampling

* batch_processing.sh: Now outputtting T1 seg in QC

* deepseg_sc/core: Updated optimal thresholds
  • Loading branch information
jcohenadad authored Oct 21, 2019
1 parent d1cdb30 commit d5d903a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion batch_processing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ cd ..
# ===========================================================================================
cd t1
# Segment spinal cord
sct_deepseg_sc -i t1.nii.gz -c t1
sct_deepseg_sc -i t1.nii.gz -c t1 -qc "$SCT_BP_QC_FOLDER"
# Smooth spinal cord along superior-inferior axis
sct_smooth_spinalcord -i t1.nii.gz -s t1_seg.nii.gz
# Flatten cord in the right-left direction (to make nice figure)
Expand Down
4 changes: 2 additions & 2 deletions spinalcordtoolbox/deepseg_sc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# Thresholds to apply to binarize segmentations from the output of the 2D CNN. These thresholds were obtained by
# minimizing the standard deviation of cross-sectional area across contrasts. For more details, see:
# https:/sct-pipeline/deepseg-threshold
THR_DEEPSEG = {'t1': 0.74353448, 't2': 0.34353448, 't2s': 0.89008621, 'dwi': 0.01422414}
THR_DEEPSEG = {'t1': 0.15, 't2': 0.7, 't2s': 0.89, 'dwi': 0.01}

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -548,7 +548,7 @@ def deep_segmentation_spinalcord(im_image, contrast_type, ctr_algo='cnn', ctr_fi
# Binarize the resampled image (except for soft segmentation, defined by threshold_seg=-1)
if threshold_seg >= 0:
logger.info("Binarizing the resampled segmentation...")
im_seg_r.data = im_seg_r.data.astype(np.uint8)
im_seg_r.data = (im_seg_r.data > 0.5).astype(np.uint8)

# post processing step to z_regularized
im_seg_r_postproc = post_processing_volume_wise(im_seg_r)
Expand Down

0 comments on commit d5d903a

Please sign in to comment.