PartSegCore.segmentation¶
Here we describe base classes for segmentation
Base classes¶
This module contains roi_extraction algorithms
- class PartSegCore.segmentation.BaseThreshold[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- class PartSegCore.segmentation.BaseWatershed[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
base class for all sprawl interface
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- abstract classmethod get_name()¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Return type
- Returns
name of algorithm
- classmethod sprawl(sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
dict
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- class PartSegCore.segmentation.NoiseFilteringBase[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
Base class for noise filtering operations
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- abstract classmethod get_name()¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Return type
- Returns
name of algorithm
- class PartSegCore.segmentation.ROIExtractionAlgorithm[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
Base class for all segmentation algorithm.
- Variables
~.image (Image) – Image to process
~.channel (numpy.ndarray) – selected channel
~.segmentation (numpy.ndarray) – final segmentation
~.mask (numpy.ndarray) – mask limiting segmentation area
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- abstract classmethod get_name()¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Return type
- Returns
name of algorithm
- class PartSegCore.segmentation.ROIExtractionResult(roi, parameters, additional_layers=<factory>, info_text='', roi_annotation=<factory>, alternative_representation=<factory>, file_path=None, roi_info=None, points=None)[source]¶
Bases:
object
Class to store results of roi extraction process.
- Variables
roi (np.ndarray) – Region of Interest represented as numpy array.
parameters (ROIExtractionProfile) – parameters of roi extraction process.
~.additional_layers (Dict[str,AdditionalLayerDescription]) – additional layers returned by algorithm. Could be previewer using napari viewer.
roi_annotation (dict) – Annotation for ROI. Currently displayed as tooltip
alternative_representation (Dict[str,np.ndarray]) – Arrays with alternative representations of ROI.
~.file_path (Optional[str]) – information on which file roi extraction was performed.
~.roi_info (ROIInfo) – ROIInfo for current roi.
~.points (Optional[np.ndarray]) – array of points.
- class PartSegCore.segmentation.RestartableAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.algorithm_base.ROIExtractionAlgorithm
,abc.ABC
Base class for restartable segmentation algorithm. The idea is to store two copies of algorithm parameters and base on difference check from which point restart the calculation.
- Variables
- abstract calculation_run(report_fun)[source]¶
Restartable calculation may return None if there is no need to recalculate
- Return type
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- abstract classmethod get_name()¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Return type
- Returns
name of algorithm
- static get_steps_num()¶
Return number of algorithm steps if your algorithm report progress, else should return 0
- class PartSegCore.segmentation.StackAlgorithm[source]¶
Bases:
PartSegCore.segmentation.algorithm_base.ROIExtractionAlgorithm
,abc.ABC
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- abstract classmethod get_name()¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Return type
- Returns
name of algorithm
- static get_steps_num()¶
Return number of algorithm steps if your algorithm report progress, else should return 0
- set_mask(mask)¶
Set mask which will limit segmentation area
.watershed¶
This module contains PartSeg wrappers for function for sprawl_utils.find_split
.
- class PartSegCore.segmentation.watershed.BaseWatershed[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
base class for all sprawl interface
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- abstract classmethod get_name()¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Return type
- Returns
name of algorithm
- classmethod sprawl(sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
dict
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- class PartSegCore.segmentation.watershed.DistanceWatershed[source]¶
Bases:
PartSegCore.segmentation.watershed.BaseWatershed
Calculate Euclidean sprawl (watershed) with respect to image spacing
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- classmethod sprawl(sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
dict
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- class PartSegCore.segmentation.watershed.FDTWatershed[source]¶
Bases:
PartSegCore.segmentation.watershed.BaseWatershed
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- classmethod sprawl(sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
dict
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- PartSegCore.segmentation.watershed.FlowMethodSelection¶
alias of
PartSegCore.segmentation.watershed.WatershedSelection
- class PartSegCore.segmentation.watershed.MSOWatershed[source]¶
Bases:
PartSegCore.segmentation.watershed.BaseWatershed
This algorithm has following parameters:
step_limits (ConstrainedIntValue)- Steep limits, Limits of Steps
reflective (bool)- Reflective
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- classmethod sprawl(cls, sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
MSOWatershedParams
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- class PartSegCore.segmentation.watershed.PathDistanceWatershed[source]¶
Bases:
PartSegCore.segmentation.watershed.BaseWatershed
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- classmethod sprawl(sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
dict
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- class PartSegCore.segmentation.watershed.PathWatershed[source]¶
Bases:
PartSegCore.segmentation.watershed.BaseWatershed
- classmethod get_fields()¶
This function return list of parameters needed by algorithm. It is used for generate form in User Interface
- Return type
- Returns
list of algorithm parameters and comments
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- classmethod sprawl(sprawl_area, core_objects, data, components_num, spacing, side_connection, operator, arguments, lower_bound, upper_bound)[source]¶
This method calculate sprawl
- Parameters
sprawl_area (
ndarray
) – Mask area to which sprawl should be limitedcore_objects (
ndarray
) – Starting objects for sprawldata (
ndarray
) – density informationcomponents_num (
int
) – numer of components in core_objectsspacing – Image spacing. Needed for sprawls which use metrics
side_connection (
bool
) –arguments (
dict
) – dict with parameters reported by functionget_fields()
lower_bound – data value lower bound
upper_bound – data value upper bound
- Returns
- pydantic model PartSegCore.segmentation.watershed.WatershedSelection[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmSelection
This register contains algorithms for sprawl area from core object.
Show JSON schema
{ "title": "WatershedSelection", "description": "This register contains algorithms for sprawl area from core object.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "values": { "title": "Values", "anyOf": [ { "$ref": "#/definitions/BaseModel" }, { "type": "object" } ] }, "class_path": { "title": "Class Path", "default": "", "type": "string" } }, "required": [ "name", "values" ], "additionalProperties": false, "definitions": { "BaseModel": { "title": "BaseModel", "type": "object", "properties": {} } } }
- Config
extra: str = forbid
- Fields
- Validators
- algorithm()¶
- classmethod construct(_fields_set=None, **values)¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
- Return type
Model
- copy(*, validate=True, **kwargs)¶
Duplicate a model, optionally choose which fields to include, exclude and change.
- Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data
deep – set to True to make a deep copy of the model
- Return type
BaseModel
- Returns
new model instance
- dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False)¶
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
- Return type
DictStrAny
- classmethod from_orm(obj)¶
- Return type
Model
- classmethod get_default()¶
- json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs)¶
Generate a JSON representation of the model, include and exclude arguments as per dict().
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
- Return type
unicode
- classmethod parse_file(path, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)¶
- Return type
Model
- classmethod parse_obj(obj)¶
- Return type
Model
- classmethod parse_raw(b, *, content_type=None, encoding='utf8', proto=None, allow_pickle=False)¶
- Return type
Model
- classmethod register(value, replace=False, old_names=None)¶
Function for registering
AlgorithmDescribeBase
based algorithms :type value:TypeVar
(AlgorithmType
, bound=Type
[AlgorithmDescribeBase
]) :param value: algorithm to register :param replace: replace existing algorithm, be patient with :type old_names:Optional
[List
[str
]] :param old_names: list of old names for registered class- Return type
TypeVar
(AlgorithmType
, bound=Type
[AlgorithmDescribeBase
])
- classmethod schema(by_alias=True, ref_template='#/definitions/{model}')¶
- Return type
DictStrAny
- classmethod schema_json(*, by_alias=True, ref_template='#/definitions/{model}', **dumps_kwargs)¶
- Return type
unicode
- validator update_class_path » class_path¶
- classmethod update_forward_refs(**localns)¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
- Return type
- classmethod validate(value)¶
- Return type
Model
.restartable_segmentation_algorithms¶
- class PartSegCore.segmentation.restartable_segmentation_algorithms.BaseMultiScaleOpening[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.TwoLevelThresholdBaseAlgorithm
,abc.ABC
- class PartSegCore.segmentation.restartable_segmentation_algorithms.BaseThresholdFlowAlgorithm[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.TwoLevelThresholdBaseAlgorithm
,abc.ABC
- class PartSegCore.segmentation.restartable_segmentation_algorithms.BorderRim[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.RestartableAlgorithm
This class wrap the
PartSegCore.mask_partition_utils.BorderRim`
class in segmentation algorithm interface. It allow user to check how rim look with given set of parametersThis algorithm has following parameters:
distance (ConstrainedFloatValue)- Distance
units (Units)- Units
- class PartSegCore.segmentation.restartable_segmentation_algorithms.LowerThresholdAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.OneThresholdAlgorithm
Implementation of lower threshold algorithm. It has same flow like
ThresholdBaseAlgorithm
. The area of interest are voxels from filtered channel with value above the given thresholdThis algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
threshold (AlgorithmDescribeBase)- Threshold
minimum_size (ConstrainedIntValue)- Minimum size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- static threshold_operator(a, b, /)¶
Same as a > b.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.LowerThresholdFlowAlgorithm[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.BaseThresholdFlowAlgorithm
This algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
threshold (AlgorithmDescribeBase)- Threshold
flow_type (AlgorithmDescribeBase)- Flow type
minimum_size (ConstrainedIntValue)- Minimum core size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
remove_object_touching_border (bool)- Remove objects touching border, Remove objects touching border
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- static threshold_operator(a, b, /)¶
Same as a > b.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.LowerThresholdMultiScaleOpening[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.BaseMultiScaleOpening
This algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
minimum_size (ConstrainedIntValue)- Minimum size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
threshold (AlgorithmDescribeBase)- Threshold
mu_mid (AlgorithmDescribeBase)- Mu mid value
step_limits (ConstrainedIntValue)- Limits of Steps
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- static threshold_operator(a, b, /)¶
Same as a > b.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.MaskDistanceSplit(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.RestartableAlgorithm
This class wrap the
PartSegCore.mask_partition_utils.SplitMaskOnPart
class in segmentation algorithm interface. It allow user to check how split look with given set of parametersThis algorithm has following parameters:
num_of_parts (ConstrainedIntValue)- Number of Parts
equal_volume (bool)- Equal Volume, If split should be done in respect of parts volume of parts thickness.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.OneThresholdAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.ThresholdBaseAlgorithm
,abc.ABC
Base class for PartSeg analysis algorithm which apply one threshold. Created for reduce code repetition.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.OtsuSegment[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.RestartableAlgorithm
This algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Noise Removal
components (ConstrainedIntValue)- Number of Components
valley (bool)- Valley emphasis
hist_num (ConstrainedIntValue)- Number of histogram bins
- class PartSegCore.segmentation.restartable_segmentation_algorithms.RangeThresholdAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.ThresholdBaseAlgorithm
Implementation of upper threshold algorithm. It has same flow like
ThresholdBaseAlgorithm
. The area of interest are voxels from filtered channel with value between the lower and upper thresholdThis algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
threshold (AlgorithmDescribeBase)- Threshold
minimum_size (ConstrainedIntValue)- Minimum size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
- class PartSegCore.segmentation.restartable_segmentation_algorithms.RestartableAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.algorithm_base.ROIExtractionAlgorithm
,abc.ABC
Base class for restartable segmentation algorithm. The idea is to store two copies of algorithm parameters and base on difference check from which point restart the calculation.
- Variables
- class PartSegCore.segmentation.restartable_segmentation_algorithms.ThresholdBaseAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.RestartableAlgorithm
,abc.ABC
Base class for most threshold Algorithm implemented in PartSeg analysis. Created for reduce code repetition.
- get_additional_layers(full_segmentation=None)[source]¶
Create dict with standard additional layers.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.TwoLevelThresholdBaseAlgorithm[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.ThresholdBaseAlgorithm
,abc.ABC
- class PartSegCore.segmentation.restartable_segmentation_algorithms.UpperThresholdAlgorithm(**kwargs)[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.OneThresholdAlgorithm
Implementation of upper threshold algorithm. It has same flow like
ThresholdBaseAlgorithm
. The area of interest are voxels from filtered channel with value below the given thresholdThis algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
threshold (AlgorithmDescribeBase)- Threshold
minimum_size (ConstrainedIntValue)- Minimum size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- static threshold_operator(a, b, /)¶
Same as a < b.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.UpperThresholdFlowAlgorithm[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.BaseThresholdFlowAlgorithm
This algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
threshold (AlgorithmDescribeBase)- Threshold
flow_type (AlgorithmDescribeBase)- Flow type
minimum_size (ConstrainedIntValue)- Minimum core size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
remove_object_touching_border (bool)- Remove objects touching border, Remove objects touching border
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- static threshold_operator(a, b, /)¶
Same as a < b.
- class PartSegCore.segmentation.restartable_segmentation_algorithms.UpperThresholdMultiScaleOpening[source]¶
Bases:
PartSegCore.segmentation.restartable_segmentation_algorithms.BaseMultiScaleOpening
This algorithm has following parameters:
channel (Channel)- Channel
noise_filtering (AlgorithmDescribeBase)- Filter
minimum_size (ConstrainedIntValue)- Minimum size (px)
side_connection (bool)- Connect only sides, During calculation of connected components includes only side by side connected pixels
threshold (AlgorithmDescribeBase)- Threshold
mu_mid (AlgorithmDescribeBase)- Mu mid value
step_limits (ConstrainedIntValue)- Limits of Steps
- classmethod get_name()[source]¶
Algorithm name. It will be used during interface generating and in registering to proper
PartSeg.PartSegCore.algorithm_describe_base.Register
.- Returns
name of algorithm
- static threshold_operator(a, b, /)¶
Same as a < b.
.threshold¶
- class PartSegCore.segmentation.threshold.BaseThreshold[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmDescribeBase
,abc.ABC
- class PartSegCore.segmentation.threshold.DoubleOtsu[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
This algorithm has following parameters:
valley (bool)- Valley emphasis
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.DoubleThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
This algorithm has following parameters:
core_threshold (AlgorithmDescribeBase)- Core threshold
base_threshold (AlgorithmDescribeBase)- Base threshold
- pydantic model PartSegCore.segmentation.threshold.DoubleThresholdSelection[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmSelection
Show JSON schema
{ "title": "DoubleThresholdSelection", "description": "Base class for algorithm selection.\nFor given algorithm there should be Register instance set __register__ class variable.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "values": { "title": "Values", "anyOf": [ { "$ref": "#/definitions/BaseModel" }, { "type": "object" } ] }, "class_path": { "title": "Class Path", "default": "", "type": "string" } }, "required": [ "name", "values" ], "additionalProperties": false, "definitions": { "BaseModel": { "title": "BaseModel", "type": "object", "properties": {} } } }
- Config
extra: str = forbid
- Fields
- Validators
- class PartSegCore.segmentation.threshold.HuangThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.IntermodesThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.IsoDataThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.KittlerIllingworthThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.LiThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.ManualThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
This algorithm has following parameters:
threshold (ConstrainedFloatValue)- Threshold, Threshold values
- class PartSegCore.segmentation.threshold.MaximumDistanceCore[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
This Is algorithm intended to bue used in “* threshold with watershed” algorithms. It generates array with three values:
0 - background,
1 - area to watershed,
2 - core objects to start watershed from
This algorithm is developed to make possible split of almost convex objects that are touching each other. Core objects are identified as local maxima of distance from the border.
To perform this task the following steps are performed:
Thresholding - to detect whole area of objects. This is controlled by
threshold
parameter.Remove small objects - to remove small objects. This is controlled by ``minimum_size` parameter.
Small objects close - to merge small objects. As distance transform is used, it is required small holes. This steep closes holes smaller tan 10px.
Distance transform - to find distance from the border
Identify local maxima - to find core objects
Remove local maxima that are too close to the border - to avoid artifacts. This distance is controlled by
minimum_border_distance
parameter.Dilate core objects - to make them bigger. For elongated objects it is possible to have multiple local maxima along longest axis of object. This step is to merge them. This distance is controlled by
dilate_radius
parameter.
This is algorithm that detect core objects
This algorithm has following parameters:
threshold (AlgorithmDescribeBase)- Threshold
dilate_radius (ConstrainedIntValue)- Dilate Radius, To merge small objects
minimum_size (ConstrainedIntValue)- Minimum Size, To remove small objects
minimum_border_distance (ConstrainedIntValue)- Border Radius, Minimum distance of local maxima from the border. To avoid artifacts
- class PartSegCore.segmentation.threshold.MaximumEntropyThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.MomentsThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.MultipleOtsu[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
This algorithm has following parameters:
components (ConstrainedIntValue)- Number of Components
lower_component (ConstrainedIntValue)- Lower Component
upper_component (ConstrainedIntValue)- Upper Component
valley (bool)- Valley emphasis
bins (ConstrainedIntValue)- Number of histogram bins
- class PartSegCore.segmentation.threshold.MultipleOtsuThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
This algorithm has following parameters:
components (ConstrainedIntValue)- Number of Components
border_component (ConstrainedIntValue)- Border Component
valley (bool)- Valley emphasis
bins (ConstrainedIntValue)- Number of histogram bins
- class PartSegCore.segmentation.threshold.OtsuThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.RangeThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.DoubleThreshold
This algorithm has following parameters:
core_threshold (AlgorithmDescribeBase)- Upper threshold
base_threshold (AlgorithmDescribeBase)- Lower threshold
- pydantic model PartSegCore.segmentation.threshold.RangeThresholdSelection[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmSelection
Show JSON schema
{ "title": "RangeThresholdSelection", "description": "Base class for algorithm selection.\nFor given algorithm there should be Register instance set __register__ class variable.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "values": { "title": "Values", "anyOf": [ { "$ref": "#/definitions/BaseModel" }, { "type": "object" } ] }, "class_path": { "title": "Class Path", "default": "", "type": "string" } }, "required": [ "name", "values" ], "additionalProperties": false, "definitions": { "BaseModel": { "title": "BaseModel", "type": "object", "properties": {} } } }
- Config
extra: str = forbid
- Fields
- Validators
- class PartSegCore.segmentation.threshold.RenyiEntropyThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.ShanbhagThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.SitkThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.BaseThreshold
,abc.ABC
- pydantic model PartSegCore.segmentation.threshold.ThresholdSelection[source]¶
Bases:
PartSegCore.algorithm_describe_base.AlgorithmSelection
Show JSON schema
{ "title": "ThresholdSelection", "description": "Base class for algorithm selection.\nFor given algorithm there should be Register instance set __register__ class variable.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "values": { "title": "Values", "anyOf": [ { "$ref": "#/definitions/BaseModel" }, { "type": "object" } ] }, "class_path": { "title": "Class Path", "default": "", "type": "string" } }, "required": [ "name", "values" ], "additionalProperties": false, "definitions": { "BaseModel": { "title": "BaseModel", "type": "object", "properties": {} } } }
- Config
extra: str = forbid
- Fields
- Validators
- class PartSegCore.segmentation.threshold.TriangleThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins
- class PartSegCore.segmentation.threshold.YenThreshold[source]¶
Bases:
PartSegCore.segmentation.threshold.SitkThreshold
This algorithm has following parameters:
apply_mask (bool)- Apply mask, If apply mask before calculate threshold
bins (ConstrainedIntValue)- Histogram bins