3D Staging System
This document offers a thorough overview of the stage
function, which is executed through the CLI command:
limb stage <folder_path>
Warning
The server is still not public, so, for now, we recommend using the local exectuble found in the Gene Mapper. Make sure to change the enviroment variable to your executable
The Function: stage
TLDR; The stage
function is crucial for preparing a 3D limb model for analysis by fitting a plane to the model and processing this information either through a remote server or a local executable. This process aligns and calibrates the model, making it ready for further stages of analysis or study.
Workflow
When you call the stage
function, it triggers the _stage_limb
function, which orchestrates the staging process. Here’s how it unfolds:
Firstly, the function loads the configuration from a file named pipeline.log
, located in the experiment folder. This file provides the path to the surface mesh that will be staged.
The function then attempts to connect to the server. If the server connection is successful and the server responds with valid data, the function proceeds to use this server to process the staging information. In the event that the server is unreachable or fails to respond, the function defaults to using a local executable to handle the staging. If there is no executable, nor a connection with the server, the program exits.
Once the server connection is established, or the fallback to the local executable is confirmed, the function sets up an interactive 3D visualization environment. Here, users can manually fit a plane to the limb model. Through this interactive tool, users can add points to define the plane's orientation and position. After fitting the plane, the function applies a transformation to the limb model to align it based on the defined plane.
Following the manual alignment, the function processes the fit data. If using the server, it sends the data as a JSON payload, which the server processes and returns with the staging result. If the executable is used, the function writes the fit data to a temporary file and runs the local executable to process the data. It then retrieves the staging result from the output generated by the local executable.
Finally, regardless of whether the server or the local executable was used, the function updates the pipeline configuration with the new staging result and saves this updated configuration back to the pipeline.log
file.
Example Usage
To execute the staging process programmatically, you can use the following snippet:
from pathlib import Path
# Define the path to the experiment folder
experiment_folder_path = Path("/path/to/experiment")
# Execute the function to perform the staging process
_stage_limb(experiment_folder_path)