PartSegCore.mask.io_functions¶
- class PartSegCore.mask.io_functions.LoadROI[source]¶
Bases:
LoadBase
Load ROI segmentation data.
- 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 load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]¶
Function for load data
- Parameters:
load_locations (
List
[Union
[str
,BytesIO
,Path
]]) – list of files to loadrange_changed (
Optional
[Callable
[[int
,int
],Any
]]) – callback function for inform about number of steps to be donestep_changed (
Optional
[Callable
[[int
],Any
]]) – callback function for report that single step has been donemetadata (
Optional
[dict
]) – additional information needed by function. Like default spacing for load image
- Return type:
- Returns:
Project info or list of project info
- class PartSegCore.mask.io_functions.LoadROIFromTIFF[source]¶
Bases:
LoadBase
- classmethod get_name()[source]¶
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 load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]¶
Function for load data
- Parameters:
load_locations (
List
[Union
[str
,BytesIO
,Path
]]) – list of files to loadrange_changed (
Optional
[Callable
[[int
,int
],Any
]]) – callback function for inform about number of steps to be donestep_changed (
Optional
[Callable
[[int
],Any
]]) – callback function for report that single step has been donemetadata (
Optional
[dict
]) – additional information needed by function. Like default spacing for load image
- Return type:
- Returns:
Project info or list of project info
- class PartSegCore.mask.io_functions.LoadROIImage[source]¶
Bases:
LoadBase
Load ROI segmentation and image which is pointed in.
- 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 load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]¶
Function for load data
- Parameters:
load_locations (
List
[Union
[str
,BytesIO
,Path
]]) – list of files to loadrange_changed (
Optional
[Callable
[[int
,int
],Any
]]) – callback function for inform about number of steps to be donestep_changed (
Optional
[Callable
[[int
],Any
]]) – callback function for report that single step has been donemetadata (
Optional
[dict
]) – additional information needed by function. Like default spacing for load image
- Return type:
- Returns:
Project info or list of project info
- class PartSegCore.mask.io_functions.LoadROIParameters[source]¶
Bases:
LoadBase
Load parameters of ROI segmentation. From segmentation file or from json
- 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 load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]¶
Function for load data
- Parameters:
load_locations (
List
[Union
[str
,BytesIO
,Path
]]) – list of files to loadrange_changed (
Optional
[Callable
[[int
,int
],Any
]]) – callback function for inform about number of steps to be donestep_changed (
Optional
[Callable
[[int
],Any
]]) – callback function for report that single step has been donemetadata (
Optional
[dict
]) – additional information needed by function. Like default spacing for load image
- Return type:
- Returns:
Project info or list of project info
- class PartSegCore.mask.io_functions.LoadStackImage[source]¶
Bases:
LoadBase
Load image from standard microscopy images
- 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 load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]¶
Function for load data
- Parameters:
load_locations (
List
[Union
[str
,BytesIO
,Path
]]) – list of files to loadrange_changed (
Optional
[Callable
[[int
,int
],Any
]]) – callback function for inform about number of steps to be donestep_changed (
Optional
[Callable
[[int
],Any
]]) – callback function for report that single step has been donemetadata (
Optional
[dict
]) – additional information needed by function. Like default spacing for load image
- Return type:
- Returns:
Project info or list of project info
- class PartSegCore.mask.io_functions.LoadStackImageWithMask[source]¶
Bases:
LoadBase
Load image, then mask from secondary file
- classmethod get_name()[source]¶
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 load(load_locations, range_changed=None, step_changed=None, metadata=None)[source]¶
Function for load data
- Parameters:
load_locations (
List
[Union
[str
,BytesIO
,Path
]]) – list of files to loadrange_changed (
Optional
[Callable
[[int
,int
],Any
]]) – callback function for inform about number of steps to be donestep_changed (
Optional
[Callable
[[int
],Any
]]) – callback function for report that single step has been donemetadata (
Optional
[dict
]) – additional information needed by function. Like default spacing for load image
- Return type:
- Returns:
Project info or list of project info
- class PartSegCore.mask.io_functions.MaskProjectTuple(file_path, image, mask=None, roi_info=<factory>, additional_layers=<factory>, selected_components=<factory>, roi_extraction_parameters=<factory>, history=<factory>, errors='', spacing=None, points=None, frame_thickness=2)[source]¶
Bases:
ProjectInfoBase
Dataclass instance to describe segmentation state
- Variables:
file_path (str) – path to current processed file
~.image (Union[Image,str,None]) – image which is proceeded in given segmentation. If
str
then it is path to image on drive~.mask (Optional[np.ndarray]) – Mask limiting segmentation area.
~.roi_info (SegmentationInfo) – ROI information.
~.roi_info – ROI description
~.selected_components (List[int]) – list of selected components
~.segmentation_parameters (Dict[int,Optional[SegmentationProfile]]) – For each component description set of parameters used for segmentation
history (List[HistoryElement]) – list of operations needed to create
mask
~.errors (str) – information about problems meet during calculation
~.spacing (Optional[List[float]]) – information about spacing when image is missed. For napari read plugin
- class PartSegCore.mask.io_functions.SaveComponents[source]¶
Bases:
SaveBase
Save selected components in separated files.
This algorithm has following parameters:
frame (int)- Frame, How many pixels around bounding box of ROI should be saved
mask_data (bool)- Keep data outside ROI, If not checked then data outside ROI will be replaced with zeros.
- classmethod get_name()[source]¶
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 save(cls, save_location, project_info, parameters, range_changed=None, step_changed=None)[source]¶
- Parameters:
save_location (
Union
[str
,BytesIO
,Path
]) – location to save, can be bufferproject_info (
MaskProjectTuple
) – all project dataparameters (
SaveComponentsOptions
) – additional parameters for saving methodrange_changed – report function for inform about steps num
step_changed – report function for progress
- class PartSegCore.mask.io_functions.SaveComponentsImagej[source]¶
Bases:
SaveBase
This algorithm has following parameters:
frame (int)- Frame, How many pixels around bounding box of ROI should be saved
mask_data (bool)- Keep data outside ROI, If not checked then data outside ROI will be replaced with zeros.
- classmethod get_name()[source]¶
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 save(cls, save_location, project_info, parameters, range_changed=None, step_changed=None)[source]¶
- Parameters:
save_location (
Union
[str
,BytesIO
,Path
]) – location to save, can be bufferproject_info (
MaskProjectTuple
) – all project dataparameters (
SaveComponentsOptions
) – additional parameters for saving methodrange_changed – report function for inform about steps num
step_changed – report function for progress
- pydantic model PartSegCore.mask.io_functions.SaveComponentsOptions[source]¶
Bases:
BaseModel
Show JSON schema
{ "title": "SaveComponentsOptions", "type": "object", "properties": { "frame": { "default": 0, "description": "How many pixels around bounding box of ROI should be saved", "title": "Frame", "type": "integer" }, "mask_data": { "default": false, "description": "If not checked then data outside ROI will be replaced with zeros.", "title": "Keep data outside ROI", "type": "boolean" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields:
- class PartSegCore.mask.io_functions.SaveParametersJSON[source]¶
Bases:
SaveBase
Save parameters of roi mask segmentation
- classmethod get_fields()[source]¶
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
.- Return type:
- Returns:
name of algorithm
- classmethod save(save_location, project_info, parameters=None, range_changed=None, step_changed=None)[source]¶
- Parameters:
project_info (
Union
[ROIExtractionProfile
,MaskProjectTuple
]) – data to save in json fileparameters (
Optional
[dict
]) – Not used, keep for satisfy interfacerange_changed – Not used, keep for satisfy interface
step_changed – Not used, keep for satisfy interface
- Returns:
- class PartSegCore.mask.io_functions.SaveROI[source]¶
Bases:
SaveBase
Save current ROI as a project
This algorithm has following parameters:
relative_path (bool)- Relative Path in segmentation, Use relative path to image in segmentation file
mask_data (bool)- Keep data outside ROI, When loading data in ROI analysis, if not checked then data outside ROI will be replaced with zeros.
frame_thickness (int)- Frame thickness, Thickness of frame around ROI
- 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 save(cls, save_location, project_info, parameters, range_changed=None, step_changed=None)[source]¶
- Parameters:
save_location (
Union
[str
,BytesIO
,Path
]) – location to save, can be bufferproject_info (
MaskProjectTuple
) – all project dataparameters (
SaveROIOptions
) – additional parameters for saving methodrange_changed – report function for inform about steps num
step_changed – report function for progress
- pydantic model PartSegCore.mask.io_functions.SaveROIOptions[source]¶
Bases:
BaseModel
Show JSON schema
{ "title": "SaveROIOptions", "type": "object", "properties": { "relative_path": { "default": true, "description": "Use relative path to image in segmentation file", "title": "Relative Path\nin segmentation", "type": "boolean" }, "mask_data": { "default": false, "description": "When loading data in ROI analysis, if not checked then data outside ROI will be replaced with zeros.", "title": "Keep data outside ROI", "type": "boolean" }, "frame_thickness": { "default": 2, "description": "Thickness of frame around ROI", "title": "Frame thickness", "type": "integer" }, "spacing": { "default": [ 1e-06, 1e-06, 1e-06 ], "hidden": true, "items": { "type": "number" }, "title": "Spacing", "type": "array" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields: