class_docstr: This class generators ND image samples with a sliding window.
code: def __init__(
      self,
      reader,
      csv_reader,
      window_sizes,
      batch_size=1,
      spatial_window_size=None,
      window_border=None,
      queue_length=10,
      smaller_final_batch_mode="pad",
      name="grid_sampler",
  ):
      # override all spatial window defined in input
      # modalities sections
      # this is useful when do inference with a spatial window
      # which is different from the training specifications
      ImageWindowDatasetCSV.__init__(
          self,
          reader=reader,
          csv_reader=csv_reader,
          window_sizes=spatial_window_size or window_sizes,
          batch_size=batch_size,
          windows_per_image=1,
          queue_length=queue_length,
          shuffle=False,
          epoch=1,
          smaller_final_batch_mode=smaller_final_batch_mode,
          name=name,
      )
      self.csv_reader = csv_reader
      self.border_size = window_border or (0, 0, 0)
      assert isinstance(
          self.border_size, (list, tuple)
      ), "window_border should be a list or tuple"
      while len(self.border_size) < N_SPATIAL:
          self.border_size = tuple(self.border_size) + (
              self.border_size[-1],
          )
      self.border_size = self.border_size[:N_SPATIAL]
      tf.logging.info("initialised window instance")
      tf.logging.info("initialised grid sampler %s", self.window.shapes)
  
file_path: NiftyNet/niftynet/contrib/csv_reader/sampler_grid_v2_csv.py
imports: from __future__ import absolute_import, division, print_function
  import numpy
  import tensorflow
  from niftynet.engine.image_window_dataset import ImageWindowDataset
  from niftynet.contrib.csv_reader.sampler_csv_rows import ImageWindowDatasetCSV
  from niftynet.engine.image_window import N_SPATIAL, LOCATION_FORMAT
label_desc: Use image node_id 1 to create a new GridSamplerCSV object from inherited base classes: ImageWindowDatasetCSV with example: obj = GridSamplerCSV(reader, csv_reader, window_sizes, batch_size, spatial_window_size, window_border, queue_length, smaller_final_batch_mode, name)