def replicate_stitch_raster_frame()

in src/spg/spg.py [0:0]


    def replicate_stitch_raster_frame(self, frame, kwargs, results):
        """ The method to replicate an existing stitched frame and renumber it in the sequence

        :param frame: the frame we are going to stitch
        :param kwargs: a dictionary of arguments for the function
        :param results: a dictionary to store the output results in cross thread
        """
        raster_map = kwargs.get("raster_map", None)
        if raster_map is None:
            raise ValueError("raster_data not found in kwargs")

        full_sequence_frame_num = kwargs.get("full_sequence_frame_num", None)
        if full_sequence_frame_num is None:
            raise ValueError("full_sequence_frame_num not found in kwargs")

        first_pattern_sequence_frame = kwargs.get("first_pattern_sequence_frame", None)
        if first_pattern_sequence_frame is None:
            raise ValueError("first_pattern_sequence_frame not found in kwargs")

        raster_name = raster_map.name
        base_path = self.get_raster_base_path(raster_name)

        file_name = "{0}.{1}.{2}".format(
            raster_name,
            str(full_sequence_frame_num).zfill(self.project_settings.frame_padding), self.project_settings.image_file_format
        )

        first_frame_file_name = "{0}.{1}.{2}".format(
            raster_name,
            str(first_pattern_sequence_frame).zfill(self.project_settings.frame_padding),
            self.project_settings.image_file_format
        )

        full_file_path = os.path.join(
            base_path,
            file_name
        )

        first_frame_file_full_path = os.path.join(
            base_path,
            first_frame_file_name
        )

        # We do not provide a channel mapping here as our images will already have had their channels swapped
        # We do not apply a color space conversion here either as these will have already been done
        shutil.copy(first_frame_file_full_path, full_file_path)
        results[raster_name][full_sequence_frame_num] = full_file_path