code: def test_binary_dice_metric(setup_cases):
      cases = setup_cases
  
      for case in cases:
          # setup pred record
          pred_record = BaseRecord(
              (
                  ImageRecordComponent(),
                  SemanticMaskRecordComponent(),
                  ClassMapRecordComponent(task=tasks.segmentation),
              )
          )
  
          pred_record.segmentation.set_class_map(ClassMap(["square"]))
          pred_record.segmentation.set_mask_array(
              MaskArray(case["pred_mask"])
          )
  
          # setup ground truth record
          gt_record = BaseRecord(
              (
                  ImageRecordComponent(),
                  SemanticMaskRecordComponent(),
                  ClassMapRecordComponent(task=tasks.segmentation),
              )
          )
  
          gt_record.segmentation.set_class_map(ClassMap(["square"]))
          gt_record.segmentation.set_mask_array(
              MaskArray(case["gt_mask"])
          )
  
          # w, h = imgA.shape[0], imgA.shape[1]
          w, h = case["gt_mask"].shape[0], case["gt_mask"].shape[1]
  
          gt_record.set_img_size(ImgSize(w, h), original=True)
  
          prediction = Prediction(
              pred=pred_record, ground_truth=gt_record
          )
  
          name = case["name"]
  
          dice = BinaryDiceCoefficient()
          dice.accumulate([prediction])
  
          results = dice.finalize()
  
          # return f'Results for test with {name}: {results}'
  
          assert results == case["expected_value"]
  
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_dice_metric(setup_cases) without return types