R/cmtk-reformat.R
cmtk.statistics.Rd
Calculate image statistics for a nrrd or other CMTK compatible file
Path to image file (any CMTK compatible format)
Optional path to a mask file
Whether image should be treated as greyscale (default) or label field.
Whether mask should be treated as label field or binary mask (default label)
Additional arguments for CMTK's statistics
tool processed
by cmtk.call
.
Whether to show cmtk status messages and be verbose about file
update checks. Sets command line --verbose
option.
data.frame describing results with the following columns when image
f
is of imagetype='greyscale'
(optionally with a mask):
MaskLevel (only present when using a mask) the integer value of the label field for this region
min The minimum voxel value within the current region
max The maximum voxel value within the current region
mean The mean voxel value within the current region
sdev The standard deviation of voxel values within the current region
n The count of all voxel within the region (irrespective of their value)
Entropy Information theoretic entropy of voxel value distribution within region
sum Sum of voxel values within the region
When image f
is of imagetype='label'
, the following results
are returned:
level The integer value of the label field for this region
count The number of voxels in this region
surface The surface area of this region
volume The volume of this region
X,Y,Z 3D coordinates of the centroid of this region
When given a label mask, returns a dataframe with a row for each level of the label field.
Note that the Entropy column (sometimes H, sometimes Entropy) will always be named Entropy in the returned dataframe.
if (FALSE) {
cmtk.statistics('someneuron.nrrd', mask='neuropilregionmask.nrrd')
cmtk.statistics('somelabelfield.nrrd', imagetype='label')
}