Example #1
0
    def test_lut_1d(self):
        """Open a 1D LUT and display it

        """
        if DISPLAY:
            plot_that_lut.plot_that_lut(self.lut1d,
                                        count=plot_that_lut.DEFAULT_SAMPLE)
        else:
            # TODO
            pass
Example #2
0
    def test_lut_3d(self):
        """Open a 3D LUT and display it

        """
        if DISPLAY:
            plot_that_lut.plot_that_lut(self.lut3d,
                                        count=plot_that_lut.DEFAULT_CUBE_SIZE)
        else:
            # TODO
            pass
Example #3
0
    def test_lut_3d(self):
        """Open a 3D LUT and display it

        """
        if DISPLAY:
            plot_that_lut.plot_that_lut(self.lut3d,
                                        count=plot_that_lut.DEFAULT_CUBE_SIZE)
        else:
            # TODO
            pass
Example #4
0
    def test_lut_1d(self):
        """Open a 1D LUT and display it

        """
        if DISPLAY:
            plot_that_lut.plot_that_lut(self.lut1d,
                                        count=plot_that_lut.DEFAULT_SAMPLE)
        else:
            # TODO
            pass
Example #5
0
    def plotThatLutUpload(
        self, lutfile, lut_type, count, custom_count, inverse=False, prelutfile=None, postlutfile=None
    ):
        """PlotThatLUT plot page

        Args:
            lutfile (str): path to a color transformation file (lut, matrix...)

            lut_type (str): possible values are 'curve' or 'cube'

            count: possible values are 'custom' or 'auto'

            custom_count (int): custom count value

        kwargs:
            inverse (bool): inverse input lut

            prelutfile (str): path to a pre LUT

            postlutfile (str): path to a post LUT

        """
        # copy uploaded files on the server to use it with plot_that_lut
        backup_filename = self.__copy_uploaded_file(lutfile)
        backup_pre_filename = None
        backup_post_filename = None
        if prelutfile.file:
            backup_pre_filename = self.__copy_uploaded_file(prelutfile)
        if postlutfile.file:
            backup_post_filename = self.__copy_uploaded_file(postlutfile)
        # init args
        if count == "custom":
            tmp_count = int(custom_count)
            display_count = str(tmp_count)
        else:
            tmp_count = None
            display_count = count
        if inverse:
            inverse_text = "Yes"
        else:
            inverse_text = "No"
        label = ("Displaying : {0} (type : {1}, samples : {2}, inverted : {3})").format(
            backup_filename, lut_type, display_count, inverse_text
        )
        if prelutfile.file:
            label = ("{0}<br>Pre-LUT : {1}").format(label, backup_pre_filename)
        if postlutfile.file:
            label = ("{0}<br>Post-LUT : {1}").format(label, backup_post_filename)
        # call plot_that_lut to export the graph
        try:
            result = plot_that_lut.plot_that_lut(
                backup_filename, lut_type, tmp_count, inverse, backup_pre_filename, backup_post_filename
            )
            result = ('<img src="/{0}" width="640" height="480"' 'border="0"/>').format(result)
        except Exception, e:
            error = str(e).replace("\n", "<br>")
            result = ("<h2>Something went wrong ! </h2>" "<br>" '<font color="#FF0000">{0}</font><br>').format(error)
            print traceback.format_exc()
Example #6
0
    def plotThatLutUpload(self,
                          lutfile,
                          lut_type,
                          count,
                          custom_count,
                          inverse=False,
                          prelutfile=None,
                          postlutfile=None):
        """PlotThatLUT plot page

        Args:
            lutfile (str): path to a color transformation file (lut, matrix...)

            lut_type (str): possible values are 'curve' or 'cube'

            count: possible values are 'custom' or 'auto'

            custom_count (int): custom count value

        kwargs:
            inverse (bool): inverse input lut

            prelutfile (str): path to a pre LUT

            postlutfile (str): path to a post LUT

        """
        # copy uploaded files on the server to use it with plot_that_lut
        backup_filename = self.__copy_uploaded_file(lutfile)
        backup_pre_filename = None
        backup_post_filename = None
        if prelutfile.file:
            backup_pre_filename = self.__copy_uploaded_file(prelutfile)
        if postlutfile.file:
            backup_post_filename = self.__copy_uploaded_file(postlutfile)
        # init args
        if count == 'custom':
            tmp_count = int(custom_count)
            display_count = str(tmp_count)
        else:
            tmp_count = None
            display_count = count
        if inverse:
            inverse_text = "Yes"
        else:
            inverse_text = "No"
        label = ('Displaying : {0} (type : {1}, samples : {2}, inverted : {3})'
                 ).format(backup_filename, lut_type, display_count,
                          inverse_text)
        if prelutfile.file:
            label = ('{0}<br>Pre-LUT : {1}').format(label, backup_pre_filename)
        if postlutfile.file:
            label = ('{0}<br>Post-LUT : {1}').format(label,
                                                     backup_post_filename)
        # call plot_that_lut to export the graph
        try:
            result = plot_that_lut.plot_that_lut(backup_filename, lut_type,
                                                 tmp_count, inverse,
                                                 backup_pre_filename,
                                                 backup_post_filename)
            result = ('<img src="/{0}" width="640" height="480"'
                      'border="0"/>').format(result)
        except Exception, e:
            error = str(e).replace('\n', '<br>')
            result = ("<h2>Something went wrong ! </h2>"
                      "<br>"
                      '<font color="#FF0000">{0}</font><br>').format(error)
            print traceback.format_exc()
Example #7
0
            plot_that_lut.DEFAULT_SAMPLE, plot_that_lut.DEFAULT_CUBE_SIZE),
        default=None,
        type=int)
    # version
    parser.add_argument('-v',
                        "--version",
                        action='version',
                        version='{0} - version {1}'.format(
                            description, __version__))
    # full version
    versions = debug_helper.get_imported_modules_versions(
        sys.modules, globals())
    versions = '{0} - version {1}\n\n{2}'.format(description, __version__,
                                                 versions)
    parser.add_argument('-V',
                        "--full-versions",
                        action=debug_helper.make_full_version_action(versions))
    # return args
    return parser.parse_args()


if __name__ == '__main__':
    ARGS = __get_options()
    try:
        plot_that_lut.plot_that_lut(ARGS.lutfiles, ARGS.plot_type,
                                    ARGS.samples_count, ARGS.inverse,
                                    ARGS.prelutfile, ARGS.postlutfile,
                                    ARGS.markers)
    except Exception as exc:
        print("Watch out !\n%s" % exc)