This function creates the training vectors for a single subject from a probability map, a gold standard mask (normally a manual segmentation), and a brain mask. For a grid of thresholds provided and applied to the probability map the function calculates Sørensen's–Dice coefficient (DSC) between the automatic image and the gold standard image. The function also calculates the volume associated with thresholding at each respective threshold.
tapas_data(thresholds = seq(from = 0, to = 1, by = 0.01), pmap,
gold_standard, mask, k = 0, subject_id = NULL, verbose = TRUE)
thresholds | A |
---|---|
pmap | A |
gold_standard | A |
mask | A |
k | The minimum number of voxels for a cluster/component. Segmentation clusters of size less than k are removed from the mask, volume estimation, and the Sørensen's–Dice coefficient (DSC) calculation. |
subject_id | A subject ID of class |
verbose | A |
A tibble
containing the training data for a single subject. The data contains columns threshold
,
Sørensen's–Dice coefficient (dsc
), and volume
.
if (FALSE) {
# Data is provided in the rtapas package as arrays. Below we will convert them to nifti objects.
library(oro.nifti)
# Gold standard manual segmentation
gs1 = oro.nifti::nifti(gs1)
# Probability map for subject 1
pmap1 = oro.nifti::nifti(pmap1)
# Brain mask
brain_mask = oro.nifti::nifti(brain_mask)
# Run the tapas_data function for subject 1
data = tapas_data(thresholds = seq(from = 0, to = 1, by = 0.01),
pmap = pmap1,
gold_standard = gs1,
mask = brain_mask,
k = 0,
subject_id = "subject_1",
verbose = TRUE)
# Visualize data returned from the tapas_data function
head(data)
}