Difference between revisions of "Blood Flow Aneurysm Tutorial Vector Field Visualization"

(Sharing automation script)
m (Query to find the Maximum Velocity on the Slice)
 
(16 intermediate revisions by 2 users not shown)
Line 26: Line 26:
 
**In the '''Glyphs''' tab:
 
**In the '''Glyphs''' tab:
 
***Under the '''Scale''' section, set the scale to '''0.5'''
 
***Under the '''Scale''' section, set the scale to '''0.5'''
***Under the '''Style''' section, chance the '''Arrow body''' to '''Cylinder'''
+
***Under the '''Style''' section, set '''Arrow body''' to '''Cylinder'''
 
***Under the '''Rendering''' section, set '''Geometry Quality''' to '''High'''
 
***Under the '''Rendering''' section, set '''Geometry Quality''' to '''High'''
 
**Click '''Apply''' and dismiss the window.
 
**Click '''Apply''' and dismiss the window.
Line 65: Line 65:
 
**Click '''Query'''
 
**Click '''Query'''
  
This will give you the maximum scalar value on the slice and the x,y,z coordinates of the element associated with this value.   
+
This will give you the maximum scalar value on the slice and the x,y,z coordinates of the node associated with this value.   
We will use the x,y,z coordinates of this element to seed a set of streamlines.
+
We will use the x,y,z coordinates of this node to seed a set of streamlines.
  
 
[[Image:bflow_tutorial_vel_mag_slice_max_query.png]]
 
[[Image:bflow_tutorial_vel_mag_slice_max_query.png]]
  
 +
==== Plotting Streamlines of Velocity ====
  
*Add a '''Streamline''' Plot of '''velocity'''
+
*Add a '''Pseudocolor''' Plot of '''operators/IntergralCurve/velocity'''
** [Plot List] Add->Streamline->'''velocity'''
+
** [Plot List] Add->Pseudocolor->'''operators/IntergralCurve/velocity'''
  
*Open the '''Streamline Plot Attributes Window'''
+
[[Image:bflow_tutorial_add_icruve_plot.png]]
*In the '''Streamlines''' tab
+
 
 +
*Open the '''IntegralCurve Operator Attributes Window'''
 +
*In the '''Integration''' tab
 
**Under the '''Source''' section
 
**Under the '''Source''' section
 
***Set the '''Source type''' to '''Circle'''
 
***Set the '''Source type''' to '''Circle'''
Line 87: Line 90:
 
***Set '''Samples in Theta''' to '''12'''
 
***Set '''Samples in Theta''' to '''12'''
  
[[Image:bflow_tutorial_vel_streamline_atts_source_.png]]
+
*In the '''Advanced''' tab:
 +
**Under the '''Warnings''' section, uncheck all of the warning checkboxes
 +
*Click '''Apply''' and dismiss the IntegralCurve operator attributes window.
 +
 
  
 +
[[Image:bflow_tutorial_vel_icurve_streamline_atts_source_.png]]
  
*In the '''Appearance''' tab
+
*Open the '''Pseudocolor Plot Attributes Window'''
 +
 
 +
*In the '''Data''' tab
 
**Under the '''Color''' section,  
 
**Under the '''Color''' section,  
 
***Change the '''Color table''' to '''Reds'''
 
***Change the '''Color table''' to '''Reds'''
**Under the '''Display''' section
 
***Change '''Draw as''' to '''Tubes'''
 
***Check the '''Show heads''' check box, and set '''Display as''' to '''Cone'''
 
***Set the '''Display quality''' to '''High'''
 
  
[[Image:bflow_tutorial_vel_streamline_atts_display_.png]]
+
[[Image:bflow_tutorial_vel_icurve_stramline_pc_color_table.png]]
  
 +
*In the '''Geometry''' tab
 +
**Under the '''Line''' section
 +
***Change '''Line Type''' to '''Tubes'''
 +
***Change '''Tail''' to '''Sphere'''
 +
***Change '''Head''' to '''Cone'''
 +
***Change Head and Tail '''Radius''' to 0.02
  
*In the '''Advanced''' tab:
+
[[Image:bflow_tutorial_vel_icurve_stramline_pc_lines_options_.png]]
**Under the '''Warnings''' section, uncheck all of the warning checkboxes
+
 
*Click '''Apply''' and dismiss the Streamline plot attributes window.
+
*Click '''Apply''' and dismiss the Pseudocolor Plot attributes window.
 
*Click '''Draw''' and use the [Time Slider] Control to view a few time steps.
 
*Click '''Draw''' and use the [Time Slider] Control to view a few time steps.
  
Line 111: Line 122:
 
Finally, to explore the time varying behavior of the flow field we will use Pathlines. Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.  
 
Finally, to explore the time varying behavior of the flow field we will use Pathlines. Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.  
  
We will modify our previous Streamline plot to create Pathlines.
+
We will modify our previous IntergralCurve options to create Pathlines.
  
 
*Set the [Time Slider] Control to the first timestep.
 
*Set the [Time Slider] Control to the first timestep.
*Open the '''Streamline Plot Attributes Window'''
+
*Open the '''Integral Curve Attributes Window'''
**Under the '''Advanced''' tab
+
**Under the '''Apperance''' tab
 
***In the '''Streamlines vs Pathlines''' section
 
***In the '''Streamlines vs Pathlines''' section
 
****Select '''Pathline'''
 
****Select '''Pathline'''
Line 121: Line 132:
 
*****Set '''How to perform interpolation over time''' to '''Mesh is static over time'''
 
*****Set '''How to perform interpolation over time''' to '''Mesh is static over time'''
  
[[Image:bflow_tutorial_vel_pathline_settings.png]]
+
[[Image:bflow_tutorial_vel_icruve_pathline_settings.png]]
  
 
*Click Apply and dismiss the window.
 
*Click Apply and dismiss the window.
Line 128: Line 139:
  
 
[[Image:bflow_tutorial_vel_pathline_final.png]]
 
[[Image:bflow_tutorial_vel_pathline_final.png]]
 
+
<!--
 
After this calculation is done, we can animate the Pathlines by cropping away portions of the curves based on advection time.  
 
After this calculation is done, we can animate the Pathlines by cropping away portions of the curves based on advection time.  
  
Line 135: Line 146:
 
**[Controls Menu]->Command
 
**[Controls Menu]->Command
 
*Find an empty tab
 
*Find an empty tab
*Paste the following Python snipper into this tab
+
*Paste the following Python snippet into this tab
 
<source lang="python">
 
<source lang="python">
# Animate our pathlines by cropping based on time
+
iatts = IntegralCurveAttributes()
satts = StreamlineAttributes()
+
iatts.cropValue = iatts.Time  
satts.referenceTypeForDisplay = satts.Time
+
iatts.cropEndFlag = 1
satts.displayEndFlag = 1
+
 
 
 
nsteps = 100 # Number of steps
 
nsteps = 100 # Number of steps
 
final_time = .995
 
final_time = .995
 
for i in range(nsteps+1):
 
for i in range(nsteps+1):
   satts.displayEnd = final_time * i /nsteps
+
   iatts.cropEnd = final_time * i /nsteps
   SetPlotOptions(satts)
+
   SetOperatorOptions(iatts)
 
</source>
 
</source>
  
Line 152: Line 162:
  
 
[[Image:bflow_tutorial_vel_pathline_anim.gif]]
 
[[Image:bflow_tutorial_vel_pathline_anim.gif]]
 +
-->
  
  
== Sharing content and video encoding using SeedMe.org ==
+
[[ Blood_Flow_Aneurysm_Tutorial_Publishing_to_SeedMe.org | Next: Publishing Pathline Visualization Results to SeedMe.org ]]
Results from visualization and analysis are often shared with collaborators. [https://www.seedme.org SeedMe.org] provides an easy to automate sharing and collaboration platform.
 
 
 
=== Required setup ===
 
 
 
* [https://www.seedme.org/user/register Sign-up] at SeedMe.org
 
 
 
* [https://www.seedme.org/user Download] your ''API Key file'', then move it to your [https://en.wikipedia.org/wiki/Home_directory Home directory].
 
 
 
=== Sharing automation script===
 
In this section we will render and save pathline trace in 20 steps. Then upload and share the rendered 20 images as a sequence and instuct SeedMe to encode a video from these set of images at 2 frames per second. A sample video can be seen [https://www.seedme.org/node/49054#videos here]
 
 
 
Brief explanation is provided in comments and detailed example can be seen [https://bitbucket.org/seedme/seedme-python-client/src/master/demo.py?at=master&fileviewer=file-view-default here].
 
 
 
*Open the Commands Window
 
**[Controls Menu]->Command
 
*Find an empty tab
 
*Paste the following Python snippet into this tab
 
<source lang="python">
 
##############################################################################
 
# To do : Set the following four variables
 
##############################################################################
 
seedme_apikey_path = '/absolute/path/to/seedme.txt'
 
my_rendered_image_path = "/absolute/path/for/images/" # does not traverse recurssively
 
my_content_privacy = "public" # private (default), group, public
 
my_share_list = "one@example.com, two@example.com" # comma delimted emails
 
 
 
 
 
# Set save window attributes including path where the rendered images will be saved
 
sa = SaveWindowAttributes()
 
sa.outputToCurrentDirectory = 0
 
sa.outputDirectory = my_rendered_image_path
 
sa.fileName = "pathline"
 
sa.family = 1
 
sa.format = sa.PNG
 
sa.width = 512
 
sa.height = 512
 
sa.screenCapture = 0
 
sa.saveTiled = 0
 
sa.quality = 80
 
sa.progressive = 0
 
sa.binary = 0
 
sa.stereo = 0
 
sa.compression = sa.PackBits  # None, PackBits, Jpeg, Deflate
 
sa.forceMerge = 0
 
sa.resConstraint = sa.ScreenProportions  # NoConstraint, EqualWidthHeight, ScreenProportions
 
sa.advancedMultiWindowSave = 0
 
SetSaveWindowAttributes(sa)
 
 
 
 
 
# Now save this pathline visualization in 20 frames (images)
 
# Animate our pathlines by cropping based on time
 
satts = StreamlineAttributes()
 
satts.referenceTypeForDisplay = satts.Time
 
satts.displayEndFlag = 1
 
 
 
nsteps = 20 # Number of steps
 
final_time = .995
 
for i in range(nsteps+1):
 
  satts.displayEnd = final_time * i /nsteps
 
  SetPlotOptions(satts)
 
  SaveWindow() # will save images at the sa.outputDirectory provided above
 
 
 
 
 
# ----------------------------------------------------------------------------------#
 
# Upload and share content at SeedMe.org                                                       
 
# Instruct the seedme module to upload 20 images then encode a video from it
 
# seedme module ships with VisIt 2.9.x +                                                         
 
# ----------------------------------------------------------------------------------#
 
import seedme
 
 
 
# Set path to the APIKey file
 
obj.set_auth_via_file(seedme_apikey_path)
 
 
 
# Create a dictionary for rendered image sequence
 
my_seq = {
 
      "filepath": my_rendered_image_path,
 
      "title": "Pathline",
 
      "description": "Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.",
 
      "fps": 2,
 
      "encode": True,
 
      }
 
 
 
# Create seedme object
 
obj = seedme.SeedMe()
 
 
 
# Create a new collection using create_collection method
 
# composed with title and sequence with public access, shared with two people
 
result=obj.create_collection(title="Aneurysm vis",
 
                            privacy=my_content_privacy,  # string = One of private(default), group, public
 
                            sharing=my_share_list, # string = Comma delimited emails
 
                            notify=True, # Boolean = False(default) send email notification to above two emails
 
                            sequences=my_seq, # upload sequence
 
                            )
 
 
 
# create_collection returns the result as a string in json format
 
print result
 
 
 
url = obj.get_url(result)
 
# Visit this url on your web browser
 
print("\n\nThe url for this collection is: " + url)
 
</source>
 
 
 
*Click '''Execute'''
 
 
 
To view your shared content [https://www.seedme.org/user login] to SeedMe.org then navigate to [https://www.seedme.org/collections My collections].
 
  
[[ Blood_Flow_Aneurysm_Tutorial_Calculating_Flux | Next: Calculating the Flux Though a Surface ]]
 
  
 
[[ Blood_Flow_Aneurysm_Tutorial | Aneurysm Tutorial Index]]
 
[[ Blood_Flow_Aneurysm_Tutorial | Aneurysm Tutorial Index]]

Latest revision as of 20:11, 14 March 2017

Simulation Data

This tutorial uses the aneurysm dataset -- available at: http://www.visitusers.org/index.php?title=Tutorial_Data

To begin:

  • Launch VisIt
  • In VisIt's GUI, under the [Sources] section, click Open
  • Navigate your file system to select the aneurysm.visit file.

Visualizing the Velocity Vector Field

This section of the tutorial outlines using Glyphs, Streamlines, and Pathlines to visualize the velocity vector field from the simulation.

This section follows the Initial Dataset Exploration Tutorial section. To create the reference blue semi-transparent plot of the simulation mesh, review the Blood_Flow_Aneurysm_Tutorial_Dataset_Exploration#Creating_a_Semi-Transparent_Exterior_Mesh_Plot content.

Plotting the Vector Field Directly with Glyphs

VisIt's vector plot renders a vector field at each time step as a collection of Arrow Glyphs. This allows us to see the direction of the vectors as well as their magnitude. We will create a vector plot to directly view the simulated velocity vector field.


  • Add a Vector Plot of velocity
    • [Plot List] Add->Vector->velocity
  • Open the Vector Plot Attributes Window
    • In the Vectors tab
      • Set Stride to 5
    • In the Data tab, Color section
      • Change the color table to Spectral, and check the Invert option
    • In the Glyphs tab:
      • Under the Scale section, set the scale to 0.5
      • Under the Style section, set Arrow body to Cylinder
      • Under the Rendering section, set Geometry Quality to High
    • Click Apply and dismiss the window.
  • Click Draw and use the Play button to animate

Bflow tutorial vel vec plot.png

Examining features of the Flow Field with Streamlines

To explore the flow field further we will seed and advect a set of streamlines near the inflow of the artery. Streamlines show the path massless tracer particles would take if advected by a static vector field. To construct Streamlines, the first step is selecting a set of spatial locations that can serve as the initial seed points.

We want to center our seed points around the peak velocity value on a slice near the inflow of the artery. To find this location, we query a sliced pseudocolor plot of the velocity_magnitude.

  • Add a Pseudocolor Plot of velocity_magnitude
    • [Plot List] Add->Pseudocolor->velocity_magnitude
    • Open Pseudocolor Plot Attributes Window and set the color table options as before.
  • Add a Slice Operator near the inlet
    • [Plot List] Operators->Slicing->Slice
  • Open the Slice Operator Attributes Window
    • Under the Normal Section
      • Set Orthogonal to Y Axis
    • Under the Origin Section
      • Select Point and set the value to 3 3 3
    • Under the Up Axis Section
      • Uncheck Project to 2D
    • Click Apply and dismiss the window.
  • [Plot List] Click Draw

Bflow tutorial vel mag slice plot.png

Query to find the Maximum Velocity on the Slice

  • [Plot list] Click to make sure the Pseudocolor plot of your velocity_magnitude slice is active
  • [Controls Menu]->Query
    • Select Max
    • Select Actual Data
    • Click Query

This will give you the maximum scalar value on the slice and the x,y,z coordinates of the node associated with this value. We will use the x,y,z coordinates of this node to seed a set of streamlines.

Bflow tutorial vel mag slice max query.png

Plotting Streamlines of Velocity

  • Add a Pseudocolor Plot of operators/IntergralCurve/velocity
    • [Plot List] Add->Pseudocolor->operators/IntergralCurve/velocity

Bflow tutorial add icruve plot.png

  • Open the IntegralCurve Operator Attributes Window
  • In the Integration tab
    • Under the Source section
      • Set the Source type to Circle
      • Set the Origin to the value returned from the max query: 3.45115 3.0 5.54927
        • (Exclude any commas in the input text box)
      • Set the Normal to the y-axis: 0 1 0
      • Set the Up axis to the z-axis: 0 0 1
      • Set the Radius to 0.12
    • Under the Sampling section
      • Set Sampling along: to Boundary
      • Set Samples in Theta to 12
  • In the Advanced tab:
    • Under the Warnings section, uncheck all of the warning checkboxes
  • Click Apply and dismiss the IntegralCurve operator attributes window.


Bflow tutorial vel icurve streamline atts source .png

  • Open the Pseudocolor Plot Attributes Window
  • In the Data tab
    • Under the Color section,
      • Change the Color table to Reds

Bflow tutorial vel icurve stramline pc color table.png

  • In the Geometry tab
    • Under the Line section
      • Change Line Type to Tubes
      • Change Tail to Sphere
      • Change Head to Cone
      • Change Head and Tail Radius to 0.02

Bflow tutorial vel icurve stramline pc lines options .png

  • Click Apply and dismiss the Pseudocolor Plot attributes window.
  • Click Draw and use the [Time Slider] Control to view a few time steps.

Bflow tutorial vel streamline view.png

Examining features of the Flow Field with Pathlines

Finally, to explore the time varying behavior of the flow field we will use Pathlines. Pathlines show the path massless tracer particles would take if advected by the vector field at each timestep of the simulation.

We will modify our previous IntergralCurve options to create Pathlines.

  • Set the [Time Slider] Control to the first timestep.
  • Open the Integral Curve Attributes Window
    • Under the Apperance tab
      • In the Streamlines vs Pathlines section
        • Select Pathline
        • In the Pathlines Options section
          • Set How to perform interpolation over time to Mesh is static over time

Bflow tutorial vel icruve pathline settings.png

  • Click Apply and dismiss the window.

This will process all 200 files in the dataset and construct the Pathlines that originate at our seed points.

Bflow tutorial vel pathline final.png


Next: Publishing Pathline Visualization Results to SeedMe.org


Aneurysm Tutorial Index