API Reference [update in progress]
platerecipy.model
File brief
model.py
Module for model object and functions.
This is a part of platerecipy package. For license and citation, please
refer to the main repository:
github.com/pjavaheri/platerecipy
Author(s): Pejvak Javaheri; pejvak.javaheri@mail.utoronto.ca
PlateModel
Bases: object
A class for defining plate detection parameters, field stacking, and performing segmentation.
use_spherical_distance
property
Whether to apply use the great circle angle of separation instead of planar distance transform (i.e., for a SphericalGrid).
wraparound_azimuthally
property
Whether to apply wraparound boundary conditions along phi (i.e., for a SphericalGrid).
__init__(grid)
Create a PlateModel object by initializing it using a Grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
(Grid,)
|
An instance of a grid |
required |
clear_stacked_field()
To reset and clear the stacked field.
find_plates(boundary_quantile=0.9, boundary_absolute=1.0, separation_tolerance=None, num_threads=1, min_marker_size=None, preserve_small_markers=False, manual_markers=None, identify_nonconforming=False, RW_beta=100.0, RW_solver_tolerance=0.001, RW_solver='LU', return_IDs=True)
Applies segmentation on stacked_field and returns an integer array of
the same shape with each cell carrying the plate ID (i.e., segment
number). This function can be called multiple times from the same object
instance as it does not alter stacked_field.
Warning
There are several options that fundamentally alter the way this function works. The user is suggested to carefully read the documentation for all input parameters regardless of their apparent relevance to the specific task at hand.
Warning
If both boundary_quantile and boundary_absolute are specified, a
node qualifies as a possible boundary point so long as it satisfies one
of the two conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
boundary_quantile
|
float
|
The quantile that represents values above which that are presumed to feature plate boundaries. |
0.9
|
boundary_absolute
|
float
|
The absolute value that represents values above which that are presumed to feature plate boundaries. |
1.0
|
separation_tolerance
|
float
|
Whether to use a distance transform and consider regions with
distances less than For a |
None
|
num_threads
|
int
|
Number of threads to use to perform the spherical distance transform. |
1
|
min_marker_size
|
int
|
If provided, watershed markers will be filtered such that markers
with fewer cells/pixels than |
None
|
preserve_small_markers
|
bool
|
Whether to reinstate small markers obscured by by the separation tolerance step. |
False
|
manual_markers
|
ndarray
|
This option ignores all previous arguments relating to marker
specification. Instead, it allows the user to manually provide
a 2D Boolean array of the same shape as |
None
|
identify_non_conforming
|
bool
|
Whether to extract and separately label non-conforming regions defined by featuring a stacked field greater than 0.5 and a ID probability less than 0.5 with ID=0. |
False
|
RW_beta
|
float
|
Gaussian beta parameter for random walker connection weights. This parameter controls the sharpness of the boundaries. |
100.
|
RW_solver_tolerance
|
float
|
Tolerance value for the choice of solver that requires a tolerance
(e.g., if |
1e-3
|
RW_solver
|
str
|
Numerical solver used to obtain an random walker probability solution. Possible choices: 'direct', 'LU', 'CG', or 'FA'. |
'LU'
|
return_IDs
|
bool
|
Whether to return a copy of |
True
|
stack_field(field, invert=False, take_log=False, stack_weight=1.0)
Stack a new field by normalizing the field values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field
|
(ndarray,)
|
The field to be stacked. |
required |
invert
|
bool
|
If increase in input |
False,
|
take_log
|
bool
|
If the input |
False,
|
stack_weight
|
float
|
The corresponding weight when stacked (between 0 and 1). |
1.,
|