class_docstr: This class creates a ``tf.data.Dataset`` instance from
  a sampler's layer_op function or generator.
  
  If ``from_generator``, ``Dataset.from_generator`` interface will be used,
  ``Dataset.map`` interface will be used otherwise::
  
      if the windows are from a image reader,
      the total number of windows produced
      will be: `epoch x n_subjects x windows_per_image`
  
      if the windows are from a generator,
      the total number of windows produced
      will be: "iterations from the generator" x num_threads
class_docstr_tok: ["This","class","creates","a","``","tf.data.Dataset","``","instance","from","a","sampler","'s","layer_op","function","or","generator",".","If","``","from_generator","``",",","``","Dataset.from_generator","``","interface","will","be","used",",","``","Dataset.map","``","interface","will","be","used","otherwise",":",":","if","the","windows","are","from","a","image","reader",",","the","total","number","of","windows","produced","will","be",":","`","epoch","x","n_subjects","x","windows_per_image","`","if","the","windows","are","from","a","generator",",","the","total","number","of","windows","produced","will","be",":","``","iterations","from","the","generator","''","x","num_threads"]
docstr: This function is used when connecting a sampler output
  to a network. e.g.::
  
      data_dict = self.get_sampler()[0].pop_batch_op(device_id)
      net_output = net_model(data_dict['image'], is_training)
  
  .. caution::
  
      Note it squeezes the output tensor of 6 dims
      ``[batch, x, y, z, time, modality]``
      by removing all dims along which length is one.
  
  :return: a dictionary of image window tensors.
docstr_tok: ["This","function","is","used","when","connecting","a","sampler","output","to","a","network",".","e.g",".",":",":","data_dict","=","self.get_sampler","(",")","[","0","]",".pop_batch_op","(","device_id",")","net_output","=","net_model","(","data_dict","[","'image","'","]",",","is_training",")","..","caution",":",":","Note","it","squeezes","the","output","tensor","of","6","dims","``","[","batch",",","x",",","y",",","z",",","time",",","modality","]","``","by","removing","all","dims","along","which","length","is","one",".",":","return",":","a","dictionary","of","image","window","tensors","."]
code: def pop_batch_op(self):
      """
      This function is used when connecting a sampler output
      to a network. e.g.::
  
          data_dict = self.get_sampler()[0].pop_batch_op(device_id)
          net_output = net_model(data_dict['image'], is_training)
  
      .. caution::
  
          Note it squeezes the output tensor of 6 dims
          ``[batch, x, y, z, time, modality]``
          by removing all dims along which length is one.
  
      :return: a dictionary of image window tensors.
      """
  
      if self.dataset is None or self.iterator is None:
          # in case `run_threads` is not called,
          # here we initialise the dataset and iterator
          self.init_dataset()
          self.iterator = self.dataset.make_one_shot_iterator()
          # self.iterator = tf.data.Iterator.from_structure(
          #     self.dataset.output_types, self.dataset.output_shapes)
  
      window_output = self.iterator.get_next()
      for name in window_output:
          window_output[name] = squeeze_spatial_temporal_dim(
              window_output[name]
          )
      return window_output
  
imports: from __future__ import absolute_import, division, print_function
  import inspect
  import numpy
  import tensorflow
  from tensorflow.python.data.util import nest
  from tensorflow.python.keras.utils import GeneratorEnqueuer
  from niftynet.engine.image_window import ImageWindow, N_SPATIAL, LOCATION_FORMAT, BUFFER_POSITION_NP_TYPE
  from niftynet.io.misc_io import squeeze_spatial_temporal_dim
  from niftynet.layer.base_layer import Layer
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 7 for calling the ImageWindowDataset obj's underlying member method code with example usage: obj.pop_batch_op() and returns: window_output