class_docstr: Creates patches of cells.
  
  Parameters
  ----------
  base_dataset: CellsDataset
      Dataset of cells
  patch_size: tuple of ints (default=(256, 256))
      The size of each patch
  random_flips: bool (default=False)
      If true, patches and masks will be randomly flipped horizontally and
      vertically.
  padding: int (default=16)
      Amount of paddding around each image and mask
class_docstr_tok: ["Creates","patches","of","cells",".","Parameters","--","--","--","--","--","base_dataset",":","CellsDataset","Dataset","of","cells","patch_size",":","tuple","of","ints","(","default=","(","256",",","256",")",")","The","size","of","each","patch","random_flips",":","bool","(","default=False",")","If","true",",","patches","and","masks","will","be","randomly","flipped","horizontally","and","vertically",".","padding",":","int","(","default=16",")","Amount","of","paddding","around","each","image","and","mask"]
code: def __init__(
      self,
      base_dataset,
      patch_size=(256, 256),
      random_flips=False,
      padding=16,
  ):
      super().__init__()
      self.base_dataset = base_dataset
      self.patch_size = patch_size
      self.patch_size_expanded = (
          patch_size[0] + 2 * padding,
          patch_size[1] + 2 * padding,
      )
      self.padding = padding
      self.random_flips = random_flips
  
      coords = []
      for idx, (_, mask) in enumerate(self.base_dataset):
          w, h = mask.size
          bboxes = calcuate_bboxes((h, w), self.patch_size)
          idx_bboxes = list(zip_longest([], bboxes, fillvalue=idx))
          coords.extend(idx_bboxes)
      self.coords = coords
  
file_path: skorch/examples/nuclei_image_segmentation/dataset.py
imports: from itertools import zip_longest, product, chain
  import random
  import numpy
  import torch
  from torch.utils.data import Dataset
  from torchvision.transforms.functional import pad, to_tensor, normalize, hflip, vflip, crop
  from PIL import Image
label_desc: Use image node_id 1 to create a new PatchedDataset object from inherited base classes: Dataset with example: obj = PatchedDataset(base_dataset, patch_size, random_flips, padding)