def _clip_warp_output(input_image, output_image, order, mode, cval, clip):
 if (clip and (order != 0)):
  min_val = input_image.min()
  max_val = input_image.max()
  preserve_cval = ((mode == 'constant') and (not (min_val <= cval <= max_val)))
  if preserve_cval:
   cval_mask = (output_image == cval)
  np.clip(output_image, min_val, max_val, out=output_image)
  if preserve_cval:
   output_image[cval_mask] = cval

def _clip_warp_output ( input_image , output_image , order , mode , cval , clip ) : if ( clip and ( order != 0 ) ) : min_val = input_image . min ( ) max_val = input_image . max ( ) preserve_cval = ( ( mode == 'constant' ) and ( not ( min_val <= cval <= max_val ) ) ) if preserve_cval : cval_mask = ( output_image == cval ) np . clip ( output_image , min_val , max_val , out = output_image ) if preserve_cval : output_image [ cval_mask ] = cval
clip output image to range of values of input image .