Exemplo n.º 1
0
    def serialize(self, h5g, destbegin = (0,0,0), destend = (0,0,0), srcbegin = (0,0,0), srcend = (0,0,0), destshape = (0,0,0) ):
        #for now save the labels and prediction in the old format
        #TODO: change that when we are certain about the new project file format
        vl = VolumeLabels(self.dataItemImage.overlayMgr["Classification/Labels"]._data)
        vl.descriptions = self.classificationModuleMgr.dataMgr.module["Classification"]["labelDescriptions"]
        vl.serialize(h5g, "labels", destbegin, destend, srcbegin, srcend, destshape)

        if len(vl.descriptions) > 0:
            prediction = numpy.zeros(self.dataItemImage.shape[0:-1] + (len(vl.descriptions),), 'float32')
            for d in vl.descriptions:
                if self.dataItemImage.overlayMgr["Classification/Prediction/" + d.name] is not None:
                    prediction[:,:,:,:,d.number-1] = self.dataItemImage.overlayMgr["Classification/Prediction/" + d.name][:,:,:,:,0]
            prediction = DataAccessor(prediction)
            prediction.serialize(h5g, 'prediction', destbegin, destend, srcbegin, srcend, destshape )
Exemplo n.º 2
0
 def deserialize(self, h5G, offsets = (0,0,0), shape = (0,0,0)):
     labels = VolumeLabels.deserialize(h5G, "labels",offsets, shape)
     self["labels"] = labels
     if 'prediction' in h5G.keys():
         self["prediction"] = DataAccessor.deserialize(h5G, 'prediction', offsets, shape)
Exemplo n.º 3
0
 def onAppend(self):
     if self.objects is None:
         l = numpy.zeros(self.dataItemImage.shape[0:-1] + (1, ), 'uint8')
         self.objects = VolumeLabels(l)
 def onAppend(self):
     if self.background is None:
         l = numpy.zeros(self.dataItemImage.shape[0:-1], 'uint8')
         self.background = VolumeLabels(l)