Esempio n. 1
0
    def showObjects(self):

        if not (self.contoursCb.isChecked() or self.showBBoxes.isChecked()) or self._files is None:
            return

        index = self.slider.value()
        try:
            mp = TiffProcessor(
                self._files[index], self._regex, self.segdlg.segmentationParams(), self.cbar.checkedChannels()
            )

            # first channel for primary segementation
            mp.segmentation()
        except Exception as e:
            QMessageBox.critical(self, "Error", "%s:%s" % (type(e), str(e)))
        finally:
            objects = mp.objects()
            if not objects:
                self.viewer.clearPolygons()
                self.viewer.clearRects()
                return

            if self.contoursCb.isChecked():
                self.cbar.setContours(objects.contours)

            if self.showBBoxes.isChecked():
                self.cbar.drawRectangles(objects.centers.values(), self.segdlg.galSize.value(), isize=mp.size)
Esempio n. 2
0
def processBild(file_, regex, segparams, feature_groups, channels):

    try:
        gsize = segparams.values()[0].gallery_size
        mp = TiffProcessor(file_, regex, segparams, channels, gsize)
        mp.segmentation()
        mp.calculateFeatures(feature_groups)
        image = mp.image[:, :, :, channels.keys()]
        objects = mp.objects()
        # cannot return OrderedDict from multiprocessing, so I split the dict
        # and reconstruct it in the main process
    except Exception as e:
        return e
    else:
        return file_, image, objects.values(), objects.feature_names