class_docstr: This dataset extracts patches from whole slide images at the locations where foreground mask
  at a given level is non-zero.
  
  Args:
      data: the list of input samples including image, location, and label (see the note below for more details).
      patch_size: the size of patch to be extracted from the whole slide image.
      patch_level: the level at which the patches to be extracted (default to 0).
      mask_level: the resolution level at which the mask is created.
      transform: transforms to be executed on input data.
      include_label: whether to load and include labels in the output
      center_location: whether the input location information is the position of the center of the patch
      additional_meta_keys: the list of keys for items to be copied to the output metadata from the input data
      reader: the module to be used for loading whole slide imaging. Defaults to cuCIM. If `reader` is
  
          - a string, it defines the backend of `monai.data.WSIReader`.
          - a class (inherited from `BaseWSIReader`), it is initialized and set as wsi_reader,
          - an instance of a class inherited from `BaseWSIReader`, it is set as the wsi_reader.
  
      kwargs: additional arguments to pass to `WSIReader` or provided whole slide reader class
  
  Note:
      The input data has the following form as an example:
  
      .. code-block:: python
  
          [
              {"image": "path/to/image1.tiff"},
              {"image": "path/to/image2.tiff", "size": [20, 20], "level": 2}
          ]
class_docstr_tok: ["This","dataset","extracts","patches","from","whole","slide","images","at","the","locations","where","foreground","mask","at","a","given","level","is","non-zero",".","Args",":","data",":","the","list","of","input","samples","including","image",",","location",",","and","label","(","see","the","note","below","for","more","details",")",".","patch_size",":","the","size","of","patch","to","be","extracted","from","the","whole","slide","image",".","patch_level",":","the","level","at","which","the","patches","to","be","extracted","(","default","to","0",")",".","mask_level",":","the","resolution","level","at","which","the","mask","is","created",".","transform",":","transforms","to","be","executed","on","input","data",".","include_label",":","whether","to","load","and","include","labels","in","the","output","center_location",":","whether","the","input","location","information","is","the","position","of","the","center","of","the","patch","additional_meta_keys",":","the","list","of","keys","for","items","to","be","copied","to","the","output","metadata","from","the","input","data","reader",":","the","module","to","be","used","for","loading","whole","slide","imaging",".","Defaults","to","cuCIM",".","If","`","reader","`","is","-","a","string",",","it","defines","the","backend","of","`","monai.data.WSIReader","`",".","-","a","class","(","inherited","from","`","BaseWSIReader","`",")",",","it","is","initialized","and","set","as","wsi_reader",",","-","an","instance","of","a","class","inherited","from","`","BaseWSIReader","`",",","it","is","set","as","the","wsi_reader",".","kwargs",":","additional","arguments","to","pass","to","`","WSIReader","`","or","provided","whole","slide","reader","class","Note",":","The","input","data","has","the","following","form","as","an","example",":","..","code-block",":",":","python","[","{","``","image","''",":","``","path\/to\/image1.tiff","''","}",",","{","``","image","''",":","``","path\/to\/image2.tiff","''",",","``","size","''",":","[","20",",","20","]",",","``","level","''",":","2","}","]"]
code: def __init__(
      self,
      data: Sequence,
      patch_size: int | tuple[int, int] | None = None,
      patch_level: int | None = None,
      mask_level: int = 7,
      transform: Callable | None = None,
      include_label: bool = False,
      center_location: bool = False,
      additional_meta_keys: Sequence[str] = (
          ProbMapKeys.LOCATION,
          ProbMapKeys.NAME,
      ),
      reader="cuCIM",
      **kwargs,
  ):
      super().__init__(
          data=[],
          patch_size=patch_size,
          patch_level=patch_level,
          transform=transform,
          include_label=include_label,
          center_location=center_location,
          additional_meta_keys=additional_meta_keys,
          reader=reader,
          **kwargs,
      )
  
      self.mask_level = mask_level
      # Create single sample for each patch (in a sliding window manner)
      self.data: list
      self.image_data = list(data)
      for sample in self.image_data:
          patch_samples = self._evaluate_patch_locations(sample)
          self.data.extend(patch_samples)
  
imports: from __future__ import annotations
  import inspect
  import os
  from collections.abc import Callable, Sequence
  import numpy
  import torch
  from monai.data import Dataset
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import iter_patch_position
  from monai.data.wsi_reader import BaseWSIReader, WSIReader
  from monai.transforms import ForegroundMask, Randomizable, apply_transform
  from monai.utils import convert_to_dst_type, ensure_tuple_rep
  from monai.utils.enums import CommonKeys, ProbMapKeys, WSIPatchKeys
label_desc: Use image node_id 1 to create a new MaskedPatchWSIDataset object from inherited base classes: PatchWSIDataset with example: obj = MaskedPatchWSIDataset(data, patch_size, patch_level, mask_level, transform, include_label, center_location, additional_meta_keys, reader)