Exemplo n.º 1
0
view.surfaceCallback(loadSurface)
view.generateCallback(generate)
view.saveCallback(save)
view.setAirways('airway_tree_FRC.ipnode', 'airway_tree_FRC.ipelem')
view.setOutputs('out.exnode', 'out.exelem')
view.setInfo("""
<h2>Grow airway tree</h2>
<p>This GUI provides an easy interface for the grow_tree Fortran code in lungsim. It allows the visualization of the airway tree and the surface mesh and allows configuring the growth algorithm.</p>
<p>Created for use within the Auckland Bioengineering Institute at the University of Auckland.</p>
<h3>Usage</h3>
<p>Select the initial airway tree (.ipnode and .ipelem) and click Load. Then select the surface mesh (.ipnode and .ipelem) into which the airways should be grown, and click Load. Both the airway tree and surface mesh are now visible in the 3D view.</p>
<p>The algorithm can be configured using the following settings:</p>
<ul>
<li><b>Grid size:</b> distance between seed points that the surface mesh gets filled with</li>
<li><b>Start node:</b> the node number from which growing starts, this branch must have final nodes within the surface mesh!</li>
<li><b>Angle max:</b> maximum branch angle with parent</li>
<li><b>Angle min:</b> minimum branch angle with parent</li>
<li><b>Branch fraction:</b> fraction of distance (to COFM) to branch</li>
<li><b>Length limit:</b> minimum length of a generated branch</li>
<li><b>Shortest length:</b> length that short branches are reset to (shortest in model)</li>
<li><b>Rotation limit:</b> maximum angle of rotatin of branching plane</li>
<li><b>Reset airway tree:</b> remove previously generated branches and start with the loaded airway template</li>
</ul>
<p><b style="color:red">Warning:</b> make sure to select the largest surface mesh first to avoid the Fortran code from crashing.</p>
<p>When the airway tree is complete you can export the data by clicking Save after selecting the output file names (.exnode and .exelem).</p>
""")
view.show()
sys.exit(app.exec_())

# Print errors
num = model._logger.getNumberOfMessages()
Exemplo n.º 2
0
    elem = os.path.splitext(exelem)[0]
    export_node_geometry_2d(node, 'fitted', 0)
    export_elem_geometry_2d(elem, 'fitted', 0, 0)
    print('Saved mesh as %s and %s' % (exnode, exelem))


view = View(scene)
view.loadCallback(load)
view.showCallback(show)
view.landmarkCallback(landmark)
view.fitCallback(fit)
view.saveCallback(save)
view.setOutputs('out.exnode', 'out.exelem')
view.setInfo("""
<h2>Lung fitting</h2>
<p>This GUI provides an easy interface for the surface_fitting Fortran code in lungsim. It allows the visualization of the data cloud and fitted surface mesh and allows configuring the fitting algorithm.</p>
<p>Created for use within the Auckland Bioengineering Institute at the University of Auckland.</p>
<h3>Usage</h3>
<p>Select the data cloud (.ipdata) and template mesh (.ipnode and .ipelem) files and press Load. Both the data cloud and surface mesh are visible in the 3D view and their visibility can be toggled with the checkboxes.</p>
<p>The number of iterations can be set for the fitting algorithm and optionally there is the possibility to select landmark nodes to supply to the fitting algorithm (not yet supported). Click on the Fit button to start the fitting procedure with its output redirected to the console.</p>
<p>You can select landmarks by hiding the surface mesh and then clicking one of the landmark buttons. Then click on a data cloud point to select the location for the landmark node. Do this for all landmarks and the nodes will show up with matching colors.</p>
<p>When the surface mesh has a good fit with the data cloud you can export the data by clicking Save after selecting the output file names (.exnode and .exelem).</p>
""")
view.show()
sys.exit(app.exec_())

# Print errors
num = model._logger.getNumberOfMessages()
for i in range(0, num):
    print model._logger.getMessageTextAtIndex(i)