cdvetal / expression-viewer

Tool for inspecting expression-based images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expression Viewer

Introductory text and screenshot soon.

Expression editing

There are two methods for modifying the input expression:

  1. Code variable: You can insert the expression string in the variable expression (located at the beginning of the code) before running the visualiser.
  2. Text file: You can store the expression string in the file expression.txt which is continuously watched by the visualiser for modifications. By default this file is located inside the folder expression_viewer/data/, but you can easily change this my modifying the variable expressionFile (located at the beginning of the code). This method is useful for live expression editing or to visualise expression being generated programmatically.

Please note that the second method overrides the first. Thus, if there is an expression saved in the file, this will be the one that will be visualised (ignoring the expression specified in the code).

Integration with Genetic Programming engine

The integration of this tool with a GP engine allows rendering the output (image) of each tree node. Specifically, the visualiser asks the GP engine to generate images for a set of expressions, including the input expression and all of its subexpressions. Once these images are generated and saved in a particular folder, the visualiser loads and displays them in the tree. Whenever the expression changes, the visualiser asks the GP engine for new images.

This integration requires the GP engine to:

Repeat:
    If file gp_engine_order.txt exists:
        Read value image_size from this file
        Read path gp_engine_images from this file
        Read path gp_engine_feedback from this file
        Read list of expressions (and each corresponding id) from this file
        If folder gp_engine_images exists:
            Remove contents of this folder
        Else:
            Create this folder
        Create empty list errors
        For each expression:
            Generate image with size image_size
            If image was created successfully:
                Save image in folder gp_engine_images with the filename id.png
            Else:
                Add to list errors one text line describing the error that occured        
            Create folder gp_engine_images
        Create file gp_engine_feedback.txt containing the list errors
        Delete file gp_engine_order.txt

The file gp_engine_order.txt is located by default inside the folder expression_viewer/data/. However, this can be changed in the variable fileWithGPEngineOrder in the visualiser code.

Interaction

  • Press key e to see or edit the input expression using the default external editor

About

Tool for inspecting expression-based images

License:MIT License


Languages

Language:Processing 100.0%