class_docstr: This class generates samples using the coordinates of the centre as
  extracted from a csv file
  
  This layer can be considered as a "guided cropping" layer of the
  input image based on preselected input.
class_docstr_tok: ["This","class","generates","samples","using","the","coordinates","of","the","centre","as","extracted","from","a","csv","file","This","layer","can","be","considered","as","a","``","guided","cropping","''","layer","of","the","input","image","based","on","preselected","input","."]
code: def transform_centres(self, subject_id, img_sizes, windows_centres):
      # For the moment assuming that same img size and orientations across
      # modalities
      list_mod = list(img_sizes.keys())
  
      print(list_mod)
      idx_subject_id = np.where(
          self.reader._file_list.subject_id == subject_id
      )[0][0]
      input_shape = self.reader.output_list[idx_subject_id][
          list_mod[0]
      ].original_shape[:N_SPATIAL]
      output_shape = self.reader.output_list[idx_subject_id][
          list_mod[0]
      ].shape[:N_SPATIAL]
      init_axcodes = self.reader.output_list[idx_subject_id][
          list_mod[0]
      ].original_axcodes
  
      fin_axcodes = self.reader.output_list[idx_subject_id][
          list_mod[0]
      ].output_axcodes
      print(output_shape, init_axcodes[0], fin_axcodes[0])
      transformed_centres, ornt_transf = do_reorientation_idx(
          windows_centres, init_axcodes[0], fin_axcodes[0], input_shape
      )
  
      transformed_centres = np.squeeze(
          transformed_centres.astype(np.int32)
      )
  
      # then taking care of change in pixdim
      input_pixdim = self.reader.output_list[idx_subject_id][
          list_mod[0]
      ].original_pixdim[0]
      output_pixdim = self.reader.output_list[idx_subject_id][
          list_mod[0]
      ].output_pixdim[0]
      reorder_axes = np.squeeze(
          np.asarray(ornt_transf[:, 0]).astype(np.int32)
      )
      print(
          "found pixdim to change",
          input_pixdim,
          output_pixdim,
          reorder_axes,
      )
      input_pixdim_no = [input_pixdim[r] for r in reorder_axes]
      transformed_centres = do_resampling_idx(
          transformed_centres, input_pixdim_no, output_pixdim
      )
  
      if transformed_centres.ndim == 1:
          transformed_centres = np.expand_dims(transformed_centres, 0)
  
      padding = (
          np.asarray(img_sizes[list_mod[0]][:N_SPATIAL])
          - np.asarray(output_shape)
      ) / 2.0
      padding = padding.astype(np.int32)
      print(transformed_centres.shape, padding.shape)
      transformed_centres += np.tile(
          np.expand_dims(padding, 0), [len(windows_centres), 1]
      )
      return transformed_centres
  
file_path: NiftyNet/niftynet/contrib/csv_reader/sampler_csvpatch.py
imports: from __future__ import absolute_import, division, print_function
  import numpy
  import tensorflow
  from niftynet.contrib.csv_reader.sampler_csv_rows import ImageWindowDatasetCSV
  from niftynet.engine.image_window import N_SPATIAL, LOCATION_FORMAT
  from niftynet.io.misc_io import do_reorientation_idx, do_resampling_idx
label_desc: Use image node_id 4 for calling the CSVPatchSampler obj's underlying member method code with example usage: obj.transform_centres(subject_id, img_sizes, windows_centres) and returns: transformed_centres