main

class main.main(*args, **kwargs)[source]

Bases: Tk

Main tkinter application, started with mainloop(). Main is the controller for the VirtualRocks project and manages app state as well as communicates between the reconstruction of the 3D point cloud/mesh and the GUI.

Parameters:

arg[0] (str) – Optional path to a .vrp file.

_end_fullscreen(event=None)[source]

Event handler bound to <Esc> key.

Parameters:

e (event) – for tkinter event handlers.

_get_progress()[source]

Helper function to get the progress of the current substep. Needed to preserve progress when switching styles.

Returns:

percentage of progress made on the current step.

Return type:

int

_open_middle(windoww, windowh)[source]

Helper function to set the size and position of the app window on open.

Parameters:
  • windoww (int) – width of the window.

  • windowh (int) – height of the window.

_shutdown()[source]

Handler for <WM_DELETE_WINDOW> event. Method will be called whenever the user closes the tkinter app. Cancels any existing reconstruction processes.

_startup()[source]

Helper function with common startup tasks for both opening and creating a new project. Will be called by new_project and open_project.

_toggle_fullscreen(event=None)[source]

Event handler bound to <F11> key.

Parameters:

e (event) – for tkinter event handlers.

add_photos(imgdir)[source]

Method that sets the controller variable for image directory and sets the example image from pictures in the selected image directory. Progress on this step is tracked using the _send_log helper function in ReconManager.

The handler method photos_handler in PipelineGUI opens a dialog that allows the user to select an image directory.

Parameters:

imgdir (pathlib.Path) – path to the image directory

auto_recon()[source]

Handler method for the automatic reconstuction feature, called by a command in the Reconstruction file menu in AppWindow.

It starts a new thread for the auto method in the ReconManager class.

Warning

Using ReconManager’s auto method does not allow the user to trim the point cloud. It’s useful when running the app on a large dataset or overnight, but will likely result in a final mesh that includes outlier points.

back_to_start()[source]

Handler method for reopening the starting page when the “Back to Start” menu item in the File menu tab in AppWindow is pressed. It reopens the Tk Frame made by StartGUI, resets the app title, and disables the Reconstruction menu tab.

cancel_recon()[source]

Handler method for cancelling the reconstruction, no matter the step it’s on. It’s called by the “Cancel” button PipelineGUI, and when changing project directory with PipelineGUI’s change_projdir.

init_style()[source]

Handles assignment of style elements when app starts or when the style changes. This includes the button size, the title font size on the start page, and progress bar appearance. The progress on the current step, if one is running, is also reprinted to the bar.

new_project(projdir, name=None, imgdir=None)[source]

Method for creating a new project. Will create a .vrp file after prompting the user for a project name and workspace directory. After creating a fresh project, app will launch into the main page of the app.

Parameters:
  • projdir (pathlib.Path) – project directory to save .pkl file in.

  • name (str) – optional, the name of the project.

  • imgdir (pathlib.Path) – optional, image directory

open_project(projfile)[source]

Method for opening an existing VirtualRocks project. Will load the correct application state and paths from the .vrp file and launch into the main page of the app.

Parameters:

projdir (pathlib.Path) – Project directory containing .pkl file.

preview_cloud()[source]

Handler method for the “Preview Point Cloud” button beneath the chart in PipelineGUI. It starts a subprocess to open an open3d viewer window of the current project file, which will remain open even if the VirtualRocks window is closed.

restore()[source]

Handler method for the “Reset” button on the setting bounds step in PipelineGUI. It overwrites the current fused.ply file with the unedited save.ply copy. The method undoes any previous point cloud trims done when setting bounds.

set_bounds(minx, maxx, miny, maxy, minz, maxz)[source]

Method communicates between the GUI and the PointCloudManager for trimming models by removing points from the dense point clouds. This step automatically completes, and its progress is tracked using the _send_log helper function in ReconManager. The handler method bounds_handler in PipelineGUI creates the dialog (using the BoundsDialog class) and passes the bounds received from the user to this method. Bounds are inclusive.

Parameters:
  • minx (float) – minimum x axis bound.

  • maxx (float) – maximum x axis bound.

  • miny (float) – minimum y axis bound.

  • maxy (float) – maximum y axis bound.

  • minz (float) – minimum z axis bound.

  • maxz (float) – maximum z axis bound.

start_matcher()[source]

Handler method for starting the mesher (Colmap), called via “2: Matcher” button press in PipelineGUI.

It starts a new thread for the matcher method in the ReconManager class.

start_mesher()[source]

Handler method for starting the mesher (pymeshlab), called via “3: Mesher” button push in PipelineGUI.

It starts a new thread for the mesher method in the ReconManager class.

update_state(state)[source]

Method for updating the state of the application, which controls which buttons are activated and the image the chart is set to. The method also controls the value of the total progress bar. Called when opening projects and progressing through the pipeline to gradually enable functionality when applicable.

Parameters:

state (int) – flag to track the state of the application.