code: def get_images(data, is_label=False):
      """Get image. If is dictionary, extract key. If is list, stack. If both dictionary and list, do both.
      Also return the image size as string to be used im the imshow. If it's a list, return `N x (H,W,D)`.
      """
      # If not a list, convert
      if not isinstance(data, list):
          data = [data]
      key = CommonKeys.LABEL if is_label else CommonKeys.IMAGE
      is_map = isinstance(data[0], dict)
      # length of the list will be equal to number of samples produced. This will be 1 except for transforms that
      # produce `num_samples`.
      data = [d[key] if is_map else d for d in data]
      data = [d[0] for d in data]  # remove channel component
  
      # for each sample, create a list of the orthogonal views. If image is 2d, length will be 1. If 3d, there
      # will be three orthogonal views
      num_samples = len(data)
      num_orthog_views = 3 if data[0].ndim == 3 else 1
      shape_str = (
          f"{num_samples} x " if num_samples > 1 else ""
      ) + str(data[0].shape)
      for i in range(num_samples):
          data[i] = [
              get_2d_slice(data[i], view, is_label)
              for view in range(num_orthog_views)
          ]
  
      out = []
      if num_samples == 1:
          out = data[0]
      else:
          # we might need to panel the images. this happens if a transform produces e.g. 4 output images.
          # In this case, we create a 2-by-2 grid from them. Output will be a list containing n_orthog_views,
          # each element being either the image (if num_samples is 1) or the panelled image.
          nrows = int(np.floor(num_samples**0.5))
          for view in range(num_orthog_views):
              result = np.asarray([d[view] for d in data])
              nindex, height, width = result.shape
              ncols = nindex // nrows
              # only implemented for square number of images (e.g. 4 images goes to a 2-by-2 panel)
              if nindex != nrows * ncols:
                  raise NotImplementedError
              # want result.shape = (height*nrows, width*ncols), have to be careful about striding
              result = (
                  result.reshape(nrows, ncols, height, width)
                  .swapaxes(1, 2)
                  .reshape(height * nrows, width * ncols)
              )
              out.append(result)
      return out, shape_str
  
imports: from __future__ import annotations
  import os
  import pathlib
  import tempfile
  import textwrap
  from copy import deepcopy
  from glob import glob
  from typing import TYPE_CHECKING
  import numpy
  import torch
  from monai.apps import download_and_extract
  from monai.transforms import Affine, Affined, AsDiscrete, Compose, EnsureChannelFirstd, Flip, Flipd, LoadImaged, MapTransform, Orientation, Orientationd, Rand3DElastic, Rand3DElasticd, RandFlip, RandFlipd, Randomizable, RandRotate, RandRotated, RandZoom, RandZoomd, Rotate, Rotate90, Rotate90d, Rotated, ScaleIntensity, ScaleIntensityd, SpatialPadd, Zoom, Zoomd
  from monai.transforms.croppad.array import BorderPad, CenterScaleCrop, CenterSpatialCrop, CropForeground, DivisiblePad, RandCropByLabelClasses, RandCropByPosNegLabel, RandScaleCrop, RandSpatialCrop, RandSpatialCropSamples, RandWeightedCrop, ResizeWithPadOrCrop, SpatialCrop, SpatialPad
  from monai.transforms.croppad.dictionary import BorderPadd, CenterScaleCropd, CenterSpatialCropd, CropForegroundd, DivisiblePadd, RandCropByLabelClassesd, RandCropByPosNegLabeld, RandScaleCropd, RandSpatialCropd, RandSpatialCropSamplesd, RandWeightedCropd, ResizeWithPadOrCropd, SpatialCropd
  from monai.transforms.intensity.array import AdjustContrast, ForegroundMask, GaussianSharpen, GaussianSmooth, GibbsNoise, HistogramNormalize, KSpaceSpikeNoise, MaskIntensity, MedianSmooth, NormalizeIntensity, RandAdjustContrast, RandBiasField, RandCoarseDropout, RandCoarseShuffle, RandGaussianNoise, RandGaussianSharpen, RandGaussianSmooth, RandGibbsNoise, RandHistogramShift, RandKSpaceSpikeNoise, RandRicianNoise, RandScaleIntensity, RandShiftIntensity, RandStdShiftIntensity, SavitzkyGolaySmooth, ScaleIntensityRange, ScaleIntensityRangePercentiles, ShiftIntensity, StdShiftIntensity, ThresholdIntensity
  from monai.transforms.intensity.dictionary import AdjustContrastd, ForegroundMaskd, GaussianSharpend, GaussianSmoothd, GibbsNoised, HistogramNormalized, KSpaceSpikeNoised, MaskIntensityd, MedianSmoothD, NormalizeIntensityd, RandAdjustContrastd, RandBiasFieldd, RandCoarseDropoutd, RandCoarseShuffled, RandGaussianNoised, RandGaussianSharpend, RandGaussianSmoothd, RandGibbsNoised, RandHistogramShiftd, RandKSpaceSpikeNoised, RandRicianNoised, RandScaleIntensityd, RandShiftIntensityd, RandStdShiftIntensityd, SavitzkyGolaySmoothd, ScaleIntensityRanged, ScaleIntensityRangePercentilesd, ShiftIntensityd, StdShiftIntensityd, ThresholdIntensityd
  from monai.transforms.post.array import KeepLargestConnectedComponent, LabelFilter, LabelToContour, RemoveSmallObjects
  from monai.transforms.post.dictionary import AsDiscreted, KeepLargestConnectedComponentd, LabelFilterd, LabelToContourd, RemoveSmallObjectsd
  from monai.transforms.smooth_field.array import RandSmoothDeform, RandSmoothFieldAdjustContrast, RandSmoothFieldAdjustIntensity
  from monai.transforms.smooth_field.dictionary import RandSmoothDeformd, RandSmoothFieldAdjustContrastd, RandSmoothFieldAdjustIntensityd
  from monai.transforms.spatial.array import GridDistortion, Rand2DElastic, RandAffine, RandAxisFlip, RandGridDistortion, RandRotate90, Resize, Spacing
  from monai.transforms.spatial.dictionary import GridDistortiond, Rand2DElasticd, RandAffined, RandAxisFlipd, RandGridDistortiond, RandRotate90d, Resized, Spacingd
  from monai.utils.enums import CommonKeys
  from monai.utils.misc import MONAIEnvVars
  from monai.utils.module import optional_import
label_desc: Use image node_id 8 for calling a global function with example usage: get_images(data, is_label) and returns: out,  shape_str