Skip to content

Overview

torch-cryoeraser is a Python package for erasing local regions of cryo-EM images in PyTorch.

Image data in masked regions are replaced with noise matching local image statistics.

Installation

pip install torch-cryoeraser

Usage

import torch
import tifffile
from torch_cryoeraser import erase_region_2d

# load image and mask
image = tifffile.imread("image.tif")
mask = tifffile.imread("mask.tif")

# to torch tensor
image = torch.tensor(image)
mask = torch.tensor(mask)

# erase masked regions
erased_image = erase_region_2d(image=image, mask=mask)