mipcandy.common.module.preprocess#

Module Contents#

Classes#

Functions#

API#

mipcandy.common.module.preprocess.reverse_paddings(paddings: mipcandy.types.Paddings) mipcandy.types.Paddings[source]#
class mipcandy.common.module.preprocess.Pad(*, value: int = 0, mode: str = 'constant', batch: bool = True)[source]#

Bases: torch.nn.Module

static _c_t(size: int, min_factor: int) int[source]#

Compute target on a single dimension

static _c_p(size: int, min_factor: int) tuple[int, int][source]#

Compute padding on a single dimension

class mipcandy.common.module.preprocess.Pad2d(min_factor: int | mipcandy.types.Shape2d, *, value: int = 0, mode: str = 'constant', batch: bool = True)[source]#

Bases: mipcandy.common.module.preprocess.Pad

paddings() mipcandy.types.Paddings2d | None[source]#
padded_shape(in_shape: tuple[int, int, ...]) tuple[int, int, ...][source]#
forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.Pad3d(min_factor: int | mipcandy.types.Shape3d, *, value: int = 0, mode: str = 'constant', batch: bool = True)[source]#

Bases: mipcandy.common.module.preprocess.Pad

paddings() mipcandy.types.Paddings3d | None[source]#
padded_shape(in_shape: tuple[int, int, int, ...]) tuple[int, int, int, ...][source]#
forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.Restore2d(conjugate_padding: mipcandy.common.module.preprocess.Pad2d)[source]#

Bases: torch.nn.Module

forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.Restore3d(conjugate_padding: mipcandy.common.module.preprocess.Pad3d)[source]#

Bases: torch.nn.Module

forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.PadTo(min_shape: mipcandy.types.Shape, *, value: int = 0, mode: str = 'constant', batch: bool = True)[source]#

Bases: mipcandy.common.module.preprocess.Pad

forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.Normalize(*, domain: tuple[float | None, float | None] = (0, None), strict: bool = False, method: Literal[linear, intercept, cut, zscore] = 'linear')[source]#

Bases: torch.nn.Module

forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.CTNormalize(mean_intensity: float, std_intensity: float, lower_bound: float, upper_bound: float)[source]#

Bases: torch.nn.Module

forward(x: torch.Tensor) torch.Tensor[source]#
class mipcandy.common.module.preprocess.ColorizeLabel(*, colormap: mipcandy.types.Colormap | None = None, batch: bool = True)[source]#

Bases: torch.nn.Module

forward(x: torch.Tensor) torch.Tensor[source]#