bscan_image_and_mask_generation_algorithm
Algorithms and related functionality for simply outputting data to CSV.
Classes
BscanImageAndMaskGenerationAlgorithm
class BscanImageAndMaskGenerationAlgorithm( datastructure: DataStructure, segmentation_configs: list[SegmentationConfig], save_path: Optional[Union[str, os.PathLike]] = None, output_original_bscans: bool = False, **kwargs: Any,):
Algorithm that outputs images of B-scans alongside their segmentation masks.
Initializes the BscanImageAndMaskGenerationAlgorithm.
Arguments
datastructure
: DataStructure object describing the data.segmentation_configs
: List of segmentation configurations.save_path
: Optional path to save output images and masks.output_original_bscans
: Flag to save original B-scans.- **
**kwargs
**: Additional keyword arguments for the base class.
Ancestors
- BaseNonModelAlgorithmFactory
- BaseAlgorithmFactory
- abc.ABC
- bitfount.federated.roles._RolesMixIn
- bitfount.types._BaseSerializableObjectMixIn
Variables
- static
fields_dict : ClassVar[dict[str, marshmallow.fields.Field]]
- static
save_path : pathlib.Path
Methods
modeller
def modeller( self, **kwargs: Any,) ‑> NoResultsModellerAlgorithm:
Returns the modeller-side of the algorithm.
Arguments
- **
**kwargs
**: Additional keyword arguments.
Returns NoResultsModellerAlgorithm instance.
worker
def worker( self, **kwargs: Any,) ‑> bitfount.federated.algorithms.ophthalmology.bscan_image_and_mask_generation_algorithm._WorkerSide:
Returns the worker-side of the algorithm.
Arguments
- **
**kwargs
**: Additional keyword arguments.
Returns _WorkerSide instance.
SegmentationConfig
class SegmentationConfig( id: str, color: tuple[int, int, int], label: Optional[str] = None,):
Configuration for a segmentation mask.
Ancestors
- bitfount.types.UsedForConfigSchemas
Methods
validate_args
def validate_args(self) ‑> None:
Validate a segmentation configuration.
Ensures that given config complies with the expected structure and types. If label is not provided, it defaults to the ID. Checks for color values that adhere to the RGB format.
SegmentationConfigList
class SegmentationConfigList(segmentation_config_list: list[SegmentationConfig]):
Configuration for a list of segmentation masks.
Variables
- static
segmentation_config_list : list[SegmentationConfig]
Methods
get_segmentation_config
def get_segmentation_config( self,) ‑> tuple[dict[str, int], dict[str, tuple[int, int, int]], dict[str, str]]:
Get the segmentation configuration as a tuple of dictionaries.
Returns Tuple of dictionaries containing segmentation labels and colors.
validate_args
def validate_args(self) ‑> None:
Validate the arguments in the segmentation config list.