code: def _enumerate_step_points(starting, ending, win_size, step_size):
      """
      generate all possible sampling size in between starting and ending.
  
      :param starting: integer of starting value
      :param ending: integer of ending value
      :param win_size: integer of window length
      :param step_size: integer of distance between two sampling points
      :return: a set of unique sampling points
      """
      try:
          starting = max(int(starting), 0)
          ending = max(int(ending), 0)
          win_size = max(int(win_size), 1)
          step_size = max(int(step_size), 1)
      except (TypeError, ValueError):
          tf.logging.fatal(
              "step points should be specified by integers, received:"
              "%s, %s, %s, %s",
              starting,
              ending,
              win_size,
              step_size,
          )
          raise ValueError
      if starting > ending:
          starting, ending = ending, starting
      sampling_point_set = []
      while (starting + win_size) <= ending:
          sampling_point_set.append(starting)
          starting = starting + step_size
      additional_last_point = ending - win_size
      sampling_point_set.append(max(additional_last_point, 0))
      sampling_point_set = np.unique(sampling_point_set).flatten()
      if len(sampling_point_set) == 2:
          # in case of too few samples, adding
          # an additional sampling point to
          # the middle between starting and ending
          sampling_point_set = np.append(
              sampling_point_set, np.round(np.mean(sampling_point_set))
          )
      _, uniq_idx = np.unique(sampling_point_set, return_index=True)
      return sampling_point_set[np.sort(uniq_idx)]
  
file_path: NiftyNet/niftynet/engine/sampler_grid_v2.py
imports: from __future__ import absolute_import, division, print_function
  import numpy
  import tensorflow
  from niftynet.engine.image_window_dataset import ImageWindowDataset
  from niftynet.engine.image_window import N_SPATIAL, LOCATION_FORMAT
label_desc: Use image node_id 2 for calling a global function with example usage: _enumerate_step_points(starting, ending, win_size, step_size) and returns: sampling_point_set