Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tb.message = "Let's count up to 100 and exit :" + str(cnt)
showm.scene.azimuth(0.05 * cnt)
sphere_actor.GetProperty().SetOpacity(cnt/100.)
showm.render()
if cnt == 100:
showm.exit()
scene.add(tb)
# Run every 200 milliseconds
showm.add_timer_callback(True, 200, timer_callback)
showm.start()
window.record(showm.scene, size=(900, 768), out_path="viz_timer.png")
# manager.
current_size = (800, 800)
show_manager = window.ShowManager(size=current_size,
title="DIPY Shapes Example")
show_manager.scene.add(rect)
show_manager.scene.add(disk)
show_manager.scene.add(ring)
interactive = False
if interactive:
show_manager.start()
window.record(show_manager.scene, size=current_size, out_path="viz_shapes.png")
# Show Manager
# ==================================
#
# Now we add label and combobox to the scene.
current_size = (400, 400)
showm = window.ShowManager(size=current_size, title="ComboBox UI Example")
showm.scene.add(label, color_combobox)
# To interact with the UI, set interactive = True
interactive = False
if interactive:
showm.start()
window.record(showm.scene, out_path="combobox_ui.png", size=(400, 400))
showm.initialize()
scene.set_camera(position=(0, 0, -300))
timer_callback = new_layout_timer(
showm, edges, vertices_count,
max_iterations=200,
vertex_initial_positions=positions)
# Run every 16 milliseconds
showm.add_timer_callback(True, 16, timer_callback)
showm.start()
window.record(showm.scene, size=(900, 768),
out_path="viz_animated_networks.png")
scene.add(panel)
###############################################################################
# Change interactive to True to start interacting with the scene
interactive = False
if interactive:
showm.start()
###############################################################################
# Save the current framebuffer in a PNG file
window.record(showm.scene, size=(1024, 768), out_path="viz_picking.png")
Path to reference FA nii.gz file
fname : str
Path of the output file (saved as )
"""
renderer = window.Renderer()
template_img_data = nib.load(template_path).get_data().astype("bool")
template_actor = actor.contour_from_roi(
template_img_data, color=(50, 50, 50), opacity=0.05
)
renderer.add(template_actor)
lines_actor = actor.streamtube(
final_streamlines, window.colors.orange, linewidth=0.3
)
renderer.add(lines_actor)
window.record(renderer, n_frames=1, out_path=fname, size=(900, 900))
"""
let's visualize extracted Corticospinal Tract (CST) Left bundle and model
bundle together
"""
interactive = False
ren = window.Renderer()
ren.SetBackground(1, 1, 1)
ren.add(actor.line(model_cst_l, colors=(.1, .7, .26)))
ren.add(actor.line(recognized_cst_l, colors=(.1, .1, 6)))
ren.set_camera(focal_point=(-18.17281532, -19.55606842, 6.92485857),
position=(-360.11, -340.46, -40.44),
view_up=(-0.03, 0.028, 0.89))
window.record(ren, out_path='CST_L_recognized_bundle.png',
size=(600, 600))
if interactive:
window.show(ren)
"""
.. figure:: CST_L_recognized_bundle.png
:align: center
Extracted Corticospinal Tract (CST) Left bundle and model bundle
"""
"""
Save the bundle as a trk file:
###############################################################################
# Now that all the elements have been initialised, we add them to the show
# manager.
current_size = (800, 800)
show_manager = window.ShowManager(size=current_size,
title="DIPY Button Example")
show_manager.scene.add(panel)
interactive = False
if interactive:
show_manager.start()
window.record(show_manager.scene, size=current_size,
out_path="viz_button.png")
scene = window.Scene()
scene.add(streamlines_actor)
scene.add(seedroi_actor)
###############################################################################
# If you uncomment the following line, the rendering will pop up in an
# interactive window.
interactive = False
if interactive:
window.show(scene)
# scene.zoom(1.5)
# scene.reset_clipping_range()
window.record(scene, out_path='contour_from_roi_tutorial.png',
size=(600, 600))
for example in examples:
for element in example:
show_manager.scene.add(element)
show_manager.scene.add(cube)
show_manager.scene.reset_camera()
show_manager.scene.set_camera(position=(0, 0, 200))
show_manager.scene.reset_clipping_range()
show_manager.scene.azimuth(30)
# To interact with the UI, set interactive = True
interactive = False
if interactive:
show_manager.start()
window.record(show_manager.scene, size=current_size, out_path="viz_ui.png")