def _depth_montage(depths): if depths.ndim == 4: assert depths.shape[1] == 1 depths = depths[:,0,:,:] #depths = imgutil.scale_values(depths, min=-2.5, max=2.5) #depths = map(imgutil.scale_values, depths) masks = [] for i in xrange(len(depths)): x = depths[i] mask = x != x.min() masks.append(mask) x = x[mask] if len(x) == 0: d = np.zeros_like(depths[i]) else: d = imgutil.scale_values(depths[i], min=x.min(), max=x.max()) depths[i] = d depths = plt.cm.jet(depths)[...,:3] for i in xrange(len(depths)): for c in xrange(3): depths[i, :, :, c][masks[i] == 0] = 0.2 return imgutil.montage(depths, border=1)
def _image_montage(imgs, min, max): imgs = imgutil.bxyc_from_bcxy(imgs) return imgutil.montage( imgutil.scale_values(imgs, min=min, max=max), border=1)