dgbpy.transforms
Module Contents
Classes
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Base class for all transforms. All transforms should inherit from this class. |
|
Applies all the transform from a list to the data. |
|
Helps understand how many times each transform would multiply the data. |
Functions
Attributes
- class dgbpy.transforms.BaseTransform(p=0.2)
Bases:
abc.ABC
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- can_apply(self, info)
Returns True if the transform can be applied to the data.
- abstract transform_label(self, info)
Returns True if the transform should be applied to the label
- abstract transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- __call__(self, image=None, label=None, **kwargs)
This is the main function that is called when the transform is applied.
- class dgbpy.transforms.Flip(p=0.2)
Bases:
BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- set_multiplier(self, info)
- transform_label(self, info)
Returns True if the transform should be applied to the label
- transform_pars(self, inp_shape)
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- class dgbpy.transforms.GaussianNoise(p=0.2, std=0.1)
Bases:
BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform_label(self, info)
Returns True if the transform should be applied to the label
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- dgbpy.transforms.hasOpenCV()
- class dgbpy.transforms.Rotate(p=0.2, angle=15)
Bases:
BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform_label(self, info)
Returns True if the transform should be applied to the label
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- transform_2d(self, arr, angle)
- transform_3d(self, arr, angle)
- class dgbpy.transforms.Translate(p=0.15, percent=20)
Bases:
BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform_label(self, info)
Returns True if the transform should be applied to the label
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- class dgbpy.transforms.FlipPolarity(p=0.2)
Bases:
BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform_label(self, info)
Check if the label should be transformed
- transform(self, arr)
FlipPolarity transform logic
- class dgbpy.transforms.ScaleTransform
Bases:
BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform_label(self, info)
Returns True if the transform should be applied to the label
- class dgbpy.transforms.Normalization
Bases:
ScaleTransform
,BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- class dgbpy.transforms.StandardScaler
Bases:
ScaleTransform
,BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- class dgbpy.transforms.MinMaxScaler
Bases:
ScaleTransform
,BaseTransform
Base class for all transforms. All transforms should inherit from this class. To create a new transform, inherit from this class and implement the transform_label and transform functions.
- Example:
- class MyTransform(BaseTransform):
- def __init__(self, p=0.2):
super().__init__() self.p = p self.multiplier = 1
- def transform_label(self, info):
return dgbhdf5.isImg2Img(info)
- def transform(self, arr):
return arr + 1
- Note:
self.multiplier is used to determine the number of times the transform should be applied. For example, if self.multiplier = 2, then the transform will be applied twice
for cases like Flip that can be done in multiple directions.
- transform(self, arr)
Returns the transformed array. This should hold the logic for the transform.
- dgbpy.transforms.scale_transforms
- dgbpy.transforms.all_transforms
- class dgbpy.transforms.TransformCompose(transforms, info, ndims, create_copy=False)
Applies all the transform from a list to the data.
- set_params(self)
Helps understand how many times each transform would multiply the data.
- set_uniform_generator_seed(self, seed, nsamples)
Sets the seed sample to receive the same type of tranform for each training.
- passModuleCheck(self, transform_i)
Checks if the transform can be applied.
- _readTransforms(self, transforms)
Read and initialize the transforms and checks if they can be applied.
- set_multiplier(self, transforms)
- transformLabel(self)
Checks if the transform can be applied to the label.
- copy_config(self, transform_idx)
Configures the copy method.
- use_copy_method(self, copy_prob)
Checks if the copy method is being used.
- __call__(self, image, label, prob_idx, transform_idx=None)
Applies all the transforms to the data.
- Args:
image: sample label: label prob_idx: index of the current sample used to choose the uniform probability when using seed transform_idx: value to be used for mixed transforms