def calculateWeights(self, volume, borderIndicator, normalizePotential=True, sigma=1.0):
        
        #TODO: this , until now, only supports gray scale and 2D!
        if borderIndicator == "Brightness":
            weights = volume[:,:,:].view(vigra.ScalarVolume)
        elif borderIndicator == "Darkness":
            weights = (255 - volume[:,:,:]).view(vigra.ScalarVolume)
        elif borderIndicator == "Gradient Magnitude":
            weights = numpy.ndarray(volume.shape, numpy.float32)
            if weights.shape[0] == 1:
                weights[0,:,:] = vigra.filters.gaussianGradientMagnitude((volume[0,:,:]).astype(numpy.float32), sigma)
            else:
                weights = vigra.filters.gaussianGradientMagnitude((volume[:,:,:]).astype(numpy.float32), sigma)
                
        if normalizePotential == True:
            min = numpy.min(volume)
            max = numpy.max(volume)
            print "Weights min/max :", min, max
            weights = (weights - min)*(255.0 / (max - min))
            
        self.setupWeights(weights)
Calculate the weights indicating borderness from the raw data
dataset/ETHPy150Open ilastik/ilastik-0.5/ilastik/modules/interactive_segmentation/core/interactiveSegmentationModuleMgr.py/InteractiveSegmentationItemModuleMgr.calculateWeights