MeasureOperations
Provides tools for statistical analysis and measurement operations on volume, mask, surface, and mesh objects. Supports histogram generation, volume/mask/surface/mesh statistics, similarity metrics, mask comparison, mesh quality analysis, primitive fitting, and measurement between primitives.
Import
import ScriptingApi as api
# Access via Application
app = api.Application()
ops = app.get_measure_operations()
Methods
Creation
generate_histogram
Generates a histogram for the specified volume object.
Signature:
generate_histogram(volumeName: str, params: HistogramParams) -> HistogramResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the volume object to analyze. |
params | any | Histogram generation parameters. Use api.HistogramParams(). |
Returns: HistogramResult — Histogram result containing bin values and frequencies.
generate_histogram_with_mask
Generates a histogram for a volume filtered by a mask.
Signature:
generate_histogram_with_mask(volumeName: str, maskName: str, params: HistogramParams) -> HistogramResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the volume object to analyze. |
maskName | any | Name of the mask object to filter the volume. |
params | any | Histogram generation parameters. Use api.HistogramParams(). |
Returns: HistogramResult — Histogram result containing bin values and frequencies.
File System
export_histogram_to_disk
Exports histogram data to a formatted text file.
Signature:
export_histogram_to_disk(histogramResult: HistogramResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
histogramResult | any | The histogram result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful, False otherwise.
export_volume_statistics_to_disk
Exports volume statistics to a formatted text file.
Signature:
export_volume_statistics_to_disk(statisticsResult: VolumeStatisticsResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
statisticsResult | any | The volume statistics result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful.
export_volume_similarity_to_disk
Exports volume similarity statistics to a formatted text file.
Signature:
export_volume_similarity_to_disk(similarityResult: VolumeSimilarityResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
similarityResult | any | The volume similarity result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful, False otherwise.
export_mask_statistics_to_disk
Exports mask statistics to a formatted text file.
Signature:
export_mask_statistics_to_disk(statisticsResult: MaskStatisticsResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
statisticsResult | any | The mask statistics result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful, False otherwise.
export_mask_comparison_to_disk
Exports mask comparison statistics to a formatted text file.
Signature:
export_mask_comparison_to_disk(comparisonResult: MaskComparisonResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
comparisonResult | any | The mask comparison result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful.
export_surface_mesh_statistics_to_disk
Exports surface mesh statistics to a formatted text file.
Signature:
export_surface_mesh_statistics_to_disk(statisticsResult: SurfaceMeshStatisticsResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
statisticsResult | any | The surface mesh statistics result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful.
export_volume_mesh_statistics_to_disk
Exports volume mesh statistics to a formatted text file.
Signature:
export_volume_mesh_statistics_to_disk(statisticsResult: VolumeMeshStatisticsResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
statisticsResult | any | The volume mesh statistics result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful.
export_surface_mesh_quality_to_disk
Exports surface mesh quality analysis to a formatted text file.
Signature:
export_surface_mesh_quality_to_disk(qualityResult: SurfaceMeshQualityResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
qualityResult | any | The surface mesh quality result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful.
export_volume_mesh_quality_to_disk
Exports volume mesh quality analysis to a formatted text file.
Signature:
export_volume_mesh_quality_to_disk(qualityResult: VolumeMeshQualityResult, fileName: str) -> bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
qualityResult | any | The volume mesh quality result to export. |
fileName | any | Full path to the output text file (.txt extension recommended). |
Returns: bool — True if export was successful.
Analysis
compute_volume_statistics
Computes grayscale statistics for the specified volume object.
Signature:
compute_volume_statistics(volumeName: str, params: VolumeStatisticsParams) -> VolumeStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the volume object to analyze. |
params | any | Volume statistics parameters. Use api.VolumeStatisticsParams(). |
Returns: VolumeStatisticsResult — Volume statistics result containing all computed metrics.
compute_volume_statistics_with_mask
Computes grayscale statistics for a volume filtered by a mask.
Signature:
compute_volume_statistics_with_mask(volumeName: str, maskName: str, params: VolumeStatisticsParams) -> VolumeStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the volume object to analyze. |
maskName | any | Name of the mask object to filter the volume. |
params | any | Volume statistics parameters. Use api.VolumeStatisticsParams(). |
Returns: VolumeStatisticsResult — Volume statistics result containing all computed metrics.
compute_volume_statistics_all_visible_masks
Computes grayscale statistics for a volume using all visible masks.
Signature:
compute_volume_statistics_all_visible_masks(volumeName: str, params: VolumeStatisticsParams) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeName | any | Name of the volume object to analyze. |
params | any | Volume statistics parameters. Use api.VolumeStatisticsParams(). |
Returns: list — List of volume statistics results, one for each visible mask.
compute_volume_similarity
Computes similarity statistics between two volume objects.
Signature:
compute_volume_similarity(sourceVolumeName: str, targetVolumeName: str) -> VolumeSimilarityResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
sourceVolumeName | any | Name of the source volume object. |
targetVolumeName | any | Name of the target volume object. |
Returns: VolumeSimilarityResult — Volume similarity result containing all similarity metrics.
compute_whole_mask_statistics
Computes shape statistics for the entire mask (whole mask statistics).
Signature:
compute_whole_mask_statistics(maskName: str, volumeName: str = "", requestedStats: list = []) -> MaskStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the mask object to analyze. |
volumeName | any | Optional volume name for intensity-based statistics (empty string if not needed). |
requestedStats | any | Optional list of label statistics to compute. When empty, all statistics are computed. Python example: [api.LabelStatisticType.VoxelCount, api.LabelStatisticType.Volume, api.LabelStatisticType.MeanIntensity] |
Returns: MaskStatisticsResult — Mask statistics result containing shape and intensity metrics.
compute_per_region_mask_statistics
Computes statistics for each connected region in a mask (per-region mask statistics).
Signature:
compute_per_region_mask_statistics(maskName: str, volumeName: str = "", requestedStats: list = []) -> MaskStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the mask object to analyze. |
volumeName | any | Optional volume name for intensity-based statistics (empty string if not needed). |
requestedStats | any | Optional list of label statistics to compute. When empty, all statistics are computed. Python example: [api.LabelStatisticType.VoxelCount, api.LabelStatisticType.Volume, api.LabelStatisticType.Compactness] |
Returns: MaskStatisticsResult — Mask statistics result containing per-region shape and intensity metrics.
compute_per_label_mask_statistics
Computes statistics for each label in a multi-label mask (per-label mask statistics).
Signature:
compute_per_label_mask_statistics(maskName: str, volumeName: str = "", requestedStats: list = []) -> MaskStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the multi-label mask object to analyze. |
volumeName | any | Optional volume name for intensity-based statistics (empty string if not needed). |
requestedStats | any | Optional list of label statistics to compute. When empty, all statistics are computed. Python example: [api.LabelStatisticType.VoxelCount, api.LabelStatisticType.Volume, api.LabelStatisticType.Elongation] |
Returns: MaskStatisticsResult — Mask statistics result containing per-label shape and intensity metrics.
compute_per_region_mask_3d_preview_statistics
Computes mesh statistics for each connected region of a mask's 3D preview.
Signature:
compute_per_region_mask_3d_preview_statistics(maskName: str, requestedStats: list = []) -> SurfaceMeshStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the mask object whose 3D preview will be analyzed. |
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.SurfaceMeshStatisticType.NumVertices, api.SurfaceMeshStatisticType.SurfaceArea, api.SurfaceMeshStatisticType.Volume] |
Returns: SurfaceMeshStatisticsResult — Surface mesh statistics result containing per-region mesh metrics.
compute_per_label_mask_3d_preview_statistics
Computes mesh statistics for each label in a multi-label mask's 3D preview.
Signature:
compute_per_label_mask_3d_preview_statistics(maskName: str, requestedStats: list = []) -> SurfaceMeshStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the multi-label mask object whose 3D preview will be analyzed. |
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.SurfaceMeshStatisticType.NumVertices, api.SurfaceMeshStatisticType.SurfaceArea] |
Returns: SurfaceMeshStatisticsResult — Surface mesh statistics result containing per-label mesh metrics.
compute_whole_surface_mesh_statistics
Computes statistics for a surface mesh object (whole surface mesh statistics).
Signature:
compute_whole_surface_mesh_statistics(surfaceName: str, requestedStats: list = []) -> SurfaceMeshStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
surfaceName | any | Name of the surface object to analyze. |
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.SurfaceMeshStatisticType.NumTriangles, api.SurfaceMeshStatisticType.SurfaceArea, api.SurfaceMeshStatisticType.Volume] |
Returns: SurfaceMeshStatisticsResult — Surface mesh statistics result containing geometry and topology metrics.
compute_all_visible_surface_mesh_statistics
Computes statistics for all visible surface mesh objects.
Signature:
compute_all_visible_surface_mesh_statistics(requestedStats: list = []) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.SurfaceMeshStatisticType.NumVertices, api.SurfaceMeshStatisticType.SurfaceArea] |
Returns: list — List of surface mesh statistics results, one for each visible surface.
compute_per_region_surface_mesh_statistics
Computes statistics for each connected region of a surface mesh.
Signature:
compute_per_region_surface_mesh_statistics(surfaceName: str, requestedStats: list = []) -> SurfaceMeshStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
surfaceName | any | Name of the surface object to analyze. |
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.SurfaceMeshStatisticType.SurfaceArea, api.SurfaceMeshStatisticType.Sphericity] |
Returns: SurfaceMeshStatisticsResult — Surface mesh statistics result containing per-region metrics.
compute_volume_mesh_statistics
Computes statistics for a volume mesh object.
Signature:
compute_volume_mesh_statistics(volumeMeshName: str, requestedStats: list = []) -> VolumeMeshStatisticsResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | Name of the volume mesh object to analyze. |
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.VolumeMeshStatisticType.NumVertices, api.VolumeMeshStatisticType.TotalVolume, api.VolumeMeshStatisticType.NumTetrahedra] |
Returns: VolumeMeshStatisticsResult — Volume mesh statistics result containing geometry metrics.
compute_all_visible_volume_mesh_statistics
Computes statistics for all visible volume mesh objects.
Signature:
compute_all_visible_volume_mesh_statistics(requestedStats: list = []) -> list
Parameters:
| Parameter | Type | Description |
|---|---|---|
requestedStats | any | Optional list of mesh statistics to compute. When empty, all statistics are computed. Python example: [api.VolumeMeshStatisticType.TotalVolume, api.VolumeMeshStatisticType.NumTetrahedra] |
Returns: list — List of volume mesh statistics results, one for each visible volume mesh.
analyze_surface_mesh_quality
Analyzes mesh quality for a surface object using the specified quality metric.
Signature:
analyze_surface_mesh_quality(surfaceName: str, metricType: SurfaceMeshQualityMetric) -> SurfaceMeshQualityResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
surfaceName | any | Name of the surface object to analyze. |
metricType | any | Quality metric type. Use api.SurfaceMeshQualityMetric.AspectRatio |
Returns: SurfaceMeshQualityResult — Surface mesh quality result containing quality statistics.
analyze_mask_3d_preview_mesh_quality
Analyzes mesh quality for a mask's 3D preview using the specified quality metric.
Signature:
analyze_mask_3d_preview_mesh_quality(maskName: str, metricType: SurfaceMeshQualityMetric) -> SurfaceMeshQualityResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the mask object whose 3D preview will be analyzed. |
metricType | any | Quality metric type. Use api.SurfaceMeshQualityMetric.AspectRatio |
Returns: SurfaceMeshQualityResult — Surface mesh quality result containing quality statistics.
analyze_volume_mesh_quality
Analyzes mesh quality for a volume mesh object using the specified quality metric.
Signature:
analyze_volume_mesh_quality(volumeMeshName: str, metricType: VolumeMeshQualityMetric) -> VolumeMeshQualityResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
volumeMeshName | any | Name of the volume mesh object to analyze. |
metricType | any | Quality metric type. Use api.VolumeMeshQualityMetric.TetAspectRatio |
Returns: VolumeMeshQualityResult — Volume mesh quality result containing quality statistics.
measure_between_primitives
Measures the distance between two primitive objects.
Signature:
measure_between_primitives(primitive1Name: str, primitive2Name: str, createMeasurement: bool = True) -> PrimitiveMeasurementResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
primitive1Name | any | Name of the first primitive object. |
primitive2Name | any | Name of the second primitive object. |
createMeasurement | any | If true, creates a distance measurement object in the project. |
Returns: PrimitiveMeasurementResult — Primitive measurement result containing distance and closest points.
General
compare_masks
Computes overlap statistics between two mask objects.
Signature:
compare_masks(sourceMaskName: str, targetMaskName: str) -> MaskComparisonResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
sourceMaskName | any | Name of the source mask object. |
targetMaskName | any | Name of the target mask object. |
Returns: MaskComparisonResult — Mask comparison result containing Dice coefficient, false positive/negative rates, and volume similarity.
fit_primitive_to_surface
Fits a geometric primitive to a surface object.
Signature:
fit_primitive_to_surface(surfaceName: str, params: PrimitiveFittingParams) -> PrimitiveFittingResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
surfaceName | any | Name of the surface object to fit. |
params | any | Primitive fitting parameters. Use api.PrimitiveFittingParams(). |
Returns: PrimitiveFittingResult — Primitive fitting result containing the fitted primitive information.
fit_primitive_to_mask_3d_preview
Fits a geometric primitive to a mask's 3D preview.
Signature:
fit_primitive_to_mask_3d_preview(maskName: str, params: PrimitiveFittingParams) -> PrimitiveFittingResult
Parameters:
| Parameter | Type | Description |
|---|---|---|
maskName | any | Name of the mask object whose 3D preview will be used for fitting. |
params | any | Primitive fitting parameters. Use api.PrimitiveFittingParams(). |
Returns: PrimitiveFittingResult — Primitive fitting result containing the fitted primitive information.