scientific visualization in scirun

53
Scientific Computing and Imaging Scientific Computing and Imaging Institute Institute School of Computing School of Computing University of Utah University of Utah David Weinstein SIAM CSE 02.09.2003 Scientific Visualization in SCIRun

Upload: anthea

Post on 02-Feb-2016

55 views

Category:

Documents


0 download

DESCRIPTION

Scientific Visualization in SCIRun. David Weinstein SIAM CSE 02.09.2003. Scientific Computing and Imaging Institute School of Computing University of Utah. Overview. Examples Tour of SCIRun - How To Get / Install It - Dataflow - Building A Module Live Demos. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Scientific Visualization in SCIRun

Scientific Computing and Imaging InstituteScientific Computing and Imaging InstituteSchool of ComputingSchool of Computing

University of UtahUniversity of Utah

Scientific Computing and Imaging InstituteScientific Computing and Imaging InstituteSchool of ComputingSchool of Computing

University of UtahUniversity of Utah

David Weinstein

SIAM CSE

02.09.2003

David Weinstein

SIAM CSE

02.09.2003

Scientific Visualization inSCIRun

Scientific Visualization inSCIRun

Page 2: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

OverviewOverview

Examples

Tour of SCIRun

- How To Get / Install It

- Dataflow

- Building A Module

Live Demos

Page 3: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Natalie: Surgical PlanningNatalie: Surgical Planning

Page 4: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Aneurysm: Volume RenderingAneurysm: Volume Rendering

Page 5: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Forward and Inverse EEGForward and Inverse EEG

Page 6: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

ElectrocardiographyElectrocardiography

Page 7: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

ElectroencephalographyElectroencephalography

Page 8: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

MEG / Diffusion TensorsMEG / Diffusion Tensors

Page 9: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Photorealism for Sci Vis: RTRTPhotorealism for Sci Vis: RTRT

Page 10: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

CSAFE: Fire-spreadCSAFE: Fire-spread

Page 11: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Nuclear Fusion: TokamakNuclear Fusion: Tokamak

Page 12: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Page 13: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Integration and InteractionIntegration and Interaction

Modeling

Simulation

Visualization

userguides

What If?

Page 14: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Elements of SCIRunElements of SCIRun

Visual programming Environment

Page 15: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

PSE RelationshipsPSE Relationships

Page 16: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

ExtensibilityExtensibility

• Leverage existing utilities• Extensibility through bridges

SCIRun

Matlab

mpeg

libimage

Teem

GENESIS

liblib

liblibsocketsocket

liblib

SQLSQL

Page 17: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Documentation: The Central SourceDocumentation: The Central Source

http://internal.sci.utah.edu/developer/doc/

Page 18: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Documentation: User SupportDocumentation: User Support

On-line Documentation• Tutorial• User’s Manual• FAQ Lists

Printed Documentation• User’s Manuals

Mailing List• [email protected]

Direct Contact• Email and Bugzilla• Phone

Page 19: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

System Specs and RequirementsSystem Specs and Requirements

Required OS and Build ToolsRequired OS and Build Tools• SGISGI• IRIX 6.5IRIX 6.5• MIPSPro Compilers (CC) 7.3.1.1mMIPSPro Compilers (CC) 7.3.1.1m

• LinuxLinux• Kernel 2.2.17Kernel 2.2.17• GCC 2.95.3GCC 2.95.3

• BothBoth• GNU Make 3.79.1GNU Make 3.79.1

http://software.sci.utah.edu/doc/TechnicalGuide/p1c1.htmlhttp://software.sci.utah.edu/doc/TechnicalGuide/p1c1.html

Page 20: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Minimum System RequirementsMinimum System Requirements

Tested Systems: Gateway, Micron, Dell.Tested Systems: Gateway, Micron, Dell.http://software.sci.utah.edu/tested_systems/tested_systems.htmlhttp://software.sci.utah.edu/tested_systems/tested_systems.html

Processor(s)Processor(s) Main MemoryMain Memory Other HW/SWOther HW/SW

SGISGI250 MHz250 MHz

R10KR10K256 MB256 MB Texture Mapping Texture Mapping

Hardware/MemoryHardware/Memory

LinuxLinux700 MHz700 MHz

Pentium IIIPentium III256 MB256 MB

NVIDIA GeForce3 Graphics NVIDIA GeForce3 Graphics Card, XFree86 drivers Card, XFree86 drivers

version 1.0-1541version 1.0-1541

http://software.sci.utah.edu/doc/TechnicalGuide/p1c2.htmlhttp://software.sci.utah.edu/doc/TechnicalGuide/p1c2.html

Page 21: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Documentation: TutorialDocumentation: Tutorial

Page 22: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Network DesignNetwork Design• Dataflow Vocabulary• Module• Dataport• Datapipe• UI

• Send and Get• GuiVars• Scheduler• Dependencies• loops: send_intermediate

Page 23: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

PackagesPackages

• Encapsulated project• External code resides in Thirdparty• Packages enabled via “configure”

options% configure ‘--enable-package=BioPSE mypackage’

Page 24: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Module CategoriesModule Categories

• …/Dataflow/Modules/{Fields,Math,…}

Page 25: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

FieldsFields

Data

int, float, double, …

Vector, Tensor, …

Data

int, float, double, …

Vector, Tensor, …

Geometry

Regular

Irregular

Geometry

Regular

Irregular

Properties

Data_at (center)

Properties

Data_at (center)

PointCloudField

ScanlineField CurveField

ImageField QuadSurfField TriSurfField

LatVolField HexVolField TetVolField

Page 26: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

On-the-fly CompilationOn-the-fly Compilation

•Combinatorial Explosion!•Geometry•Data type•Data_at

•Build source, compile, link – all at run time

Page 27: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Error MessagesError Messages

•Run-time messages are sent to the module’s “log”

Startup messagesStartup messages

Log message indicatorGray: no messagesRed: errorBlue: warning/remark

Log message indicatorGray: no messagesRed: errorBlue: warning/remark

Page 28: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Tikhonov RegularizationTikhonov Regularization

Page 29: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Tikhonov RegularizationTikhonov Regularization

Page 30: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

How To Build A ModuleHow To Build A Module

•Before You Start

• Structure of a Module

• Ports and Datatypes

•Component Wizard

•GUI’s

•Dynamic Compilation Algorithm

Page 31: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Before You StartBefore You Start

Design Your Function• A Module is a Function• Inputs and Outputs• User Input (GUI Variables)• Dataflow

Coding Standard• Standards• Advice• SCIRun/doc/Developer/Guide/coding_standard.html

Page 32: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Module StructureModule Structure

Support Files• .cc file• sub.mk• .xml file• .tcl file• sub.mk• .h file (optional)

Page 33: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Ports and DatatypesPorts and Datatypes

Ports• LockingHandles• Generation number• Memory Management• Sending Data• Cache Results

Datatypes• Fields, Matrix, SceneGraph• Detach (Dataflow)• Properties

Page 34: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard

Adding a Module

Page 35: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard

Page 36: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard

Edit a Port• Name• Namespace

Page 37: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard• Package• Category• Path

Page 38: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard• New Package?• New Category?• Reconfiguring.

Page 39: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard

After Compiling

Page 40: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Component WizardComponent Wizard

Your Skeleton GUI

Page 41: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

GUI’sGUI’s

TCL• itcl

• blt

•Use Simple GUI as a Pattern

•GuiVars

Page 42: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

GUI’sGUI’s itcl_class SCIRun_Fields_SelectField {

inherit Module constructor {config} { set name SelectField

global $this-stampvalue global $this-runmode

set_defaults }

method set_defaults {} {set $this-stampvalue 100set $this-runmode 0# 0 nothing 1 accumulate 2 replace

}

method replace {} {set $this-runmode 2$this-c needexecute

}

method accumulate {} {set $this-runmode 1$this-c needexecute

}

Page 43: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

GUI’sGUI’s method ui {} {

set w .ui[modname] if {[winfo exists $w]} { raise $w return } toplevel $w

frame $w.row1frame $w.row3frame $w.row4

pack $w.row1 $w.row3 $w.row4 -side top -e y -f both -padx 5 -pady 5

label $w.row1.value_label -text "Selection Value"entry $w.row1.value -textvariable $this-stampvaluepack $w.row1.value_label $w.row1.value -side left

button $w.row3.execute -text "Replace" -command "$this replace"pack $w.row3.execute -side top -e n -f both

button $w.row4.execute -text "Accumulate" -command "$this accumulate"

pack $w.row4.execute -side top -e n -f both }

Page 44: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

GUI’sGUI’s

GuiVars• Values to from C side– Initialize

C++ side constructor synchs with tcl name tcl side sets the initial value

–my_var.reset()

–my_var.get()

• tcl_command(...)– $this-c “needexecute”

Page 45: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Algorithm StructureAlgorithm StructureAlgorithm Base Class

• Inherits from common base class• Defines the pure virtual interface needed by a module• Provides a static CompileInfo

Templated Algorithm• Implements the pure virtual interface in the base class• Potentially specialized for specific field type

Algorithm Base Class• Inherits from common base class• Defines the pure virtual interface needed by a module• Provides a static CompileInfo

Templated Algorithm• Implements the pure virtual interface in the base class• Potentially specialized for specific field type

RenderFieldBase

RenderField<TetVol<double> >

RenderField<TetVol<Vector> >

RenderField<LatticeVol<double> >

RenderField<LatticeVol<Vector> >

etc...

virtual void render(FieldBase&)=0;virtual void render(FieldBase&)=0;

template<class Field> RenderField : public RenderFieldBasetemplate<class Field> RenderField : public RenderFieldBase

Page 46: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

TypeDescriptionTypeDescription

TypeDescription object augments RTTIHolds:

• Strings that describe object’s exact type• Namespace string• Path to the .h file that declares the object

Has a recursive structure

Example: foo<bar, foobar<int> >;

TypeDescription object augments RTTIHolds:

• Strings that describe object’s exact type• Namespace string• Path to the .h file that declares the object

Has a recursive structure

Example: foo<bar, foobar<int> >;

foo

int

foobarbar

Page 47: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

CompileInfoCompileInfo

Similar info as a TypeDescriptionAlgorithm is not instantiated, so cannot yet be

queriedStart with a CompileInfo from Algorithm base classAugmented with information from all pertinent

TypeDescription objects for the specific types involved

Passed to DynamicLoader, which creates the proper type

Similar info as a TypeDescriptionAlgorithm is not instantiated, so cannot yet be

queriedStart with a CompileInfo from Algorithm base classAugmented with information from all pertinent

TypeDescription objects for the specific types involved

Passed to DynamicLoader, which creates the proper type

Page 48: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

DynamicLoaderDynamicLoader

Returns Requested Algorithm• Writes C++ instantiation code• Compile shared library, using SCIRun makefiles• Load shared library (dlopen)• Return Instance of Algorithm (Cached for next use)

Synchronization code such that• Only 1 thread can compile at a time per algorithm• Multiple algorithms can compile and load at the same time

Returns Requested Algorithm• Writes C++ instantiation code• Compile shared library, using SCIRun makefiles• Load shared library (dlopen)• Return Instance of Algorithm (Cached for next use)

Synchronization code such that• Only 1 thread can compile at a time per algorithm• Multiple algorithms can compile and load at the same time

Page 49: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

Calling ModuleCalling Module void ShowField::execute()

{ // Get a Field from input field port. field = (FieldIPort *)get_iport("Field"); field->get(field_handle); // Get the input field's type info. const TypeDescription *td = field_handle->get_type_description();

// Get the Algorithm. CompileInfo *ci = RenderFieldBase::get_compile_info(td); if (! DynamicLoader::scirun_loader().get(*ci, rend_algo)) { error("Could not compile algorithm for ShowField -");

return; } RenderFieldBase *rf = dynamic_cast<RenderFieldBase*>(rend_algo); // Let the templated algorithm render this field. rf->render(field_handle, /* any other parameters from gui */);

// Send results downstream...} 

No template instantiations for the exact algorithm typeNo template instantiations for the exact algorithm type

Page 50: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

ExampleExample

//! ConvertTetBase supports the dynamically loadable algorithm concept.//! when dynamically loaded the user will dynamically cast to a //! ConvertTetBase from the DynamicAlgoBase they will have a pointer to.class ConvertTetBase : public DynamicAlgoBase{public: virtual FieldHandle convert_quadratic(FieldHandle in) = 0; virtual ~ConvertTetBase();

static const string& get_h_file_path(); static string dyn_file_name(const TypeDescription *td) { // add no extension. return template_class_name() + "." + td->get_filename() + "."; }

static const string base_class_name() { static string name("ConvertTetBase"); return name; }

static const string template_class_name() { static string name("ConvertTet"); return name; }

//! support the dynamically compiled algorithm concept static CompileInfo *get_compile_info(const TypeDescription *td);};

Page 51: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

ExampleExample

template <class Fld>class ConvertTet : public ConvertTetBase{public: //! virtual interface. virtual FieldHandle convert_quadratic(FieldHandle in);};

template <class Fld>FieldHandleConvertTet<Fld>::convert_quadratic(FieldHandle ifh){ Fld *fld = dynamic_cast<Fld*>(ifh.get_rep()); ASSERT(fld != 0); typedef typename Fld::value_type val_t; FieldHandle fh(QuadraticTetVolField<val_t>::create_from(*fld)); return fh;}

Page 52: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

SummarySummary

Concepts• Ports and Datatypes

•Modules (Component Wizard)

• Templated Algorithms

•Dynamic Loading

Page 53: Scientific Visualization in SCIRun

SCIRun

SIAM CSESIAM CSE

On the Horizon (BioPSE 2.0)On the Horizon (BioPSE 2.0)

GUI Separation: Event/State Managers•Detachable interface•Reproducibility•Collaboration•Remote vis•Custom UI• Scripting•Regression testing

BioPSEGUI

StateManager

GUI

GUI