def intensity_range(image, range_values='image', clip_negative=False):
 if (range_values == 'dtype'):
  range_values = image.dtype.type
 if (range_values == 'image'):
  i_min = np.min(image)
  i_max = np.max(image)
 elif (range_values in DTYPE_RANGE):
  (i_min, i_max) = DTYPE_RANGE[range_values]
  if clip_negative:
   i_min = 0
 else:
  (i_min, i_max) = range_values
 return (i_min, i_max)

def intensity_range ( image , range_values = 'image' , clip_negative = False ) : if ( range_values == 'dtype' ) : range_values = image . dtype . type if ( range_values == 'image' ) : i_min = np . min ( image ) i_max = np . max ( image ) elif ( range_values in DTYPE_RANGE ) : ( i_min , i_max ) = DTYPE_RANGE [ range_values ] if clip_negative : i_min = 0 else : ( i_min , i_max ) = range_values return ( i_min , i_max )
return image intensity range based on desired value type .