code: def cut_patches(self):
      # TODO cycle once
      patch_indices = get_valid_indices(
          self.H, self.W, self.patch_size, self.patch_size // 4
      )
      dd = {
          k: cut_patches(v, patch_indices, self.patch_size)
          for k, v in self.data_dict.items()
          if isinstance(v, torch.Tensor)
      }
      threshold = 0.1
      mask_p = torch.mean(
          dd.get("mask", torch.ones_like(dd["input"])), dim=(-1, -2, -3)
      )
      masked_idx = (mask_p > threshold).nonzero(as_tuple=True)[0]
      dd = {k: v[masked_idx] for k, v in dd.items()}
      dd["len"] = len(masked_idx)
      dd["H"], dd["W"] = (self.patch_size,) * 2
  
      return dd
  
imports: from typing import Callable, Dict
  import torch
  from torch.utils.data import Dataset
  import torchvision.transforms.functional
  from torchvision import transforms
  import pytorch_lightning
  from collections.abc import Iterable
  from pathlib import Path
  from PIL import Image
  from typing import Tuple
label_desc: Use image node_id 6 for calling the PatchDataModule obj's underlying member method code with example usage: obj.cut_patches() and returns: dd