N2V Manipulate
N2V manipulation transform for PyTorch.
N2VManipulate
Default augmentation for the N2V model.
This transform expects C(Z)YX dimensions.
Parameters:
-
n2v_manipulate_config(N2VManipulateConfig) –N2V manipulation configuration.
-
device(str, default:None) –The device on which operations take place, e.g. "cuda", "cpu" or "mps".
Attributes:
-
masked_pixel_percentage(float) –Percentage of pixels to mask.
-
roi_size(int) –Size of the replacement area.
-
strategy(Literal[uniform, median]) –Replacement strategy, uniform or median.
-
remove_center(bool) –Whether to remove central pixel from patch.
-
struct_mask(Optional[StructMaskParameters]) –StructN2V mask parameters.
-
rng(Generator) –Random number generator.
__call__(batch, *args, **kwargs)
Apply the transform to the image.
Parameters:
-
batch(Tensor) –Batch if image patches, 2D or 3D, shape BC(Z)YX.
-
*args(Any, default:()) –Additional arguments, unused.
-
**kwargs(Any, default:{}) –Additional keyword arguments, unused.
Returns:
-
tuple[Tensor, Tensor, Tensor]–Masked patch, original patch, and mask.
__init__(n2v_manipulate_config, device=None)
Constructor.
Parameters:
-
n2v_manipulate_config(N2VManipulateConfig) –N2V manipulation configuration.
-
device(str, default:None) –The device on which operations take place, e.g. "cuda", "cpu" or "mps".