code: def test_init_2d_mo_3out(self):
      reader = get_2d_reader()
      sampler = GridSampler(
          reader=reader,
          window_sizes=MOD_2D_DATA,
          batch_size=10,
          spatial_window_size=None,
          window_border=(3, 4, 5),
          queue_length=50,
      )
      aggregator = GridSamplesAggregator(
          image_reader=reader,
          name="image",
          output_path=os.path.join("testing_data", "aggregated"),
          window_border=(3, 4, 5),
          interp_order=0,
      )
      more_batch = True
  
      with self.cached_session() as sess:
          sampler.set_num_threads(2)
          while more_batch:
              out = sess.run(sampler.pop_batch_op())
              out_flatten = np.reshape(
                  np.asarray(out["image"]), [10, -1]
              )
              min_val = np.sum(
                  np.reshape(np.asarray(out["image"]), [10, -1]), 1
              )
              stats_val = np.concatenate(
                  [
                      np.min(out_flatten, 1, keepdims=True),
                      np.max(out_flatten, 1, keepdims=True),
                      np.sum(out_flatten, 1, keepdims=True),
                  ],
                  1,
              )
              more_batch = aggregator.decode_batch(
                  {
                      "window_image": out["image"],
                      "csv_sum": min_val,
                      "csv_stats": stats_val,
                  },
                  out["image_location"],
              )
      output_filename = "window_image_{}_niftynet_out.nii.gz".format(
          sampler.reader.get_subject_id(0)
      )
      sum_filename = os.path.join(
          "testing_data",
          "aggregated",
          "csv_sum_{}_niftynet_out.csv".format(
              sampler.reader.get_subject_id(0)
          ),
      )
      stats_filename = os.path.join(
          "testing_data",
          "aggregated",
          "csv_stats_{}_niftynet_out.csv".format(
              sampler.reader.get_subject_id(0)
          ),
      )
      output_file = os.path.join(
          "testing_data", "aggregated", output_filename
      )
  
      self.assertAllClose(nib.load(output_file).shape, (128, 128))
      min_pd = pd.read_csv(sum_filename)
      self.assertAllClose(min_pd.shape, [10, 9])
      stats_pd = pd.read_csv(stats_filename)
      self.assertAllClose(stats_pd.shape, [10, 11])
      sampler.close_all()
  
imports: from __future__ import absolute_import, division, print_function
  import os
  import nibabel
  import tensorflow
  import numpy
  import pandas
  from niftynet.engine.sampler_grid_v2 import GridSampler
  from niftynet.engine.windows_aggregator_grid import GridSamplesAggregator
  from niftynet.io.image_reader import ImageReader
  from niftynet.io.image_sets_partitioner import ImageSetsPartitioner
  from niftynet.layer.discrete_label_normalisation import DiscreteLabelNormalisationLayer
  from niftynet.layer.pad import PadLayer
  from niftynet.utilities.util_common import ParserNamespace
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 9 for calling the GridSamplesAggregatorTest obj's underlying member method code with example usage: obj.test_init_2d_mo_3out() without return types