code: def list_to_ndimage( image, image_list ):
      
      inpixeltype = image_list[0].pixeltype
      dimension = image_list[0].dimension
      components = len(image_list)
  
      for imageL in image_list:
          if not isinstance(imageL, iio.ANTsImage):
              raise ValueError('list may only contain ANTsImage objects')
          if image.pixeltype != inpixeltype:
              raise ValueError('all images must have the same pixeltype')
  
      dimensionout = ( *image_list[0].shape, len( image_list )  )
      newImage = iio2.make_image(
        dimensionout,
        spacing = iio.get_spacing( image ),
        origin = iio.get_origin( image ),
        direction = iio.get_direction( image ),
        pixeltype = inpixeltype
        )
      # FIXME - should implement paste image filter from ITK
      for x in range( len( image_list ) ):
          if dimension == 2:
              newImage[:,:,x] = image_list[x][:,:]
          if dimension == 3:
              newImage[:,:,:,x] = image_list[x][:,:,:]
      return newImage
docs: Merge list of multiple scalar ANTsImage types of dimension into one
      ANTsImage of dimension plus one
  
      ANTsR function: `mergeListToNDImage`
  
      Arguments
      ---------
      image : target image space
      image_list : list/tuple of ANTsImage types
          scalar images to merge into target image space
  
      Returns
      -------
      ANTsImage
  
      Example
      -------
      >>> import ants
      >>> image = ants.image_read(ants.get_ants_data('r16'))
      >>> image2 = ants.image_read(ants.get_ants_data('r16'))
      >>> imageTar = ants.make_image( ( *image2.shape, 2 ) )
      >>> image3 = ants.list_to_ndimage( imageTar, [image,image2])
      >>> image3.dimension == 3