cmtk.statistics: Calculate image statistics for a nrrd or other CMTK...

View source: R/cmtk-reformat.R

cmtk.statisticsR Documentation

Calculate image statistics for a nrrd or other CMTK compatible file

Description

Calculate image statistics for a nrrd or other CMTK compatible file

Usage

cmtk.statistics(
  f,
  mask,
  imagetype = c("greyscale", "label"),
  masktype = c("label", "binary"),
  ...,
  Verbose = FALSE
)

Arguments

f

Path to image file (any CMTK compatible format)

mask

Optional path to a mask file

imagetype

Whether image should be treated as greyscale (default) or label field.

masktype

Whether mask should be treated as label field or binary mask (default label)

...

Additional arguments for ctmk's statistics tool processed by cmtk.call.

Verbose

Whether to show cmtk status messages and be verbose about file update checks. Sets command line --verbose option.

Details

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.

Value

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

Examples

## Not run: 
cmtk.statistics('someneuron.nrrd', mask='neuropilregionmask.nrrd')
cmtk.statistics('somelabelfield.nrrd', imagetype='label')

## End(Not run)

nat documentation built on Aug. 25, 2023, 5:16 p.m.