code: def test_1d_coordinates(self):
      img_size = (21, 1, 1, 1, 1)
      win_size = (15, 1, 1)
      sampling_map = np.zeros(img_size)
      coords = balanced_spatial_coordinates(
          10, img_size, win_size, sampling_map
      )
  
      self.assertAllEqual(coords.shape, (10, N_SPATIAL))
      self.assertCoordinatesAreValid(coords, sampling_map)
  
      sampling_map[9, 0, 0, 0, 0] = 1.0
      coords = balanced_spatial_coordinates(
          500, img_size, win_size, sampling_map
      )
      # better test?
      self.assertTrue(
          np.sum(np.all(coords == [9, 0, 0], axis=1)) >= 200
      )
  
imports: from __future__ import absolute_import, division, print_function
  import os
  import unittest
  import numpy
  import tensorflow
  from niftynet.engine.image_window import N_SPATIAL
  from niftynet.engine.sampler_balanced_v2 import BalancedSampler, balanced_spatial_coordinates
  from niftynet.io.image_reader import ImageReader
  from niftynet.io.image_sets_partitioner import ImageSetsPartitioner
  from niftynet.utilities.util_common import ParserNamespace
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 4 for calling the BalancedCoordinatesTest obj's underlying member method code with example usage: obj.test_1d_coordinates() without return types