code: def crop_image(image, label_image=None, label=1):
      
      inpixeltype = image.pixeltype
      ndim = image.dimension
      if image.pixeltype != 'float':
          image = image.clone('float')
  
      if label_image is None:
          label_image = get_mask(image)
  
      if label_image.pixeltype != 'float':
          label_image = label_image.clone('float')
  
      libfn = utils.get_lib_fn('cropImageF%i' % ndim)
      itkimage = libfn(image.pointer, label_image.pointer, label, 0, [], [])
      return iio.ANTsImage(pixeltype='float', dimension=ndim, 
                          components=image.components, pointer=itkimage).clone(inpixeltype)
docs: Use a label image to crop a smaller ANTsImage from within a larger ANTsImage
  
      ANTsR function: `cropImage`
      
      Arguments
      ---------
      image : ANTsImage  
          image to crop
      
      label_image : ANTsImage
          image with label values. If not supplied, estimated from data.
      
      label : integer   
          the label value to use
  
      Returns
      -------
      ANTsImage
  
      Example
      -------
      >>> import ants
      >>> fi = ants.image_read( ants.get_ants_data('r16') )
      >>> cropped = ants.crop_image(fi)
      >>> cropped = ants.crop_image(fi, fi, 100 )