code: def _set_image(self, image, nodata=None):
          
          # convert to masked array:
          if isinstance(image, np.ma.core.MaskedArray):
              masked = image
          elif isinstance(image, np.core.ndarray):
              masked = self._build_masked_array(image, nodata)
          else:
              raise GeoRaster2NotImplementedError('only ndarray or masked array supported, got %s' % type(image))
  
          # make sure array is 3d:
          if len(masked.shape) == 3:
              self._image = masked
          elif len(masked.shape) == 2:
              self._image = masked[np.newaxis, :, :]
          else:
              raise GeoRaster2Error('expected 2d or 3d image, got shape=%s' % masked.shape)
  
          # update shape
          if self._shape is None:
              self._set_shape(self._image.shape)
  
          self._image_after_load_validations()
          if self._image_readonly:
              self._image.setflags(write=0)
docs: Set self._image.
  
          :param image: supported: np.ma.array, np.array, TODO: PIL image
          :param nodata: if provided image is array (not masked array), treat pixels with value=nodata as nodata
          :return: