code: def test_3d_init(self):
      constraint_built = Constraint(
          compulsory_labels=[1], min_ratio=0.000001, min_num_labels=2
      )
      sampler = SelectiveSampler(
          reader=get_3d_reader(),
          data_param=MULTI_MOD_DATA,
          batch_size=2,
          constraint=constraint_built,
          windows_per_image=2,
          queue_length=10,
      )
      with self.cached_session() as sess:
          sampler.run_threads(sess, num_threads=1)
          out = sess.run(sampler.pop_batch_op())
          self.assertTrue(
              check_constraint(out["label"], constraint_built)
          )
          self.assertAllClose(out["image"].shape, (2, 7, 10, 2, 2))
          self.assertAllClose(out["label"].shape, (2, 7, 10, 2, 1))
          print("Test should finish here")
      sampler.close_all()
  
file_path: NiftyNet/niftynet/contrib/segmentation_selective_sampler/test_sampler_selective.py
imports: from __future__ import absolute_import, division, print_function
  import os
  import numpy
  import tensorflow
  from niftynet.contrib.segmentation_selective_sampler.sampler_selective import SelectiveSampler, Constraint
  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 1 for calling the SelectiveSamplerTest obj's underlying member method code with example usage: obj.test_3d_init() without return types