Skip to main content

HistogramParams

Other

Parameters for histogram generation. numberOfBins, target, and sliceMode control how the histogram data is computed: target restricts the region (whole volume, active mask, or all visible masks) and sliceMode restricts the slice(s) included in the computation. If imageFilePath is not empty, generateHistogram() and generateHistogramWithMask() also save a histogram chart image to disk using the standard application histogram styling. For that exported image, graphType selects the chart style and yAxisMode selects the Y-axis scaling. graphType and yAxisMode affect only the exported image, not the returned histogram data.

Import

import ScriptingApi as api

# Create parameter instance
params = api.HistogramParams()

Properties

target

Region over which the histogram is computed. Use api.VolumeStatisticsTarget.WholeVolume

Type: VolumeStatisticsTarget


slice_mode

Slice(s) over which the histogram is computed. Use api.SliceMode.AllSlices

Type: SliceMode


y_axis_mode

Y-axis scaling for the exported histogram image. Use api.HistogramYAxisMode.Logarithmic This field affects only the exported image, not the returned histogram data.

Type: HistogramYAxisMode


graph_type

Chart style for the exported histogram image. Use api.HistogramGraphType.Bar This field affects only the exported image, not the returned histogram data.

Type: HistogramGraphType


number_of_bins

Number of bins for the histogram. Must be greater than 0.

Type: int


image_file_path

Optional output image file path for saving a histogram chart image. Leave empty to skip image export. The image format is inferred from the file extension, for example .png, .jpg, or .bmp.

Type: str


See Also