def __init__(self, mainOperator, projectFileGroupName):
with Tracer(traceLogger):
super( PixelClassificationSerializer, self ).__init__( projectFileGroupName, self.SerializerVersion )
self.mainOperator = mainOperator
self._initDirtyFlags()
// Set up handlers for dirty detection
def handleDirty(section):
self._dirtyFlags[section] = True
self.mainOperator.Classifier.notifyDirty( bind(handleDirty, Section.Classifier) )
def handleNewImage(section, slot, index):
slot[index].notifyDirty( bind(handleDirty, section) )
// New label images need to be "serialized" as an empty group.
if section == Section.Labels:
handleDirty(Section.Labels)
// These are multi-slots, so subscribe to dirty callbacks on each of their subslots as they are created
self.mainOperator.LabelImages.notifyInserted( bind(handleNewImage, Section.Labels) )
self.mainOperator.PredictionProbabilities.notifyInserted( bind(handleNewImage, Section.Predictions) )
self._predictionStorageEnabled = False
self._predictionStorageRequest = None
self._predictionsPresent = False