load_tiff#

deepinv.utils.load_tiff(fname, dtype=None)[source]#

Load image or volume from a TIFF file as a torch tensor.

Integer images are normalized to the range [0, 1] by dividing by the maximum value representable by their dtype; floating point images are loaded as-is. 2D images of shape (H, W) are loaded with a single channel, and 3D arrays of shape (H, W, C) are converted to channel-first (C, H, W). In both cases a leading batch dimension is added.

Warning

Requires tifffile to be installed. Install it with pip install tifffile.

Parameters:
  • fname (str, pathlib.Path) – path to TIFF file or buffer.

  • dtype (torch.dtype) – if not None, cast the output tensor to this dtype.

Returns:

torch.Tensor of shape (1, C, H, W).

Return type:

Tensor

Examples using load_tiff:#

Low-intensity STED fluorescence microscopy denoising

Low-intensity STED fluorescence microscopy denoising