class_docstr: Each window is associated with a tuple of coordinates.
  These data properties are used to create TF
  placeholders or ``tf.data.Dataset`` when constructing a TF graph.
  Sampler read the data specifications and fill the placeholder/dataset.
class_docstr_tok: ["Each","window","is","associated","with","a","tuple","of","coordinates",".","These","data","properties","are","used","to","create","TF","placeholders","or","``","tf.data.Dataset","``","when","constructing","a","TF","graph",".","Sampler","read","the","data","specifications","and","fill","the","placeholder\/dataset","."]
docstr: Create a window instance with input data properties
  each property is grouped into dict, with pairs of
  image_name: data_value. Some input images is a
  concatenated data array from multiple data sources.
  example of input::
  
      source_names={
          'image': (u'modality1', u'modality2'),
          'label': (u'modality3',)},
      image_shapes={
          'image': (192, 160, 192, 1, 2),
          'label': (192, 160, 192, 1, 1)},
      image_dtypes={
          'image': tf.float32,
          'label': tf.float32},
      window_sizes={
          'image': (10, 10, 2),
          'label': (10, 10, 2)}
  
  the ``window_sizes`` can also be::
  
      window_sizes={
          'modality1': (10, 10, 2),
          'modality3': (10, 10, 2)}
  
  or using a nested dictionary with 'spatial_window_size' (deprecating)::
  
      window_sizes={
          'modality1': {'spatial_window_size': (10, 10, 2)},
          'modality2': {'spatial_window_size': (10, 10, 2)},
          'modality3': {'spatial_window_size': (5, 5, 1)}}
  
  see ``niftynet.io.ImageReader`` for more details.
  
  :param source_names: input image names
  :param image_shapes: tuple of image window shapes
  :param image_dtypes: tuple of image window data types
  :param window_sizes: window sizes for the image image
  :param allow_dynamic: if True, window_sizes negative or 0 indicates
      dynamic window sizes; . Otherwise the dynamic sizes will be fixed
      as the image shapes; this assumes the same image size across the
      dataset.
  :return: an ImageWindow instance
docstr_tok: ["Create","a","window","instance","with","input","data","properties","each","property","is","grouped","into","dict",",","with","pairs","of","image_name",":","data_value",".","Some","input","images","is","a","concatenated","data","array","from","multiple","data","sources",".","example","of","input",":",":","source_names=","{","'image","'",":","(","u'modality1","'",",","u'modality2","'",")",",","'label","'",":","(","u'modality3","'",",",")","}",",","image_shapes=","{","'image","'",":","(","192",",","160",",","192",",","1",",","2",")",",","'label","'",":","(","192",",","160",",","192",",","1",",","1",")","}",",","image_dtypes=","{","'image","'",":","tf.float32",",","'label","'",":","tf.float32","}",",","window_sizes=","{","'image","'",":","(","10",",","10",",","2",")",",","'label","'",":","(","10",",","10",",","2",")","}","the","``","window_sizes","``","can","also","be",":",":","window_sizes=","{","'modality1","'",":","(","10",",","10",",","2",")",",","'modality3","'",":","(","10",",","10",",","2",")","}","or","using","a","nested","dictionary","with","'spatial_window_size","'","(","deprecating",")",":",":","window_sizes=","{","'modality1","'",":","{","'spatial_window_size","'",":","(","10",",","10",",","2",")","}",",","'modality2","'",":","{","'spatial_window_size","'",":","(","10",",","10",",","2",")","}",",","'modality3","'",":","{","'spatial_window_size","'",":","(","5",",","5",",","1",")","}","}","see","``","niftynet.io.ImageReader","``","for","more","details",".",":","param","source_names",":","input","image","names",":","param","image_shapes",":","tuple","of","image","window","shapes",":","param","image_dtypes",":","tuple","of","image","window","data","types",":","param","window_sizes",":","window","sizes","for","the","image","image",":","param","allow_dynamic",":","if","True",",","window_sizes","negative","or","0","indicates","dynamic","window","sizes",";",".","Otherwise","the","dynamic","sizes","will","be","fixed","as","the","image","shapes",";","this","assumes","the","same","image","size","across","the","dataset",".",":","return",":","an","ImageWindow","instance"]
code: def from_data_reader_properties(
      cls,
      source_names,
      image_shapes,
      image_dtypes,
      window_sizes=None,
      allow_dynamic=False,
  ):
      """
      Create a window instance with input data properties
      each property is grouped into dict, with pairs of
      image_name: data_value. Some input images is a
      concatenated data array from multiple data sources.
      example of input::
  
          source_names={
              'image': (u'modality1', u'modality2'),
              'label': (u'modality3',)},
          image_shapes={
              'image': (192, 160, 192, 1, 2),
              'label': (192, 160, 192, 1, 1)},
          image_dtypes={
              'image': tf.float32,
              'label': tf.float32},
          window_sizes={
              'image': (10, 10, 2),
              'label': (10, 10, 2)}
  
      the ``window_sizes`` can also be::
  
          window_sizes={
              'modality1': (10, 10, 2),
              'modality3': (10, 10, 2)}
  
      or using a nested dictionary with 'spatial_window_size' (deprecating)::
  
          window_sizes={
              'modality1': {'spatial_window_size': (10, 10, 2)},
              'modality2': {'spatial_window_size': (10, 10, 2)},
              'modality3': {'spatial_window_size': (5, 5, 1)}}
  
      see ``niftynet.io.ImageReader`` for more details.
  
      :param source_names: input image names
      :param image_shapes: tuple of image window shapes
      :param image_dtypes: tuple of image window data types
      :param window_sizes: window sizes for the image image
      :param allow_dynamic: if True, window_sizes negative or 0 indicates
          dynamic window sizes; . Otherwise the dynamic sizes will be fixed
          as the image shapes; this assumes the same image size across the
          dataset.
      :return: an ImageWindow instance
      """
      try:
          image_shapes = nest.map_structure_up_to(
              image_dtypes, tuple, image_shapes
          )
      except KeyError:
          tf.logging.fatal("window_sizes wrong format %s", window_sizes)
          raise
      # create ImageWindow instance
      window_instance = cls(shapes=image_shapes, dtypes=image_dtypes)
  
      if not window_sizes:
          # image window sizes not specified, defaulting to image sizes.
          return window_instance
  
      window_instance.set_spatial_shape(window_sizes, source_names)
      if not allow_dynamic:
          full_shape = window_instance.match_image_shapes(image_shapes)
          window_instance.set_spatial_shape(full_shape)
      return window_instance
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import copy
  import numpy
  import tensorflow
  from tensorflow.python.data.util import nest
  from niftynet.utilities.util_common import ParserNamespace
label_desc: Use image node_id 6 for calling the ImageWindow obj's underlying member method code with example usage: obj.from_data_reader_properties(cls, source_names, image_shapes, image_dtypes, window_sizes, allow_dynamic) and returns: window_instance, window_instance