def profile_line(img, src, dst, linewidth=1, order=1, mode='constant', cval=0.0):
 perp_lines = _line_profile_coordinates(src, dst, linewidth=linewidth)
 if (img.ndim == 3):
  pixels = [ndi.map_coordinates(img[..., i], perp_lines, order=order, mode=mode, cval=cval) for i in range(img.shape[2])]
  pixels = np.transpose(np.asarray(pixels), (1, 2, 0))
 else:
  pixels = ndi.map_coordinates(img, perp_lines, order=order, mode=mode, cval=cval)
 intensities = pixels.mean(axis=1)
 return intensities

def profile_line ( img , src , dst , linewidth = 1 , order = 1 , mode = 'constant' , cval = 0.0 ) : perp_lines = _line_profile_coordinates ( src , dst , linewidth = linewidth ) if ( img . ndim == 3 ) : pixels = [ ndi . map_coordinates ( img [ ... , i ] , perp_lines , order = order , mode = mode , cval = cval ) for i in range ( img . shape [ 2 ] ) ] pixels = np . transpose ( np . asarray ( pixels ) , ( 1 , 2 , 0 ) ) else : pixels = ndi . map_coordinates ( img , perp_lines , order = order , mode = mode , cval = cval ) intensities = pixels . mean ( axis = 1 ) return intensities
return the intensity profile of an image measured along a scan line .