Пример #1
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)
Пример #2
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)