Blood Flow Aneurysm Tutorial Publishing to SeedMe.org

Results from visualization and analysis are often shared with collaborators. SeedMe.org provides an easy to automate sharing and collaboration platform.

Required setup

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 here

Brief explanation is provided in comments and detailed example can be seen here.

  • Open the Commands Window
    • [Controls Menu]->Command
  • Find an empty tab
  • Paste the following Python snippet into this tab
#
# file: aneurysm_seedme.py
# info:
# Example showing how to use SeedMe to publish a pathline animation 
#
# Copied from:
# http://visitusers.org/index.php?title=Blood_Flow_Aneurysm_Tutorial_Publishing_to_SeedMe.org


##############################################################################
# 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 recursively
my_content_privacy = "public" # private (default), group, public
my_share_list = "one@example.com, two@example.com" # comma delimited 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
iatts = IntegralCurveAttributes()
iatts.cropValue = iatts.Time
iatts.cropEndFlag = 1

nsteps = 20 # Number of steps
final_time = .995
for i in range(nsteps+1):
    iatts.cropEnd = final_time * i /nsteps
    SetOperatorOptions(iatts)
    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)
  • Click Execute

To view your shared content login to SeedMe.org then navigate to My collections.




To learn more about SeedMe Python API review the example demo.py


Next: Calculating the Flux Though a Surface

Aneurysm Tutorial Index