Ejemplo n.º 1
0
    def main(self):

        if self.cfg.params[self.cfg.opt_vign] and self._wht_img is not None:
            # apply de-vignetting
            obj = LfpDevignetter(lfp_img=self._lfp_img,
                                 wht_img=self._wht_img,
                                 cfg=self.cfg,
                                 sta=self.sta)
            obj.main()
            self._lfp_img = obj.lfp_img
            del obj

        if self.cfg.params[self.cfg.opt_rota] and self._lfp_img is not None:
            # de-rotate centroids
            obj = LfpRotator(self._lfp_img,
                             self.cfg.calibs[self.cfg.mic_list],
                             rad=None,
                             cfg=self.cfg,
                             sta=self.sta)
            obj.main()
            self._lfp_img, self.cfg.calibs[
                self.cfg.mic_list] = obj.lfp_img, obj.centroids
            del obj

        # interpolate each micro image with its MIC as the center with consistent micro image size
        obj = LfpResampler(lfp_img=self._lfp_img,
                           cfg=self.cfg,
                           sta=self.sta,
                           method='cubic')
        obj.main()
        self._lfp_img = obj.lfp_out
        del obj

        return True
Ejemplo n.º 2
0
    def main(self):

        if self.cfg.params[self.cfg.opt_rota] and self._lfp_img is not None:
            # de-rotate centroids
            obj = LfpRotator(self._lfp_img,
                             self.cfg.calibs[self.cfg.mic_list],
                             rad=None,
                             cfg=self.cfg,
                             sta=self.sta)
            obj.main()
            self._lfp_img, self.cfg.calibs[
                self.cfg.mic_list] = obj.lfp_img, obj.centroids
            del obj

        # interpolate each micro image with its MIC as the center with consistent micro image size
        obj = LfpResampler(self._lfp_img,
                           cfg=self.cfg,
                           sta=self.sta,
                           method='cubic')
        obj.main()
        self._lfp_img = obj.lfp_out
        del obj

        # print status
        self.sta.status_msg('Alignment finished', opt=True)
        self.sta.progress(100, opt=True)

        return True
Ejemplo n.º 3
0
    def main(self):

        if self.cfg.lfpimg:
            # hot pixel correction
            obj = CfaHotPixels(bay_img=self._lfp_img,
                               cfg=self.cfg,
                               sta=self.sta)
            obj.rectify_candidates_bayer(n=9, sig_lev=2.5)
            self._lfp_img = obj.bay_img
            del obj

        if self.cfg.params[self.cfg.opt_vign] and self._wht_img is not None:
            # apply de-vignetting
            obj = LfpDevignetter(lfp_img=self._lfp_img,
                                 wht_img=self._wht_img,
                                 cfg=self.cfg,
                                 sta=self.sta,
                                 noise_lev=0)
            obj.main()
            self._lfp_img = obj.lfp_img
            self._wht_img = obj.wht_img
            del obj

        if self.cfg.lfpimg and len(
                self._lfp_img.shape) == 2 and not self.sta.interrupt:
            # perform color filter array management and obtain rgb image
            cfa_obj = CfaProcessor(bay_img=self._lfp_img,
                                   wht_img=self._wht_img,
                                   cfg=self.cfg,
                                   sta=self.sta)
            cfa_obj.main()
            self._lfp_img = cfa_obj.rgb_img
            del cfa_obj

        if self.cfg.params[
                self.cfg.
                opt_rota] and self._lfp_img is not None and not self.sta.interrupt:
            # de-rotate centroids
            obj = LfpRotator(self._lfp_img,
                             self.cfg.calibs[self.cfg.mic_list],
                             rad=None,
                             cfg=self.cfg,
                             sta=self.sta)
            obj.main()
            self._lfp_img, self.cfg.calibs[
                self.cfg.mic_list] = obj.lfp_img, obj.centroids
            del obj

        if not self.sta.interrupt:
            # interpolate each micro image with its MIC as the center with consistent micro image size
            obj = LfpResampler(lfp_img=self._lfp_img,
                               cfg=self.cfg,
                               sta=self.sta,
                               method='linear')
            obj.main()
            self._lfp_img = obj.lfp_out
            del obj

        return True
Ejemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        super(HexCorrector, self).__init__(*args, **kwargs)

        self.ref_img = kwargs['ref_img'] if 'ref_img' in kwargs else self.central_view
        self.method = kwargs['method'] if 'method' in kwargs else 'cubic'

        if self.cfg.calibs[self.cfg.mic_list] is not None:
            # analyse
            self.hex_odd = LfpResampler().get_hex_direction(np.asarray(self.cfg.calibs[self.cfg.mic_list]))
        else:
            # reset pattern type to skip hex correction process
            self.cfg.calibs[self.cfg.pat_type] = 'rec'