Esempio n. 1
0
    def raw_lfr2xraw(self,
                     lfp_in,
                     calibration_in=None,
                     dir_out=None,
                     threads=None,
                     i=0):
        """TNT process: raw LFR to xraw LFR

        :param lfp_in: `str`, source LFP file
        :param calibration_in: `str`, calibration directory
        :param dir_out: `str`, directory out
        :param threads: `int`, number of processing threads to use
        :param i: `int`, iteration during multi file-out process
        """

        calibration_in = self._set_calibration_in(lfp_in, calibration_in)

        basedir, name, ext = self._split_path(lfp_in)
        dir_out = self._check_dir(dir_out) if dir_out else basedir
        xraw_out = self.xraw_out(dir_out, name)
        xraw_out = utils.sanitize_path(xraw_out)

        self._status("xraw LFR", "raw", src=lfp_in, dest=xraw_out, i=i)

        tnt = Tnt(verbose=self.verbose)
        tnt.threads(threads)
        tnt.lfp_in(lfp_in)
        tnt.lfp_out(xraw_out)
        tnt.lfr2xraw()
        tnt.calibration_in(calibration_in)
        self._execute(tnt)
Esempio n. 2
0
    def warp_unpack(self,
                    lfp_in,
                    depthrep=None,
                    dir_out=None,
                    height=None,
                    imagerep=None,
                    threads=None,
                    width=None,
                    i=0):
        """TNT process: warp LFP to unpacked warp LFP

        :param lfp_in: `str`, source LFP file
        :param depthrep: `str`, depth map representation
        :param dir_out: `str`, directory out
        :param height: `int`, resolution height (in pixels)
        :param imagerep: `str`, image representation for processed LFP
        :param threads: `int`, number of processing threads to use
        :param width: `int`, resolution width (in pixels)
        :param i: `int`, iteration during multi file-out process
        """

        depthrep = depthrep or self._db['depthrep_warp_unpack']
        imagerep = imagerep or self._db['imagerep_warp_unpack']
        height, width = self._set_height_width(lfp_in, height, width)

        basedir, name, ext = self._split_path(lfp_in)
        dir_out = self._check_dir(dir_out) if dir_out else basedir
        lfp_out = self.lfp_out_unpacked(dir_out, name)

        self._status("unpacked LFP", "warp", src=lfp_in, dest=dir_out, i=i)

        tnt = Tnt(verbose=self.verbose)
        tnt.threads(threads)
        tnt.lfp_in(lfp_in)
        tnt.dir_out(dir_out)
        tnt.lfp_out(lfp_out)
        tnt.transcode()
        tnt.unpack()
        tnt.imagerep(imagerep)
        tnt.depthrep(depthrep)
        tnt.height(height)
        tnt.width(width)
        self._execute(tnt)

        if os.path.exists(lfp_out):
            self.recipe_out(lfp_out, threads=threads, i=i)
            self.warp_depth_map_json_out(lfp_out, i=i)
Esempio n. 3
0
    def warp_transcode(self, lfp_in, lfp_out=None, threads=None, i=0):
        """TNT process: warp LFP to warp LFP

        :param lfp_in: `str`, source LFP file
        :param lfp_out: `str`, destination LFP file
        :param threads: `int`, number of processing threads to use
        :param i: `int`, iteration during multi file-out process
        """

        lfp_out = lfp_out or lfp_in

        self._status("warp LFP", "warp", src=lfp_in, dest=lfp_out, i=i)

        tnt = Tnt(verbose=self.verbose)
        tnt.threads(threads)
        tnt.lfp_in(lfp_in)
        tnt.lfp_out(lfp_out)
        tnt.transcode()
        self._execute(tnt)
Esempio n. 4
0
    def raw_raw2lfp(self, raw_in, dir_out=None, threads=None, i=0):
        """TNT process: package RAW and corresponding TXT

        :param raw_in: `str`, source RAW file
        :param dir_out: `str`, directory out
        :param threads: `int`, number of processing threads to use
        :param i: `int`, iteration during multi file-out process
        """

        basedir, name, ext = self._split_path(raw_in)
        dir_out = self._check_dir(dir_out) if dir_out else basedir
        lfp_out = self.lfr_out(dir_out, name)
        lfp_out = utils.sanitize_path(lfp_out)

        self._status("raw", "unpackaged RAW", src=raw_in, dest=lfp_out, i=i)

        tnt = Tnt(verbose=self.verbose)
        tnt.threads(threads)
        tnt.raw_in(raw_in)
        tnt.lfp_out(lfp_out)
        tnt.raw2lfp()
        self._execute(tnt)
Esempio n. 5
0
    def raw_unpack(self,
                   lfp_in,
                   calibration_in=None,
                   depth_in=None,
                   depthrep=None,
                   dir_out=None,
                   height=None,
                   imagerep=None,
                   orientation=None,
                   perspective_u=None,
                   perspective_v=None,
                   recipe_in=None,
                   threads=None,
                   width=None,
                   i=0):
        """TNT process: raw LFR to image out

        :param lfp_in: `str`, source LFP file
        :param calibration_in: `str`, calibration directory
        :param depth_in: `str`, depth map input file
        :param depthrep: `str`, depth map representation
        :param dir_out: `str`, directory out
        :param height: `int`, resolution height (in pixels)
        :param imagerep: `str`, image representation for processed LFP
        :param orientation: `int`, image orientation
        :param perspective_u: `float`, perspective u coordinate
        :param perspective_v: `float`, perspective v coordinate
        :param recipe_in: `str`, input recipe file
        :param threads: `int`, number of processing threads to use
        :param width: `int`, resolution width (in pixels)
        :param i: `int`, iteration during multi file-out process
        """

        calibration_in = self._set_calibration_in(lfp_in, calibration_in)
        depthrep = depthrep or self._db['depthrep_raw_unpack']
        imagerep = imagerep or self._db['imagerep_raw_unpack']
        height, width = self._set_height_width(lfp_in, height, width)

        basedir, name, ext = self._split_path(lfp_in)
        recipe_in = self.set_recipe_in(recipe_in, i)
        parent_dir = self._check_dir(dir_out) if dir_out else basedir
        dir_out = os.path.join(parent_dir, name)
        dir_out = self._check_dir(dir_out, sane=True)
        lfp_out = self.lfp_out_unpacked(dir_out, name)

        self._status("unpacked warp LFP", "raw", src=lfp_in, dest=dir_out, i=i)

        tnt = Tnt(verbose=self.verbose)
        tnt.threads(threads)
        tnt.lfp_in(lfp_in)
        tnt.dir_out(dir_out)
        tnt.lfp_out(lfp_out)
        tnt.unpack()
        tnt.imagerep(imagerep)
        tnt.depthrep(depthrep)
        tnt.height(height)
        tnt.width(width)
        tnt.orientation(orientation)
        tnt.depth_in(depth_in)
        tnt.recipe_in(recipe_in)
        tnt.calibration_in(calibration_in)
        tnt.perspective_u(perspective_u)
        tnt.perspective_v(perspective_v)
        self._execute(tnt)

        if os.path.exists(lfp_out):
            self.recipe_out(lfp_out, threads=threads, i=i)
            self.warp_depth_map_json_out(lfp_out, i=i)