Пример #1
0
    def normalize_image(self, plate_id=None):

        img_in = self.meta_image.image
        if self.bFlatfieldCorrection:
            self.logger.debug("* using flat field correction with image from %s"
                              % self.strBackgroundImagePath)
            imgBackground = self._load_flatfield_correction_image(plate_id)

            crop_coordinated = MetaImage.get_crop_coordinates()
            if crop_coordinated is not None:
                self.logger.debug("* applying cropping to background image")
                imgBackground = ccore.subImage(imgBackground,
                                               ccore.Diff2D(crop_coordinated[0],
                                                            crop_coordinated[1]),
                                               ccore.Diff2D(crop_coordinated[2],
                                                            crop_coordinated[3]))

            img_in = ccore.flatfieldCorrection(img_in, imgBackground, 0.0, True)
            img_out = ccore.linearTransform2(img_in, self.fNormalizeMin,
                                             self.fNormalizeMax, 0, 255, 0, 255)
        else:
            self.logger.debug("* not using flat field correction")
            if type(img_in) == ccore.UInt16Image:
                img_out = ccore.linearTransform3(img_in, int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax),
                                                 0, 255, 0, 255)
            elif type(img_in) == ccore.Image:
                img_out = ccore.linearTransform2(img_in, int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax),
                                                 0, 255, 0, 255)

            else:
                img_out = img_in

        self.meta_image.set_image(img_out)
Пример #2
0
    def normalize_image(self, plate_id=None):
        try:
            import pydevd
            pydevd.connected = True
            pydevd.settrace(suspend=False)
            print 'Thread enabled interactive eclipse debuging...'
        except:
            pass
        img_in = self.meta_image.image
        if self.bFlatfieldCorrection:
            self.logger.debug(
                "* using flat field correction with image from %s" %
                self.strBackgroundImagePath)
            imgBackground = self._load_flatfield_correction_image(plate_id)

            crop_coordinated = MetaImage.get_crop_coordinates()
            if crop_coordinated is not None:
                self.logger.debug("* applying cropping to background image")
                imgBackground = ccore.subImage(
                    imgBackground,
                    ccore.Diff2D(crop_coordinated[0], crop_coordinated[1]),
                    ccore.Diff2D(crop_coordinated[2], crop_coordinated[3]))

            img_in = ccore.flatfieldCorrection(img_in, imgBackground, 0.0,
                                               True)
            img_out = ccore.linearTransform2(img_in, self.fNormalizeMin,
                                             self.fNormalizeMax, 0, 255, 0,
                                             255)
        else:
            self.logger.debug("* not using flat field correction")
            if type(img_in) == ccore.UInt16Image:
                img_out = ccore.linearTransform3(img_in,
                                                 int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax), 0,
                                                 255, 0, 255)
            elif type(img_in) == ccore.Image:
                img_out = ccore.linearTransform2(img_in,
                                                 int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax), 0,
                                                 255, 0, 255)

            else:
                img_out = img_in

        self.meta_image.set_image(img_out)
Пример #3
0
    def normalize_image(self, plate_id=None):
        try:
            import pydevd
            pydevd.connected = True
            pydevd.settrace(suspend=False)
            print 'Thread enabled interactive eclipse debuging...'
        except:
            pass
        img_in = self.meta_image.image
        if self.bFlatfieldCorrection:
            self.logger.debug("* using flat field correction with image from %s"
                              % self.strBackgroundImagePath)
            imgBackground = self._load_flatfield_correction_image(plate_id)

            crop_coordinated = MetaImage.get_crop_coordinates()
            if crop_coordinated is not None:
                self.logger.debug("* applying cropping to background image")
                imgBackground = ccore.subImage(imgBackground,
                                               ccore.Diff2D(crop_coordinated[0],
                                                            crop_coordinated[1]),
                                               ccore.Diff2D(crop_coordinated[2],
                                                            crop_coordinated[3]))

            img_in = ccore.flatfieldCorrection(img_in, imgBackground, 0.0, True)
            img_out = ccore.linearTransform2(img_in, self.fNormalizeMin,
                                             self.fNormalizeMax, 0, 255, 0, 255)
        else:
            self.logger.debug("* not using flat field correction")
            if type(img_in) == ccore.UInt16Image:
                img_out = ccore.linearTransform3(img_in, int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax),
                                                 0, 255, 0, 255)
            elif type(img_in) == ccore.Image:
                img_out = ccore.linearTransform2(img_in, int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax),
                                                 0, 255, 0, 255)

            else:
                img_out = img_in

        self.meta_image.set_image(img_out)
Пример #4
0
    def normalize_image(self, plate_id=None):

        img_in = self.meta_image.image
        if self.bFlatfieldCorrection:
            self.logger.debug(
                "* using flat field correction with image from %s" %
                self.strBackgroundImagePath)
            imgBackground = self._load_flatfield_correction_image(plate_id)

            crop_coordinated = MetaImage.get_crop_coordinates()
            if crop_coordinated is not None:
                self.logger.debug("* applying cropping to background image")
                imgBackground = ccore.subImage(
                    imgBackground,
                    ccore.Diff2D(crop_coordinated[0], crop_coordinated[1]),
                    ccore.Diff2D(crop_coordinated[2], crop_coordinated[3]))

            img_in = ccore.flatfieldCorrection(img_in, imgBackground, 0.0,
                                               True)
            img_out = ccore.linearTransform2(img_in, self.fNormalizeMin,
                                             self.fNormalizeMax, 0, 255, 0,
                                             255)
        else:
            self.logger.debug("* not using flat field correction")
            if type(img_in) == ccore.UInt16Image:
                img_out = ccore.linearTransform3(img_in,
                                                 int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax), 0,
                                                 255, 0, 255)
            elif type(img_in) == ccore.Image:
                img_out = ccore.linearTransform2(img_in,
                                                 int(self.fNormalizeMin),
                                                 int(self.fNormalizeMax), 0,
                                                 255, 0, 255)

            else:
                img_out = img_in

        self.meta_image.set_image(img_out)