PartSegCore.analysis.measurement_base¶
- class PartSegCore.analysis.measurement_base.AreaType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumOn which area type measurement should be calculated
- pydantic model PartSegCore.analysis.measurement_base.Leaf[source]¶
Bases:
BaseModelClass 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": { "default": 1.0, "title": "Power", "type": "number" }, "area": { "anyOf": [ { "$ref": "#/$defs/AreaType" }, { "type": "null" } ], "default": null }, "per_component": { "anyOf": [ { "$ref": "#/$defs/PerComponent" }, { "type": "null" } ], "default": null }, "channel": { "anyOf": [ { "properties": { "value": { "anyOf": [ { "type": "string" }, { "type": "integer" } ], "title": "value" } }, "title": "Channel", "type": "object" }, { "type": "null" } ], "default": null, "title": "Channel" } }, "$defs": { "AreaType": { "description": "On which area type measurement should be calculated", "enum": [ 1, 2, 3 ], "title": "AreaType", "type": "integer" }, "PerComponent": { "description": "How measurement should be calculated", "enum": [ 1, 2, 3, 4 ], "title": "PerComponent", "type": "integer" } }, "additionalProperties": false, "required": [ "name" ] }
- Config:
extra: str = forbid
- Fields:
-
field per_component:
Optional[PerComponent] = None¶
- 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:
BaseModelDescribe 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": { "anyOf": [ { "$ref": "#/$defs/Node" }, { "$ref": "#/$defs/Leaf" } ], "title": "Calculation Tree" } }, "$defs": { "AreaType": { "description": "On which area type measurement should be calculated", "enum": [ 1, 2, 3 ], "title": "AreaType", "type": "integer" }, "Leaf": { "additionalProperties": false, "description": "Class for describe calculation of basic measurement", "properties": { "name": { "title": "Name", "type": "string" }, "parameters": { "title": "Parameters" }, "power": { "default": 1.0, "title": "Power", "type": "number" }, "area": { "anyOf": [ { "$ref": "#/$defs/AreaType" }, { "type": "null" } ], "default": null }, "per_component": { "anyOf": [ { "$ref": "#/$defs/PerComponent" }, { "type": "null" } ], "default": null }, "channel": { "anyOf": [ { "properties": { "value": { "anyOf": [ { "type": "string" }, { "type": "integer" } ], "title": "value" } }, "title": "Channel", "type": "object" }, { "type": "null" } ], "default": null, "title": "Channel" } }, "required": [ "name" ], "title": "Leaf", "type": "object" }, "Node": { "additionalProperties": false, "description": "Class for describe operation between two measurements", "properties": { "left": { "anyOf": [ { "$ref": "#/$defs/Node" }, { "$ref": "#/$defs/Leaf" } ], "title": "Left" }, "op": { "description": "Operation to perform between left and right child. Currently only division (`/`) supported", "title": "Op", "type": "string" }, "right": { "anyOf": [ { "$ref": "#/$defs/Node" }, { "$ref": "#/$defs/Leaf" } ], "title": "Right" } }, "required": [ "left", "op", "right" ], "title": "Node", "type": "object" }, "PerComponent": { "description": "How measurement should be calculated", "enum": [ 1, 2, 3, 4 ], "title": "PerComponent", "type": "integer" } }, "additionalProperties": false, "required": [ "name", "calculation_tree" ] }
- Config:
extra: str = forbid
- Fields:
- class PartSegCore.analysis.measurement_base.MeasurementMethodBase[source]¶
Bases:
AlgorithmDescribeBase,ABCThis is base class For all measurement calculation classes based on text_info[0] the measurement name will 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:
BaseModelClass for describe operation between two measurements
Show JSON schema
{ "$defs": { "AreaType": { "description": "On which area type measurement should be calculated", "enum": [ 1, 2, 3 ], "title": "AreaType", "type": "integer" }, "Leaf": { "additionalProperties": false, "description": "Class for describe calculation of basic measurement", "properties": { "name": { "title": "Name", "type": "string" }, "parameters": { "title": "Parameters" }, "power": { "default": 1.0, "title": "Power", "type": "number" }, "area": { "anyOf": [ { "$ref": "#/$defs/AreaType" }, { "type": "null" } ], "default": null }, "per_component": { "anyOf": [ { "$ref": "#/$defs/PerComponent" }, { "type": "null" } ], "default": null }, "channel": { "anyOf": [ { "properties": { "value": { "anyOf": [ { "type": "string" }, { "type": "integer" } ], "title": "value" } }, "title": "Channel", "type": "object" }, { "type": "null" } ], "default": null, "title": "Channel" } }, "required": [ "name" ], "title": "Leaf", "type": "object" }, "Node": { "additionalProperties": false, "description": "Class for describe operation between two measurements", "properties": { "left": { "anyOf": [ { "$ref": "#/$defs/Node" }, { "$ref": "#/$defs/Leaf" } ], "title": "Left" }, "op": { "description": "Operation to perform between left and right child. Currently only division (`/`) supported", "title": "Op", "type": "string" }, "right": { "anyOf": [ { "$ref": "#/$defs/Node" }, { "$ref": "#/$defs/Leaf" } ], "title": "Right" } }, "required": [ "left", "op", "right" ], "title": "Node", "type": "object" }, "PerComponent": { "description": "How measurement should be calculated", "enum": [ 1, 2, 3, 4 ], "title": "PerComponent", "type": "integer" } }, "$ref": "#/$defs/Node" }
- Config:
extra: str = forbid
- Fields:
- class PartSegCore.analysis.measurement_base.PerComponent(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
EnumHow measurement should be calculated