class_docstr: Wrapper class around a Nibabel file format. Loads an image using PIL
  (or scikit-image if available) and transforms it to a `nib.Nifti1Image`.
  
  The resulting 2D color image is already translated to a 5D array,
  swapping the channels to the last axis.
class_docstr_tok: ["Wrapper","class","around","a","Nibabel","file","format",".","Loads","an","image","using","PIL","(","or","scikit-image","if","available",")","and","transforms","it","to","a","`","nib.Nifti1Image","`",".","The","resulting","2D","color","image","is","already","translated","to","a","5D","array",",","swapping","the","channels","to","the","last","axis","."]
code: def __init__(self, img, affine):
      if img.ndim == 3 and img.shape[2] <= 4:  # Color Image
          img = img[:, :, None, None, :]
  
      if (
          img.dtype == np.bool
      ):  # bool is not a supported datatype by nibabel
          img = img.astype(np.uint8)
  
      nib.Nifti1Image.__init__(self, img, affine)
  
file_path: NiftyNet/niftynet/io/image_loader.py
imports: from collections import OrderedDict
  import nibabel
  import numpy
  import tensorflow
  from niftynet.utilities.util_import import require_module
label_desc: Use image node_id 1 to create a new ImageAsNibabel object from inherited base classes: nib with example: obj = ImageAsNibabel(img, affine)