class_docstr: This class generates samples by rescaling
  the whole image to the desired size
  Assuming the reader's output is 5d:
  ``Height x Width x Depth x time x Modality``
class_docstr_tok: ["This","class","generates","samples","by","rescaling","the","whole","image","to","the","desired","size","Assuming","the","reader","'s","output","is","5d",":","``","Height","x","Width","x","Depth","x","time","x","Modality","``"]
docstr: This function generates sampling windows to the input buffer
  image data are from ``self.reader()``.
  
  It first completes window shapes based on image data,
  then resize each image as window and output
  a dictionary (required by input buffer)
  
  :return: output data dictionary ``{'image_modality': data_array}``
docstr_tok: ["This","function","generates","sampling","windows","to","the","input","buffer","image","data","are","from","``","self.reader","(",")","``",".","It","first","completes","window","shapes","based","on","image","data",",","then","resize","each","image","as","window","and","output","a","dictionary","(","required","by","input","buffer",")",":","return",":","output","data","dictionary","``","{","'image_modality","'",":","data_array","}","``"]
code: def layer_op(self, idx=None):
      """
      This function generates sampling windows to the input buffer
      image data are from ``self.reader()``.
  
      It first completes window shapes based on image data,
      then resize each image as window and output
      a dictionary (required by input buffer)
  
      :return: output data dictionary ``{'image_modality': data_array}``
      """
      image_id, data, interp_orders = self.reader(idx=idx)
      image_shapes = dict(
          (name, data[name].shape) for name in self.window.names
      )
      # window shapes can be dynamic, here they
      # are converted to static ones
      # as now we know the image shapes
      static_window_shapes = self.window.match_image_shapes(
          image_shapes
      )
      # for resize sampler the coordinates are not used
      # simply use the spatial dims of the input image
      output_dict = {}
      for name in list(data):
          # prepare output dictionary keys
          coordinates_key = LOCATION_FORMAT.format(name)
          image_data_key = name
  
          output_dict[coordinates_key] = self.dummy_coordinates(
              image_id,
              static_window_shapes[name],
              self.window.n_samples,
          )
          image_array = []
          for _ in range(self.window.n_samples):
              # prepare image data
              image_shape = image_shapes[name]
              window_shape = static_window_shapes[name]
  
              if (
                  image_shape == window_shape
                  or interp_orders[name][0] < 0
              ):
                  # already in the same shape
                  image_window = data[name]
              else:
                  zoom_ratio = [
                      float(p) / float(d)
                      for p, d in zip(window_shape, image_shape)
                  ]
                  image_window = zoom_3d(
                      image=data[name],
                      ratio=zoom_ratio,
                      interp_order=interp_orders[name][0],
                  )
              image_array.append(image_window[np.newaxis, ...])
          if len(image_array) > 1:
              output_dict[image_data_key] = np.concatenate(
                  image_array, axis=0
              )
          else:
              output_dict[image_data_key] = image_array[0]
      # the output image shape should be
      # [enqueue_batch_size, x, y, z, time, modality]
      # here enqueue_batch_size = 1 as we only have one sample
      # per image
      if self.csv_reader is not None:
          _, label_dict, _ = self.csv_reader(idx=image_id)
          output_dict.update(label_dict)
          for name in self.csv_reader.names:
              output_dict[name + "_location"] = output_dict[
                  "image_location"
              ]
      return output_dict
  
file_path: NiftyNet/niftynet/contrib/csv_reader/sampler_resize_v2_csv.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import scipy.ndimage
  import tensorflow
  from niftynet.contrib.csv_reader.sampler_csv_rows import ImageWindowDatasetCSV
  from niftynet.engine.image_window import LOCATION_FORMAT
label_desc: Use image node_id 2 for calling the ResizeSamplerCSV obj's underlying member method code with example usage: obj.layer_op(idx) and returns: output_dict