PartSegCore.analysis.measurement_base¶
- class PartSegCore.analysis.measurement_base.AreaType(value)[source]¶
Bases:
enum.Enum
On which area type measurement should be calculated
- pydantic model PartSegCore.analysis.measurement_base.Leaf[source]¶
Bases:
PartSegCore.utils.BaseModel
Class for describe calculation of basic measurement
Show JSON schema
{ "title": "Leaf", "description": "Class for describe calculation of basic measurement", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "parameters": { "title": "Parameters" }, "power": { "title": "Power", "default": 1.0, "type": "number" }, "area": { "$ref": "#/definitions/AreaType" }, "per_component": { "$ref": "#/definitions/PerComponent" }, "channel": { "title": "Channel", "type": "object", "properties": { "value": { "title": "value", "anyOf": [ { "type": "string" }, { "type": "integer" } ] } } } }, "required": [ "name" ], "additionalProperties": false, "definitions": { "AreaType": { "title": "AreaType", "description": "On which area type measurement should be calculated", "enum": [ 1, 2, 3 ] }, "PerComponent": { "title": "PerComponent", "description": "How measurement should be calculated", "enum": [ 1, 2, 3, 4 ] } } }
- Config
extra: str = forbid
- Fields
- Validators
_validate_parameters
»parameters
_validate_per_component
»per_component
- field area: Optional[PartSegCore.analysis.measurement_base.AreaType] = None¶
- field channel: Optional[PartSegImage.channel_class.Channel] = None¶
- Constraints
title = Channel
type = object
properties = {‘value’: {‘title’: ‘value’, ‘anyOf’: [{‘type’: ‘string’}, {‘type’: ‘integer’}]}}
- field parameters: Any [Optional]¶
- Validated by
_validate_parameters
- field per_component: Optional[PartSegCore.analysis.measurement_base.PerComponent] = None¶
- Validated by
_validate_per_component
- get_channel_num(measurement_dict)[source]¶
Get set with number of channels needed for calculate this measurement
- Parameters
measurement_dict (
Dict
[str
,MeasurementMethodBase
]) – dict with all measurementh method.- Return type
- Returns
set of channels num
- get_unit(ndim)[source]¶
Return unit of selected measurement reflecting dimensionality.
- Parameters
ndim (
int
) – data dimensionality- Return type
Symbol
- pretty_print(measurement_dict)[source]¶
Pretty print for presentation in user interface.
- Parameters
measurement_dict (
Dict
[str
,MeasurementMethodBase
]) – dict with additional information used for more detailed description- Return type
- Returns
string with indentation
- pydantic model PartSegCore.analysis.measurement_base.MeasurementEntry[source]¶
Bases:
PartSegCore.utils.BaseModel
Describe single measurement in measurement set
Show JSON schema
{ "title": "MeasurementEntry", "description": "Describe single measurement in measurement set", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "calculation_tree": { "title": "Calculation Tree", "anyOf": [ { "$ref": "#/definitions/Node" }, { "$ref": "#/definitions/Leaf" } ] } }, "required": [ "name", "calculation_tree" ], "additionalProperties": false, "definitions": { "AreaType": { "title": "AreaType", "description": "On which area type measurement should be calculated", "enum": [ 1, 2, 3 ] }, "PerComponent": { "title": "PerComponent", "description": "How measurement should be calculated", "enum": [ 1, 2, 3, 4 ] }, "Leaf": { "title": "Leaf", "description": "Class for describe calculation of basic measurement", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "parameters": { "title": "Parameters" }, "power": { "title": "Power", "default": 1.0, "type": "number" }, "area": { "$ref": "#/definitions/AreaType" }, "per_component": { "$ref": "#/definitions/PerComponent" }, "channel": { "title": "Channel", "type": "object", "properties": { "value": { "title": "value", "anyOf": [ { "type": "string" }, { "type": "integer" } ] } } } }, "required": [ "name" ], "additionalProperties": false }, "Node": { "title": "Node", "description": "Class for describe operation between two measurements", "type": "object", "properties": { "left": { "title": "Left", "anyOf": [ { "$ref": "#/definitions/Node" }, { "$ref": "#/definitions/Leaf" } ] }, "op": { "title": "Op", "description": "Operation to perform between left and right child. Currently only division (`/`) supported", "type": "string" }, "right": { "title": "Right", "anyOf": [ { "$ref": "#/definitions/Node" }, { "$ref": "#/definitions/Leaf" } ] } }, "required": [ "left", "op", "right" ], "additionalProperties": false } } }
- Config
extra: str = forbid
- Fields
- field calculation_tree: Union[PartSegCore.analysis.measurement_base.Node, PartSegCore.analysis.measurement_base.Leaf] [Required]¶
- class PartSegCore.analysis.measurement_base.MeasurementMethodBase[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
This is base class For all measurement calculation classes based on text_info[0] the measurement name wil be generated, based_on text_info[1] the description is generated
- static area_type(area)[source]¶
Map chosen area type to proper area type. Allow to correct Area type.
- static calculate_property(channel, roi, mask, voxel_size, result_scalar, roi_alternative, roi_annotation, **kwargs)[source]¶
Main function for calculating measurement
- Parameters
channel (
ndarray
) – main channel selected for measurementchannel_{i} – for channel requested using
get_fields()
AlgorithmProperty("channel", "Channel", 0, value_type=Channel)
area_array – array representing current area returned by
area_type()
roi (
ndarray
) – array representing roimask (
ndarray
) – array representing mask (upper level roi)voxel_size (
Tuple
[Union
[float
,int
],...
]) – size of single voxel in metersresult_scalar (
float
) – scalar to get proper units in resultroi_alternative (
Dict
[str
,ndarray
]) – dict with alternative roi representation (for plugin specific mapping)roi_annotation (
Dict
[int
,Any
]) – dict with roi annotations (for plugin specific mapping)
List incomplete.
- classmethod get_units(ndim)[source]¶
Return units for measurement. They are shown to user
- Return type
symbols
- pydantic model PartSegCore.analysis.measurement_base.Node[source]¶
Bases:
PartSegCore.utils.BaseModel
Class for describe operation between two measurements
Show JSON schema
{ "$ref": "#/definitions/Node", "definitions": { "AreaType": { "title": "AreaType", "description": "On which area type measurement should be calculated", "enum": [ 1, 2, 3 ] }, "PerComponent": { "title": "PerComponent", "description": "How measurement should be calculated", "enum": [ 1, 2, 3, 4 ] }, "Leaf": { "title": "Leaf", "description": "Class for describe calculation of basic measurement", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "parameters": { "title": "Parameters" }, "power": { "title": "Power", "default": 1.0, "type": "number" }, "area": { "$ref": "#/definitions/AreaType" }, "per_component": { "$ref": "#/definitions/PerComponent" }, "channel": { "title": "Channel", "type": "object", "properties": { "value": { "title": "value", "anyOf": [ { "type": "string" }, { "type": "integer" } ] } } } }, "required": [ "name" ], "additionalProperties": false }, "Node": { "title": "Node", "description": "Class for describe operation between two measurements", "type": "object", "properties": { "left": { "title": "Left", "anyOf": [ { "$ref": "#/definitions/Node" }, { "$ref": "#/definitions/Leaf" } ] }, "op": { "title": "Op", "description": "Operation to perform between left and right child. Currently only division (`/`) supported", "type": "string" }, "right": { "title": "Right", "anyOf": [ { "$ref": "#/definitions/Node" }, { "$ref": "#/definitions/Leaf" } ] } }, "required": [ "left", "op", "right" ], "additionalProperties": false } } }
- Config
extra: str = forbid
- Fields
- field left: Union[PartSegCore.analysis.measurement_base.Node, PartSegCore.analysis.measurement_base.Leaf] [Required]¶
- field op: str [Required]¶
Operation to perform between left and right child. Currently only division (/) supported
- field right: Union[PartSegCore.analysis.measurement_base.Node, PartSegCore.analysis.measurement_base.Leaf] [Required]¶
- class PartSegCore.analysis.measurement_base.PerComponent(value)[source]¶
Bases:
enum.Enum
How measurement should be calculated