Beispiel #1
0
    def __init__(self):

        # inheritance
        tk.Tk.__init__(self)

        # window title
        self.wm_title("PlenoptiCam-v" + __version__)

        # icon handling
        self.icon_handling()

        # initialize parameters
        self.sta = PlenopticamStatus()

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.pbar_wid = PbarWidget(self)
        self.pbar_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)
Beispiel #2
0
    def __init__(self, wht_img, cfg=None, sta=None, M=None):

        # input variables
        self._wht_img = wht_img
        self.cfg = cfg if cfg is not None else PlenopticamConfig()
        self.sta = sta if sta is not None else PlenopticamStatus()
        self._M = M
Beispiel #3
0
    def load_json(fp=None, sta=None):

        sta = sta if sta is not None else PlenopticamStatus()

        # file name and file path handling
        if fp is not None and splitext(fp)[-1] != '.json':
            fn = splitext(basename(fp))[0] + '.json'
            fp = join(splitext(fp)[0], fn)

        # load calibration data from json file
        if exists(fp):
            try:
                with open(fp, 'r') as f:
                    json_dict = json.load(f)
            except json.decoder.JSONDecodeError:
                remove(fp)
                sta.status_msg(
                    'Calibration JSON File may be corrupted. Attempt to delete file %s'
                    % fp,
                    opt=True)
                raise PlenopticamError(
                    'Calibration JSON File may be corrupted. Attempt to delete file %s'
                    % fp)
        else:
            json_dict = None
            if splitext(fp)[-1].lower() in ('.lfp', 'lfr', '.raw'):
                sta.status_msg('Provided file %s does not exist' % fp,
                               opt=True)

        return json_dict
Beispiel #4
0
    def __init__(self,
                 img,
                 centroids,
                 cfg=None,
                 sta=None,
                 M=None,
                 method=None):
        """

        This class takes a list of integer coordinates as centroids and an intensity map as inputs and re-computes

        :param img: image used as basis for coordinate refinement calculation
        :param centroids: iterable (list or np.ndarray) with coordinates of integer type
        :param cfg: PlenoptiCam configuration object
        :param sta: PlenoptiCam status object
        :param M: micro image size
        :param method: 'area' or 'peak'
        """

        # input variables
        self._img = img
        self._centroids = centroids
        self.cfg = cfg if cfg is not None else PlenopticamConfig()
        self.sta = sta if sta is not None else PlenopticamStatus()
        self._M = M
        self._method = method if method is not None else 'area'

        # internal variables
        self._t = self._s = 0

        # output variables
        self._centroids_refined = []
Beispiel #5
0
    def __init__(self, parent):

        # inheritance
        tk.Tk.__init__(self, parent)
        self.parent = parent

        # window title
        self.wm_title("PlenoptiCam-" + __version__)

        # icon handling
        self.icon_handling()

        # initialize parameters
        self.sta = PlenopticamStatus()
        #self.sta.status_msg(msg='\n', opt=True)     # status message placeholder

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.view_wid = ViewWidget(self)
        self.view_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)
    def __init__(self, img, cfg=None, sta=None, M=None):

        # input variables
        self._img = img
        self.cfg = cfg if cfg is not None else PlenopticamConfig()
        self.sta = sta if sta is not None else PlenopticamStatus()
        self._M = M if M is not None else self.cfg.params[self.cfg.ptc_leng]

        # private variables
        self._peak_img = self._img.copy()
        self._centroids = []
Beispiel #7
0
    def __init__(self, *args, **kwargs):
        super(PlenopticamError, self).__init__(*args)

        self.cfg = kwargs['cfg'] if 'cfg' in kwargs else None
        self.sta = kwargs['sta'] if 'sta' in kwargs else PlenopticamStatus()

        self.args = args
        try:
            self.write_log()
        except PermissionError as e:
            self.sta.status_msg(msg=e, opt=True)
            raise e
    def __init__(self, img, cfg, sta=None, M=None, method=None):

        # input variables
        self._img = img
        self._cfg = cfg
        self._sta = sta if sta is not None else PlenopticamStatus()
        self._M = M if M is not None else 9
        self._method = method if method is not None else 'area'

        # private variables
        self._peak_img = self._img.copy()
        self._centroids = []
    def __init__(self, img, centroids, cfg, sta=None, M=None, method='area'):

        # input variables
        self._img = img
        self._centroids = centroids
        self.cfg = cfg
        self.sta = sta if sta is not None else PlenopticamStatus()
        self._M = M
        self._method = method

        # internal variables
        self._t = self._s = 0

        # output variables
        self._centroids_refined = []
Beispiel #10
0
    def __init__(self, img, cfg=None, sta=None, scale_val=1.625, CR=3):

        # input variables
        self._img = img
        self.cfg = cfg if cfg is not None else PlenopticamConfig()
        self.sta = sta if sta is not None else PlenopticamStatus()
        self._scale_val = scale_val
        self._CR = CR

        # internal variables
        self._top_img = None

        # output variables
        self._M = None
        self.scale_space = []
Beispiel #11
0
    def __init__(self, centroids, cfg, sta=None):

        # input variables
        self._centroids = np.asarray(centroids)     # list of unsorted maxima
        self.cfg = cfg                              # config file
        self.sta = sta if sta is not None else PlenopticamStatus()

        # internal variables
        self._lens_x_max = None  # maximum number of "complete" micro image centers in a row
        self._lens_y_max = None  # maximum number of "complete" micro image centers in a column
        self._upper_l = None
        self._lower_r = None

        # output variables
        self._mic_list = []                     # list of micro image centers with indices assigned
        self._pattern = None                    # pattern typ of micro lens array
        self._pitch = None                      # average pitch in horizontal and vertical direction
    def __init__(self, cfg, sta=None):

        # input variables
        self.cfg = cfg
        self.sta = sta if sta is not None else PlenopticamStatus()

        # internal variables
        self._lfp_json = {}
        self._georef = None
        self._serial = None
        self._cal_fn = None
        self._raw_data = None
        self._file_found = None
        self._opt_prnt = False if sta is not None else self.cfg.params[self.cfg.opt_prnt]
        self._path = self.cfg.params[self.cfg.cal_path]

        # output variables
        self._wht_img = None
Beispiel #13
0
    def __init__(self, cfg=None, sta=None):

        # input variables
        self.cfg = cfg if sta is not None else PlenopticamConfig()
        self.sta = sta if sta is not None else PlenopticamStatus()

        # internal variables
        self._lfp_json = {}
        self._georef = None
        self._lensref = None
        self._serial = None
        self._cam_model = ''
        self._cal_fn = None
        self._raw_data = None
        self._file_found = None
        self._opt_prnt = True if sta is not None else self.cfg.params[
            self.cfg.opt_prnt]
        self._path = self.cfg.params[self.cfg.cal_path]

        # output variables
        self._wht_bay = None
Beispiel #14
0
    def __init__(self, parent):

        # inheritance
        tk.Tk.__init__(self, parent)
        self.parent = parent

        # window title
        self.wm_title("Plenopticam-" + __version__)

        # icon handling
        if sys.platform == 'win32':
            self.wm_iconbitmap(default=ICON_PATH)
            cwd = sys._MEIPASS if hasattr(sys, '_MEIPASS') else os.getcwd()
            fp = os.path.join(cwd, 'icns', '1055104.ico')
            fp = fp if os.path.exists(fp) else ICON_PATH
            self.iconbitmap(fp)

        # initialize parameters
        self.sta = PlenopticamStatus()

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.view_wid = ViewWidget(self)
        self.view_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)

        # enable tkinter resizing
        self.resizable(True, False)