Conversion Module

class src.bio_volumentations.conversion.transforms.Contiguous(always_apply: bool = True, p: float = 1.0)[source]

Bases: DualTransform

Transform the image data to a contiguous array.

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

image, mask, float mask

apply(image, **params)[source]
apply_to_mask(mask, **params)[source]
class src.bio_volumentations.conversion.transforms.ConversionToFormat(always_apply: bool = True, p: float = 1)[source]

Bases: DualTransform

Check the very basic assumptions about the input images.

Add channel dimension to the 3D images without it. Check that shapes of individual target types are consistent (to some extent).

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

image, mask

apply(volume, **params)[source]
apply_to_float_mask(mask, **params)[source]
apply_to_mask(mask, **params)[source]
class src.bio_volumentations.conversion.transforms.ConvertFromBBoxes(always_apply: bool = True, p: float = 1.0)[source]

Bases: DualTransform

Converts bounding boxes back to the ‘raw data’ format specified previously from the internal BoundingBox classes.

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

bounding_box

apply(volume, **params)[source]
apply_to_bboxes(bboxes, **params)[source]
convert_back(bbox)[source]
class src.bio_volumentations.conversion.transforms.ConvertToBBoxes(bbox_format: str = 'voc', always_apply: bool = True, p: float = 1.0)[source]

Bases: DualTransform

Converts bounding boxes from ‘raw data’ to objects of BoundingBox class.

Parameters:
  • bbox_format (str) –

    Format the bounding boxes are supplied in. Supported formats: ‘voc’, ‘coco’, ‘yolo’, ‘albumentations’.

    Defaults to ‘voc’.

  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

bounding_box

apply(volume, **params)[source]
apply_to_bboxes(bboxes, **params)[source]
get_params(targets, **data)[source]
class src.bio_volumentations.conversion.transforms.KeypointsFixDatatype(always_apply: bool = True, p: float = 1)[source]

Bases: DualTransform

Convert any 2D array-like format of keypoints into a list of tuples containing ints of floats.

The input can be a 2d numpy array, a list of lists, a list of tuples, etc., and individual coordinate values can be of type int, float, or any numpy dtype.

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

key points

apply(volume, **params)[source]
apply_to_keypoints(keypoints, keep_all=False, **params)[source]
class src.bio_volumentations.conversion.transforms.NoConversion(always_apply: bool = True, p: float = 1)[source]

Bases: DualTransform

An identity transform.

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

image, mask

apply(volume, **params)[source]
apply_to_float_mask(mask, **params)[source]
apply_to_mask(mask, **params)[source]
class src.bio_volumentations.conversion.transforms.StandardizeDatatype(always_apply: bool = True, p: float = 1.0)[source]

Bases: DualTransform

Change image and float_mask datatype to np.float32 without changing the intensities. Change mask datatype to np.int32.

Parameters:
  • always_apply (bool, optional) –

    Always apply this transformation in composition.

    Defaults to True.

  • p (float, optional) –

    Probability of applying this transformation in composition.

    Defaults to 1.

Targets:

image, mask, float mask

apply(image, **params)[source]
apply_to_float_mask(mask, **params)[source]
apply_to_mask(mask, **params)[source]