class_docstr: This class keeps record of the currently cached image,
  initialised as all zeros, and the values are replaced
  by image window data decoded from batch.
class_docstr_tok: ["This","class","keeps","record","of","the","currently","cached","image",",","initialised","as","all","zeros",",","and","the","values","are","replaced","by","image","window","data","decoded","from","batch","."]
docstr: Initialise an empty image in which to populate the output
  :param image_id: image_id to be used in the reader
  :param n_channels: numbers of channels of the saved output (for
  multimodal output)
  :param dtype: datatype used for the saving
  :return: the initialised empty image
docstr_tok: ["Initialise","an","empty","image","in","which","to","populate","the","output",":","param","image_id",":","image_id","to","be","used","in","the","reader",":","param","n_channels",":","numbers","of","channels","of","the","saved","output","(","for","multimodal","output",")",":","param","dtype",":","datatype","used","for","the","saving",":","return",":","the","initialised","empty","image"]
code: def _initialise_empty_image(
      self, image_id, n_channels, dtype=np.float
  ):
      """
      Initialise an empty image in which to populate the output
      :param image_id: image_id to be used in the reader
      :param n_channels: numbers of channels of the saved output (for
      multimodal output)
      :param dtype: datatype used for the saving
      :return: the initialised empty image
      """
      self.image_id = image_id
      spatial_shape = self.input_image[self.name].shape[:3]
      output_image_shape = spatial_shape + (n_channels,)
      empty_image = np.zeros(output_image_shape, dtype=dtype)
      for layer in self.reader.preprocessors:
          if isinstance(layer, PadLayer):
              empty_image, _ = layer(empty_image)
  
      if self.fill_constant != 0.0:
          empty_image[:] = self.fill_constant
  
      return empty_image
  
file_path: NiftyNet/niftynet/engine/windows_aggregator_grid.py
imports: from __future__ import absolute_import, division, print_function
  import os
  from collections import OrderedDict
  import numpy
  import pandas
  import niftynet.io.misc_io
  from niftynet.engine.windows_aggregator_base import ImageWindowsAggregator
  from niftynet.layer.discrete_label_normalisation import DiscreteLabelNormalisationLayer
  from niftynet.layer.pad import PadLayer
label_desc: Use image node_id 3 for calling the GridSamplesAggregator obj's underlying member method code with example usage: obj._initialise_empty_image(image_id, n_channels, dtype) and returns: empty_image