Shows how cylinders, with radius defined by a field can be used to visualize the coronary mesh. Also demonstrates how to make movies with cmgui. NOTE: The coronary mesh is quite large and is slow to view on older workstations.
If you are using the firefox web browser and have installed the Zinc extension you can run this example using Zinc (unsigned) - requires some configuration of Firefox security settings.
For more information about running zinc see The Zinc web page.
#Example_a4: Radius fields, cylinders and movies: heart and coronaries # # The coronary model describes the network of arteries delivering blood to the # heart. Starting with few, quite large vessels, the arteries bifurcate several # times until they are very fine and numerous. Consequently, this mesh is quite # large and takes some time to view. The elements in the mesh have a radius # field that will be used to draw them into appropriately sized cylinders. Since # it will be too slow to rotate the coronaries on most workstations, this # example also shows how to make a movie of the model rotating, enabling a # better appreciation of the 3-D layout of the arteries. # # Be sure to run the commands in this example in the order they are presented, # and not all at once. Comments and instructions for things you can do are given # between these commands. # # #---------- # # Create a few materials in addition to the default for use later. gfx create material heart ambient 0.3 0 0.3 diffuse 1 0 0 specular 0.5 0.5 0.5 shininess 0.5 gfx cre mat bluey ambient 0 0.2 0.4 diffuse 0 0.5 1 specular 0.5 0.5 0.5 shininess 0.8 gfx cre mat gold ambient 1 0.7 0 diffuse 1 0.7 0 specular 0.5 0.5 0.5 shininess 0.8 # # First read in the 120-element refined heart mesh (group heart) to show the # coronaries against. Its node and element numbers are lower than those used in # the coronary mesh and do not overlap. # !!! CS 26/1/2001 The heart model used here predates a modification to the scale # factors and the sheet angles in the current Auckland model. It has been left as # is because the coronary solutions were calculated based on this model. gfx read nodes example large_heart.exnode gfx read elements example large_heart.exelem # Clear the graphics for heart and set up increased surface quality: gfx mod g_e heart general clear element_discretization "10*10*4"; # # Draw the endo-cardial surfaces. gfx mod g_e heart surfaces exterior face xi3_0 mat heart # # Read in the coronary mesh (group coro0) and hide the axes. gfx read nodes example coro0.exnode gfx read elements example coro0.exelem # # Open the graphics window and reorient the heart up the right way (since -x is # "up" in the heart model). Also turn on perspective. gfx cre win 1 gfx mod win 1 image rotate 0 1 0 -90 gfx mod win 1 view perspective # # Destroy the default lines gfx modify g_element coro0 lines delete # # The coronary mesh has a very large number of nodes and elements. Since the # elements are all lines, set minimal element discretization (of one segment per # element curve) to reduce the memory requirements and increase rendering speed. gfx modify g_element coro0 general element_discretization 1 # # The radius of the coronary arteries is stored in component 1 of field # 'general', defined over the elements in the coro0 group. Now draw cylinders # using these radii with the following command, and note that it will take some # time to appear on the window! gfx mod g_e coro0 cylinders radius general.1 material gold # # Now we will make a movie of the coronaries rotating. The movie can be played # in the program and will also be written to disk, so you can run it using the # movieplayer program. Note that the movie file will be quite large and you # should probably delete it once you have tried it. First we will set up the # exact view we wish to see the object from. # # Set the resolution of the viewport in the window to 400x400. gfx mod win 1 layout width 400 height 400 # Set the interest point, eye point and up vector that define the centre of # what you are looking at, where you are viewing from and which way is up. CMGUI # automatically makes sure the up_vector is orthogonal to the direction of view # - unless you specify the 'allow_skew' options. gfx mod win 1 view interest_point 10 0 0 eye_point 0 -300 0 up_vector -1 0 0 # # Set the near and far clipping planes in distance from the view point. gfx mod win 1 view near_clipping_plane 1 far_clipping_plane 600 # # Set the view angle to mostly fill the screen. gfx mod win 1 view view_angle 30 # # Rotate the top of the heart slightly towards the viewer. gfx mod win 1 image rotate 0 0 1 -15 # # Set the number of segments used to draw the cylinders to 6. Increasing this # number will make the movie look better, but rendering will be slower and # smaller systems may run out of memory. gfx mod g_e coro0 general circle_discretization 6 # # If you wish to produce the best results, turn on "scene antialiasing" # at the highest quality level of 8, using the command gfx mod win 1 set antialias 8 # for ($i = 0 ; $i < 6 ; $i++) { # Rotate the coronaries about the -x axis by -10 degrees. Note that this angle # refers to the amount the viewer moves in the direction of a right hand screw # relative to the given axis. gfx modify window 1 image rotate -1 0 0 -10 # Save the frame. I am using sgi files as these are non lossy but compressed. # We probably could use jpg files but currently cmgui does not expose any way # of controlling the amount of compression and so defaults to a relatively low # value. gfx print window 1 file coronary_rotate$i.sgi } # # # If mpeg2enc is available build a movie. Shell return codes need to inversed. # Pipe output to /dev/null to hide it if (!system("which convert >/dev/null") && !system("which mpeg2enc >/dev/null")) { #convert images for ($i = 0 ; $i < 6 ; $i++) { system("convert coronary_rotate$i.sgi coronary_rotate$i.jpg") and die "Unable to convert image."; } # Pipe output to /dev/null so that the example generates the same screen output whether # mpeg2enc is available or not. system("jpeg2yuv -f 25 -I p -b 0 -j coronary_rotate%d.jpg 2>/dev/null | mpeg2enc -f 3 -b 3800 -a 1 -4 2 -2 3 -s -F 3 -np -q 1 -v 1 -o coronary_rotate.m2v > /dev/null 2>&1") and die "Unable to generate movie."; } #---------- # # FINAL NOTE: movies are extremely large files. To conserve disk space, make # sure you delete the movie you just created after running this example! #
Name Modified Size
example_a4.com 17-Mar-2014 5.9k COPYRIGHT 17-Mar-2014 504 coro.rgb 17-Mar-2014 587k coro0.exelem 17-Mar-2014 1.1M coro0.exnode 17-Mar-2014 1.9M coronary_rotate.com 17-Mar-2014 296 coronary_rotate.com_save 17-Mar-2014 292 large_heart.exelem 17-Mar-2014 432k large_heart.exnode 30-Mar-2015 71k
Name Modified Size
examples_a_a4.tar.gz 09-Mar-2016 3.5M
Status | Tested | Real time (s) | |
i686-linux | |||
cmgui-wx | Failure | Sun Mar 6 00:37:02 2016 | 20 |
last break | Tue Feb 24 03:37:00 2015 | 20 | |
cmgui-wx-debug | Failure | Sun Mar 6 00:41:16 2016 | 20 |
last break | Tue Feb 24 03:39:00 2015 | 20 | |
cmgui-wx-debug-memorycheck | Failure | Sun Mar 6 00:42:02 2016 | 22 |
last break | Tue Feb 24 03:38:00 2015 | 24 | |
cmgui-wx-debug-valgrind | Failure | Sun Mar 6 03:43:35 2016 | 1358 |
last break | Sun Mar 6 03:20:00 2016 | 1358 | |
x86_64-linux | |||
cmgui-wx | Failure | Sun Mar 6 00:01:26 2016 | 0 |
last break | Sun Mar 6 00:01:00 2016 | 0 | |
cmgui-wx-debug | Failure | Sun Mar 6 00:01:26 2016 | 0 |
last break | Sun Mar 6 00:01:00 2016 | 0 | |
cmgui-wx-debug-memorycheck | Failure | Sun Mar 6 00:01:26 2016 | 0 |
last break | Sun Mar 6 00:01:00 2016 | 0 | |
cmgui-wx-debug-valgrind | Failure | Sun Mar 6 00:02:45 2016 | 9 |
last break | Sun Mar 6 00:02:00 2016 | 9 |
x86_64-linux | |||
139 | cmgui-wx: | error exit status 139. | |
139 | cmgui-wx-debug: | error exit status 139. | |
139 | cmgui-wx-debug-memorycheck: | error exit status 139. | |
139 | cmgui-wx-debug-valgrind: | error exit status 139. |
i686-linux | |||
Failure | cmgui-wx: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-debug: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-debug-memorycheck: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-debug-valgrind: | diff test: differences with generic answer; Test output. | |
x86_64-linux | |||
Failure | cmgui-wx: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-debug: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-debug-memorycheck: | diff test: differences with generic answer; Test output. | |
Failure | cmgui-wx-debug-valgrind: | diff test: differences with generic answer; Test output. |
i686-linux | |||
Failure | cmgui-wx: | idiff test: Test output; wx answer. | |
Failure | cmgui-wx-debug: | idiff test: Test output; wx answer. | |
Failure | cmgui-wx-debug-memorycheck: | idiff test: Test output; wx answer. | |
Failure | cmgui-wx-debug-valgrind: | idiff test: Test output; wx answer. | |
x86_64-linux | |||
Missing | cmgui-wx: | output file not generated for idiff; wx answer. | |
Missing | cmgui-wx-debug: | output file not generated for idiff; wx answer. | |
Missing | cmgui-wx-debug-memorycheck: | output file not generated for idiff; wx answer. | |
Missing | cmgui-wx-debug-valgrind: | output file not generated for idiff; wx answer. |
Html last generated: Wed Mar 9 16:01:13 2016
Input last modified: Wed Mar 9 15:49:38 2016