stats
¶
- A module for estimating
signal-to-noise ratio (SNR) for binarizable datasets.
accuracy metrics for segmentation maps.
- ct_segnet.stats.ROC(thresh, true_img=None, seg_img=None)[source]¶
Receiver Operating Characteristics (ROC) curve
- Parameters
thresh (float) – threshold value
true_img (numpy.array) – ground truth segmentation map (ny, nx)
seg_img (numpy.array) – predicted segmentation map (ny, nx)
- Returns
tuple – FPR, TPR
- ct_segnet.stats.calc_SNR(img, seg_img, labels=(0, 1), mask_ratio=None)[source]¶
SNR = 1 / s*sqrt(std0^^2 + std1^^2) where s = 1 / (mu1 - mu0) mu1, std1 and mu0, std0 are the mean / std values for each of the segmented regions respectively (pix value = 1) and (pix value = 0). seg_img is used as mask to determine stats in each region.
- Parameters
img (np.array) – raw input image (2D or 3D)
seg_img (np.array) – segmentation map (2D or 3D)
labels (tuple) – an ordered list of two label values in the image. The high value is interpreted as the signal and low value is the background.
mask_ratio (float or None) – If not None, a float in (0,1). The data are cropped such that the voxels / pixels outside the circular mask are ignored.
- Returns
float – SNR of img w.r.t seg_img
- ct_segnet.stats.calc_dice_coeff(true_img, seg_img)[source]¶
- Parameters
true_img (np.array) – ground truth segmentation map (ny, nx)
seg_img (np.array) – predicted segmentation map (ny, nx)
- Returns
float – Dice coefficient
- ct_segnet.stats.calc_jac_acc(true_img, seg_img)[source]¶
- Parameters
true_img (np.array) – ground truth segmentation map (ny, nx)
seg_img (np.array) – predicted segmentation map (ny, nx)
- Returns
float – Jaccard accuracy or Intersection over Union
- ct_segnet.stats.fidelity(true_imgs, seg_imgs, tolerance=0.95)[source]¶
Fidelity is number of images with IoU > tolerance
- Parameters
tolerance (float) – tolerance (default = 0.95)
true_imgs (numpy.array) – list of ground truth segmentation maps (nimgs, ny, nx)
seg_imgs (numpy.array) – list of predicted segmentation maps (nimgs, ny, nx)
- Returns
float – Fidelity