def removeSegmentsByKey(self, key):
        
        print "removing segment '%s'" % (key)
        labelsForKey = self._mapKeysToLabels[key]
        print " - labels", [i for i in self._mapKeysToLabels[key]], "belong to '%s'" % (key)
        
        del self._mapKeysToLabels[key]
        for l in labelsForKey:
            del self._mapLabelsToKeys[l] 
        
        path = self.outputPath+'/'+str(key)
        print " - removing storage path '%s'" % (path)
        shutil.rmtree(path)
        
        #Clear the segmentation
        #The association with the overlay will be broken,
        #but this is not so bad because the overlay is 'fixed' via
        #the overlaysChanged() notification. This is not nice, but works...
        self.segmentation = None
        
        self.__reset()
        
        self.__saveMapping()
        
        self.__rebuildDone()
        
        #write out done file again
        f = h5py.File(self.outputPath + "/done.h5", 'w')
        f.create_group('volume')
        f.create_dataset('volume/data', data=self.done, dtype=numpy.uint16, chunks=True, compression='gzip')
        f.close()
        
        self.emit(SIGNAL('overlaysChanged()'))
Remove all segments belong to 'key'.
dataset/ETHPy150Open ilastik/ilastik-0.5/ilastik/modules/interactive_segmentation/core/interactiveSegmentationModuleMgr.py/InteractiveSegmentationItemModuleMgr.removeSegmentsByKey