code: def test_endianness(self, endianness, use_array, image_only):
      hdr = nib.Nifti1Header(endianness=endianness)
      nii = nib.Nifti1Image(self.im, np.eye(4), header=hdr)
      nib.save(nii, self.fname)
  
      data = [self.fname] if use_array else [{"image": self.fname}]
      tr = (
          LoadImage(image_only=image_only)
          if use_array
          else LoadImaged("image", image_only=image_only)
      )
      check_ds = Dataset(data, tr)
      check_loader = DataLoader(check_ds, batch_size=1)
      ret = next(iter(check_loader))
      if isinstance(ret, dict) and PostFix.meta("image") in ret:
          np.testing.assert_allclose(
              ret[PostFix.meta("image")]["spatial_shape"], [[100, 100]]
          )
  
imports: from __future__ import annotations
  import os
  import tempfile
  import unittest
  from pathlib import Path
  from typing import TYPE_CHECKING
  from unittest.case import skipUnless
  import numpy
  from parameterized import parameterized
  from monai.data import DataLoader, Dataset, create_test_image_2d
  from monai.data.image_reader import PILReader
  from monai.transforms import LoadImage, LoadImaged
  from monai.transforms.io.array import switch_endianness
  from monai.utils.enums import PostFix
  from monai.utils.module import optional_import
label_desc: Use image node_id 2 for calling the TestNiftiEndianness obj's underlying member method code with example usage: obj.test_endianness(endianness, use_array, image_only) without return types