Image Checker

ImageChecker.__init__()[source]

There are several configurable parameters that are imporant for this class:

  • resize_x - the reduction factor describing how much has the width been reduced from the original to the displayed image.
  • resize_y - the reduction factor describing how much has the height reduced between the original and displayed image.

Optionally you can rebind the key functionality or change the color scheme of the table in the top right by editing the TopRight Frame of the rightFrame. Additionally, the displayed keys in the TopRight Frame are editable through that class.

class lfd.gui.imagechecker.imagechecker.ImageChecker[source]

GUI app that allows for visual inspection of Events. To run the app instantiate the class and run its mainloop method or invoke run function located in this module.

The App itself does not manage the data. Data loading and management is handled by the EventBrowser class stored in self.data attribute.

The GUI consits of 2 Frames - left and right. Left frame is used to display information on the Event and the right hand side displays the image representation of the Event if availible. GUI binds the following shortcut keys:

  • <Left> - move to previous image without saving any changes
  • <Right> - continue to the next image without saving any changes
  • <Up> - continue to the next image but set the verified and false positive flags of the current Event to True and False respectively. Persist the changes to the DB
  • <Down> - continue to the next image but set the verified and false positive flags of the current Event to True and True respectively and persist the change to the DB
  • <LMB> - when clicked on the image will move the first point of the linear feature to that location and persist the changes to the database
  • <RMB> - when clicked on the image will move the second point of the linear feature to that location and persist the changes to the database

The colors in the data table on the right frame indicate the following:

  • Yellow - the Event was never visually inspected
  • Green - the Event was visually inspected and confirmed as true
  • Red - the Event was visually inspected and was determined to be a false detection
failedUpdate()[source]

Redraw left and right Frames and display their failure screens.

initGUI()[source]

Will initialize the GUI for the first time by prompting user for the location of the Database to connect to and the location of the images. The order of operations here is not particulary important because the update function will be called to clean and redisplay everything on the screen.

initImages()[source]

Prompt user for the directory containing all the images in the DB.

initResults()[source]

Prompt user for the database file from which Events will be read.

update()[source]

Redraw right and left Frames. The order is important, updating left frame before loading new event will not load the data required to draw the line over the canvas.

class lfd.gui.imagechecker.leftframe.LeftFrame(parent)[source]

Represents the left frame of the GUI. Contains the Canvas within which the image is displayed and additional functionality that allows the users to chage the line parameters, and persist those changes to the DB. The following mouse actions are bound to the canvas:

  • <Button-1> - on click of the left mouse button (LMB) will bind the current coordinates of the mouse pointer and convert the on-canvas coordinates to the frame-coordinate system using the resize_x and resize_y resizing reduction factors defined in the root class of the app. These converted coordinates are then set as a new x1, y1 coordinates of the p1 Point of the Event.
  • <Button-3> - on right mouse button (RMB) click records the coordinates of the pointer, scales them to frame coord. sys. and persists the change as the x2, y2 coordinates of p2 Point of the Event.
drawline(delete=False)[source]

Draws the line defined by the current Event’s Points p1 and p2. If delete is set to True then it will delete any existing line. It is important that the resize scaling factors are correctly set.

failedImageLoadScreen()[source]

Clears the canvas and displays the Error image.

lmb(event)[source]

Callback, records and updates the x1, y1 coordinates of the Event.

rmb(event)[source]

Callback, records and updates the x2, y2 coordinates of the Event.

update()[source]

Updates the canvas and handles the errors.

updateLine(sx, sy, which)[source]

Function that will scale the canvas coordinates to correspond to the frame-coordinate system and sets the new coordinates as the p1 or p2 coordinates of the Event. It is important that the resize scaling factors used in the App are correct if the output is to be trusted.

Parameters:
  • sx (int) – x coordinate in canvas coordinate system
  • sy (int) – y coordinate in canvas coordinate system
  • which (str) – used to determine whether the coordinates belong to point 1 or point 2 of the Event. Either ‘1’ or ‘2’.
class lfd.gui.imagechecker.rightframe.RightFrame(parent)[source]

Represents the right part of the frame containing all the action buttons and displaying the data of he Event from the database. The right frame is split into two sub-frames one used to display the Event in question and the other one containing all the action elements (next, true, false, previous, find, change data source etc.)

failedEventLoadScreen()[source]

Redraws the right frame displaying appropriate error messages in case of failure.

update()[source]

Calls the update methods of each subframe in the correct order and handles failures.

class lfd.gui.imagechecker.topright.TopRight(parent)[source]

Top right part of the right frame. Used to display the data on currently selected Event.

Contains several customizable attributes such as:

  • unverified_color- the color to display when the Event’s verified flag is False (DarkGoldenrod1 by default)
  • falsepositive_color - the color to display when the Event is verified as false positive (red by default)
  • positive_color - color to display when the Event is verified as a positive detection (DarkOliveGreen3)
  • displayKeys - keys that will be displayed in the information table of the Event. Any valid column name of Event is accepted, by default will be: [run, camcol, filter, field, frame.t.iso]
updateImageData()[source]

Clears the currently displayed table, and draws a new table displaying the data of currently loaded Event. If there is no Event currently loaded, raises an IndexError (since the index of current Event is None).

class lfd.gui.imagechecker.botright.BottomRight(parent)[source]

Bottom right Frame of the RightFrame of the app. This section contains all the active elements of the app, such as Buttons for selecting the DB, directory of images, moving to the next or previous image or changing the DB entries by verifying their truthfulness.

false(*args)[source]

Callback that sets the false_positive attribute of the current Event to True, persists the change to the DB, moves the current data index to the following data instance and updates the whole GUI.

nextimg(*args)[source]

Callback function that moves the current data index to the following one and updates the whole GUI.

previmg(*args)[source]

Callback function that moves to the previous data instance and updates the whole GUI.

search()[source]

Opens a new window that allows user to input the run, camcol, filter and field designations of the Frame they would like to jump to. The search will jump to the first Event with the correct Frame designation.

As there can be multiple Events on the same Frame, user can provide the ordinal number of the Event they are interested in.

selectimages()[source]

Re-initializes the apps selection of directory containing images and refreshes the whole GUI.

selectresults()[source]

Re-initializes the apps selection of the Event database and refreshes the whole GUI.

true(*args)[source]

Callback that sets the false_positive attribute of the current Event to False, persists the change to the DB, moves the current data index to the following data instance and updates the whole GUI.