code: def test_correct(self, keepdim, im_type, update_meta, list_output):
      data = deepcopy(self.data)
      data["i"] = im_type(data["i"])
      arr = data["i"]
      for dim in range(arr.ndim):
          out = SplitDimd(
              "i",
              dim=dim,
              keepdim=keepdim,
              update_meta=update_meta,
              list_output=list_output,
          )(data)
          if list_output:
              self.assertIsInstance(out, list)
              self.assertEqual(len(out), arr.shape[dim])
          else:
              self.assertIsInstance(out, dict)
              self.assertEqual(
                  len(out.keys()), len(data.keys()) + arr.shape[dim]
              )
          # if updating metadata, pick some random points and
          # check same world coordinates between input and output
          if update_meta:
              for _ in range(10):
                  idx = [np.random.choice(i) for i in arr.shape]
                  split_im_idx = idx[dim]
                  split_idx = deepcopy(idx)
                  split_idx[dim] = 0
                  if list_output:
                      split_im = out[split_im_idx]["i"]
                  else:
                      split_im = out[f"i_{split_im_idx}"]
                  if isinstance(data, MetaTensor) and isinstance(
                      split_im, MetaTensor
                  ):
                      # idx[1:] to remove channel and then add 1 for 4th element
                      real_world = (
                          data.affine
                          @ torch.tensor(idx[1:] + [1]).double()
                      )
                      real_world2 = (
                          split_im.affine
                          @ torch.tensor(split_idx[1:] + [1]).double()
                      )
                      assert_allclose(real_world, real_world2)
  
          if list_output:
              out = out[0]["i"]
          else:
              out = out["i_0"]
          expected_ndim = arr.ndim if keepdim else arr.ndim - 1
          self.assertEqual(out.ndim, expected_ndim)
          # assert is a shallow copy
          arr[0, 0, 0, 0] *= 2
          self.assertEqual(arr.flatten()[0], out.flatten()[0])
  
file_path: MONAI/tests/test_splitdimd.py
imports: from __future__ import annotations
  import unittest
  from copy import deepcopy
  import numpy
  import torch
  from parameterized import parameterized
  from monai.data.meta_tensor import MetaTensor
  from monai.transforms import LoadImaged
  from monai.transforms.utility.dictionary import SplitDimd
  from tests.utils import TEST_NDARRAYS, assert_allclose, make_nifti_image, make_rand_affine
label_desc: Use image node_id 2 for calling the TestSplitDimd obj's underlying member method code with example usage: obj.test_correct(keepdim, im_type, update_meta, list_output) without return types