Amir A Users Guide
Amir A Users Guide
User's Guide
Amira 5
Amira Users Guide
Intended Use Amira R is intended for research use only. It is not a medical device. Copyright Information c 1999-2008 Visage Imaging GmbH c 1995-2008 Konrad-Zuse-Zentrum f r Informationstechnik Berlin (ZIB), Germany u All rights reserved. Trademark Information: Amira is being jointly developed by Konrad-Zuse-Zentrum f r Informationstechnik Berlin (ZIB) and u Visage Imaging. Amira R is a registered trademark of Visage Imaging. HardCopy, MeshViz, VolumeViz, TerrainViz are trademarks of Mercury Computer Systems S.A. Mercury Computer Systems S.A. is a source licensee of OpenGL R , Open Inventor R from Silicon Graphics, Inc. OpenGL R and Open Inventor R are registered trademarks of Silicon Graphics, Inc. All other products and company names are trademarks or registered trademarks of their respective companies. This manual has been prepared for Visage Imaging licensees solely for use in connection with software supplied by Visage Imaging and is furnished under a written license agreement. This material may not be used, reproduced or disclosed, in whole or in part, except as permitted in the license agreement or by prior written authorization of Visage Imaging. Users are cautioned that Visage Imaging reserves the right to make changes without notice to the specications and materials contained herein and shall not be responsible for any damages (including consequential) caused by reliance on the materials presented, including but not limited to typographical, arithmetic or listing errors.
Contents
I
1
1
3 4 6 6 6 7 8 9 10 11 13 13 13 14 14 17
2.1
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1 2.1.2 2.1.3 2.1.4 Loading Data . . . . . . . . . . . . . . . . . . . . . . . Invoking Editors . . . . . . . . . . . . . . . . . . . . . . Visualizing Data . . . . . . . . . . . . . . . . . . . . . . Interaction with the Viewer . . . . . . . . . . . . . . . . The Amira File Browser . . . . . . . . . . . . . . . . . . Reading 3D Image Data from Multiple 2D Slices . . . . Setting the Bounding Box . . . . . . . . . . . . . . . . . The Stacked Slices le format . . . . . . . . . . . . . . . Working with Large Disk Data . . . . . . . . . . . . . . Orthogonal Slices . . . . . . . . . . . . . . . . . . . . . Simple Data Analysis . . . . . . . . . . . . . . . . . . . Resampling the Data . . . . . . . . . . . . . . . . . . . Displaying an Isosurface . . . . . . . . . . . . . . . . . Cropping the Data . . . . . . . . . . . . . . . . . . . . . Volume Rendering . . . . . . . . . . . . . . . . . . . . . Interactive Image Segmentation . . . . . . . . . . . . . . Volume Measurement . . . . . . . . . . . . . . . . . . . Threshold Segmentation . . . . . . . . . . . . . . . . . . Rening Threshold Segmentation Results . . . . . . . . Extracting Surfaces from Segmentation Results . . . . . Simplifying the Surface . . . . . . . . . . . . . . . . . .
18 19 21 22 24 26 26 27 28 29 30 32 33 33 35 36 36 37 40 40 42 43 44 45 45 46
2.2
2.3
2.4
2.5
2.6
ii
CONTENTS
2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.9 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.10.1 2.10.2 2.10.3 2.11.1 2.11.2 2.11.3 2.11.4
Simplifying the Surface . . . . . . . . . . . . . . . . . . Editing the Surface . . . . . . . . . . . . . . . . . . . . Generation of a Tetrahedral Grid . . . . . . . . . . . . . Displaying Data Sets in Two Viewers . . . . . . . . . . . Creating a Landmark Set . . . . . . . . . . . . . . . . . Registration via a Rigid Transformation . . . . . . . . . Warping Two Image Volumes . . . . . . . . . . . . . . . Basic Manual Registration . . . . . . . . . . . . . . . . Automatic Registration . . . . . . . . . . . . . . . . . . Image Fusion . . . . . . . . . . . . . . . . . . . . . . . Basic Manual Alignment . . . . . . . . . . . . . . . . . Alignment Via Landmarks . . . . . . . . . . . . . . . . Optimizing the Quality Function . . . . . . . . . . . . . Resampling the Input Data . . . . . . . . . . . . . . . . Using a Reference Image . . . . . . . . . . . . . . . . . Loading the Wing and the Flow Field . . . . . . . . . . . Line Integral Convolution . . . . . . . . . . . . . . . . . Illuminated Stream Lines . . . . . . . . . . . . . . . . . Exploration the volume data . . . . . . . . . . . . . . . . Automatic extraction of the dendritic tree . . . . . . . . . Filament Tracing . . . . . . . . . . . . . . . . . . . . . Visualize the network . . . . . . . . . . . . . . . . . . .
47 49 52 54 54 55 58 58 59 60 61 62 64 64 66 68 69 70 70 71 71 73 75 76 76 79 81
CONTENTS
iii
2.11.5
Alternative way to extract a network using the Segmentation Editor . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Network . . . . . . . . . . . . . . . . . . . . Animating an OrthoSlice Module . . . . . . . . . . . . . Activating a Module in the Viewer Window . . . . . . . Using a Camera Rotation . . . . . . . . . . . . . . . . . Editing or Removing an Already Dened Event . . . . . Overlaying the Bone with Skin . . . . . . . . . . . . . . Using Clipping to Add the Skin Gradually . . . . . . . . More Comments on Clipping . . . . . . . . . . . . . . . Breaks and Function Keys . . . . . . . . . . . . . . . . .
82 83 83 84 86 88 89 89 90 93 94 96 97 97 97
2.12 Creating animated demonstrations . . . . . . . . . . . . . . . . . 2.12.1 2.12.2 2.12.3 2.12.4 2.12.5 2.12.6 2.12.7 2.12.8 2.12.9
2.12.10 Loops and Go-to . . . . . . . . . . . . . . . . . . . . . . 2.12.11 Storing and Replaying the Animation Sequence . . . . . 2.13 Creating movie les . . . . . . . . . . . . . . . . . . . . . . . . 2.13.1 2.13.2 2.14.1 2.14.2 Attaching MovieMaker to a Camera Path . . . . . . . . .
Attaching MovieMaker to DemoMaker . . . . . . . . . . 100 Lowpass Filtering on Images . . . . . . . . . . . . . . . 101 Thresholding on a Volume . . . . . . . . . . . . . . . . 104 105
Interface Components . . . . . . . . . . . . . . . . . . . . . . . 105 File Menu . . . . . . . . . . . . . . . . . . . . . . . . . 105 Edit Menu . . . . . . . . . . . . . . . . . . . . . . . . . 109 Pool Menu . . . . . . . . . . . . . . . . . . . . . . . . . 110 Explorer Menu . . . . . . . . . . . . . . . . . . . . . . . 113 Create Menu . . . . . . . . . . . . . . . . . . . . . . . . 113
iv
CONTENTS
3.1.6 3.1.7 3.1.8 3.1.9 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.2
View Menu . . . . . . . . . . . . . . . . . . . . . . . . 113 Online Help . . . . . . . . . . . . . . . . . . . . . . . . 116 Main Window . . . . . . . . . . . . . . . . . . . . . . . 119 Viewer Window . . . . . . . . . . . . . . . . . . . . . . 130 Console Window . . . . . . . . . . . . . . . . . . . . . 135 File Dialog . . . . . . . . . . . . . . . . . . . . . . . . . 135 Job Dialog . . . . . . . . . . . . . . . . . . . . . . . . . 139 Preferences Dialog . . . . . . . . . . . . . . . . . . . . 140 Snapshot Dialog . . . . . . . . . . . . . . . . . . . . . . 146 System Information Dialog . . . . . . . . . . . . . . . . 147
General Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 148 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 Class Structure . . . . . . . . . . . . . . . . . . . . . . . 148 Scalar Field and Vector Fields . . . . . . . . . . . . . . . 150 Coordinates and Grids . . . . . . . . . . . . . . . . . . . 151 Surface Data . . . . . . . . . . . . . . . . . . . . . . . . 153 Vertex Set . . . . . . . . . . . . . . . . . . . . . . . . . 153 Transformations . . . . . . . . . . . . . . . . . . . . . . 153 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 154 Subapplication Concept . . . . . . . . . . . . . . . . . . 155 157
Data Import . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Command Line Options . . . . . . . . . . . . . . . . . . . . . . 158 Environment Variables . . . . . . . . . . . . . . . . . . . . . . . 160 User-dened start-up script . . . . . . . . . . . . . . . . . . . . 162 System Requirements . . . . . . . . . . . . . . . . . . . . . . . 163 4.5.1 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . 164
CONTENTS
Amira License Manager . . . . . . . . . . . . . . . . . . . . . . 166 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 Contents . . . . . . . . . . . . . . . . . . . . . . . . . . 166 About Password Protection . . . . . . . . . . . . . . . . 166 About the Amira License Manager . . . . . . . . . . . . 167 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . 168 Using TGS LICENSE DEBUG . . . . . . . . . . . . . . 169 Contacting the License Administrator . . . . . . . . . . . 172 Contacting Technical Support . . . . . . . . . . . . . . . 172
4.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Introduction to Tcl . . . . . . . . . . . . . . . . . . . . . . . . . 176 5.2.1 5.2.2 5.2.3 5.2.4 Tcl Lists, Commands, Comments . . . . . . . . . . . . . 176 Tcl Variables . . . . . . . . . . . . . . . . . . . . . . . . 177 Tcl Command Substitution . . . . . . . . . . . . . . . . 178 Tcl Control Structures . . . . . . . . . . . . . . . . . . . 179
5.3
Amira Script Interface . . . . . . . . . . . . . . . . . . . . . . . 183 5.3.1 5.3.2 5.3.3 Predened Variables . . . . . . . . . . . . . . . . . . . . 185 Object commands . . . . . . . . . . . . . . . . . . . . . 186 Global Commands . . . . . . . . . . . . . . . . . . . . . 186
Amira Script File . . . . . . . . . . . . . . . . . . . . . . . . . . 200 Conguring Popup Menus . . . . . . . . . . . . . . . . . . . . . 201 Registering pick callbacks . . . . . . . . . . . . . . . . . . . . . 204
vi
CONTENTS
207
Directory Structure and Files . . . . . . . . . . . . . . . . . . . 208 Directories and Files in src/ . . . . . . . . . . . . . . . . 209 Data Storage . . . . . . . . . . . . . . . . . . . . . . . . 215
II
7
221
223
First Steps with Molecular Visualization in Amira . . . . . . . . 223 Getting Started with Molecular Visualization . . . . . . . 224 Selection, Labeling, and Masking . . . . . . . . . . . . . 227 Alignment of Molecules . . . . . . . . . . . . . . . . . . 235 Molecular Surfaces . . . . . . . . . . . . . . . . . . . . 240 Sequential and Structural Alignment . . . . . . . . . . . 243 Editing of molecules . . . . . . . . . . . . . . . . . . . . 246 Molecular Interfaces . . . . . . . . . . . . . . . . . . . . 249 Measurement . . . . . . . . . . . . . . . . . . . . . . . 252 Internal Structure of Molecules . . . . . . . . . . . . . . 253 Coloring Molecules . . . . . . . . . . . . . . . . . . . . 254 Selecting and Filtering atoms . . . . . . . . . . . . . . . 256 Alignment of Trajectories . . . . . . . . . . . . . . . . . 259 Mean Distance Alignment . . . . . . . . . . . . . . . . . 261
CONTENTS
vii
Visualizing Molecular Trajectories and Metastable Conformations 261 Atom Expressions . . . . . . . . . . . . . . . . . . . . . . . . . 262 7.6.1 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . 262 Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 Operators . . . . . . . . . . . . . . . . . . . . . . . . . 264 Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Further Examples . . . . . . . . . . . . . . . . . . . . . 266
269
271
VR Pack Essentials . . . . . . . . . . . . . . . . . . . . 272 Using VR Pack on a multi-pipe system . . . . . . . . . 274 Using VR Pack on a cluster . . . . . . . . . . . . . . . . 274 Flat Screen Congurations . . . . . . . . . . . . . . . . 281 Example: A 2-channel Passive Stereo Conguration . . . 282 Example: A Super-wide Conguration with Soft-edge Blending . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Example: A Tiled 4-channel 2x2 Monitor Conguration . 288 Immersive Congurations . . . . . . . . . . . . . . . . . 290 Example: A Workbench Conguration . . . . . . . . . . 291 Example: A Holobench Conguration . . . . . . . . . . 294 Example: A 4-side CAVE Conguration . . . . . . . . . 297 Calibrating the Tracking System . . . . . . . . . . . . . 300 3D User Interaction . . . . . . . . . . . . . . . . . . . . 307
viii
CONTENTS
The 3D Menu . . . . . . . . . . . . . . . . . . . . . . . 308 User-dened 3D Menu Items . . . . . . . . . . . . . . . 309 3D Module Controls . . . . . . . . . . . . . . . . . . . . 313 Navigation Modes . . . . . . . . . . . . . . . . . . . . . 314 Tcl Event Procedures . . . . . . . . . . . . . . . . . . . 315 The 2D Mouse mode . . . . . . . . . . . . . . . . . . . 316 Writing VR Pack Custom Modules . . . . . . . . . . . . 317 Cong File Reference . . . . . . . . . . . . . . . . . . . 322 Tracker Emulator . . . . . . . . . . . . . . . . . . . . . 330
IV
9
333
335
Working with out-of-core data les (LDA) . . . . . . . . . . . . 335 Tune the Size Threshold to Allow Conversion . . . . . . 336 Load the Out-of-core Data . . . . . . . . . . . . . . . . 336 Raw Data Parameters . . . . . . . . . . . . . . . . . . . 339 Out-of-core Conversion . . . . . . . . . . . . . . . . . . 339 Display an Orthoslice, an Oblique Slice, and a 3D Volume 340
V VI
343
347
349
10 Deconvolution introduction
CONTENTS
ix
10.2 Data acquisition and sampling rates . . . . . . . . . . . . . . . . 351 10.3 Standard Deconvolution Tutorial . . . . . . . . . . . . . . . . . 353 10.4 Blind Deconvolution Tutorial . . . . . . . . . . . . . . . . . . . 359 10.5 Bead Extraction Tutorial . . . . . . . . . . . . . . . . . . . . . . 362 10.6 Performance issues and multi-processing . . . . . . . . . . . . . 367 11 Working with Multi-Channel Images 371
11.1 Loading Multi-Channel Images into Amira . . . . . . . . . . . . 372 11.2 Using OrthoSlice with a MultiChannelField . . . . . . . . . . . 373 11.3 Using ProjectionView with a MultiChannelField . . . . . . . . . 374 11.4 Using Voltex with a MultiChannelField . . . . . . . . . . . . . . 375 11.5 Saving a MultiChannelField in a Single AmiraMesh File . . . . . 376
377
379
12.1 Importing your Image Data . . . . . . . . . . . . . . . . . . . . 379 12.2 Arranging the Bricks . . . . . . . . . . . . . . . . . . . . . . . . 380 12.3 Aligning Bricks . . . . . . . . . . . . . . . . . . . . . . . . . . 381 12.4 Filtering, Correcting Z-Drop, Resampling . . . . . . . . . . . . . 382 12.5 Creating the Large Disk Data . . . . . . . . . . . . . . . . . . . 383 12.6 Accessing the Large Disk Data . . . . . . . . . . . . . . . . . . 384 12.7 Computing directly on the Large Disk Data . . . . . . . . . . . . 385 12.8 Region of Interest . . . . . . . . . . . . . . . . . . . . . . . . . 388 12.9 Check Network . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 12.10 Coloring a Lineset According to its Depth Value . . . . . . . . . 390
CONTENTS
Part I
Chapter 1
Introduction
Amira is a 3D data visualization, analysis and modelling system. It allows you to visualize scientic data sets from various application areas, e.g. medicine, biology, bio-chemistry, microscopy, biomed, bioengineering. 3D data can be quickly explored, analysed, compared, and quantied. 3D objects can be represented as image volumes or geometrical surfaces and grids suitable for numerical simulations, notably as triangular surface and volumetric tetrahedral grids. Amira provides methods to generate such grids from voxel data representing an image volume, and it includes a general-purpose interactive 3D viewer. Amira is a powerful, multifaceted software platform for visualizing, manipulating, and understanding Life Science and bio-medical data coming from all types of sources and modalities. Initially known and widely used as the 3D visualization tool of choice in microscopy and biomed research, Amira has become a more and more sophisticated product, delivering powerful visualization and analysis capabilities in all visualization and simulation elds in Life Science. Multi purpose - One tool for interdisciplinary work Flexible - Option packages to congure amira to your needs Easy to use - Intuitive user interface and great documentation Cost effective - Multiple options and exible license models Handling large data - Very large data sets are easily accessible with specic readers
Extensible - C++ coding wizard for technical extension and customization Support - Direct customer support with high level of interaction Innovative - Technology always updated to the latest innovation Flexible - Option packages to congure amira to your needs Efcient - Exploits latest graphics cards and processors Easy to use - Intuitive user interface and great documentation Cost effective - Multiple options and exible license models Handling large data - Very large data sets are easily accessible with specic readers Extensible - C++ coding wizard for technical extension and customization Support - Direct customer support with high level of interaction Innovative - Technology always updated to the latest innovation
Section 1.1 (Overview) provides a short overview of the fundamentals of Amira, i.e. its object-oriented design and the concept of data objects and modules. Section 1.2 (Features) summarizes key features of Amira, for example direct volume rendering, image processing, and surface simplication. Section 1.3 (Application Areas) illustrates some typical application areas of Amira and shows what kinds of problems can be solved using the system. Section 1.4 (Packs) shortly describes optional packs available for Amira and what they can be used for.
1.1 Overview
Amira is a modular and object-oriented software system. Its basic system components are modules and data objects. Modules are used to visualize data objects or to perform some computational operations on them. The components are represented by little icons in the Pool. Icons are connected by lines indicating processing dependencies between the components, i.e., which modules are to be applied to which data objects. Alternatively, modules and data objects can be displayed in a tree view Explorer. Data objects of specic types are created automatically from le input data when reading such or as output of module computations, modules matching an existing data object are created as instances of particular module types via a context-sensitive popup menu. Networks can be created with a min-
Chapter 1: Introduction
Figure 1.1: Data objects and modules are represented as little icons in the Pool (top left). In the 3D graphic window a surface colored according to its curvature is shown. Curvature information has been computed by a computational module and is stored as a separate data object. In the mid right window the parameters of selected modules are shown. The lower left pane provides a Tcl-command shell as well as access to the help browser.
imal amount of user interaction. Parameters of data objects and modules can be modied in Amiras interaction area. For some data objects such as surfaces or colormaps there exist special-purpose interactive editors that allow the user to modify the objects. All Amira components can be controlled via a Tcl command interface. Commands can be read from a script le or issued manually in a separate console window. The biggest part of the screen is occupied by a 3D graphics window. Additional 3D views can be created if necessary. Amira is based on the latest release of Open Inventor from Mercury. In addition, several modules apply direct OpenGL rendering to achieve special rendering effects or to maximize performance. In total, there are more than 270 data object and module types. They allow the system to be used for a broad range of applications. Scripting can be used for customization and automation. User-dened extensions are facilitated by the Amira developer version.
Overview
A large number of le formats are supported in the standard edition or through specic optional readers. For an introduction to data import, see Chapter 2. For more details, see section 4.1.
Chapter 1: Introduction
A built-in spatial transformation editor makes it easy to register data sets with respect to each other or to deal with different coordinate systems. Automatic registration of volume or geometric data is also possible. Direct interaction with the 3D scene allows you to quickly control regions of interest, slices, probes and more. Combinations of data sets, representation and processing features can be dened with minimal user interaction for simple or complex tasks. See section 1.1.
Features overview
sometimes sufcient method for reconstructing polygonal surface models. Beside standard algorithms, Amira provides an improved method, which generates signicantly fewer triangles with very little computational overhead. In this way, large 3D data sets can be displayed interactively even on smaller desktop graphics computers. 1.2.3.4 Large Volume Data With the Large Data Pack, even very large datasets that cannot be fully loaded in memory can be manipulated at interactive speed. Multi-resolution techniques can manage and visualize extremely large amounts of volume data of up to hundreds of gigabytes. You can then, for instance, quickly select a region of interest and extract down-sampled or partial data for further processing.
Chapter 1: Introduction
connected component analysis, images correlation, objects separation and ltering (see Quantication+ Pack), etc... See section 2.4 for a tutorial about image segmentation.
Features overview
simulations. These grids are constructed using a exible advancing-front algorithm. Again, special care is taken to obtain meshes of high quality, i.e., tetrahedra with bad aspect ratio are avoided. Several different le formats are supported, so that the grid can be exported to many standard simulation packages. 1.2.5.4 Point Clouds/Scattered Data Amira can also reconstruct surfaces from scattered points (see Delaunay and PointWrap modules). 1.2.5.5 Skeletonization A set of tools is included for reconstructing and analyzing a dendritic, porous or fracture network from 3D image data.
10
Chapter 1: Introduction
grids. Most general purpose image visualization techniques and analysis tools can be applied, e.g.: slice extraction, computation of isolines or isosurfaces, data probing and histograms. In addition, scalar quantities can be visualized with pseudocolors on the grid itself. Beside visualization, data representations such as isosurfaces, grid cuts or contour lines can be extracted as rst class data objects. Displacement vectors can be visualized on grids or applied as grid deformation that can be animated. 1.2.6.4 Flow Visualization Amira provides many advanced tools for vector elds and ow visualization. Vector arrows can be drawn on a slice, within a volume, or upon a surface. The ow structure may be better revealed by representations such as fast Line Integral Convolution on slices or arbitrary surfaces, illuminated and animated streamlines, stream ribbons, stream surfaces, particle animations, synthetic vector probe... All of these stream visualization techniques are highly interactive. While seedpoint distributions can be automatically calculated, you can also select and interactively manipulate seed points and structures, thus supporting the investigation the ow eld and highlighting of different features. Amira can also support six-component complex vector elds and phase visualization, e.g. electromagnetic elds. See tutorial section 2.10 (visualization of vector elds) . 1.2.6.5 Tensor Data Amira has support for iconic visualization of tensor eld, extraction of eigen values, computation of rate of strain tensor, gradient tensor.
Features overview
11
accuracy in the models. Amira allows manual registration through interactive manipulators, automatic rigid or non-rigid registration through landmarks, and automatic registration using iterative optimization algorithms (see AfneRegistration module). Surfaces can also be registered using rigid or non-rigid transformations, based on landmarks sets warping, alignment of centers or principal axes, or distance minimisation algorithms. 1.2.7.2 Operating on 3D data Many utilities are available for data processing. Here are some important ones. Resampling can reduce or enlarge the resolution of a 3D image or datasets dened on regular grids, and different sampling kernels are supported. Data can be cropped or regions of interest can be dened. Data can be converted to any supported primitive type, from byte to 64-bits oating point numbers. Multi-component data such as multi-channel images or vector data can be composed or decomposed. Standard 3D eld operators such as scalar eld gradient or vector eld curl are available. Surface curvatures and distances between surfaces can also be computed, as scalar or vector information. The powerful Arithmetic module allows to perform calculations on datasets with user-dened expression, and can be used to interpolate data between regular grids and polyhedral grids. Data sets can also be created from arithmetic expressions. 1.2.7.3 Measurements, quantication You can query the exact values of your datasets at arbitrary locations specied interactively by a mouse click, or along user-dened lines and spline curves. Probe points can serve to set interactively isosurfaces. You can plot or export the data for further processing with spreadsheet or plotting applications, with probing, measuring, counting, and other statistical modules quantify densities, distances, areas, volumes, mean value and standard deviation, ... Histograms of values can be computed and plotted, possibly restricted to a region of interest. Volume/value diagrams can be also plotted. The Quantication+ Pack provides an extensive set of intensity and geometrical measurements on image or label data, either for individual labelled particles or as statistics. See section ??.
12
Chapter 1: Introduction
Features overview
13
Examples from these disciplines are illustrated by several demo scripts contained in the online version of the users guide.
1.4 Packs
Amira Packs are additional sets of modules providing solutions for dedicated application areas. Packs can be added to a standard Amira installation at any time. For each pack a separate license is required. Currently, the following packs are available for Amira: Amira Developer Pack allows you to develop your own custom modules, le readers, and le writers using the C++ programming language. Amira Molecular Pack adds advanced tools for the visualization of molecules. It combines Amiras strong capabilities for 3D data visualization such as hardware-accelerated volume rendering, with specic tools for molecular visualization and data analysis, such as molecular surfaces, sequence alignment, conguration density computation, and molecule trajectories. Amira Molecular Pack includes a very powerful molecule editor. Amira Mesh Pack supports mesh generation for ow, stress, and thermal analysis; for export of surface or 3D meshes to solvers; and for postprocessing of data coming back from these solvers, providing very powerful visualization on scalar, vector, and tensor elds. Amira DICOM Reader allows for import/export of DICOM data in Amira, making Amira the perfect application for medical data analysis.
14
Chapter 1: Introduction
Amira for Microscopy (ResolveRT) includes readers for most important microscopy le formats, 3D image deconvolution and and a dedicated lament editor. Skeleton Pack supports reconstruction and analysis of porous, vascular and dendritic networks. Amira VR Pack is designed to enable the use of Amira s advanced data visualization and analysis features on immersive VR systems and tiled screen congurations. It has built-in support for efcient multi-threaded rendering on multipipe systems and for distributed rendering on cluster systems using application-level distribution. This approach leads to optimal performance with minimal bandwidth requirements. Tracking capabilities allow for a true immersive experience as well as interaction with the visualization. Amira Very Large Data Pack manages and visualizes very large amounts of volume data, up to hundreds of gigabytes. The multi-resolution technique used in this pack allows for interactive visualization and navigation through vast amounts of data. Amira Quantication+ Pack includes new image processing capability as well as image analysis and quantication tools. Very powerful for material sciences, this pack allows for efcient statistical analysis of data in this application area. Specialized Readers For the following le formats / applications specialized readers are available: SEG-Y, CATIA 4, CATIA 5, IGES, STEP, TNO Madymo, and Mecalog Radioss
Packs
15
The following table shows the license keyword associated with each of the Amira Packs: Amira Pack Developer Pack Molecular Pack Mesh Pack DICOM reader ResolveRT Pack Skeleton Pack VR Pack Very Large Data Pack Quantication+ Pack Specialized readers: SEGY reader Catia5 reader Catia4 reader IGES reader STEP reader Madymo reader (TNO) Mecalog Radioss reader License keyword AmiraDev AmiraMol AmiraMesh AmiraDicomReader ResolveRT AmiraSkel AmiraVR AmiraVLD AmiraQuant
For additional information about Amira and its packs, please refer to the Amira web site, http://www.amira.com.
16
Chapter 1: Introduction
Chapter 2
Getting started - the basics of Amira Reading images - how to read images Visualizing 3D images - slices, isosurfaces, volume rendering Image segmentation - segmentation of 3D image data Surface reconstruction - surface reconstruction from 3D images Grid generation - creating a tetrahedral grid from a triangular surface Warping - how to work with landmark sets 3D image registration - how to register 3D image data sets Alignment of 2D Physical Cross-Sections - how to reconstruct a 3D model Vector elds - stream lines and other techniques Filament Editor - lament tracing for neurons and vessels images The DemoMaker module - creating animations with the DemoMaker module
Creating movie les - how to use the MovieMaker module Using MATLAB - how to use the CalculusMatlab module In all tutorials the steps to be performed by the user are marked by a dot. If you only want to get a quick idea how to work with Amira you may skip the explanations between successive steps and just follow the instructions. But in order to get a deeper understanding you should refer to the text. Note: If you want to visualize your own data, please rst refer to Section 4.1. This section contains some general hints on how to import data sets into Amira.
The following text has the form of a short step-by-step tutorial. Each step builds on the steps described before. We recommend that you read the text online and carry out the instructions directly on the computer. Instructions are indicated by a dot so you can execute them quickly without reading the explanations between the instructions. On a Windows system, select the Amira icon from the start menu. On a Unix system, start Amira by entering Amira in a shell window. If there is no such command, the software has not been properly installed. In this case try to execute the script bin/start located in the AMIRA ROOT directory. When Amira is running, a window like the one shown in Figure 2.1 appears on the screen. The user interface is divided into four major regions. The 3D viewer window displays visualization results, e.g., slices or isosurfaces. The Pool will contain small icons representing data objects and modules. The Properties Area
18
Figure 2.1: The Amira user interface consists of ve major parts: the 3D viewer (1), the Pool (2), the Properties Area (3), the console window (4), and the help browser (5).
displays interface elements (ports) associated with Amira objects. Finally, the lower left pane is shared by the console and Amiras integrated hypertext help browser. Click on the Console or Help tab to select which window you want to view. The console prints system messages and lets you enter Amira commands. You can use the help browser to read the users guide online. You can also activate the help browser by pressing F1, selecting Users Guide from the Help menu of Amiras main window, or by typing help in the console window.
Getting Started
19
Figure 2.2: Data sets can be loaded into Amira using the le browser. In most cases, the le format can be determined automatically. This is done by either analyzing the le header or the le name sufx.
Now, we would like to load a scalar eld from one of the demo data directories contained in the Amira distribution. Change to the directory data/tutorials, select the le lobus.am and press OK. The data will be loaded into the system. Depending on its size this may take a few seconds. The le is stored in Amiras native AmiraMesh format. The le lobus.am contains 3D image data of a part of a fruit ys brain, namely an optical lobe, obtained by confocal microscopy. This means the data represents a series of parallel 2D image slices across a 3D volume. Once it has been loaded, the data set appears as a green icon in the Pool. In the following we call this data set lobus data set. Click on the green data icon with the left mouse button to select it. This causes some information about the data record to be displayed in the Properties Area (Figure 2.3). In our case we can read off the dimensions of the data set, the primitive data type, the coordinate type, as well as the voxel size. To deselect the icon, click on an empty area in the Pool window. You may also pick the icon with the left mouse button and drag it around in the Pool.
20
Figure 2.3: Data objects are represented by green icons in the Pool. Once an icon has been selected information about the data set such as its size or its coordinate type is displayed in the Properties Area.
Clicking on an object typically causes additional buttons to be displayed in the button area at the top of the Pool. These buttons are convenience buttons allowing easy one-click access to the modules most frequently used by the selected object. The tutorials, however, will have you to access modules via the menu interface to help familiarize you with the organization of modules within Amira.
Getting Started
21
Invoke one of the editors by clicking on an editor icon. Close the editor by clicking again on the editor icon. Further information about particular editors is provided in the users reference manual.
22
Figure 2.4: In order to attach a module to a data set, click on the green icon using the right mouse button. A popup menu appears containing all modules which can be used to process this particular type of data.
in contrast to the BoundingBox, the OrthoSlice icon is orange, indicating that this module can be used for clipping. Select the OrthoSlice module. Now you should see various buttons and sliders in the Properties Area, ordered in rows. Each row represents a port allowing you to adjust one particular control parameter. Usually, the name of a port is printed at the beginning of a row. For example, the port labeled Slice Number allows you to change the slice number via a slider. Select different slices using the Slice Number port. By default, OrthoSlice displays slices with axial orientation, i.e., perpendicular to the z-direction. However, the module can also extract slices from the image volume perpendicular to x- and y-direction. These two alternate orientations are sometimes referred to as sagittal and coronal (these are standard phrases used in radiology).
Getting Started
23
Figure 2.5: Visualization results are displayed in the 3D viewer window. Parameters or ports of a module are displayed in the Properties Area after you select the module.
24
Figure 2.6: The OrthoSlice module is able to extract arbitrary orthogonal slices from a regular 3D scalar eld or image volume.
Change the orientation using the Orientation port again. Choose different slices using the Slice Number port or directly in the viewer with the interaction mode described above. Each display module has a viewer toggle by which you can switch off the display without removing the module. This button is just to the right of the colored bar where the module name is shown as illustrated below. Deactivate and activate the display of the OrthoSlice or BoundingBox module using the viewer toggle.
If you want to remove a module permanently, select it and choose Remove Object from the Pool menu. Choose Remove All from the same menu to remove all modules. Remove the BoundingBox module by selecting its icon and choosing Re-
Getting Started
25
move Object from the Pool menu. Remove all remaining modules by choosing Remove All Objects from the same menu. Now the Pool should be empty again. You may continue with the next tutorial, i.e., the one on scalar eld visualization.
26
Example: Files containing the string AmiraMesh in the rst line are considered AmiraMesh les. Files with the sufx .stl are considered STL les. If automatic le format detection fails, e.g. because some non-standard sufx has been used, the format may be set manually using the Format entry in the pop-up menu of the Load dialog (right mouse button).
27
28
Figure 2.9: The denition of the bounding box in Amira. Different gray shades depict the intensity values dened on the regular grid (white lines). The black square depicts the extent of one voxel. The outer frame depicts the extent of the bounding box.
# Amira Stacked Slices # Directory where image files reside pathname C:/data/pictures # Pixel size in x- and y-direction pixelsize 0.1 0.1 # Image list with z-positions picture1.tif 10.0 picture7.tif 30.0 picture13.tif 60.0 colstars.jpg 330.0 end
29
Some remarks on the syntax: # Amira Stacked Slices is an optional header that allows Amira to automatically determine the le format. pathname is optional and can be included if the pictures are not in the same directory as the description le. A space separates the tag pathname from the actual pathname. pixelsize is optional, too. The statement species the pixel size in xand y-directions. The bounding box of the resulting 3D image is set from 0 to pixelsize*(number of pixels-1). picture1.tif 10.0 is the name of the slice and its z-value, separated by a space character. end indicates the end of the description le. Comments are indicated by a hash-mark character (#).
30
Figure 2.10: The usage of AmiraMesh as LargeDiskData. For instantaneous update, the auto-refresh check boxes of the Access and Isosurface modules have been checked
Right mouse click, attach an Access module. Select the Access module in the Pool and enter 224, 161, and 59 into the BoxSize text elds. Check Subsample and enter 4 4 2 into the Subsample elds and press the Apply button. This retrieves a down-sampled version of the data. Disconnect the reg005.view.am data icon from the Access module and use it as an overview (e.g. with OrthoSlice). Select the Access module in the Pool and deselect the subsample check box. Use the dragger box in the viewer to resize the subvolume. Press the Apply button. Attach an Isosurface module to the reg005.view2.am (set threshold set to 100).
Tip: To browse the data, check the auto-refresh check box for the Access and Isosurface modules. Now each time the blue subvolume dragger is repositioned, the visualization is updated automatically. Loading AmiraMesh, StackedSlices, and Raw asLargeDiskData is a convenient and fast way of exploring data that exceed the size of system memory. However, especially with StackedSlices, it is not always the most efcient way of doing this. Amira can store the image data in a special format that facilitates the random
31
retrieval of data from disk. Choose from the Create/Data menu ConvertToLargeDiskData Click Browse from the Input port. Click Add, go to /Amira-5/data/medical/ and reg005.ctdata.am, then click Load. Click Browse from the Output port. Go to C:/tmp/ and enter a lename of your choice. Press the Apply button.
select
Although you will most likely not notice any difference with the small image data used in this tutorial, this method for retrieving large data signicantly accelerates the Apply operation.
32
2. 3. 4. 5. 6.
simple threshold segmentation resampling the data displaying an isosurface cropping the data volume rendering
We start by loading the data you already know from Section 2.1 (Getting Started): a 3D image data set of a part of a fruit ys brain. The data set has been recorded with a confocal laser scanning microscope at the University of Wuerzburg. Load the le lobus.am located in subdirectory data/tutorials.
In addition to the OrthoSlice module, which allows you to extract slices orthogonal to the coordinate axes, Amira also provides a module for slicing in arbitrary orientations. This more general module is called ObliqueSlice. You might want to try it by selecting it from the Display submenu of the lobus data popup menu.
Visualizing 3D Images
33
Figure 2.12: Lobus data set visualized using three orthogonal slices.
e.g., 30...100, any value smaller or equal to 30 will become black, and all pixels with an associated value of more then 100 will become white. Try modifying the range. This port provides a simple way of determining a threshold, which later can be used for segmentation, e.g., in biology or medicine to separate background pixels from anatomical structures. This can be most easily done by making the minimum and maximum values coincide.
Remove two of the OrthoSlice modules. Select the remaining OrthoSlice module. Make sure that the mapping type is set to linear. Change the minimum and maximum values of the data window port until these values are the same and a suitable segmentation result is obtained. For this data set 85 should be a good threshold value.
A more powerful way of quantitatively examining intensity values of a data set is to use a data probing module PointProbe or LineProbe. However, we will not discuss these modules in this introductory tutorial.
34
Figure 2.13: By adjusting the data window of the OrthoSlice module a suitable value for threshold segmentation can be found. Intensity values smaller than the min value will be mapped to black, intensity values bigger than the max value will be mapped to white.
Visualizing 3D Images
35
You may want to compare the resampled data set with the original one using the OrthoSlice module. You can simply pick the blue line indicating the data connection and drag it to a different data source. Whenever the mouse pointer is over a valid source, the connection line appears highlighted in lighter blue.
36
Remove the resampled data lobus.Resampled. Activate the display of the OrthoSlice module. Select the lobus.am data icon. Click on the Crop Editor button in the Properties Area.
A new window pops up. There are two ways to crop the data set. You can either type the desired ranges of x, y, and z coordinates into the crop editors window or put the viewer into interaction mode and adjust the crop box using the green handles directly in the viewer window. Put the viewer into interaction mode. With the left mouse button, pick one of the green handles attached to the crop volume. Drag and transform the volume until the part of the data you are interested in is included. Press OK in the crop editors dialog window. The new dimensions of the data set are given in the Properties Area. If you want to work with this cropped data record in later sessions you should save it by choosing Save Data As ... from the File menu. As you already might have noticed, the crop editor also allows you to rescale the bounding box of the data set. By changing the bounding box alone, no voxels will be cropped. You may also use the crop editor to enlarge the data set, e.g., by entering a negative value for the k min number. In this case the rst slice of the data set will be duplicated as many times as necessary. Also, the bounding box will be updated automatically.
Visualizing 3D Images
37
Figure 2.15: The crop editor works on uniform scalar elds. It allows you to crop a data set, to enlarge it by replicating boundary voxels, or to modify its coordinates, i.e. to scale or shift its bounding box.
You can choose between two different methods for these computations: maximum intensity projections or an ordinary emission-absorption model. Remove all objects in the Pool other than the lobus.am data record. Connect a Voltex module to the data. Select the data icon and read off the range of data values printed on the rst info line (22...254). Select the Voltex module and enter the range in the Colormap port. Press the Apply button in order to perform some texture preprocessing which is necessary for visualizing the data. By default, emission-absorption volume rendering is shown. The amount of light being emitted and absorbed by a voxel is taken from the color and alpha values of the colormap connected to the Voltex module. In our example the colormap is less opaque for smaller values. You may try to set the lower bound of the colormap to 40 or 60 in order to get a better feeling for the inuence of the transfer function. In order to compute maximum intensity projections, choose the mip option of port Options. Internally, the voltex module makes heavy use of OpenGL texture mapping. Both texture modes, 2D and 3D, are implemented. 3D textures yield slightly better results. However, this mode is not supported by all graphics boards. The 3D texture mode requires you to adjust the number of slices cut through the image
38
Figure 2.16: The Voltex module can be used to generate maxmimum intensity projections as well as volume renderings based on an emission-absoprtion model. In both cases, 2D or 3D texture mapping techniques can be applied applied.
volume. The higher this number the better the results are. Alternatively, 2D textures can be used for volume rendering. In this case, slices perpendicular to the major axes are used. You may observe how the slice orientation changes if you slowly rotate the data set. The 2D texture mode is well suited for mid-range graphics workstations with hardware accelerated texture mapping. If your computer does not support hardware texture mapping at all, you should use visualization techniques other than volume rendering. Make sure the mip button of port Options is unchecked. If 3D texture mode is enabled, choose about 200 slices. Click with the right mouse button on port Colormap and choose volrenRed.icol. Set Lookup to RGBA and change the min and max values of the colormap to 40 and 150. Finally, press Apply in order to initialize the Voltex textures. Whenever you choose a different colormap or change the min and max values of the colormap, you must press the Apply button again. This causes the internal texture maps to be recomputed. An exception are SGI systems with Innite Reality
Visualizing 3D Images
39
graphics. On these platforms a hardware-specic OpenGL extension is exploited, causing colormap changes to take effect immediately.
40
Figure 2.17: Image segmentation editor after selecting and assigning pixels for two structures in one slice
In the lower right view, use the slider on the bottom to scroll through the slices. Go to slice 20. You see two bigger structures and one structure just appearing on the top. If necessary, click on the second button under the label Zoom and Data Window to zoom out the data so that you have a view of the entire slice. Click on the second button under the label Tools, the brush. Mark the rightmost structure with the mouse. Hold down the control button to unselect wrongly selected pixels if necessary. When done, select the entry Inside in the Materials list. Then click the + button under the Selection label. The previously selected pixels are now assigned to the material Inside. You can right click on the entry Inside in the Materials list and choose a different draw style (for example, dotted). Click into the material list and choose New Material from the right button menu. Mark the middle structure using the brush, select the new material in the Materials list and assign the pixels to that structure. Go to slice 21 and practice by segmenting the two structures.
Segmentation of 3D Images
41
Hint: If you prefer to work with one larger view rather than four smaller views, click on the Single Layout button in the viewer toolbar. To cycle through each of the four views, press the Single Layout button repeatedly. To return to 4-viewer mode, press the Layout4 button. If a structure does not change a lot from slice to slice, you can use interpolation. Go to slice 22 and mark the right structure using the brush. Go to slice 31 and mark the same structure. Choose from the menu bar: Selection/Interpolate. Scroll through the data set. You should see that the in between slices 23 to 30 are selected too. In order to assign the selected pixels in all slices to the Inside material, select the Inside material in the list, then click the + button. Repeat the procedure between slice 32 and 50. Repeat the procedure for the middle structure. Hints: It is highly recommended to frequently save the segmentation results while working. In order to do so, select the label eld in the Amira main window and choose Save or Save As... from the Amira File menu. The brush is only the most basic segmentation tool. The segmentation editor provides many more functions that are described on its reference page. There are many useful key bindings, including SPACE and BACKSPACE to change the slice number or d to toggle the draw style. Of course you can give the materials more meaningful names or colors using the context menu (right mouse button in the list). At this point you may want to close the editor by pressing the Close button. Save the label eld. In the next tutorial you will learn how to create a 3D surface model from the segmentation results.
42
Right click on the LabelFields green icon. sure/MaterialStatistics. Press the Apply button. A new icon appears. Select this icon and press the Show button.
Choose Mea-
The units in the volume column depend on the units you have specied the voxel size. In case of the lobus.am, the voxel size is in m, therefore the volume is in m3 .
Segmentation of 3D Images
43
Figure 2.18: Data from confocal microscopy is segmented using Amiras image segmentation editor.
interior or exterior label for each voxel according to the segmentation result.
44
are not so smooth and there are many little islands, bordered by brownish contours. This is what we want to improve now. Choose Remove Islands from the editors Segmentation menu. In response, a little dialog window appears. In the dialog window select the all slices mode. Then press Remove in order to apply the lter in all slices. Note how the segmentation results become less noisy. To further clean up the image, choose Smooth Labels from the editors Segmentation menu. Another dialog box appears. Select the 3D volume mode and press the Apply button in order to execute the smoothing operation. To examine the results of the lter operations, browse through the label eld slice by slice. In addition to the slice slider you may also use the cursor-up and cursor-down keys for this. Click on the Close button to close the image segmentation editor.
45
Connect a SurfaceGen module to the lobus.Labels data. Press the Apply button. The option add border ensures that the created surface be closed. A new data object lobus.surf is generated. Again, it is represented by a green icon in the Pool.
46
The number of triangles is reduced to about 3500 now. The progess bar tells you how much of the simplication task has already been done. To examine the simplied surface, attach a SurfaceView module to the lobus.surf data object. The SurfaceView module maintains an internal buffer and displays all triangles stored in this buffer. By default the buffer shows all triangles forming the boundary to the exterior. If you change the selection at the Materials port, the newly selected triangles are highlighted, i.e., they are displayed using a red wireframe representation. The Add and Remove buttons cause the highlighted triangles to be added to or removed from the buffer, respectively. You may easily visualize a subset of all triangles using a 3D selection box or by drawing contours in the 3D viewer. Press the Clear button of the Buffer port to see the display shown in Figure 2.19.
47
triangles should be reduced in a surface simplication step. In Amira a Surface Simplication Editor is provided for this purpose. There may be different goals for the simplication: In computer graphics, one wants to prescribe just the number of faces, because this determines the rendering speed. For a numerical simulation, one often wants to specify the maximum edge length occuring in the grid model. This tutorial shows how the maximum edge length can be controlled during simplication. Select the surface lobus.surf. Click on the Simplier (triangle mesh icon) in the Properties Area. Set the desired number of faces to 1000 and the desired maximal distance (i.e. edge length) to 10 in the Simplify port. Leave the fast toggle turned off in the Options port. This will cause intersection tests to be performed during simplication, which will considerably reduce the probability that the simplied surface contains self intersections. Press the Simplify now button in the Action port.
48
Simplication terminates when either of the limits given by the number of faces or the maximum distance is reached. The progress bar tells you how much of the simplication task has already been done. In this example the maximum distance will be the limiting factor, and the resulting surface will contain about 6000 faces. Besides the maximum edge length, the minimum edge length occurring in the surface should also be controlled, because the ratio of maximum and minimum edge length will inuence the quality of the resulting tetrahedral grid. This ratio should not be much larger than 10. If edges that are too short occur in the simplied surface, they can be removed as follows. Set the desired minimum distance to 2 in the Simplify port. Observe the number of faces as shown at the Surface port, and press the Contract edges button in port Action. All edges shorter than 2 will be contracted. In this example about 30 small edges will be detected. You will observe that the number of faces slightly decreases.
49
occur too often if toggle fast was switched off during surface simplication. In case they occur, the rst of the intersecting triangles and its neighbors are shown in the viewer window. You can manually repair intersections using four basic operations: Edge Flip, Edge Collapse, Edge Bisection, and Vertex Translation. See the description of the Surface Editor for details. After repairing, invoke the intersection test again by selecting it from the Surface/Tests menu or by pressing the Compute button. When the intersection test has been successfully passed, select the Orientation test from the Surface/Tests menu. After surface simplication, the orientation of a small number of triangles may be inconsistent, resulting in a partial overlap of the materials bounded by the triangles. In case of such incorrect orientations, which should occur quite rarely, there is an automatic repair. If this fails, the detected triangles will be shown, and you can use the above mentioned manual operations for repair. Note: There are two prerequisites for the orientation test: the surface must be free of intersections, and the outer triangles of the surface must be assigned to material Exterior. If the surface does not contain such a material or if the assignment to Exterior is not correct, the test will falsely report orientation errors. A successful pass of the intersection and orientation test is mandatory for tetrahedral grid generation. These tests are automatically performed at the beginning of grid generation. So you can directly enter the TetraGen module (see below) and try to create a grid. If one of the tests fails, an error message will be issued in the console window. You can then go back to the Surface Editor and start editing. The remaining three tests analyze the surface mesh with respect to different quality measures. These tests only need to be performed if the tetrahedral quality of the volumetric grid plays an important role, e.g., if the grid will be used for a numerical simulation. Select Aspect ratio from the Surface/Tests menu. This computes the ratio of the radii of the circumcircle and the incircle for each triangle. The triangle with the worst (i.e. largest) value is shown rst, and the actual value is printed in the console window. The largest aspect ratio should be below 20 (better below 10). Fortunately there is an automatic tool for improving the aspect ratio included in the Surface Editor. Select Flip edges from the Edit menu. A small dialog window appears. In
50
the Radius Ratio area, set the value of the Try to ip a triangle... eld to 10. Select mode operate on whole surface. Press button Flip. All triangles with an aspect ratio larger than 10 will be inspected; if the aspect ratio can be improved via an edge ip, this will be done automatically. The console window will tell you the total number of bad triangles and how many of them could be repaired. Press the Close button to leave the Flip edges tool. Select again Aspect ratio from the Surface/Tests menu. Only a small number of triangles with large aspect ratio should remain after applying the Flip edges tool. Select Dihedral angle from the Surface/Tests menu. For each pair of adjacent triangles, the angle between them at their common edge will be computed. The triangle pair including the worst (i.e. smallest) angle is shown in the viewer, and the actual value is printed in the console window. The smallest dihedral angle should be larger than 5 degrees (better larger than 10). For a manual repair of a small dihedral angle proceed as follows: select the third points of both triangles (i.e. the points opposite to the common edge) and move them away from each other. For moving vertices you must enter Vertex Translation mode by clicking on the rst icon from the right on the top of the viewer window or by pressing the "t" key. If the viewer is in viewing mode, switch it into interaction mode by pressing the ESC key or by clicking on the arrow icon (the rst icon from the top) on the right of the viewer window. Click on the vertex to be moved. At the picked vertex a point dragger will be shown. Pick and translate the dragger for moving the vertex. In some cases an edge ip might also improve the situation. Enter Edge Flip mode by clicking on the third icon from the right on the top of the viewer window or by pressing the "f" key. Switch the viewer into interaction mode. Click on the edge to be ipped. Select Tetra quality from the Surface/Tests menu. For each surface triangle the aspect ratio of the tetrahedron which would probably be created for that triangle will be calculated. The aspect ratio for a tetrahedron is dened as the ratio of the radii of the circumsphere and the inscribed sphere. The triangle with the worst (i.e. largest) value is shown in the viewer, and the actual value is printed in the console window. The largest tetrahedral aspect ratio should be below 50 (better below 25). If all small dihedral angles have already been repaired, the tetra quality test will mainly detect congurations
51
where the normal distance between two triangles is small compared to their edge lengths. Again, the vertex translation and the edge ip operation are best suited for a manual repair of large tetrahedron aspect ratios. Leave the Surface Editor by again clicking on the Surface Editor button in the Properties Area. Hint: In order to see the entire surface again, select the SurfaceView icon, then press its Show/Hide button, then press the ViewAll button in the viewer toolbar.
52
you are not sure about a suitable value, set the desired mesh size to 0. In this case the mean edge length of the surface triangles will be used. Press the Run now button at port Action. A pop-up dialog appears asking you whether you really want to start the grid generation. Click Continue in order to proceed. Once grid generation is running, the progress bar informs you about the number of tetrahedra which already have been created. In some situations grid generation may fail, for example, if the input surface intersects itself. Then an error message will occur at the Console Window. In this case go back to the Surface Editor to interactively x any intersections. After the tetrahedral grid has been successfully created, a new icon called lobus.grid will be put in the Pool. You can select this icon in order to see how many tetrahedra the created grid contains. If grid generation takes too long, you may also load the pre-computed grid lobus.grid from the data/tutorials directory. As the very last step you may want to have a look at the fruits of your work: Attach a GridVolume module to the lobus.grid. Select the GridVolume icon and press the Add to button of the Buffer port.
53
The GridVolume module maintains an internal buffer and displays all tetrahedra stored in this buffer. By default the buffer is empty, but all tetrahedra are highlighted, i.e., they are displayed using a red wireframe representation. The Add to button causes the highlighted tetrahedra to be added to the buffer. You may easily visualize a subset of all tetrahedra using a 3D selection box or by drawing contours in the 3D viewer. Similar to the Surface Editor, there is a Grid Editor which can be invoked by selecting the green icon of the tetrahedral grid and clicking on the pencil icon (rst from the right in the title bar) in the Properties Area. The editor allows for selecting tetrahedra with respect to different quality measures, e.g., aspect ratio, dihedral angles at tetrahedron edges, solid angles at tetrahedron vertices, and edge length. The editor contains several modiers that can be applied for improving mesh quality.
54
This script will load two data sets called lobus.am and lobus2.am. In addition, two isosurface modules connected to each of the data sets will be created. In the viewer the two lobes are visualized by isosurfaces, the rst in yellow and the second in blue. As we can see, the lobes are oriented differently. We want to look at each lobe in its own viewer. Choose 2 Viewers horizontal from the View Layout menu. You can see the two lobes in both viewers. Visualize the rst lobe (blue) in the upper viewer and the second lobe (yellow) in the lower viewer. This is done by deactivating the lower viewer toggle (orange buttons in the icons) of the Isosurface module and by deactivating the upper viewer toggle in the Isosurface2 module.
55
in order to create an empty landmark object. A new green icon will show up in the Pool. Since we are going to match two objects by means of corresponding landmarks we had to select the landmark objects containing 2 sets of landmarks (Landmarks (2 sets)). Select object Landmarks. Launch the Landmark Editor by clicking on the Landmark Editor button in the Properties Area. When starting the editor, a LandmarkView module is automatically created and connected to the Landmarks data object. As indicated on the info line, two empty landmark sets are available now. We use the editor to dene some markers in both objects. For the following, it is useful to push-pin the three ports on the landmark editor. In order to do so, select the gray push-pin toggles to the left of the port labels. Connect a second LandmarkView module to the Landmarks object. Select the rst LandmarkView module and choose Point Set: Point Set 1. Shift-select the second LandmarkView module and choose Point Set: Point Set 2. Set the viewer toggles of the two LandmarkView modules in the same manner as described for the SurfaceView modules previously. LandmarkView should be visible in the upper viewer and LandmarkView2 in the lower viewer. Before starting to set landmarks it is helpful to rotate the two lobes in their viewers such that they are approximately aligned. This will make it easier to locate corresponding features in the two objects and to select reasonable positions for landmarks. Rotate the two lobes to align them roughly. Now, we are ready to dene and set corresponding landmarks. Select the Landmarks object if necessary and choose the option Edit mode: Add.
56
Figure 2.23: The image shows how the viewer toggles and Point Set ports should be set.
To set corresponding landmarks simply click with the left mouse button anywhere on the surface in the rst viewer rst and click on the surface in the second viewer subsequently. The landmarks are visualized as small spheres, the rst landmark in yellow and the corresponding landmark in blue. Make sure to always set the rst landmark on the rst (yellow) surface and the second landmark on the second (blue) surface!! If you want to change the position of an existing landmark set Edit mode: Move and select the respective landmark (blue or yellow) by clicking on it with the left mouse button. Then just click at the desired position. You can also delete existing landmarks by setting Edit mode: Remove and clicking on the respective landmark. Both corresponding landmarks (blue and yellow) will be removed, no matter which one was selected.
57
You should now be able to create several landmarks. You may want to change the view of the objects to set landmarks on the back. In case you have problems dening landmarks, you may use an existing set of landmarks by loading the le landmarkSet from the directory data/tutorials. Once landmarks have been created, the next step is to transform the two objects into each other.
58
Figure 2.24: Result of landmark-based elastic warping using the Bookstein method.
Method: Bookstein and press the DoIt button. To visualize the result, the isosurface has to be recomputed. Having done that, you can see both the deformed and the second lobe in the rst viewer. To merely see the resulting deformation in the rst viewer, switch off the viewer toggle of the second lobes Isosurface module. Only a little deformation will be seen because the two original objects were rather similar. Using more different data sets results in larger deformations.
59
provides an afne registration, i.e. it determines an optimal transformation with respect to translation, rotation, anisotrope scaling, and shearing. Closely related to registration is the task of image fusion, i.e., the simultaneous visualization of two registered image data sets. This tutorial shows how a registration can be performed and how to visualize the results. The following issues will be discussed: 1. Basic manual registration using the Transform Editor 2. Automatic registration 3. Image fusion
60
viewer using different Open Inventor draggers. You can also enter transformations numerically. Press the Dialog button. A dialog window will pop up. Enter -2 at the third text eld of the Translation port of the dialog window. This means a translation of -2 cm in the z direction. Enter 5 at the rst text eld at the Rotation port. This means a rotation of 5 degrees. The axis of rotation is dened at the next ports, here it is the z-axis. Press the Close button of the dialog window. Leave the Transform Editor by pressing again the Transform Editor button.
Inspect some coronal slices through the MRT data set. Now there is a better alignment of the CT and MRT data, but its still not perfect.
61
the resampling hierarchy will consist of four levels: (8,8,3), (4,4,2), (2,2,1), and the original resolution, (1,1,1). The Normalized Mutual Information is calculated from gray value histograms. The selected histogram ranges should enclose the essential information of each data set. Normally you can choose the same range as for visualization via an OrthoSlice module. Set -200 and 200 at the two text elds of the Histogram range reference port. At the Transform port you can specify the type of afne transformation. The default settings mean that only rigid body motions will be applied, i.e. translations and rotations. Option Ignore nest resolution means that optimization is done on all but the nest level of the resampling hierarchy. This will slightly reduce the accuracy, but save a large amount of computing time. Automatic registration may take some time depending on the resolution of the images and the quality of the pre-alignment. You can interrupt automatic registration at any time using the stop button. Interruption may take some seconds. The progress bar shows the current hierarchy level and the progress at that level. Start automatic registration by pressing the Register button at the Action port.
62
Select the physics.icol colormap at port Colormap. Set 70 as the upper bound for the colormap range. Select the icon of the OrthoSlice module. Inspect axial slices with slice numbers between 15 and 45.
You will observe a good alignment of the pelvic bone from both data sets. The soft tissue contours are not perfectly aligned because there was some soft tissue deformation between both scans. This cannot be described by a rigid transformation. In image fusion it is sometimes necessary to observe all three orthogonal directions simultaneously. For that the StandardView module can be used for image fusion. The StandardView module opens a separate window with four viewers, three of them showing the three orthogonal slices of the image data and a fourth being a new instance of the 3D viewer.
Attach a StandardView module to the CT data set by choosing Display StandardView from the popup menu over the CT-data.am icon. Amiras Viewer window will now be split into four parts showing three orthogonal slices through the CT data, and the 3D Viewer in the upper left part. Connect the second input port OverlayData of the StandardView module to the MRT data set. For this, click with the right mouse button on the white square at the left hand side of the modules icon. Select slice numbers 179, 149, and 31 at ports Slice x, Slice y, and Slice z, respectively. The three orthogonal slices will show the hip joints now. Increase the zoom-factor by clicking twice on button > at the Zoom port. Select checkerboard at the Overlay mode port. Vary the size of the checkerboard tiles by moving the slider at the Pattern size port. In this way you can again check the alignment of the CT and MRT data sets.
The bone contours around the hip joints show a good match. Note that bone is represented by white (i.e high intensity) voxels in the CT data, but may occur as both white and black voxels in the MRT data. In the axial slice you can observe larger deviations of the outer body contour between the CT and MRT data.
63
64
entire slice to be visible in viewer. Translate the upper slice by moving the mouse with the left mouse button pressed down. Rotate the upper slice by moving the mouse with the left mouse button and the Ctrl key pressed down. Alternatively, slices can be rotated using the middle mouse button. Make the lower slice editable by selecting the lower slice tool button. Translate and rotate the lower slice. Hold down key number 1. While this key is hold down only the lower slice is displayed. Hold down key number 2. While this key is hold down only the upper slice is displayed. Pressing key number 1 and 2 also changes the editable slice. Note how the slice tool buttons change their state. Other pairs of slices can be selected using the slider in the upper left part of the align window. Note that the number displayed in the text eld at the right side of the slider always refers to the editable slice. The next or the previous pair of slices can also be selected using the space bar or using the backspace key, respectively. The cursors keys are used to translate the current slice by one pixel in each direction. Browse through all slices using the space bar and the backspace key. Trans-
65
late and rotate some slices in an arbitrary way. Translate all slices at once by moving the mouse with the left mouse button and the Shift key pressed down. Rotate all slices at once by moving the mouse with the left mouse button and the Shift and Ctrl key pressed down. Transforming all slices at once can be useful in order to move the region of interest into the center of the image.
66
Figure 2.26: The gure shows how the landmarks should be set in the tutorial.
Choose Add from the Landmarks menu. Click anywhere into the image in order to dene the position of the new landmark. Select the yellow landmark by clicking on it. Choose Remove from the Landmarks menu in order to delete the selected landmark again. Two landmarks should be visible now, a red one, and a blue one. Next, let us move these landmarks to some reasonable positions so that we can perform an alignment. Select slice number 0. Place the landmarks as shown in Figure 2.26. Make use of the double-click method. In all other slices place the landmarks at the same positions. Once all landmarks have been set, we can align the slices. It is possible to align only the current pair of slices, or to align all slices at once. Note that all alignment actions as well as landmark movements can be undone by pressing Ctrl-Z. Switch back to transform mode by pressing the hand-shape tool button. Two slices should be displayed again. Align the current pair of slices by pressing the second tool button from the right (the one with only two lines).
67
Align all slices by pressing the rst tool button from the right (the one with many lines). Move and rotate the whole object into the center of the image using the mouse with the Shift key hold down. In most slices the alignment now should be quite good. However, looking at the pairs 3-4 and 4-5 (displayed in the lower left corner of the align window) youll notice that there is something wrong. In fact, slice number 4 has been accidently inverted when taking the microscopic images. Fortunately, we can compensate for this error as follows: Select slice pair 3-4 and make sure that the upper slice, i.e., slice number 4, is editable. Invert the upper slice by pressing the invert button (third one from the right). Realign the current pair of slices by pressing the second button from the right). Select slice pair 4-5 and realign this pair of slices as well. Alternatively, you could have aligned all slices from scratch by pressing the rst button from the right.
68
Align the current pair of slices by pressing the second button from the right. Observe how the quality is improved. Automatic alignment is an iterative process. It may take quite a long time depending on the resolution of the images and of the quality of the pre-alignment. You can interrupt automatic alignment at any time using the Stop button. Automatically align all slices by pressing the rst button from the right.
69
70
71
Figure 2.28: Air ow around the wing visualized using Line Integral Convolution
2D domain. The direction is represented by local streamlines, i.e. by curves whose tangent vectors coincide with those of the given vector eld. Local streamlines are computed such that all image pixels are covered. The streamlines are projected onto a random noise input texture map of the same size as the vector eld domain. The projection step involves summations of texture pixel intensities along streamline paths by way of a convolution integral with a lter kernel. This causes pixel intensities in the resulting image to be highly correlated along individual streamlines but statistically independent perpendicular to the latter. Thus the directional structure of the vector eld becomes clearly visible. Here we use the 3D vector eld that we have already loaded and visualize twodimensional slices: Connect a PlanarLIC module to the vector eld wing.am and select it. Choose the slice number 22 in the Translate port. Set lter length to 40 and resolution to 200. Press the Apply button.
Whenever the projection plane of the PlanarLIC module is changed or other values for lter length or resolution are taken, the LIC texture must be recalculated, i.e., the Apply button must be pressed again. Otherwise, a checkerboard pattern will be displayed. Experiment with different lter lengths and resolution values to see what kinds of textures can be produced. To get an impression of the magnitude of the vectors, you can apply a colormap to
72
the image. Some default colormaps are already loaded when Amira starts up. The corresponding icons usually will be hidden. In order to use one of the colormaps, you have to select it explicitly: From the main windows Pool / Show Object menu select temperature.icol or any other colormap: the corresponding icon becomes visible. Select Magnitude from port Colorize of the PlanarLIC module. A new port labeled Colormap appears in the Properties Area. Connect the colormap port to temperature.icol by clicking with the right mouse button in the red rectangle and choosing temperature.icol from the appearing popup menu. The two integer values of the colormap port specify the range of values to which the colormap is applied. Vector magnitudes within this range are depicted symbolically by coloring streamline pixels such that each pixel gets the unique color associated with the magnitude value by the temperature.icol colormap. Select the wing.am icon and read off the magnitude range. Shift-select the PlanarLIC icon and enter the magnitude range into the Colormap port. Holding the Shift key while selecting a module adds it to the currently displayed modules. This is a convenient way to edit several modules at the same time. You can also use the Adjust range function located in the colormap menu visible when right clicking on the colormap color ramp. This function computes automatically the exact range of values by reading the attached data set.
73
Connect a DisplayISL module to the vector eld wing.am. Set Num Lines to 300. Press the Apply button. Click on the TabBox button of port Seed Box and zoom out the viewer if you cannot see a box.
A TabBox appears in the viewer. Only stream lines owing through this box are visible. The green tabs at the corners and edges of the box allow you to change the dimensions of the box. Switch the viewer into interact mode. Try out what happens if you click with the left mouse button on one of the green tabs on the corners or edges of the TabBox and drag them around. To move the whole TabBox, click with the left mouse button in the box and move it. Try to get the TabBox into a shape and position as shown in the image. Press Apply button again in order to recalculate the stream lines. Now some information about Console Window commands. Most Amira modules provide more control features than those that are available by the ports displayed in the Properties Area. All of them are available by commands that you type in the console window. You can get a list of commands associated with a particular module currently in use just by entering its name. Now we will use such commands
74
to form and position the TabBox exactly as in the image above. Type DisplayISL into the Console Window. Type DisplayISL getBox into the Console Window. The rst command lists all commands of the DisplayISL module and the second shows the scale and translation of the current TabBox. The rst word of a command must always be the name of a module as shown on its icon. Note that module commands are not recognized unless corresponding modules have been loaded into the Pool. However, you do not need to select a module for typing in its commands. Type DisplayISL setBoxTranslation -0.31 0.00 0.17 Type DisplayISL setBoxScale 0.11 0.04 0.14 Now the sub-eld that corresponds to the clipping of the vector eld as implied by the settings of the TabBox should look like the one shown in the image above.
To access the Filament Editor, click the icon in the sub-application bar. We begin our work by loading the 3D image data set.
75
located
in
subdirectory
76
Figure 2.30: The Filament Editor immediately after the image data has been loaded. The left-hand panel of the viewer shows a 2D slice of the volume, while the right-hand panel shows the 3D objects. The 3D and slice rendering have been activated in the 3D viewer.
Select the Auto Skeleton tool in the Tool Box and check the Preview option. The 3D viewer shows a shaded volume rendering of the neurons main branches and gives a rough estimate of what the automatic tracing procedure will consider as neuron. Press the Run button. After a few seconds you will see green lines and blue points in the 2D viewer. In the 3D viewer gray spheres are displayed together with the preview rendering. If you do not see them, click the icon View All (or the space bar) to center the 3D viewer on them. Adjust the Alpha slider in the Auto Skeleton tab such that you can see the graph through the preview rendering. The Auto Skeleton tool traces connected regions according to a user-dened window level and converts the centerline of those regions into graphs composed of points, segments, and nodes, which are the elements of the data class SpatialGraph. The result of the skeletonization is, therefore, a SpatialGraph object, which is being visualized in the 3D viewer as balls and lines, and as blue points connected by green lines in the 2D viewer. Depending on the quality of the data and on the selected window level the result of skeletonization will typically show several disconnected elements and as well
77
as loops within the networks. Disconnected elements will break the single neuron into several sub-graphs. Loops, on the other hand, are parts of a graph where segments connect onto itself. In some biological objects like e.g. neurons loops must not occur. To identify graphs and loops the Filament Editor offers dedicated tools. Press the button Identify Graphs to automatically detect and label all graphs in the SpatialGraph object, that is all connected components. This creates a new label group in the Label Editor named Identied Graphs under which all identied graphs are listed as Graph1, Graph2, ..., GraphN. To visually identify them just click on one of the items in the Identied Graphs list. The selected item is highlighted in red in both viewers. Under Identied Graphs select Graph2 and shift-select Graph25, then remove them by clicking the Delete Selection icon. Press again the button Identify Graphs, now you should have only two graphs. Scale the nodes by moving the Node Scaling Factor slider in the View Options tab of the Tool Box (we will see the details in the next paragraph). At this point we have only two graphs: Graph0 is the large tree, while Graph1 is just three segments and four nodes. Switch back to the Auto Skeleton tab in the Tool Box. Select Graph1 in the Label Editor under Identied Graphs Activate the Select Single icon and Ctrl-click on the closest node of Graph0 in the 3D viewer. Select the Connect Selected icon to connect the graph. Press again Identify Graphs. At this point you should have only one graph. Press Identify Loops to get another label group Identied Loops. Under Identied Loops select Loop2 and remove it by clicking the Delete Selection icon. Note that a segment is dened by two nodes. Therefore, when you remove a node the associated segment will be removed too. In this example this will not happen, but in general it is very likely that some connected segments are removed when a loop is deleted.
78
Figure 2.31: The SpatialGraph object obtained with the Auto Skeleton tool. Note the highlighted main graph.
It should perhaps be noted that the Auto Skeleton tool is also available as a compute module in the Pool under the Skelton category. Also, there is a rich set of tools available in the Segmentation Editor to perform the threshold segmentation neccessary for the skeletonization process. Finally, in the case of a strict tree topology it may be advantageous to restrict the search to a tree. In this case you may want to use module CenterlineTree to extract a graph with guaranteed tree topology. Before closing this subsection, we should save the SpatialGraph data object we have created, it will be useful in further step of this tutorial. Switch back to the Pool, save the object called neuron.Smt.SptGraph in a directory of your choice and then remove it from the Pool. Switch again to the Filament Editor to prepare the next step.
79
data window. Now we can use the Interactive Tracer to re-trace the neuron segments. In order to clearly understand how to use the tracer, we will try to re-trace a small part the of the neuron tree we extracted in the previous paragraph. Press the New button at the Graph Data port to crate a new SpatialGraph data object. Click in the 2D viewer. Using the Browse Slices tool or the mouse wheel, slice through the volume until you reach the root of the neuron. Set the thickness of the Thick Slice at 10 for a better visualization. Activate the Interactive Tracer by clicking the Trace lament tab and make sure that the Thick structures option is checked. Note that the Interactive Tracer is alway active while the Trace lament tab is highlighted and it can be triggered only if the 2D viewer is active. If you now move the mouse over the 2D slice, the cursor has a cross shape whenever it is over black regions and turns into a crosshair (cross within circle) when it is over voxels that are within the window level. The cross-hair shape indicates that it is possible to set tracing key points. As you will see later, when the pointer is over a traced segment (green line) a small P appears in the crosshair. This indicates that a click would select the nearest point as a key point. Likewise, an N is shown in the cursor whenever the cursor is over a node and a click will select this node as a key point. Furthermore, the cursor turns red when the trace tool is in append mode, meaning that the next click will trigger a tracing action between the previously selected and the current key point. Start the tracing by clicking on a gray value of the tree root. Slice ahead and set further points, until you reach the rst bifurcation and click on it. Deactivate the Interactive Tracer e.g. by clicking the Select Single tool. If you press Identify Graphs graphs, you will see only one graph. You can also access some statistical information by clicking on Graph Info button in the Auto Skeleton tab. This opens a spreadsheet window containing a list of all segments in the graph. The spreadsheet is interactive, i.e. if you click on a line, the corresponding segment will be highlighted in the viewer. Repeat the actions to trace the rst branching sections from the root.
80
81
Figure 2.32: The visualization of the SpatialGraph obtained with the AutoSkeleton and Tracing tools.
82
Once you have learned how to dene an animated demo sequence, you can further learn how to record the demonstration into a movie le in Section 2.13.
83
use the mouse to navigate around the model in the 3D viewer, you should manage to get a result similar to this:
(load network)
84
Click on the blue icon to see its user interface. Whenever you want to animate some port of the current network, you must select that port in the selection list called GUI element. Try to nd the entry called OrthoSlice/Slice Number, which corresponds to the Slice Number port of the current OrthoSlice module. If you cannot nd the entry, you may need to press the Update button to the left of the selection menu (see below for an explanation).
Once you have selected OrthoSlice/Slice Number, you see two more ports appear in the DemoMaker module: Start/end value as well as Start/end time. The start and end value specify between which two values the OrthoSlice slider will be moved. Click the mouse into the start or end value elds, hold down the Shift key, and drag the mouse with Shift held down. With this feature called the virtual slider you can quickly set the desired value within the allowed range. Set the start value to 0 and the end value to 30. Then, set the start time to 0 and the end time to 0.2. These time values specify times on the Time slider of the DemoMaker module (rst port in the module). You have now specied an event starting at time 0 and ending at time 0.2, varying the OrthoSlice slice number between 0 and 30 during that time.
85
Now press the Add button in the Event List port to add the newly dened event to the list of events. This list of events is represented in the selection menu above the Add button.
Test the result by pressing the play button of DemoMakers time slider, represented by the triangle pointing to the right. When you press it, the time slider will start moving from the left to the right. When the time value is between 0 and 0.2, you should see that the OrthoSlice plane is moving between the specied start and end values in the viewer (load network). You can also play your demo backwards using the play button to the left of the time slider, or simply click somewhere on the time slider to jump to any point in time of the demonstration. If the demo sequence runs too slow or too fast, you can adjust this by right-clicking anywhere on the time slider and selecting Congure from the popup menu. Change the Increment value in the dialog box that appears. A smaller increment will make the animation slower, whereas a larger increment makes it faster. If you choose an increment value too large, the animation might become jerky.
86
yellow SurfaceView module to see its user interface. Press the Clear button in the Buffer port, then select Bone and All in the Materials port and press the Add button in the buffer port. This will visualize the bone surface of the model.
If you want to switch the bone visualization on and off manually, you would use the viewer toggle (orange rectangle) of the SurfaceView module. If you want to include this action in your demo sequence, you need to do the following: Click on the DemoMaker module. Click on the Update button in the GUI element port. This is necessary whenever you add new modules to the Pool after you have created the DemoMaker module. Select SurfaceView/Viewer Mask/Viewer 0 from the GUI element list. Enter on in the Toggle to value port. Enter 0.2 in the Trigger time port. Press the Add button in the Event List port to add this newly dened event to the event list.
87
To test the newly added event, rst toggle the SurfaceView module off using its orange viewer toggle icon. Now click to the very left of the DemoMaker time slider to jump to the start of the demo sequence. Click the play button. As before, the slice moves up. When it reaches the maximum value at time 0.2, the bone model is switched on (load network).
Now play the demo to see the result. After moving the slice and switching on the bone model, the view is rotated so that the bone can be seen from all sides (load
88
network).
89
Smooth out the outer surface by clicking on more options in the Draw Style port and selecting Vertex normals. Like we did with the bone model, we can switch on the skin model at some point in the demo sequence: Click on the DemoMaker module. Click on the Update button in the GUI element port. Select SurfaceView2/Viewer Mask/Viewer 0 from the GUI element list. Check on in the Toggle to value port. Enter 0.6 in the Trigger time port. Click on Add in the Event List port.
90
First, we need to move the OrthoSlice plane down again to where we want to start the clipping: Click on the DemoMaker module. Select OrthoSlice/Slice Number from the GUI element list. Enter 30 and 3 as the start/end values. Enter 0.3 and 0.5 as the start/end time. Click on Add in the Event List port.
Now, when you play the demo, the OrthoSlice plane will move down again during the camera rotation (load network). Now, we will clip the skin model using the OrthoSlice plane: Click on the DemoMaker module. Select SurfaceView2 / Clip using OrthoSlice from the GUI element list. Enter on as toggle value and 0.6 as trigger time. Click on Add in the Event List port.
When you run the animation now, you will not see the skin surface. This is because it is clipped above the OrthoSlice plane, and only visible below that plane. To see the partial surface below the plane, we must make the Orthoslice display transparent: Click on the DemoMaker module. Select OrthoSlice / Transparency from the GUI element list. Select None and Alpha as the from/to values. Enter 0.6 as the trigger time. Click on Add in the Event List port.
This way we have specied that at time 0.6, the Transparency port of the OrthoSlice module will be changed from value None to the new value Alpha. When
91
running the demo sequence, the result should look like this:
As you see, part of the skin model is showing below the transparent OrthoSlice plane. To show all of the skin, we simply move the plane upwards pretty much the same way we did before: Click on the DemoMaker module. Select OrthoSlice / Slice Number from the GUI element list. Enter 3 and 58 as the start/end value. Enter 0.6 and 0.9 as the start/end time. Click on Add in the Event List port.
92
Now you see the skin slowly appearing over the bone as the clipping plane moves upwards. As a last step, you might want to rotate the view again while the skin is appearing. You can simply reuse the old camera rotation during a second time range: Click on the DemoMaker module. Select 0.3 ... 0.5: CameraRotate from the Event List menu. You will see start/end value and start/end time appear in the lower part. Change the start/end time to 0.6 and 0.9. Click on Add in the Event List port. This will leave the old event untouched and add a second camera rotation event to the list.
You can check out the nal animation by loading a saved network script.
93
You do not need to use an OrthoSlice module to do clipping. As you have seen, the OrthoSlice might occlude parts of what you want to show. In that case, it is better to create an empty ClippingPlane module by selecting Create/Clipping Plane from the menu. Attach the module to the data set you want to clip (e.g., to reg005.surf in our example), and then use the ClippingPlane for clipping just as you used the OrthoSlice before.
94
This way the demo will stop at time 0.21, which is right after the time when the bone model is switched on (0.2). When you play the demo from the start, you will notice that after the bone is switched on, the demo will stop. Let us insert a second break at time step 0.51, which is right before the skin is starting to show. Proceed as above, using a trigger time of 0.51 instead of 0.21 (load network). If you run the demo from the very beginning, it will stop after the bone is displayed, and you can read a message in the console window telling you that DemoMaker just stopped and you may press F4 to continue. Try this by pressing the function key F4. The demo continues. Likewise, the demo will stop just before showing the skin. Again, you can continue the demo by pressing F4. In general, at any point while the demo is running, you can press the F3 key to stop it manually. Pressing F4 will continue from the point where the demo stopped. If you have dened breaks as we did above, there are two more interesting function keys that in some sense allow you to navigate through the demo segments: pressing F9 will jump back to the previous break or to the very beginning of the demo, and F10 will jump to the next break, or to the very end of the demo. If you use F9/F10 when the demo is stopped, it will just jump, and you need to press F4 to start playing it from the new time step. If you press F9/F10 while the demo is running, it will just jump to the new time step and continue running. Please note that you can disable the breaks by checking the skip break toggle in the Options port of the DemoMaker module. You may even disable the denition of function keys by checking the options toggle in the Functions port, and then unchecking function keys in the second Options port. This is especially important
95
if you want to use multiple DemoMaker modules, since only one of the modules can dene the keys.
When you run the demo sequence now, it will loop in the rst segment, only showing the OrthoSlice move up, jump down, move up again. . . You can stop this by clicking on the stop button of the DemoMaker time slider or by pressing F3. To continue after the loop, you need to jump to the next segment by pressing F10, and then start playing again by pressing F4.
96
Just check the auto start toggle and save the network. When you load it again, the demo will start running automatically (load network).
97
create an appropriate camera path and record a movie by following the camera along that path. Let us create a simple example. Load the lobus.am data set from the tutorial subdirectory and attach an Isosurface module to it. Choose an isosurface threshold of 70 and press the Apply button. The result should look similar to this:
The easiest way to create a simple camera path is to use the CameraRotate module. Select Create/CameraRotate from the menu, and press the play button of the newly created module. You can watch the scene rotate in the viewer while the time slider is playing (load network). To record an animated scene into a movie le, you need to attach a MovieMaker module to a module that posesses a time slider port. The movie is recorded by going through the individual time steps and taking snapshots of the viewer along the way. In our example, the CameraRotate module has a time slider, so we can attach a
98
MovieMaker module to it by right-clicking on the CameraRotate icon in the Pool and selecting MovieMaker from the popup menu:
In the MovieMaker module, rst click on the Browse button in the Filename port and enter a movie le name like c:/tmp/test.mpg. The .mpg sufx suggests that the movie le format will be MPEG, which is a widely accepted standard format for digital movies achieving a good compression ratio. Next, adjust the parameters of the MovieMaker module to your liking, e.g., change the number of frames, the image size, or the compression quality. Please refer to the MovieMaker documentation for details. In our example, let us choose 180 frames and leave all other parameters untouched. Since the CameraRotate module does a full rotation of 360 degrees, each of the 180 frames will represent a rotation of two degrees with respect to the previous frame. Press the Create Movie button to start recording.
99
Wait for some time while the MovieMaker module drives the CameraRotate module and accumulates the snapshots. Please note that the speed during the recording process is different than the playback speed of the movie. Now view the resulting movie le test.mpg with a movie player of your choice (e.g., Windows Media Player or a similar tool). Experiment with the recording parameters until you get the desired result (e.g., control the le size and image quality by changing the Compression quality value, choose different image sizes to see up to which image size your computer is capable of smoothly displaying the movie, and change the number of frames to control the speed of the rotation).
100
If you remember the previous section in this tutorial, you might already have an idea of how we can record this animated demonstration into a movie le. Like the CameraRotate module in the rst example, the DemoMaker module is controlled via a time slider that we can attach to. So simply right-click on the DemoMaker icon in the Pool and attach a MovieMaker module. Like before, enter a movie le name and select the number of frames before you click on the Create Movie button to start recording.
101
Choose Luminance in the Channel Conversion eld as shown in Figure 2.33. Right click on the green icon and choose CalculusMatlab from the Compute section. A new red icon appears, the CalculusMatlab module that will try to connect to the MATLAB engine. This may take a while. Load the script lowpass.m located in subdirectory data/tutorials/matlab by clicking the Read button of the File port. Execute the script by clicking on the buffer button of the Execute port. Connect an OrthoSlice to the ltered image result. The module uses the MATLAB computation engine which has its own user interface. You can easily show or hide the MATLAB console using the checkbox in the options eld. The MATLAB console is very useful for debugging purposes because it allows you to access variables of the MATLAB workspace. Any variable not cleared by the MATLAB clear command in the script is accessible in the MATLAB workspace, even after nishing the current CalculusMatlab computation (see the CalculusMatlab documentation).
102
In addition you can control scalar parameters of the script using time sliders: Create a time slider (File/Create/Data/Time). Connect the CalculusMatlab module to the time slider. Change the line cutoff=0.05 to cutoff=t in the script (see the CalculusMatlab documentation for more information about the keyword t). Click on the time slider and adjust the value that will be assigned to w. Right mouse click in the text eld of the time slider and select Congure to adjust the data range of the parameters. Note: To handle RGBA image ltering, you must load the image with Color Field Channel Conversion and treat each channel separately in the script.
103
104
Chapter 3
Program Description
This chapter contains a detailed description of Amira interface components and data types. No in-depth knowledge of Amira is required to understand the following sections, but it is a good idea to have a look at one of the tutorials contained in Chapter 2, particularly the very rst one described in Section 2.1 (Getting Started).
3.1.1.1 Open Data The Open Data button activates Amiras le dialog and lets you import data sets stored in a le. Most le formats supported by Amira will be recognized automatically via the le header or the le name extension. For each le, the le dialog will display its format. If you try to load a le for which the format couldnt be detected automatically, an additional dialog pops up asking you to select the format manually. You may also manually set the le format for any le by selecting the le, activating the le dialogs popup menu using the right mouse button, and then choosing the Format option. A list of all supported le formats is contained in the reference manual. Hints on how to import your own data sets are given in Section 4.1. If you select multiple les in the le dialog, all of them will be loaded, provided all of them are stored in the same format. 2D images stored in separate les usually will be combined into a single 3D data object. On the other hand, there are some le formats which cause multiple data objects to be created. Finally, you can also import and execute Amira network scripts using the Load button. 3.1.1.2 Open Time Series Data This button also activates the le dialog, but in contrast to the ordinary Load option it is assumed that all selected les represent different time steps of a single data object. When loading such a time series an instance of a time series control module is created. This module provides a time slider allowing you to adjust the current time step. Whenever a new time step is selected the corresponding data le is read, and data objects associated with a previous time step are replaced. The module also provides a cache so that the data les only need to be read once provided the cache is large enough. 3.1.1.3 Save Data The Save Data button allows you to save a single modied data object again using the same lename previously chosen under Save Data As. The button will only be active if the data object to be saved is selected and if this data object already has been saved using Save Data As. A common application of the Save button is to store intermediate results during manual segmentation in Amiras image segmentation editor.
106
3.1.1.4 Save Data As This button lets you write a data object into a le. To do so you must rst select the data object (click on the corresponding green data icon). Then choose Save Data As to activate Amiras le dialog. The le dialog presents a list of all formats suitable for saving that data object. Choose the one you like and press OK. Note that you must specify the complete le name including the sufx. Amira will not automatically add a sufx to the le name. However, it will update the sufx whenever you select a new format from the le format list. Also, Amira will ask you before it overwrites an existing le. Some le formats create multiple les for a single data object. For example, each slice of a 3D image data set might be saved as a separate raster le. In this case, the le name may contain a sequence of hashmarks. This sequence will be replaced by consecutive numbers formatted with leading zeros. If no le format at all has been registered for a certain type of data object, the Save as button will be disabled. It will also be disabled if more than one data object is selected in the Pool. 3.1.1.5 New Network This button does a Remove all objects so that you can start building a new network in the Pool. It also sets the new network name to Untitled.hx. 3.1.1.6 Open Network The Open Network button activates Amiras le dialog and lets you load a network stored in a le. Network les show up in the dialog as being of format Amira Script. A Remove all objects will be done before the new network is loaded so that effectively the new network replaces the old network in the Pool. Currently only les with extension .hx can be opened. 3.1.1.7 Save Network This button allows you to save the complete network of icons and connections shown in the Pool. If the network has not been previously saved, you will need to specify the name of an Amira network script in the le dialog. When executed, the network script restores all data objects and modules as well as the current object
Interface Components
107
transformations and the camera settings. The feature is useful for resuming work at a point where it was left in a previous Amira run. Note that usually all data objects must have been stored in a le in order to be able to save the network. If this is not the case, a dialog is popped up listing all the data objects that still need to be saved. In the dialog you can specify that all required data objects should be saved automatically in a separate subdirectory. Instead of the option Amira script you can also choose Amira script and data les (pack & go) from the le dialogs format menu. In this case all data objects currently loaded will be saved in a separate directory. More options affecting the export of network scripts can be adjusted in the Preferences dialog.
3.1.1.8 Save Network As This button works like the Save Network button except that in this case you will always need to specify the name of an Amira network script in the le dialog.
3.1.1.9 Recent Files This button can be used to load recently used les. When choosing this menu entry a submenu appears listing the ve most recent les. If multiple 2D images have been loaded this is indicated with the name of the rst le followed by three periods (...).
3.1.1.10 Recent Networks This button can be used to load recently used network scripts. When choosing this menu entry a submenu appears listing the ve most recent network scripts.
3.1.1.11 Jobs This button brings up Amiras job dialog which is used to control the execution of batch jobs running in the background. For example, tetrahedral grids can be generated in a batch job (see module TetraGen). However, for most users the batch queue will be of minor interest.
108
3.1.1.12 Quit This button terminates Amira. The current network conguration will be lost unless you explicitly save it using Save Network.
3.1.2.1 Cut In the Console, this command cuts selected text and copies it to the clipboard. In the Pool, this command removes the selected objects.
3.1.2.2 Copy In the Console, this command copies the selected text to the clipboard. In the Pool, this command has no effect.
3.1.2.3 Paste In the Console, this command pastes the text in the clipboard to the current text insertion point. In the Pool, this command has no effect.
3.1.2.4 Delete In the Console, this command deletes the selected text. In the Pool, this command deletes the selected objects.
3.1.2.5 Select All In the Pool, this command select all objects.
Interface Components
109
3.1.2.6 Database The Database button activates an extended version of the Parameter Editor, allowing you to manipulate Amiras global parameter database. Among others, the parameter database contains a set of predened materials (to be used for image segmentation and surface reconstruction) and of predened boundary ids (to be used for surface editing and FEM pre-processing). For example, for each material and for each boundary id a default color can be dened in the database. Modication, insertion, and removal of parameters is performed in the same way as in the ordinary parameter editor. In addition, the extended parameter dialog provides a menu bar allowing you to load, import, save, or search the global parameter database. Amiras default database is stored in the le share/materials/database.hm located in the directory where Amira was installed. Use the Database menu option Set default le to specify that a different database le be used instead. This change is permanent, i.e., it takes effect also if Amira is restarted. To switch back to the system default, use the Database menu option Use system default le.
3.1.2.7 Preferences This option opens the Amira preferences dialog described in Section 3.1.13. The dialog controls how network scripts are exported. It also lets you choose if warning dialogs should be popped up if you try to delete data objects which have not yet been saved to le, or if you try to exit Amira without having saved the current network before. Possibly most interesting, it allows you to congure the layout of your Amira window.
110
3.1.3.1 Hide The Hide button hides all currently selected objects. The objects icons are removed from the Pool but the objects themselves are retained. You get the same effect by pressing the Ctrl-H key. Hidden objects can be made visible again using Show or Show All.
3.1.3.2 Remove The Remove button deletes all selected objects and removes the corresponding icons from the Pool. You can get the same effect by pressing Ctrl-X. If you want to reuse a data object later on, be sure to save it in a le before deleting it. If a data object has been modied but has not yet been saved to a le, it is marked by a little asterisk in the object icon. In the Perferences dialog you can choose whether a warning dialog should be printed if you try to delete unsaved data objects which cannot be recomputed by an up-stream compute module. If you delete a data object, all connected modules will be deleted as well. However, if you delete a module connected data objects (e.g., the results of a compute module) will be retained.
3.1.3.3 Duplicate The Duplicate button creates copies of all selected data objects. For each copy a new data icon is put in the Pool. The name of a duplicated data object differs from the original one by one or more appended digits. The duplicate option is not available if you have selected icons that do not represent data objects (e.g., display or compute modules).
3.1.3.4 Rename This button allows you to change the name of a selected object in a small dialog box which is popped up when the button is pressed. If no object is selected or if multiple objects are selected the button is disabled. Note that no two objects in Amira can have the same name. Therefore, the name entered in the dialog may be modied by appending digits to it, if necessary.
Interface Components
111
3.1.3.5 Show The Show button allows you to make hidden objects visible, so that their icons are displayed in the Pool. Among the hidden objects there are usually some colormaps which are loaded at start-up. This option will be unavailable if there are no hidden objects. 3.1.3.6 Show All The Show All button makes all currently hidden objects visible, so that their icons are displayed in the Pool. This option will be unavailable if there are no hidden objects. 3.1.3.7 Remove All The Remove All button deletes all currently visible icons and the associated objects from the Pool. A pre-loaded colormap that is currently visible is also deleted, but all hidden objects are retained. If you select the option check if data objects need to be saved in the Preferences dialog, a warning dialog is popped up if there are data objects which have not yet been saved to a le. 3.1.3.8 Duplicate mode This mode is applicable when multiple modules of the same type will be attached to a single data object. If the toggle is on, the port values of the rst module will be used to initialize the port values of subsequently attached modules. This can be convenient if you want the modules to have the same initial port values. Example: Attach an Orthoslice to your data object and set the Mapping type to Colormap and the colormap range to 0-3. If you attach another Orthoslice to the same data object, its Mapping type will be Colormap and its colormap range will be 0-3. 3.1.3.9 Auto adjust range of colormaps If this toggle is on, requests that Amira automatically adjust the range of a colormap to correspond to the data range of the data set it is connected to. Note that this feature only applies to the seismic modules: seismic slices Inline, Crossline, TimeSlice, etc., CroppedVolume, and SeismicSurfaceView.
112
Interface Components
113
addition, the dialog allows you to adjust the two colors used by these styles. In order to change the background color via the command interface, use the viewer commands viewer <n> setBackgroundColor and viewer <n> setBackgroundColor2. The command interface also allows you to place an arbitrary raster image into the viewer background (see Section 5.3.3.1, viewer commands). 3.1.6.3 Transparency The Transparency button controls the way of calculating pixel values with respect to object transparencies during the rendering process. Screen Door: Transparent surfaces are approximated using a stipple pattern. Add: Additive alpha blending. Add Delayed: Additive alpha blending with two rendering passes. Opaque objects come rst and transparent objects come second. Add Sorted: Like Add Delayed, but transparent objects are sorted by distances of bounding box centers from the camera and are rendered in backto-front order. Blend: Multiplicative alpha blending. Blend Delayed: Multiplicative alpha blending with two rendering passes. Opaque objects come rst and transparent objects come second. Blend Sorted: Like Blend Delayed, but transparent objects are sorted by distances of bounding box centers from the camera and are rendered in backto-front order. Sorted Layers: Uses a fragment-level depth sorting technique, which. gives better results for complex transparent objects. Multi-Texture, Texture Environment Combine, Depth texture, and Shadow OpenGL extensions must be supported by your graphics board. If the graphics board does not support these extensions, behaves as if Blend Sorted was set. 3.1.6.4 Lights The Lights menu lets you activate different light settings for the 3D viewer. By default, the viewer uses a single headlight, i.e., a directional light pointing in almost the same direction as the camera is looking. The headlight can be switched
114
on or off in each viewer via the viewers popup menu. Alternatively, the headlight can be switched on or off for all viewers using the headlight toggle in this Lights menu. This standard light settings can be restored using the Standard button. More light settings can be dened by creating an appropriate le in $AMIRA ROOT/share/lights. By default, Amira provides one additional light setting including colored lights (BlueRed). At any time, additional lights can be created via the Create light option. Except for the viewers default headlight, all lights are represented by little blue icons in the Pool, just like ordinary data objects or modules. In order to make all hidden light icons visible, use the Show all icons option. Hide all icons hides the icons of all light objects. For more information about lights, please refer to the Reference Section of this manual.
3.1.6.5 Fog The Fog button introduces a fog effect into the displayed scene and controls how opacity increases with distance from the camera. The fog effect will only be seen on a uniform background. More ne tuning is provided by the fogRange Viewer command. None: No fog effect (default). Haze: Linear increase in opacity with distance. Fog: Exponential increase in opacity with distance. Smoke: Exponential squared increase in opacity with distance.
3.1.6.6 Axis The Axis button creates an Axis module named GlobalAxis which immediately displays a coordinate frame in the viewer window. This button is a toggle, so clicking on it again deletes the GlobalAxis module and removes the coordinate frame from the viewer window. The axes will be centered at the origin of the world coordinate system. You may also create local axes by selecting the appropriate entry from a data objects popup menu.
Interface Components
115
3.1.6.7 Measuring The Measuring button creates an instance of a Measuring module that lets you measure distances and angles on objects within the viewer. 3.1.6.8 Easy Fade The Easy Fade toggle lets you switch on a fading effect which is applied to all kinds of scene movements. Before a new image is rendered only a certain fraction of the background will be cleared. In this way older images remain visible until they fade out after a while. Note that this mode requires single buffer rendering, and therefore, ickering may be visible in some cases. 3.1.6.9 Frame Counter The Frame Counter toggle lets you switch on a frames-per-second counter that will be displayed in the rst viewer (viewer 0). 3.1.6.10 Console The Console toggle lets you switch on or off display of the Console window.
You may access the documentation of any such object via a separate index page accessible from the home page of the online help browser. Amira modules also
116
provide a question mark button in the Properties Area. Pressing this button directly pops up the help browser for the particular module. By default, the help browser is displayed in the lower left portion of your Amira window, in the same pane as the console. A tab button allows you to switch between the two. To request that the help browser be displayed in its own top-level window, use the Layout tab of the Edit/Preferences menu. Going through the online documents is similar to text handling within any other hypertext browser. In fact, the documentation is stored in HTML format and can be read with a standard web browser as well. Some specially marked (colored and underlined) text items allow you to jump quickly to related or referenced topics, where blue items point to unread sections, and red items to already viewed sections. Use the Backward and Forward buttons to scroll in the document history and Home to move to the rst page. Searching the online documentation The online help browser provides a very simple interface for a full text search. First, press the Question Mark button (or CTRL-F) to display the Search dialog. Then enter the desired text into the text eld. Press the Next button in order to perform the search. For example, suppose you are looking for information about the surface editor. Here are the results of various search strings you might enter: Search string: surface editor Result: all occurrences of surface or editor Search string: surface +editor Result: all occurrences (pages) containing the word surface and the word editor Search string: surface editor Result: all occurrences of the string (case insensitive) of surface editor Radio buttons allow you to search the current page or throughout all documentation. In current page mode, each time you press the Next button, the next occurrence of the search string is highlighted. When the help browser is shown in a top-level window, its user interface is slightly different. The Search dialog is still accessible via the Question Mark button or by pressing CTRL-F but you can also enter the search string into a specic text eld which is used for local searchs (ie in the current page). Use the Backward and
Interface Components
117
118
Forward buttons to scroll in the document history and Home to move to the rst page. Running demo scripts In the demo section of the on-line manual you can easily start any demonstration just by clicking on the marked text. The script will be loaded and executed immediately. You may interrupt running demo scripts by using the stop button in the lower right of the Amira main window.
Commands
help Makes the help dialog appear and loads the home page of the online help. help getFontName Returns the name of the font of the browser. help setFontName Sets the font of the browser. help getFontSize Returns the size of the font of the browser. help setFontSize Sets the size of the font of the browser. In order to permanently change the font size, put this command in the .Amira le in your home directory or in an Amira.init le in the current working directory. For details see Section 4.4. help load file.html Load the specied hypertext document in the le browser. Note that only a subset of HTML is supported. help reload Reload the current document.
Interface Components
119
The Pool contains icons representing data objects and modules currently in use as well as lines connecting icons indicating dependencies between objects and modules. Like the Pool, the Explorer contains icons representing data objects and modules currently in use. However this information is displayed in a tree view. The user can choose to use either display type by selecting the icons in the Subapplication Toolbar In graph view mode, the Pool is displayed. In tree view mode, the Explorer is displayed. Note: Other than when attention is being specically called to highlight the differences between the Pool (Pool View) and the Explorer (Tree View), Pool will be used throughout the Amira documentation to refer generically to the upper pane of the main Amira window containing the collection of objects and modules that dene the visualization network. The Properties Area is the place where the user interface of selected objects is displayed. Typically, the interface consists of buttons and sliders arranged in Ports. They can be thought of as ports because the user can pass information to a module through them. The Pool and the Properties Area are described below. By default, the Main Window, the Viewer window, the Console window, and the Help browser are all panes of a single large Amira window. However, it is possible to designate that any of these last three components be displayed in its own toplevel window using the Layout tab of the Edit/Preferences menu. 3.1.8.1 Pool (Graph View) Concepts The Pool is displayed if graph view is selected. This selection is made using the the Layout tab of the Edit/Preferences menu. Once a data object has been loaded or a module has been created, it will be represented by an icon in the Pool. Some objects, especially initially loaded colormaps, may not be visible here. Such hidden objects are listed in the Pool/Show Object menu of the Main Window. Selecting an object from this menu causes the corresponding icon to be made visible in the Pool. Icon colors are used indicate different types of objects. Data objects are shown in green and are the only objects which can be saved to disk using File/Save. Computational modules are shown in red, visualization modules are yellow, and visualization modules of slicing type are orange. Such modules may be used to clip the graphical output of any other module.
120
Connections between data objects and processing modules, shown as blue lines, represent the ow of data. For display modules, these connections show the data used to generate the display. You may connect or disconnect objects by picking and dragging a blue line between object icons. As you might expect, not all types of processing modules are applicable to all kinds of data objects. If you click on a data object icon with the right mouse button, a menu pops up that shows all types of modules that can be connected to that object. (Alternatively, you can click on the small white triangle on the right side of the icon with the left, right, or middle button.) Selecting one of the modules will automatically create an instance of that module type and connect it to the data object. A new icon and a connecting line will appear in response. This way you can set up a more or less complex network that represents the computational steps required to carry out a specic visualization task and is used to trigger them. Note that modules used will appear as shortcut (or macro) buttons in the upper part of the window. If you look closer at an objects icon you will notice two small squares on its left, one white and one orange. If you click on the white square with the left (or right, or middle) mouse button, a menu pops up that shows all connection ports of that object. If the white square has a - or a + inside, you can click it with the left (or right, or middle) mouse button to hide (collapse) or unhide the objects connected to that object. The collapse feature is helpful if there are too many objects in the Pool to view easily at once. The hidden objects will be visible in the Pool/Show Object menu. The orange square controls the objects visibility in the viewers. It shows the current viewer layout (1 viewer, 2 viewers, etc.). Click inside the region of the square corresponding to a specic viewer to toggle the visibility of the object in that viewer. The region turns gray when the module is set to invisible. If you are using more than 4 viewers, each additional viewer will have its own orange square on the objects icon. You can also control an objects visibility by clicking on its visibility toggle in the Properties Area. As mentioned above, for most objects the required connections are automatically established on creation. However, in order to set up optional connections you must use the connection popup menu. For example, you may attach an optional scalar eld to an Isosurface modules Coloreld port in order to color the surface using the values in the Coloreld.
Interface Components
121
Figure 3.2: The Pool contains data objects and module icons.
Once you have selected an entry from the connection popup menu of the object icon, you can choose a new input object for that port. In order to do so, click on the input objects icon in the Pool. The blue connection line will become lighter blue if the connection port can be connected to the chosen object. Reasons for not being able to connect an input to a port can include the following: incompatible data type (use Casteld to change), incompatible dimensionality of the input (use ChannelWorks to change), incompatible grid type of the data (for example, use Arithmetic to sample on a regular grid), or simply that the connection does not make sense, for example, connecting a display module for surfaces to a CT data set. In order to disconnect an input object click on the icon of the module the port belongs to. Data objects possess a special connection port called Master. This port refers to a computational module or editor the data object is attached to. It indicates that the computational module or editor controls the data object, i.e., that it may modify its contents. Each object has an associated control panel containing buttons and sliders for setting or changing additional parameters of the object. The control panel becomes visible once the object has been selected, i.e. by clicking on its icon with the left mouse button. In order to select multiple objects, you can shift-click the corresponding icons or select them by using the rectangular selection tool (press and hold down the left mouse button over the Pool background, then sweep out a rectangle). Clicking on the icon of a selected object deselects it again. Clicking some-
122
where on the background of the Pool causes all selected objects to be deselected. One or more selected icons may be dragged around in the Pool by clicking on them and moving the mouse pointer while holding down the mouse button. Interface At the right of the Pool banner are the PoolSelect (arrow) and PoolPan (hand) buttons. In PoolSelect mode, the mouse is used for selecting, positioning, connecting, and disconnecting objects in the Pool. In PoolPan mode, moving the mouse pans the Pool workspace. Press the Control key to switch temporarily from one mode to the other. At the top of the Pool is a region containing shortcut (or macro) buttons. The Open Data button is a shortcut to the File/Open Data menu item. Up to 4 additional buttons are automatically displayed depending on the currently selected object(s). They provide easy access to the modules that are most commonly used and/or that have been recently used with the currently selected object. The trashcan at the bottom right of the Pool provides a convenient shortcut for removing an object. Drag the object to the trashcan. When the cursor turns into an X, release the mouse button and the object will be removed from the Pool. If you remove a data object, all modules downstream from that module will be deleted as well. Alternatively, you can use the Remove object item from the Pool menu, or you can use the Delete key or Ctrl-x to remove a selected object.
3.1.8.2 Explorer (Tree View) The Explorer is displayed if Tree View is selected in the Sub-application Toolbar. Once a data object has been loaded or a module has been created, it will be represented by a new entry in the tree view. Each object has an associated control panel containing buttons and sliders for setting or changing additional parameters of the object. The control panel becomes visible in the Properties Area once the object has been selected, i.e., by clicking on its icon with the left mouse button. In order to select multiple objects, you can shift-click the corresponding icons. Clicking on the icon of a selected object deselects it again. Clicking somewhere off of the tree view, e.g., beyond the bottom of the tree view, causes all selected objects to be deselected. At the top of the Explorer is a region containing shortcut (or macro) buttons. The
Interface Components
123
Figure 3.3: The Explorer contains data objects and module icons in a tree view.
Open Data button is a shortcut to the File/Open Data menu item. Up to 4 additional buttons are automatically displayed depending on the currently selected object(s). They provide easy access to the modules that are most commonly used and/or that have been recently used with the currently selected object. The tree view display has 5 columns: Column 1: Contains the actual tree view. Organization: The tree is organized into folders containing different kinds of objects: Data, Display, Compute, etc. Most of the folders are predened and cannot be modied. A few, however, such as the Data folder, can have more folders added beneath. Currently, there are two templates that control the organization of the tree view: a default template for most Amira users, and a geoscience template that includes predened folders for 3D surveys, horizons, faults, etc. The user can choose the desired template using the Layout tab of the Edit/Preferences menu.
Connections: If you click on a data object icon with the right mouse button, a menu pops up that shows all types of modules that can be connected to that
124
object. Selecting one of the modules will automatically create an instance of that module type and connect it to the data object. A new item in the tree view will appear in response. In this way you can set up a more or less complex network that represents the computational steps required to carry out a specic visualization task and is used to trigger them. Note that modules used will appear as shortcut (also known as macro) buttons in the upper part of the window. For most objects the required connections are automatically established on creation. The connection is shown in the connected objects input port in its control panel in the Properties Area. For example, when you attach a TimeSlice to my data.lda, in the Data port of the TimeSlice control panel, you will see my data.lda in the pulldown list. If other objects in the Explorer can be connected to the TimeSlice, they will be in the list as well. To switch the connection, simply select a different item from the list. The tree view (and possibly the viewer display) will be updated accordingly. Selecting NO SOURCE from the list disconnects the module from any object. Reasons for not being able to connect an input to a port can include the following: incompatible data type (use Casteld to change), incompatible dimensionality of the input (use ChannelWorks to change), incompatible grid type of the data (for example, use Arithmetic to sample on a regular grid), or simply that the connection does not make sense, for example, connecting a display module for surfaces to a volume data set. Data objects possess a special connection port called Master. This port refers to a computational module or editor the data object is attached to. It indicates that the computational module or editor controls the data object, i.e., that it may modify its contents.
Expand/Collapse: You can click on the + and - icons to expand or collapse respectively a portion of the tree.
Drag-and-Drop: You can use drag-and-drop to move items in the tree view. For example, to connect an existing visualization module to a different data set, you can drag and drop it from its current location onto a compatible data set. Drag-and-drop does not work for disconnecting objects. You must use the connection ports for this.
Interface Components
125
Viewer Toggle: The check boxes control the visibility of the object in the currently active viewer. If there are multiple viewers, e.g., a 4-viewer layout, you can select a viewer to be active, set the objects visibility in that viewer, then repeat as often as necessary to set the desired visibility in each viewer. However, it will probably be more convenient to control the visibility in individual viewers by using the viewer toggle button in the objects control panel in the Properties Area. The viewer toggle button is the orange square just to the right of the module name in its control panel. The button is divided into regions corresponding to the current viewer layout. Click on the region to toggle visibility of the object on/off in the corresponding viewer. If there are more than 4 viewers, each additional viewer will have it own toggle button.
Adding a Folder: At the right of the Explorer banner is the TVNewFolder button used for adding a new folder directly below the currently selected folder. You can also add a folder by right clicking on an existing folder and selecting New Folder from the context menu. At some positions in the tree, it may not be possible to add a new folder.
Removing an Object: To remove one or more objects from the Explorer, rst select the object(s) to be removed. You can then use the Remove object item from the Explorer context menu, or you can press the Delete key or Ctrl-x to remove a selected object. If you remove a data object, all modules downstream from that module will be deleted as well.
Hovering: Hovering the mouse over an item in the tree view displays information about item, usually its type, e.g., HxUniformScalarField3. Column 2: Shows, for certain objects, the current value of a port of interest. Currently, the slice number is shown for slice modules (OrthoSlice, Inline, etc.) and the Time Scale Factor is shown for the SeismicSettings module.
126
Column 3: Shows the current colormap, if any, associated with the module or object. You can right click on it to bring the standard colormap context menu. Or you can left click on it to bring up the Colormap Editor.
Column 4: Displays the icon of the editor, if any, currently operating on the object. For example, the Crop Editor, the Parameter Editor, etc.
Column 5: Displays a colored-coded marker indicating the kind of object or module, as follows: Red computational modules Orange visualization modules of slicing type. These modules may be used to clip the graphical output of any other module. Yellow visualization modules Green data objects. These are the only objects which can be saved to disk using File/Save. Blue script objects Purple settings modules, e.g., SeismicSettings, LDAExpertSettings, etc.
3.1.8.3 Properties Area Once an object has been selected, its input controls will be displayed in the Properties Area below the Pool. Each object has a specic set of controllable parameters or options. These are described in detail for each module in the index section of the reference manual. Computational modules and visualization modules also provide a question mark
Interface Components
127
Figure 3.4: The Properties Area contains the input controls for objects in the Pool. This is the control panel for the Arithmetic module.
button which lets you access the documentation of that module directly. The Apply button is active (green) for modules that require you to explicitly initiate their action. Typically this is the case for modules whose action may take a signicant amount of time, such as some of the compute modules. When the Stop button is red, you can press it to interrupt the action. Check on the auto-refresh check box to automatically force an apply for any change in the network. At the top of an objects control panel its name is displayed and a number of additional control buttons are provided. All objects have one or more orange viewer buttons for each 3D viewer. These buttons control whether any graphical output of an object is displayed in a particular viewer or not. For example, if you have two viewers and two isosurface modules you may want to display one isosurface in each viewer. Display modules of slicing type (orange ones) provide a clip button. Clicking this button will cause the graphical output of any other module to be clipped by that slice. Clipping does not affect modules with hidden geometry or modules that are created after the clip button has been pressed. Data objects provide a number of additional editor buttons. Editors are used in order to modify the contents of a data object interactively. For example, you can
128
Figure 3.5: Some visualization module can show in the Shadow button in the Properties Area.
perform manual segmentation of 3D image data by editing label elds using the image segmentation editor. Some editors display their controls in the Properties Area like all other objects, while others use a separate dialog window that allows you to perform object manipulations. As already mentioned, specic input controls of an object or a module are organized in Ports. Each port has a pin button on its left. If a port is pinned it will still be visible even when the object is deselected. The ports are composed of various widgets that reect an operational meaning, e.g., a value is entered by a slider, a state is set by radio buttons, a binary choice is presented as a toggle button. The control elements have a uniform layout and are divided into several basic types. A description of the basic port types is contained in the component index section of the Users Reference Manual. Ports whose labels are displayed in italic are special: they are input connection ports. They are used for connecting data objects and modules into a network that represents the computational steps required to carry out a specic visualization task. Each connection port contains the list of objects to which it can be possibly connected, plus a NO SOURCE item, which means not to connect to anything. In graph view mode, display of these connection ports can be toggled on and off via the Layout tab of the Edit/Preferences menu. They are displayed by default to help beginners understanding the Pool architecture. In tree view mode, these connection ports are always displayed because this is the only mechanism in this mode for dening networks. When an object is completely disconnected from all others, it will be moved in the tree to an appropriate folder. For example, to Display for a display module, to Compute for a compute module, and so on. If the shadowing effect is switched on in the Rendering tab of the Edit/Preferences menu, some visualization module shows the Shadow button. Clicking the button will switch across the following modes:
Interface Components
129
Cast Shadow the object will cast shadows Receive Shadow the object will only receive shadows Cast & Receive Shadow the object will cast and receive shadows No Shadow no shadows will be visualized
130
ing on the arrow button in the upper left corner. If the viewer is in interaction mode, the mouse cursor will be an arrow instead of a hand symbol. You can use the [ESC] key in order to quickly switch between interaction mode and viewing mode. If the viewer is in interaction mode, use the [Alt] key to temporarily switch to viewing mode. More than one viewer can be active at a time. Standard screen layouts with one, two, or four viewers can be selected via the View menu. Additional viewers can be created using the Tcl command viewer <n> show, where <n> is an integer number between 0 and 15. While viewers 0 to 3 will be placed in a common panel window, viewers 4 to 15 will create their own top-level window. For more specic control, the viewer provides an extensive command set, which is documented in Section 5.3.3.1. The toolbar of the main viewer window provides several buttons and controls, allowing you for example to switch between viewing mode and interaction mode, to choose certain orientations, or to take snapshots. The precise meaning of these controls is described below. Interact: Switches the viewer into interaction mode. You can also use the [ESC] key to toggle between viewing mode and interaction mode. Trackball: Switches the viewer into viewing mode. You can also use the [ESC] key to toggle between interaction mode and viewing mode. The left mouse button is used to change the view direction by means of a virtual trackball. Translate: Same as Trackball except that the left mouse button is used for panning (translation). Zoom:
Interface Components
131
Same as Trackball except that in this mode vertical motion of the left mouse button controls zooming. Rotate: Rotates the camera around the current view direction. By default, a clockwise rotation of one degree is performed. If the Shift-key is pressed while clicking, a 90 degree rotation is done. If the Ctrl-key is pressed, the rotation will be counterclockwise. Seek: Pressing the seek button and then clicking on an arbitrary object in the scene causes the object to be moved into the center of the viewer window. Moreover, the camera will be oriented parallel to the normal direction at the selected point. Seeking mode may also be activated by pressing the [S] key in the viewer window. Home: Resets camera to the home position. Set Home: Sets the current position as the new home position. Perspective/Ortho: Toggles between a perspective and an orthographic camera. By default, a perspective camera is used. You may want to use an orthographic camera in order to measure distances or to exactly align objects in 3D space. Note: Only one of
132
these buttons will be visible at a time, the button indicating the currently active camera type. View All: or Repositions the camera so that all objects become visible. The orientation of the camera will not be changed. Note: The rst button is seen if technical naming or the geoscience template has been selected in the Edit/Preferences/Layout dialog, the second button will be displayed if medical naming has been selected. YZ-, XY- and XZ-Views: or Adjusts the camera according to the specied viewing direction. The viewing direction is parallel to the coordinate axis perpendicular to the specied coordinate plane. Medical doctors are used to viewing series of tomographic images parallel to the XY-plane with the y-axis pointing downwards. This convention is followed by the XY-button. The opposite view direction is used if the Shift key is pressed. Note1: The rst set of buttons is seen if technical naming has been selected in the Edit/Preferences/Layout dialog, the second set of buttons will be displayed if medical naming has been selected. They correspond to axial, coronal, and sagittal views respectively. Note2: These buttons are replaced by the geographic view orientation buttons if the geoscience template has been selected in the Edit/Preferences/Layout dialog. Geographic View Orientation: Adjusts the camera according to the specied viewing direction: from top, from bottom, from west, from east, from south, from north. Note: These buttons replace the XYZ view buttons if the seismic mode has been selected in the Edit/Preferences/Layout dialog. Stereo: Allows you to enable or disable stereo viewing, as well as specify various stereo viewing parameters via the Stereo Preferences dialog.
Interface Components
133
Measuring:
Pressing this button creates an instance of a Measuring module that lets you measure distances and angles on objects within the viewer. Clicking on the down arrow will display a menu of measuring tools to chose from: 2D line, 3D line, 2D angle, 3D angle, and annotation. See the Measuring modules documentation for details. Note: Only one of these buttons will be visible on the toolbar at a time, the button of the measuring tool most recently accessed from the viewer toolbar. Snapshot: Takes a snapshot of the current rendering area and saves it in a le. The lename as well as the desired output format must be entered through the Snapshot dialog. Snapshots may also be taken using the viewer command snapshot. Layout: Selects the viewer layout: a single view, two viewers side-by-side, two viewers stacked, or four viewers. Fullscreen: Selects fullscreen mode. In this mode, the viewer occupies the entire screen and no other windows will be visible. To exit fullscreen mode, click the right mouse button and uncheck Fullscreen in the popup menu. In addition to these buttons, the Amira viewers provide an extensive set of Tcl commands, which are listed in Section 5.3.3.1.
134
Interface Components
135
Figure 3.6: Amiras viewer window provides a virtual trackball for easy navigation, as well as a camera trackball (lower right) for constrained rotation.
Figure 3.7: Amiras console window displays info messages and lets you enter Tcl commands.
136
the Load, Save Data As, and Save Network items of the main windows File menu. The dialog provides two modes of information, a detail mode and a multi-column mode. In the detail mode, which is active by default, some le data are shown next to each lename, namely the le size, the les last modication time, and the le format. You may sort the le list according to each of these properties by clicking on the particular columns header bar. Subdirectories will always be displayed rst. In multi-column mode only the le name is displayed. You may switch between both modes using the tool buttons in the upper right part of the dialog window. Most le formats supported by Amira will be recognized automatically, either by analyzing the le header or by looking at the le name sufx. A list of all supported le formats is contained in the reference section of this manual. You may manually set the format of a le by means of the dialogs popup menu (see below). 3.1.11.1 Changing Directories You can change the current directory by double-clicking a subdirectory in the le list or by entering a new directory in the dialogs path list. By default, the path
Interface Components
137
list contains the current directory, the directory containing the demo data sets provided with Amira, as well as all directories dened by the environment variable AMIRA DATADIR. In AMIRA DATADIR multiple directory names have to be separated by colons [:] on Unix systems or by semicolons [;] on Windows systems. In addition, on Windows system the names of the twelve most recently visited directories are stored in the path list.
3.1.11.2 Selecting Files To select a single le just click on it or type in its name in the le name text eld. In some cases you might want to select more than one le at once, e.g., when loading a 3D image data set as a series of single 2D images. You can do this by selecting the rst le rst and then shift-selecting the last le. Then all intermediate les will be selected as well. Moreover, you may ctrl-click a le in order to toggle its selection state individually.
3.1.11.3 Using the Filename Filter The lename lter is visible when the dialog is in import mode (Load File). It is useful to restrict the list of lenames to a subset matched by the lter expression. The lter expression may contain the wildcard characters ? (matches any character) and * (matches an arbitrary character sequence). For example, the expression *.img matches all lenames with the sufx .img.
3.1.11.4 The File Dialogs Popup Menu The le dialog provides a popup menu which may be activated by pressing the right mouse button over the le list. Among others, this menu lets you rename or delete les or directories, provided you have the permission to do that. Note that you may only delete empty directories. Using the Format option of the popup menu you may manually set the format to be used when loading a le into Amira. This option is useful if for some reason the wrong format has been detected automatically, or if no format at all could be detected. Note however, that any format specication set manually will be overwritten when the directory is reread the next time.
138
Figure 3.9: The job dialog lets you start, stop, examine, and delete batch jobs.
The job directory For each job a temporary directory is created containing any required input data, scripts, state information, and log les. On Unix systems this directory is created at the location specied by the environment variable TMPDIR. If no such variable exists, /tmp is used. On Windows systems the default temporary directory is used. Typically this will be C:/TEMP.
Interface Components
139
Controlling the job queue A jobs state may be manipulated using the action buttons shown above the job list. In order to start the job queue select the rst job waiting for execution and then press the Start button. Note that only one job can be executed at a time. In order to kill a running job, select it in the job list and press the Kill button. You may delete a job from the job queue using the Delete button. When deleting a job the temporary job directory will be removed as well. Information about a job Once you have selected a job in the job queue, more detailed information about it will be displayed in the lower part of the dialog window, notably the state of the job, the temporary job directory, the submit time, the time when the job has been started, the run time, and the name of the command to be executed. Any console output of a running job will be redirected to a log le located in the temporary job directory. Once such a log le exists and has non-zero size you may inspect it by pushing the View output button.
Commands
job submit cmd info [tmpdir] Submits a new job to the job queue. command species the command to be executed. info species the info string displayed in the job dialog. tmpdir species the temporary job directory. If this argument is omitted a temporary job directory is created by Amira itself. In any case, the directory will be automatically deleted when the job is removed from the job queue. Example: job submit "clock.exe" "Test job" job run Starts the rst job in job queue pending for execution. When a job is nished, execution of the next job in the queue starts automatically, thus all jobs in the queue will be executed consecutively by job run.
140
saving the network. The second tab, Layout, affects the layout of the user interface. The third, On Exit, controls what conditions are checked for in the networks when Amira exits. The Molecules tab allows you to specify options for handling molecular data. The LDA tab allows you to specify options for out-of-core data. For advanced users, additional options can be set using the LDAExpertSettings module. The Segmentation tab allows you to specify options for the Segmentation Editor. See the Segmentation Editor documentation for details.
3.1.13.1 The General Tab 2-pass ring algorithm If set, a slightly more complex ring algorithm is used which ensures that downstream modules connected to an up-stream object via multiple paths are only red once if the up-stream object changes. The default is on. Auto-select new modules If set, a new module selected from the popup menu of its parent object is shown automatically in the Properties Area. The default is on. Deselect previously selected modules This option can only be set if auto-selection is turned on. If set, all objects are deselected before selecting the new module. Otherwise the new module will be appended at the end of the Properties Area. The default is on. Draw viewer toggles on icons If set, small viewer mask toggles are drawn on the icons of data objects and display modules. This allows you to show or hide a module in a viewer without selecting it rst. The default is on. Draw compute indicator If set, a small red rectangle is drawn inside the icon of a module to indicate that the module is currently working. The default is on. Include unused data objects If set, all data objects including hidden colormaps are stored in network scripts. When executing such a script all existing objects are removed rst. If not set only visible data objects and objects which are referenced by others are stored in a network script. When executing the script hidden data objects are not removed. The default is on.
Interface Components
141
Include window sizes and positions If set, window sizes and positions are stored in network scripts. Be careful using this option if you want to send your script to a machine with a different screen resolution. Overwrite existing les in auto-save If set, no overwrite check is performed for data objects which need to be saved automatically in order to create a network script. Otherwise a unique le name will be chosen. The default is on. Details about the auto-save feature are described in Section 3.1.1.7. 3.1.13.2 The Layout Tab Naming convention These toggles allow you chose between two naming conventions: medical and technical. Your choice will affect the labels of some ports, for example, Orientation ports, as well as the appearance of the viewer buttons controlling the view orientation. Windows These items allow you to congure the layout of the Amira windows. By default, the main Amira interface components (Pool, Properties Area, main Viewer window, Console, and Help Browser) share one large window. You can use the check boxes to display some of these components in separate top-level windows. This gives you additional exibility in managing the real-estate of your graphics display. For example, on a dual-head display it can be interesting to display the main Viewer window on one display and the rest of the Amira interface on the other. Show viewer window in top-level window The main Viewer window will be displayed in a top-level window. Show console in top-level window The console will be displayed in a top-level window. Show help browser in top-level window The help browser will be displayed in a top-level window. Show DoIt buttons Some modules have a button, usually labeled DoIt, to initiate the action of the module. Since Amira 4.0, by default, this button is not displayed in the Properties Area. Rather, the green Apply button at the bottom of the Properties Area is used
142
to initiate the action. If this box is checked, the button will be displayed in the Properties Area. The green Apply button will still be available for use as well. Finally, you have the choice to Save current layout (now), and Restore current layout (now). Viewer gadgets There are two viewer gadgets, a camera trackball and a compass. The camera trackball, used for constrained rotation of the camera about the screenaligned X, Y, or Z axes, is described in Section 3.1.9. The 3D compass indicates the direction from which the camera is viewing the scene. See Section 3.1.9 for more details on the compass. Click on the tab of the gadget whose attributes you wish to control, then set its attributes as described below. Show the camera trackball Show the compass This toggle controls the visibility of the trackball (compass). The default is on. Auto-hide the camera trackball Auto-hide the compass When this box is checked, the trackball (compass) is only displayed while the mouse is within the trackball (compass) display area. It is hidden as soon as the mouse moves outside the trackball (compass) display area. The default is off. This item is not active if the Show the trackball (or compass) item is off. Camera trackball position Compass position This menu allows you to specify which corner of the viewer window to display the trackball (compass) in. The default is Lower right for the trackball, and Upper right for the compass. This item is not active if the Show the trackball (or compass) item is off. Pool You can choose between a graph view and a tree view display of the contents of the Pool. Tree view is the default if you have an Amira SEG-Y le reader license, otherwise Graph view is the default. The graph view is described in Section 3.1.8.1, the tree view in Section 3.1.8.2. If Tree view is selected, you can select a template that controls the basic organiza-
Interface Components
143
tion of the tree, i.e., what top-level folders are present. Default uses generic folder names (Data, Display, Compute,...), whereas the seismic template uses names that are specic to geosciences (Wells, Horizons, Faults,...). If Graph view is selected, you can choose to Show connection ports in the Properties Area. If you check this box on, an objects/modules connection ports are shown at the top of its control panel in the Properties Area. By default this is off because the connections (shown as blue lines) between data objects and modules can be conveniently managed directly in the Pool. Changes to the connections made in the Pool are reected in the connection ports in the Properties Area, and vice versa. If Tree view is selected, this box is always checked on because in tree view, using the connection ports in the Properties Area is the only convenient way to manage the connections between data objects and modules.
3.1.13.3 The On Exit Tab The page allows you to control what conditions are checked for in the networks when Amira exits.
3.1.13.4 The Molecules Tab Color Schemes These check boxes allow you to chose alternate color schemes: CPK for atoms, and RasMol for amino acids. Selection Info These items control how much information is printed into the console when parts of a molecule are selected. Activate Molecule name if the name of the molecule should be printed. Activate Group name if the name of the selected group should be printed. If you activate Group attributes, all attributes of the selected group are printed. If Explicit attributes is activated, the printed attributes are restricted to those explicitly named in the corresponding text eld. Atom Expressions ID case sensitive Species if atom identiers are case sensitive or note.
144
3.1.13.5 The LDA Tab Out-of-core threshold Species the size above which data sets will be treated as out-of-core data. Main memory amount Sets the maximum allowed main memory in MB (megabytes) for all the out-ofcore data sets. Video memory amount Sets the maximum allowed texture memory in MB (megabytes) for all the out-ofcore data sets. Viewpoint renement If set, renement depends on the viewpoint. View culling If set, renement takes place only in the view frustum. Move low resolution If set, ortho slices and oblique slices are computed in half resolution when moving. Loading policy Sets loading behavior. If No Interaction is selected, the asynchronous loading thread will only load when the user does not interact with the scene. If Always is selected, loading occurs as long as there is something to load. If Never is selected, no loading occurs. The default is No Interaction.
3.1.13.6 The Segmentation Tab Material If set, materials are shown in the 3D viewer. This toggle applies when material draw style 3D view is enabled in the Segmentation Editor. Otherwise, it has no effect. Slice position If set, the slice position is displayed in the 3D viewer. Show 3D If set, the selection is shown in the 3D viewer. Draw style This option lets you choose the material draw style used in the 3D viewer.
Interface Components
145
Figure 3.10: The snapshot dialog allows you to save or print the contents of a viewer window.
3.1.13.7 The Rendering Tab Shadowing If set, shadows will be generated. You can select also the default behaviour, the intensity and the quality of the shadows. If this option is switched on, some visualization module shows the Shadow button, through which you can directly specify the object behaviour. Surface Rendering The two options can be used to optimize the rendering performance of surface objects according to your system requirements.
146
into n x m tiles where n and m can be entered into the adjacent text elds. Then the camera position is set such that each tile lls the current viewer and a snapshot is taken. Finally the tiles are internally merged to a single image and sent to the device specied in the Output port. Filename: Lets you specify the lename if the to le option is set. The Browse button allows you to browse to a desired location within the lesystem. Format: The format option lets you select the le format to be produced for le output. The following formats are supported: TIFF (.tif,.tiff), SGI-RGB (.rgb,.sgi,.bw), JPEG (.jpg,.jpeg), PPM (.pgm,.ppm), BMP (.bmp), PNG (.png), DCM (.dcm), and Encapsulated PostScript (.eps). In addition, this port offers three radio buttons to choose between grayscale, rgb, and rgb alpha type of raster images. If rgb alpha option is set, images are produced such that the viewer background is assigned to the alpha channel. This option is not available for le formats that do not support an alpha channel.
3.1.15.1 The CPU Tab This page displays information about the system on which you are running Amira. This information can be useful when reporting problems to technical support.
Interface Components
147
3.1.15.2 The OpenGL Tab This page displays information about the current OpenGL graphics driver. In particular, a list of available OpenGL extensions is printed. This list allows it to check if certain rendering techniques like direct volume rendering via 3D textures are supported on a particular hardware platform or not. 3.1.15.3 The Libraries Tab This page displays a list of all DLLs or shared libraries contained in the Amira lib directory. For each library certain version information as well as an MD5 checksum are printed. In this way it is possible to check whether a certain patch has already been installed or not. For most libraries the version information is compiled in. For other libraries this information is read from the version information les found in share/versions in the AMIRA ROOT directory.
148
can be connected to many different data objects, e.g., the Bounding Box module, others cannot, e.g., the OrthoSlice module. The latter can only be connected to voxel data or to scalar distributions on voxel grids. The reason is that internally both are represented as a scalar eld with uniform Cartesian coordinates. Consequently, the same visualization methods can be applied to both. On the other hand, for example a volumetric tetrahedral grid model of the object of interest usually looks completely different. But since it is also a 3D data object, the same Bounding Box module can be connected to it. In summary, there are Amira data objects that might be conceived of different type, but with respect to mathematical structure, applicability of viewing and other processing modules, as well as programming interface design have many common properties. Obeying principles of object-oriented design, the data types of Amira are organized in class hierarchies where common properties are attributed to higher up classes and inherited to derived classes, as sub-classes of a class are commonly referred to. Conceptually each object occuring in Amira is an instance of a class and each of its predecessors in the hierarchy that the class belongs to. The classes and their hierarchies are dened within Amira. As the user you normally deal with instances of classes only. For instance, there is a class called HxObject with sub-classes HxData and HxModule. HxData comprises the types of data associated with data objects used for modeling the objects of interest, e.g., volumetric tetrahedral grids or surfaces. HxModule comprises data types that have been assigned to display and other processing modules, again in accordance with principles of object-oriented design. This is why Amiras data objects and processing modules are commonly referred to as objects. There are also classes in Amira that are not derived from HxObject and constitute other data types, and there are several independent class hierarchies. e.g., there is a class called HxPort from which all classes supporting the operation and display of interface control elements are derived (see section Properties Area and the List of Ports in the index section of the users guide). A single class hierarchy is usually gured as an upside-down tree, i.e. with the root at the top. Thus the data class tree is the one to which the information as to which processing module is applicable to which data object is hooked. Its classes reect the mathematical structure of the object models supported by Amira. For example, scalar elds and vector elds are such structures and derived from a common eld class which represents a mapping R3 Rn . Deriving a subclass from this base class requires a value to be specied for n.
General Concepts
149
At the same time elds dened on Cartesian grids are distinguished from elds dened on tetrahedral grids, i.e., this distinction is part of the classication scheme that gives rise to branches in the data class subtree. In the next section of this chapter you will learn more about the data class hierarchy. In the second section we discuss how some data types frequently used for various visualization tasks t into it. Internally, all class names begin with a prex Hx. However, you dont have to remember these names unless you want to use the command shell to create objects. For example, a bounding box is usually created by choosing the BoundingBox item from the pop-up menu of a data object that is to be visualized, but you may also create it by typing create HxBoundingBox in the command window.
150
The class HxRegScalarField3 represents a eld which is dened on a regular Cartesian grid. Such a grid is organized as a three-dimensional array of nodes. In the most simple case these nodes are axis-aligned and have equal spacings. The coordinates of such a uniform grid can be obtained from a simple bounding box containing the origin vector and increments for all directions. Stacked coordinates are another example. Here the spacing in z-direction between subsequent slices may be different. In any case scalar values inside a hexahedral grid cell are obtained from the eight vertex values using trilinear interpolation. While the OrthoSlice module can only be used to visualize scalar elds with uniform or stacked coordinates, other modules like ObliqueSlice or Isosurface work for all scalar elds with regular coordinates. Yet another example of a scalar eld is the class HxAnnaScalarField3. It represents an analytically dened scalar eld. To create such a eld, select ScalarField from the Create menu of Amiras main window. You have to specify a mathematical expression which is used to evaluate the eld at each requested position. Up to three other elds can be connected to the object. These can be combined to a new scalar eld, even if they are dened on different grids.
3.2.2.2 Vector Fields As for scalar elds Amira provides a number of vector eld classes, these are derived from the base classes HxVectorField3 and HxComplexVectorField3. While ordinary vector elds return a three-component vector at each position, complex vector elds return a six-component vector. Complex vector elds are used for encoding stationary electromagnetic wave pattern as required by some applications. Usually complex vector elds are visualized by projecting them into the space of reals using different phase offsets. The Vectors module even allows you to animate the phase offset. In this way a nice impression of the oscillating wave pattern is obtained.
General Concepts
151
3.2.3.1 Regular Grids A regular grid consists of a three-dimensional array of nodes. Each node may be addressed by an index triple (i,j,k). Regular grids are further distinguished according to the kind of coordinates being used. The most simple case comprises uniform coordinates, where all cells are assumed to be rectangular and axis-aligned. Moreover, the grid spacing is constant along each axis. A grid with stacked coordinates may be imagined as a stack of uniform 2D slices. However, the distance between neighboring slices in z-direction may vary. In case of rectilinear coordinates the cells are still aligned to the axes, but the grid spacing may vary from cell to cell. Finally, in case of curvilinear coordinates each node of the grid may have arbitrary coordinates. Grids with curvilinear coordinates are often used in uid dynamics because they have a simple structure but still allow for accurate modeling of complex shapes like rotor blades or airfoils.
3.2.3.2 Tetrahedral Grids The TetraGrid class represents a volumetric grid composed of many tetrahedrons. Such grids can generally be used to perform nite-element simulations, e.g., Eeld simulations. A considerable amount of information is maintained in a TetraGrid. For each vertex a 3D coordinate vector is stored. For each tetrahedron the indices of its four vertices are stored as well as a number indicating the segment the tetrahedron belongs to as obtained by a segmentation procedure. Beside this fundamental information a number of additional variables are stored in order for the grid being displayed quickly. In particular all triangles or faces are stored separately together with six face indices for each tetrahedron. In addition for each face pointers to the two tetrahedrons it belongs to are stored. This way the neighborhood information can be obtained efciently. When simulating E-elds using the nite-element method, the edges of a grid need to be stored explicitly, because vector or Whitney elements are used. These elements and its corresponding coefcients are dened on a per-edge basis. When a grid is selected information on the number of its vertices, edges, faces, and tetrahedrons is displayed.
152
3.2.6 Transformations
Data objects in Amira can be modied using an arbitrary afne transformation. For example, this makes it possible to align two different data objects so that they roughly match each other. Internally, afne transformations are represented by a 4x4 transformation matrix. In particular, a uniform scalar eld remains a uniform scalar eld, even if it is rotated or sheared. Display modules like OrthoSlice still can exploit the simple structure of the uniform eld. The possible transformation is automatically applied to any geometry shown in the 3D viewer. In order to interactively manipulate the transformation matrix use the Transform Editor (documentation is contained in the index section of the users guide). Be careful when saving transformed data sets! Most le formats do not allow to
General Concepts
153
store afne transformations. In this case you have to apply the current transformation to the data. This can be done using the Tcl-command applyTransform. In case of vertex set objects the transformation is applied to all vertices. Old coordinates are replaced by new ones, and the transformation matrix is reset to identity afterwards. After a transformation has been applied to a data set, it cannot be unset easily anymore. If a transformation is applied to uniform elds, e.g., to 3D image data, the coordinate structure is not changed, i.e., the eld remains a uniform one. Instead, the data values are resampled, i.e., the transformed eld is evaluated at every vertex of the nal regular grid. The bounding box of the resulting grid is modied so that it completely encloses the transformed original box.
3.2.7 Parameters
For any data object an arbitrary number of additional parameters or attributes may be dened. Parameters can be interactively added, deleted, or edited using the parameter editor. Parameters are useful for example to store certain parameters of a simulation or of an experiment. In this way the history of a data object can be followed. There are certain parameters which are interpreted by several Amira modules. The meaning of these parameters is summarized in the following list: Colormap name This species the name of the default colormap used to visualize the data. Some modules automatically search the Pool for this colormap and for example use it for pseudocoloring. DataWindow minVal maxVal This indicates the preferred data range used for visualizing the data. The OrthoSlice module automatically maps values below minVal to black and values above maxVal to white. LoadCmd cmd This parameter is usually set by import lters when a data object is read. It is used when saving the current network into a le and it allows to restore the object automatically. Internal use only. Note that there are many le formats which do not allow to store parameters.
154
Therefore, information might get lost when you save the data set in such a format. If in doubt, use the Amira specic AmiraMesh format.
Technically, the sub-applications shall be registered dynamically in Amira .rc les like standard modules. The DLL providing a sub-application are loaded at runtime when the sub-application is opened.
General Concepts
155
156
Chapter 4
Technical Information
This chapter contains technical information about Amira which is not covered in the previous chapters.
Data Import Command Line Options Environment Variables Amira start-up script System Requirements Amira License Manager
the format name. Often, 3D image volumes are stored slice by slice using standard 2D image formats such as TIFF or JPEG. In case of medical images, slices are commonly stored in ACR-NEMA or DICOM format. If you select multiple 2D slices simultaneously in the le browser, all slices will automatically be combined into a single 3D data set. Simultaneous selection is most easily achieved by rst clicking the rst slice and then shift-clicking the last one. If your data is not already present in a standard le format supported by Amira you will have to write your own converter or export lter. For many data objects such as 3D images, regular elds, or tetrahedral grids Amiras native AmiraMesh format is most appropriate. Using this format you can even represent point sets or line segments for which there is hardly any other standard format. The AmiraMesh documentation explains the le syntax in detail and contains examples of how to encode different data objects. One important Amira data type, triangular nonmanifold surfaces, cannot be represented in a AmiraMesh le but has its own le format called HxSurface format. Alternatively, with Developer Pack a C++ programmer can extend Amira in order to integrate a custom reader or writer. Finally, in case of images or regular elds with uniform coordinates you may also read binary raw data. Note that for raw data the dimensions and the bounding box of the data volume must be entered manually in a dialog box which pops up after you have selected the le in the le browser.
158
The syntax of Amira is as follows: Amira [options] [files ...] Data les specied in the command line will be loaded automatically. In addition to data les, script les can also be specied. These scripts will be executed when the program starts. The following options are supported: -help Prints a short summary of command line options. -version Prints the version string of Amira. -no stencils Tells Amira not to ask for a stencil buffer in its 3D graphics windows. This option can be set to exploit hardware acceleration on some low-end PC graphics boards. -no overlays Tells Amira not to use overlay planes in its 3D graphics windows. Use this option if you experience problems when redirecting Amira on a remote display. -no gui Starts up Amira without opening any windows. This option is useful for executing a script in batch mode. -logfile filename Causes any messages printed in the console window also to be written into the specied log le. Useful especially in conjunction with the -no gui option. -depth size number This option is only supported on Linux systems. It species the preferred depth of the depth buffer. The default on Linux systems is 16 bits. -style={windows | motif | cde} This option sets the display style of Amiras Qt user interface. -debug This options applies to the developer version only. It causes local packages to be executed in debug version. By default, optimized code will be used. -cmd command [-host hostname] [-port port]
159
Send Tcl command to a running Amira application. Optionally the host name and the port number can be specied. You must type app -listen in the console window of Amira before commands can be received. -clusterdaemon Start as VR daemon, on a cluster slave node (VR Pack). This may be replaced by a service. See Section 8.0.9.
160
AMIRA NO LICENSE MESSAGE By default, Amira issues warning messages to the console when your Amira license is about to expire. This allows you to take timely action so that your use of Amira is not interrupted unexpectedly when the license expires. To disable these messages, set this variable to 1. AMIRA NO OVERLAYS If this variable is set, Amira will not use overlay planes in its 3D graphics windows. The same effect can be obtained by means of the -no overlays command line option. Turn off overlays if you experience problems with redirecting Amira on a remote display, or if your X server does not support overlay visuals. AMIRA NO SPLASH SCREEN If this variable is set, Amira will not display a splash screen while it is initializing. AMIRA LOCAL Species the location of the local Amira directory containing user-dened modules. IO routines or modules dened in this directory replace the ones dened in the main Amira directory. This environment variable overwrites the local Amira directory set in the development wizard (see Amira programmers guide for details). AMIRA SMALLFONT Unix systems only. If this variable is set a small font will be used in all ports being displayed in the Properties Area even if the screen resolution is 1280x1024 or bigger. By default, the small font will be used only in case of smaller resolutions. AMIRA XSHM Unix systems only. Set this variable to 0 if you want to suppress the use of the X shared memory extension in Amiras image segmentation editor. AMIRA SPACEMOUSE This variable has to be set in order to support a spaceball or spacemouse device (see www.spacemouse.com). With the spacemouse you can navigate in the 3D viewer window. Two modes are supported, a rotate mode and a y mode. You can switch between the two modes by pressing the spacemouse buttons 1 or 2. AMIRA STEREO ON DEFAULT If this variable is set the 3D viewer will be opened in OpenGL raw stereo
Environment Variables
161
mode by default. In this way some screen icker can be avoided which otherwise occurs when switching from mono to stereo mode. Currently the variable is supported on Unix systems only. TMPDIR This variables species in which directory temporary data should be stored. If not set, such data will be created under /tmp. Among others, this variable is interpreted by Amiras job queue.
162
In this example, rst the systems default start-up script is executed. This ensures that all Amira objects are registered properly. Then some special settings are made. Finally, a hot-key procedure is dened for the function key F2. You can dene such a procedure for any other function key as well. In addition, procedures like onKeyShiftF2 or onKeyCtrlF2 can be dened. These procedures are executed when a function key is pressed with the Shift or the Ctrl modier key being pressed down.
System Requirements
163
4.5.1 Troubleshooting
Amira is a very demanding application that extensively uses high-end features. Experience shows that such applications tend to reveal instabilities in system hardware, hardware drivers, and the operating system. A common problem is insufcient main memory. We recommend you congure enough swap memory in addition to physical memory. The total amount of virtual memory should be at least 1 GB. 2 GB would be even better. Especially on PC platforms, OpenGL drivers today are not always as robust as desired. Also, system crashes due to bad memory chips or unstable power-supply are not rare. If you experience problems or instabilities with Amira on your Windows platform, we recommend that you follow these steps: 1. Click on all the demo scripts in the Online Users Guide. If the system crashes, turn off hardware acceleration (choose the extended button from the Windows display settings dialog) and try again. If this eliminates the problem, there is a bug in your OpenGL driver. Try to get a new driver from the web site of the manufacturer of your graphics board. 2. Try using a different color depth in the Windows display settings dialog. Try 24 or 32 bit. 3. Load the lobus.am data set and visualize it with a Voltex module. Turn on the spin rotation (turn it with the mouse in the viewer and release the mouse button while moving the mouse, so that the object continues moving). Let it run overnight (turn off the screen saver). If the system has crashed or frozen the next morning, you probably have a hardware problem. If this does not help, or if a reproducible error occurs on different computers, then it might be a bug in the Amira software itself. Please report such bugs so that they can be eliminated in the next release or a patch can be prepared.
164
texturing and programmable shaders, available on recent graphics boards. Note: On Windows Vista, you may want to disable Windows Aero for saving hardware resources and achieving best 3D performance with Amira. In Control Panel, open Appearance and Personalization, then click Personalization. You can alternatively right-click an empty spot on your desktop and click Personalize in pop-up. Click Window Color and Appearance, and then click Open Classic Appearance Properties for More Color Options. Now you can select a Color scheme different from Windows Aero, such as the Windows classic theme. In order to add custom extensions to Amira with Developer Pack you will need Visual Studio 2005.
4.5.3 Linux
The Linux version of Amira as been developed and tested on Red Hat Enterprise Linux 4.0 and 5.0. On other Linux distributions this version might not run because certain required system libraries are missing or because different versions of these libraries are installed. In particular you may need to install libg2c.so included in compat-g77 package (you may copy it as libg2c.so.0 in Amira installation directory under lib/arch-Linux...-Optimize/). Amira is also available for Linux IA64 or AMD64 systems. Graphics Hardware: Amira works with the current 3D graphics drivers from nVidia and ATI under XFree86 4/Xorg. It has also been successfully tested with other X-servers like the 3D Accelerated-X servers from XI graphics. Notes: After a standard installation of Linux, hardware acceleration is not necessarily activated, although X-Windows and Amira may work ne. To enable OpenGL hardware acceleration specic drivers may have to be installed, like the nVidia drivers from http://www.nvidia.com. This can dramatically increase rendering performance. Sometimes it is necessary to disable the stencil buffers (by starting Amira with the option -no stencils) to get acceleration. On some distribution, you may see incorrect display of some parts of the
System Requirements
165
user interface, such as the segmentation editor. This is a known Qt issue. You can workaround this by disabling the composite option in the extension section of your XFree86.conf or Xorg.conf conguration le: Section "Extensions" Option "Composite" EndSection
"disable"
In order to add custom extensions to Amira with Developer Pack you will need gcc 3.4.x on RHEL 4, or gcc 4.1.x on RHEL 5.
4.5.4 Mac OS
The Mac version of Amira has been developed and tested on Mac OS X Tiger (10.4). On other later Mac releases this version might not run because certain required system libraries may be different. Graphics Hardware: Amira works with the current Mac 3D graphics drivers from nVidia and ATI.
About Password Protection About the Amira License Manager Troubleshooting Using TGS LICENSE DEBUG Contacting the License Administrator Contacting Technical Support
166
license. Generally, your software is also computer ID locked. Computer ID locking is a form of software license control that allows the software to run only on specically licensed systems. If your license is for a specic system, your password string will include a computer ID. If your site has purchased Amira oating licenses for use with FLEXNet, you will nd information in a specic section about Conguring FLEXNet Licensing, including instructions for installing the Client License Files. This documentation may be found in <install directory>/share/license/FLEXNet
The Amira License Manager has an editable text eld displaying the contents of the active license le. The path of the active license le is given in the box above. You may enter new license keys by directly typing into the text eld or by pasting the contents of the clipboard. Alternatively, you may import licenses by clicking the Import license le ... button and pointing the le browser to the le containing the license keys, or use Drag & Drop onto the text eld to load the license le. The contents of the le will be appended to the active license le. License keys that are invalid are printed in red, valid licenses are printed green. To run the application there has to be a valid license for the product Amira . Thus, the le may contain valid (i.e. green) license keys for product options (Packs) other than Amira , and still Amira will not start. Once Amira nds a valid Amira license it will start. If you want to update the license key or enter additional license keys for options (Packs) you will need to select Help License Manager from the Amira menu bar and apply one of the methods described above to update the license.
167
4.6.4 Troubleshooting
Having trouble entering your Amira license? License is not valid? When you try to run Amira, the License Manager dialog is displayed again? Here are steps for remedying the situation. 1. If you are using an evaluation or demo license,
make sure that expiration date is in the future. Action: Ask your Amira reseller for an extension of the trial period or purchase a license.
168
make sure that the computer ID of your license key matches the computer ID shown in the computer ID eld of the License Manager. Action: If the computer IDs do not match, you will need to request a new license from the License Administrator (see below). Please supply the host ID from the License Manager dialog as well as your existing license key for reference.
3. If the above suggestions do not resolve the license problem, it will be necessary to debug the problem using environment variable TGS LICENSE DEBUG. See below for instructions.
169
9. Run Amira from the Start menu. When the License Manager dialog comes up, dismiss it.
10. Then look for a le named debug.txt in the top level of the Amira installation directory. Send that le to tech support for analysis. Windows - Command Prompt 1. On Windows 2000 and Windows XP you can get to a command prompt via the Windows Start menu as follows: Start > Programs > Accessories > Command Prompt
170
3. Change the current directory to where your Amira executable is. For example, cd /Program Files/Amira5/bin/arch-Win32VC8-Optimize
6. Look for the le debug.txt in the current directory. Send that le to tech support for analysis.
4.6.5.2 On Linux/UNIX 1. On Linux/UNIX systems, the exact command to use for setting environment variables depends on the kind of shell you are using. Here are examples for a few commonly used shells. Bash shell: export TGS LICENSE DEBUG=debug.txt C shell: setenv TGS LICENSE DEBUG debug.txt
2. In the window in which you set the environment variable, cd to the directory containing the Amira executable. For example, cd /opt/Amira5
171
5. Look for the le debug.txt in the current directory. Send that le to tech support for analysis. NOTE: If you dont see the debug.txt le there, possibly you do not have privilege to write into the Amira installation directory. In this case, set TGS LICENSE DEBUG to a path where you can write. For example, /home/your login name/debug.txt
172
though you think you have enough physical memory installed, then the information provided on this page might be useful for you. The Problem: Any 32-bit operating system such as Windows (NT4.0, 2000, XP) or Linux can manage at most 4 gigabytes (GB) of memory. Windows divides this addressable space into 2 GB reserved for usage by the system only and 2 GB for any user application. Therefore, a single application can use at maximum 2 GB of memory. Note that this is independent of the actual physical memory, i.e., it does not matter whether the system has 1, 2, 3 or 4 GB of memory installed. Within the 2 GB reserved for the user, the software itself (executable and all of its DLLs) and all of the data has to t. This makes clear that it is impossible for a Windows program to load 2 GB of data at a time. To overcome this, Microsoft has provided a boot option for Windows that alters partitioning of address space so that 3 GB are reserved for the user and 1 GB for the system. Unfortunately, however, this boot option is not compliant with most Windows XP installations at level SP1. A description of the problem is given here. Microsoft has xed the problem with its current Service Pack 2. How to activate the /3GB switch: It should be noted that we cannot guarantee that the following changes to be made in your system will not affect the execution of other programs although we have not found any incompatibilities so far. We also wish to stress that we assume no responsibility for any loss of data as a consequence of those changes. We therefore strongly recommend that you back up your system before making these changes. All you need to do is to edit the le C:/boot.ini. To do so, make sure that you are logged on your machine with administrative privileges. Then select from Start->Settings->Control Panel->System->Advanced->(Startup and Recovery) Settings and click the Edit button. Duplicate the line under [operating systems]. Change the name between the quotes and add the /3GB switch right after the /fastdetect switch. The new entry might look then similar to this:
[operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP \ Professional" /fastdetect multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP \ Professional 3GB" /fastdetect /3GB
Note that for the usage of the /3GB boot option the application must be aware of
173
the altered memory assignment. For Amira 5 there is already native support for the /3GB boot option. If you are using an older version of Amira, we strongly recommend updating to 5. Now, as you boot up your computer, a screen is displayed that gives you the choice between two boot options. Use the arrow keys to select the entry with the 3GB in the line and press return. Amira should now be able to address 3 GB of memory instead of the default 2 GB. You can appreciate this by comparing the result of app maxmalloc in the Amira console window with and without the 3 GB option. On a typical installation with 1 GB of memory installed and without the /3GB switch, the command app maxmalloc may result in something like this: Allocated Allocated Allocated Allocated Allocated Allocated chunk of 942 MB. chunk of 225 MB. chunk of 129 MB. chunk of 121 MB. chunk of 72 MB. a total of 1723 MB in 25 chunks
With the /3GB switch on the same installation, the command results in the following: Allocated Allocated Allocated Allocated Allocated chunk of 1023 MB. chunk of 919 MB. chunk of 225 MB. chunk of 111 MB. a total of 2278 MB in 4 chunks
What you can see is that the total amount of allocatable memory has not changed dramatically. However, with the /3GB switch, the second largest chunk of memory is nearly as large as the rst one.
174
Chapter 5
Scripting
5.1 Introduction
This chapter is intended for advanced Amira users only. If you do not know what scripting is, it is very likely that you will not need the features described in this chapter. Beside the interactive control via the graphical user interface, most of the Amira functionality can also be accessed using specic commands. This allows you to automate certain processes and to create scripts for managing routine tasks or for presenting demos. Amiras scripting commands are based on Tcl, the Tool Command Language. This means you can write command scripts using Tcl with Amira-specic extensions. Amira commands can be typed into the Amira console window, as described in Section 3.1.10. Commands typed directly into the console window will be executed immediately. Alternatively, commands can be written into a text le, which can then be executed as a whole. This chapter is organized as follows: Section 5.2 (Introduction to Tcl) gives a short introduction to the Tcl scripting language. This section is not very Amira specic. Section 5.3 (Amira Script Interface) explains Amira-specic commands and con-
cepts related to scripting. This includes a reference of global commands. Section 5.4 (Amira Script Files) explains the different ways of writing and executing script les including references to script objects, resource les, and functionkey bound Tcl procedures. Section 5.5 (Conguring Popup Menus) describes how the popup menu of an object can be congured using script commands, and how new entries causing a script to be executed can be created. Section 5.6 (Registering pick callbacks) describes how script callbacks can be attached to objects or viewers and be invoked on user pick events.
Data Type: Script Object describes how to use Tcl scripts for dening custom modules that have their own graphical user interface and can be used like the builtin Amira objects.
176
Chapter 5: Scripting
A Tcl command is a space-separated list of words. The rst word represents the command name, all further words are treated as arguments to that command. As an example, try the Amira-specic command echo, which will print all its arguments to the Amira console. Try typing echo Hello World This will output the string Hello World. Note that Tcl commands can be separated by a semi-colon (;) or a newline character. If you want to execute two successive echo commands, you can do it this way: echo Hello World ; echo Hello World2 or like this: echo Hello World echo Hello World2 Instead of a command, you can also place a comment in Tcl code. A comment starts with a hash character (#) and is ended by the next line break: # this is a comment echo Hello World
Introduction to Tcl
177
Note that in Tcl internally all variables are of string type. Since the set command requires exactly one argument as the variable value, you have to quote values that contain spaces: set Output "Hello World" or set Output {Hello World} In order to substitute the value of a variable with name varname, a $ sign has to be put in front of that name. The expression $varname will be replaced by the value of the variable. After the above denitions, echo $Output would print Hello World in the console window, and echo "$i.) $Output" would yield the output 1.) Hello World. Note that variable substitution is performed for strings quoted in ", while it is not done for strings enclosed in braces {}. Even newline characters are allowed in a { } enclosed string. Note however that it is not possible to type in multi-line commands into the Amira console.
178
Chapter 5: Scripting
In order to use the result of a command like expr for further commands, an important Tcl mechanism has to be used: command substitution, denoted by brackets []. Any list enclosed in brackets [] will be executed as a separate command rst, and the [...] construct will be replaced with the result of the command. This is similar to the ... construct in Unix command shells. For example, in order to increase the value of the variable i by one you can use: set i [expr $i + 1] Of course, command expressions can be arbitrarily nested. The order of execution is always from the innermost bracket pair to the outermost one: echo [expr 5 * [expr 7 + [expr 3+3]]]
Introduction to Tcl
179
The elseif and else parts are optional. Multiple elseif parts can be used, but only a single if and else part. Another important construct is the conditional loop. Like the if command, it is based on checking a conditional expression. In contrast to if, the conditional code is executed multiple times, as long as the expression evaluates to true: for {set i 1} {$i < 100} {set i [expr $i*2]} { echo $i } In fact this code is identical to: set i 1 while {$i < $100} { echo $i set $i [expr $i * 2] } Both loops would produce the output 1, 2, 4, 8, 16, 32, 64. If you want to execute a loop for all elements of a list, there is another very convenient command for that: foreach x {1 2 4 8 16 32 64} { echo $x } This will generate the same output as the previous example. Note that the expression enclosed in braces is a space-separated list of words.
180
Chapter 5: Scripting
return [expr ($a+$b)/2.0] } proc computeAverageB {a b c} { return [expr ($a+$b+$c)/3.0] } echo "average of 2 and 3: [computeAverageA 2 3]" echo "average of 2,3,4: [computeAverageB 2 3 4]" As you can see in the example, the argument list denes the names for local variables that can be used in the body of the procedure (e.g. $a). The return command is used to dene the result of the procedure. This result is the value that is used in the command bracket substitution []. If you want to dene a procedure with a exible number of arguments, you must use the special argument name args. If the argument list contains just this word, the newly dened command will accept an arbitrary number of arguments, and these arguments are passed as a list called args: proc computeAverage args { set result 0 foreach x $args { set result [expr $result + $x] } return [expr $result / [llength $args]] } In this example, the llength command returns the number of elements contained in the args list. Note that the variable result dened in the procedure has local scope, meaning that it will not be known outside the body of the procedure. Also, the value of globally dened variables is not known within a procedure unless that global variable is declared using the keyword global: set x 3 proc printX {} { global x echo "the value of x is $x" }
Introduction to Tcl
181
There is much more to be said about procedures, e.g., concerning argument passing, evaluation of commands in the context outside of the procedure, and so on. Please refer to a Tcl reference book for these advanced topics.
182
Chapter 5: Scripting
The result of this command will be 1 2 3 4 5 {6 7} 8 9 Please note that Tcl will automatically quote strings that are not single words when constructing a list. Here is an example: set i [list 1 2 3] lappend i "4 5 6" echo $i will yield the output 1 2 3 {4 5 6} You can use the lindex command to access a single element of a list. lindex takes two arguments: the list and the index number of the desired element, starting with 0: set i [list a b c d e] echo [lindex $i 2] will yield the result c.
183
identical to the name of the object as displayed in the Pool. Typically the script interface of a specic object contains many different functions. The general syntax for an Amira object-related command is <object-name> <command-word> <optional-arguments> ... For example, if an object called GlobalAxis exists (choose View/Axis from the Amira menu) then you can use commands like GlobalAxis deselect GlobalAxis select GlobalAxis setIconPosition 100 100 Remember to use the completion and history functions provided by the Amira console, as described in Section 3.1.10 (console window) to save typing. If you have already used Amira you have noticed that the parameters and the behavior of an Amira module are controlled via its ports. The ports provide a user interface to change their values when the module is selected. All ports can also be controlled via the command interface. The general syntax for that is
<object-name> <port-name> <port-command> <optional-arguments> For example for the GlobalAxis you can type GlobalAxis options setValue 1 1 GlobalAxis thickness setValue 1.5 GlobalAxis fire When you type in these commands you will notice that the values in the user interface change immediately. However the modules compute method is not called until explicitly ring the module using the fire command. This allows you to rst set values for multiple ports without a recomputation after each command. However, note that some modules automatically reset some of their ports for example when a new input object is connected. In such cases you may need to call fire after setting the value of every single port.
184
Chapter 5: Scripting
Usually the name of a port is identical to the text label displayed in the graphical user interface, except that white spaces are removed and command names start with a lower case letter. To nd out the names of all ports of a specic module use the command <object-name> allPorts Almost all ports provide a setValue and a getValue command. The number of parameters and the syntax, of course, depend on the ports. Commands of the type <object-name> <port-name> setValue ... make up more than 90% of a typical Amira script. However, besides the port commands, many Amira objects provide additional specic commands. The command interface for a particular module is described in the Users Reference Guide. You can quickly nd the corresponding page by clicking the ? button in the Properties Area when the module has been selected. As a quick help, entering an objects name without further options will display all commands available for that object. Note that this will also show undocumented, unreleased, and experimental commands. In order to get more information about a particular module or port command, you can type it into the console window without any arguments and then press the F1 key. This opens the help browser with a command description. Amira objects are part of a class hierarchy. Similar to the C++ programming interface, also script commands are inherited by derived classes from its base classes. This means that a particular object like the axis object will beside its own specic commands also provide all the commands available in its base classes. Links to the base class commands are given in a modules documentation.
185
SCRIPTDIR: Directory in which currently executed script resides. hideNewModules: If set to 1, icons of newly created modules will initially be hidden.
viewer command options (viewer) main window command options (theMain) console command options (theMsg) common commands for top-level windows progress bar command options (workArea) application command options (app) other global commands
186
Chapter 5: Scripting
5.3.3.1 Viewer command options Commands to a viewer can be entered in the console window. The syntax is viewer [<number>] command, where <number> species the viewer being addressed. The value 0 refers to the main viewer and may be omitted for convenience.
Commands
viewer [<number>] snapshot [-offscreen [<width> <height>]] <filename> This command takes a snapshot of the current scene and saves it under the specic lename. The image format will be automatically determined by the extension of the le name. The list of available formats includes: TIFF (.tif,.tiff), SGI-RGB (.rgb,.sgi,.bw), JPEG (.jpg,.jpeg), PNM (.pgm,.ppm), BMP (.bmp), PNG (.png), and Encapsulated PostScript (.eps). If the viewer number is not given, the snapshot is taken from all viewers, if you have selected the 2 or 4 viewer layout from the View menu. If the -offscreen option is specied, offscreen rendering with a maximum size of 2048x2048 is used. In this case the viewer number is required even if viewer 0 is addressed. If the width and height is not specied explicitly, the size of the image is the current size of the viewer. Caution: If you have more than one transparent object visible in the viewer and you want to use offscreen rendering set the transparency mode to Blend Delayed and check to see if all objects are rendered properly prior to taking a snapshot. viewer [<number>] setPosition <x> <y> (in top-level mode only) Sets the position of the viewer window relative to the upper left corner of the screen. If more than one viewer is shown in the same window the position of the toplevel window is set. viewer [<number>] getPosition Returns the position of the viewer window. If more than one viewer is shown in the same window the position of the toplevel window is returned.
187
viewer [<number>] setSize <width> <height> (in top-level mode only) Sets the size of the viewer window. Width and height speciy the size of the actual graphics area. The window size might be a little bit larger because of the viewer decoration and the window frame. viewer [<number>] getSize Returns the size of the viewer window without decoration and window frame. viewer [<number>] setCamera <camera-string> Restores all camera settings. The camera string should be the output of a getCamera command. viewer [<number>] getCamera This command returns the current camera settings, i.e., position, orientation, focal distance, type, and height angle (for perspective cameras) or height (for orthographic cameras). The values are returned as Amira commands, which can be executed in order to restore the camera settings. The complete command string may also be passed to setCamera at once. viewer [<number>] setCameraPosition <x> <y> <z> Denes the position of the camera in world coordinates. viewer [<number>] setCameraPosition <x> <y> <z> Returns the position of the camera in world coordinates. viewer [<number>] setCameraOrientation <x> <y> <z> <a> Denes the orientation of the camera. By default, the camera looks in negative z-direction with the y-axis pointing upwards. Any other orientation may be specied as a rotation relative to the default direction. The rotation is specied by a rotation axis x y z followed by a rotation angle a (in radians). viewer [<number>] getCameraOrientation Returns the current orientation of the camera in the same format used by setCameraOrientation. viewer [<number>] setCameraFocalDistance <value> Denes the cameras focal distance. The focal distance is used to compute the center around which the scene is rotated in interactive viewing mode. viewer [<number>] getCameraFocalDistance Returns the current focal distance of the camera.
188
Chapter 5: Scripting
viewer [<number>] setCameraHeightAngle <degrees> Sets the height angle of a perspective camera in degrees. Making the angle smaller makes the eld of view smaller, effectively zooming in, as with a telephoto lens. Unless you specically want to change the camera eld of view, it is normally better to move the camera closer to an object (sometimes called dolly in) to make the object appear larger. The command has no effect if the current camera is an orthographic one. viewer [<number>] getCameraHeightAngle Returns the height angle of a perspective camera. viewer [<number>] setCameraHeight <height> Sets the height of the view volume of an orthographic camera. The command has no effect if the camera is an perspective one. viewer [<number>] getCameraHeight Returns the height of an orthographic camera. viewer [<number>] setCameraType <perspective|orthographic> Sets the camera type. viewer [<number>] getCameraType Returns the camera type. viewer [<number>] setTransparencyType <type> This command denes the strategy used for rendering transparent objects. The argument type may be a number between 0 and 6, corresponding to the entries Screen Door, Add, Add Delay, Add Sorted, Blend, Blend Delay, and Blend Sorted as described for the View menu. Most accurate results are obtained using mode 6, which is the default. However, some objects may not be recognized correctly as being transparent. In this case you may switch them off and on again in order to force them to be rendered last. Also, if lines are to be rendered on a transparent background problems may occur. In this case, you may use transparency mode 4 and ensure the correct rendering order manually. viewer [<number>] getTransparencyType This command returns the current transparency type as a number in
189
the range 0...6. The meaning of this number is the same as in setTransparencyType. viewer [<number>] setBackgroundColor <r> <g> <b> This command sets the color of the background to a specic value. The color may be specied either as a triple of integer RGB values in the range 0...255, as a triple of rational RGB values in the range 0.0...1.0, or simply as plain text, e.g., white, where the list of allowed color names is dened in /usr/lib/X11/rgb.txt. viewer [<number>] getBackgroundColor Returns the primary background color as an RGB triple with values between 0 and 1. viewer [<number>] setBackgroundColor2 <r> <g> <b> Sets the secondary background color which is used by non-uniform background modes. viewer [<number>] getBackgroundColor2 Returns the secondary background color as an RGB triple with values between 0 and 1. viewer setBackgroundMode <mode> Allows you to specify different background patterns. If mode is set to 0 a uniform background will be displayed. Mode 1 denotes a gradient background. Mode 2 causes a checkerboard pattern to be displayed. This might help to understand the shape of transparent objects. Finally, mode 3 draws an image previously dened with setBackgroundImage on the background. viewer getBackgroundMode Returns the current background mode. viewer setBackgroundImage <imagefile> [<imagefile2>] [-stereo] This command allows you to place an arbitrary raster image into the center of the viewers background. The image must not be larger than the viewer window itself. Otherwise it will be clipped. The format of the image le will be detected automatically by looking at the le name extension. All formats mention for the snapshot command are supported except of Encapsulated PostScript. If a second image le is specied, this le will be used as the
190
Chapter 5: Scripting
right eye image in case of active stereo rendering. If the options -stereo is specied and only one image le is given, it it assumed that this le contains a left eye view and a right eye view composited side by side. These views then will be separated automatically. viewer getBackgroundImage This command returns the le name of the last background image le dened with setBackgroundImage. If a pair of stereo images was specied, two le names are returned. If the option -stereo was used in setBackgroundImage, this option will be returned too. viewer [<number>] setAutoRedraw <state> If state is 0, the auto redraw mode is switched off. In this case the image displayed in the viewer window will not be updated, unless a redraw command is sent. If state is 1, the auto redraw mode is switched on again. In a script it might be useful to disable the auto redraw mode temporarily. viewer [<number>] isAutoRedraw Returns true is auto redraw mode is on. viewer [<number>] redraw This command forces the current scene to be redrawn. An explicit redraw is only necessary if the auto redraw mode has been disabled. viewer [<number>] rotate <degrees> [x|y|z|m|u|v] Rotates the camera around an axis. The axis to be taken is specied by the second argument. The following choices are available: x: the x-axis (1,0,0) y: the y-axis (0,1,0 z: the z-axis (0,0,1) m: the most vertical axis of x, y, or z u: the viewers up direction v: the view direction
The last option does the same as the rotate button of the user interface. In most cases the m option is most adequate. For backward-compatibility the default is u.
191
viewer [<number>] setDecoration <state> Deprecated. viewer [<number>] saveScene <filename> Saves all of the geometry displayed in a viewer in Open Inventor 3D graphics format. Warning: Since many Amira modules use custom Open Inventor nodes, the scene usually can not be displayed correctly in external programs like ivview. viewer [<number>] viewAll Resets the camera so that the whole scene becomes visible. This method is called automatically for the rst object being displayed in a viewer. viewer [<number>] show This command opens the specied viewer and ensures that the viewer window is displayed on top of all other windows on the screen. viewer [<number>] hide This command closes the specied viewer. viewer [<number>] fogRange <min> <max> Sets a range of attenuation for the fog affect that can be introduced into a viewer scene by the View menu. The default range is [0, 1]. Values within this range correspond to distances of scene points from the camera, such that points nearest to the camera have value zero and those farthest away have value one. Restricting the range of attenuation means that attenuation will start at points where the specied minimum is attained and reach its maximum at points where the specied maximum is attained. Maximum attenuation by fog is equivalent to invisibility, thus all points beyond that maximum will appear as background. viewer [<number>] setVideoFormat pal|ntsc Sets the size of the viewer window according to PAL 601 or NTSC 601 resolution, i.e., 720x576 pixels or 720x486 pixels. The current setting of the decoration is taken into account. viewer [<number>] setVideoFrame <state> If state is 1, a frame is displayed in the overlay plane of the viewer. This frame depicts the area where images recorded to video are safely shown on video players. Setting state to 0 switches the frame off. Note: Objects displayed in the overlay planes are not saved to le with the snapshot command (see above).
192
Chapter 5: Scripting
5.3.3.2 Main window command options The command theMain allows you to access and control the Amira main window. Besides the specic command options listed below also all sub-commands listed in Section 5.3.3.4 (Common commands for top-level windows) can be used.
Commands
theMain snapshot lename Creates and saves a snapshot image of the main window. The format of the image le is determined from the le name extension. Any standard image le format supported by Amira can be used, e.g., .jpg, .tif, .png, or .bmp. theMain setViewerTogglesOnIcons {0|1} Enables or disables the display of the orange viewer toggles on object icons in the Amira Pool. theMain ignoreShow [0|1] Enables or disables the special purpose no show ag. If this ag is set, subsequent mainWindow show commands are ignored. This can be useful to run standard Amira scripts in a VR Pack environment. Calling the command without an argument just returns the current value of the ag. 5.3.3.3 Console command options The command theMsg allows you to access and control the Amira console window. Besides the specic command options listed below also all sub-commands listed in Section 5.3.3.4 (Common commands for top-level windows) can be used.
Commands
theMsg error <message> [<btn0-text>] [<btn1-text>] [<btn2-text>] Pops up an error dialog with the specied message. The dialog can be congured with up to three different buttons. The command blocks until the user presses a button. The id of the pressed button is returned. theMsg warning <message> [<btn0-text>] [<btn1-text>] [<btn2-text>] Pops up a warning dialog with the specied message. The dialog can be
193
congured with up to three different buttons. The command blocks until the user presses a button. The id of the pressed button is returned. theMsg question <message> [<btn0-text>] [<btn1-text>] [<btn2-text>] Pops up a question dialog with the specied message. The dialog can be congured with up to three different buttons. The command blocks until the user presses a button. The id of the pressed button is returned. theMsg overwrite <filename> Pops up a dialog asking the user if it is ok to overwrite the specied le. If the user clicks Ok, 1 is returned, otherwise 0. 5.3.3.4 Common commands for top-level windows These commands are available for all Amira objects which open a separate toplevel window. In particular, these are the Amira main window (theMain), the console window (theMsg), and the viewer window (viewer 0). For example, you can set or get the position of these windows using the corresponding global command followed by setPosition or getPosition.
Commands
getFrameGeometry Returns the position and size of the window including the window frame. In total four numbers are returned. The rst two numbers indicate the position of the upper left corner of the window frame relative to the upper left corner of the desktop. The last two numbers indicate the window size in pixels. getGeometry Returns the position and size of the window without the window frame. In total four numbers are returned. The rst two numbers indicate the position of the upper left corner of the window relative to the upper left corner of the desktop. The last two numbers indicate the window size in pixels. getPosition Returns the position of the upper left corner of the window including the window frame. This is the same as the rst two numbers returned by getFrameGeometry.
194
Chapter 5: Scripting
getRelativeGeometry Returns the position and size of the window including the window frame in relative coordinates. The size of the desktop is (1,1). The position and size of the window is specied by fractional numbers between 0 and 1. getSize Returns the size of the window without the window frame. This is the same as the last two numbers returned by getGeoemtry. hide Hides the window. setCaption <text> Sets the window title displayed in the window frame. setFrameGeometry <x y width height> Sets the position and size of the window including the window frame. Four numbers need to be specied, the x- and y-positions, the window width and the window height. setGeometry <x y width height> Sets the position and size of the window without the window frame. Four numbers need to be specied, the x- and y-positions, the window width and the window height. setPosition <x y> Sets the position of the upper left corner of the window frame. setRelativeGeometry <x y width height> Sets the position and size of the window including the window frame in relative coordinates. The size of the desktop is (1,1). The position and size of the window is specied by fractional numbers between 0 and 1. setSize <width height> Sets the size of the window without the window frame. show Makes the window visible in normal state. Also raises the window. showMinimized Makes the window visible in iconied state.
195
showMaximized Makes the window visible in maximized state. 5.3.3.5 Progress bar command options The command workArea allows you to access the progress bar located in the lower part of the Amira main window. You can print messages or check if the stop button was pressed.
Commands
workArea setProgressInfo <text> Sets an info text to be displayed in the progress bar. The text can be used to describe the status during some computation. workArea setProgressValue <value> Sets the value of the progress bar. The argument must be a oating point number between 0 and 1. For example, a value of 0.8 indicates that 80% of the current task has been done. workArea startWorking [<message>] Activates the stop button. After calling this command the Amira stop button becomes active. In your script you can check if the stop button was hit by calling workArea wasInterrupted. When the stop button is active you cant interact with any other widget unless you call workArea stopWorking in your script. Therefore you must not enter this command directly in the console window, but you should only use it in a script le or in a Tcl procedure. workArea stopWorking Deactivates the stop button. Call this command when the compute task started with workArea startWorking is done or if the user pressed the stop button. This command also restores the progress info text which was shown before calling startWorking. workArea wasInterrupted Checks if the user pressed the stop button. You should only use this command between workArea startWorking and workArea stopWorking. If there are multiple nested compute tasks and the user presses the stop button, all subsequent calls to wasInterrupted return true until the rst level is reached.
196
Chapter 5: Scripting
5.3.3.6 Application command options The app command provides several options not related to a particular object or component in Amira, but related to Amira itself.
Commands
app version Returns the current Amira version. app uname Returns simplied name of operating system. app arch Returns Amira architecture string, e.g., arch-Win32VC8-Optimize, archLinuxAMD64-Optimize... app hostid Returns host id needed to create an Amira license key. app listen [port] Opens a socket to which Tcl commands can be sent. The TCP/IP port can be specied optionally. WARNING: This can create security holes. Do not use this unless behind a rewall and if you know what you are doing. app close Closes the Amira Tcl port. app port Returns port number of Amira Tcl port. Returns -1 if socket has not been opened. app send <command> [<host> [<port>]] Sends a Tcl command to a listening Amira. If no host or port are specied, the Amira instance will send the command to itself. app opengl Retrieve information about the used OpenGL driver including version number and supported extensions. This is useful information to send to the hotline if reporting rendering problems.
197
app cluster Returns the current node status which can be master or slave if some cluster mode is active or simply single if is not the case. 5.3.3.7 Other global commands
Commands
addTimeout msec procedure [arg] Schedules a Tcl procedure for being called after msec milliseconds. If arg is specied, it will be passed to the procedure. The specied procedure will be called only once. If necessary, you can schedule it again in the time-out procedure. Example: addTimeout 10000 echo {10 seconds are over.} all [-selected | -visible | -hidden] [type] Returns a list of all Amira objects currently in the Pool. If type is specied, only objects with that C++ class type (or derived objects) are returned. Search can be limited to selected, visible, or hidden objects, respectively. Example: all -hidden HxColormap. aminfo [-a outle|-b outle] AmiraMesh-File If used with only a le name as argument, this command will open the le which has to be in AmiraMesh format and print header information. If used with the -a or -b option, the outputle specied as argument outle will be written in ASCII (-a) or binary (-b) format, respectively. Thus, aminfo can be used to convert binary AmiraMesh into ASCII and vice versa. clear Clears console window. create class name [instance name] Creates an instance of an Amira object like a module or data object. Returns the instance name. Note that data objects are normally not created this way but by loading them from a le. Example: create HxOrthoSlice MySlice. dso options Controls loading of dynamic libraries. The following options are provided: addPath path ... Adds a path to the list of directories to be searched when loading a dynamic library.
198
Chapter 5: Scripting
verbose {0|1} Switches on and off debug information related to dynamic shared object loading. open <package> Trys to load the specied dynamic library. It is enough to specify the package name, e.g., hxfield. This name will be automatically converted into the platform dependent name, e.g., libhxfield.so on Linux or hxfield.dll on Windows. echo args Prints its arguments to the Amira console. Use this rather than the native Tcl command puts which prints to stdout. help arguments Without arguments this opens the Amira help browser. httpd [port] Start a built-in httpd server. The http server will deliver any document requested. If a requested document ends with .hx, Amira will instead of delivering it execute the le as a Tcl script. This can be used to control Amira from a web browser. WARNING: This command can create security holes. Do not use this unless behind a rewall and if you know what you are doing. limit {datasize | stacksize | coredumpsize} size Change process limits. Available on Unix platforms only. Use unlimited as size for no limit. The size has to be specied in bytes. Alternatively you can use for example 1000k for 1000 kilobytes or 1m for one megabyte. load [fileformat] les Load data from one or more les. Optionally a le format can be specied to override Amiras automatic le format recognition. The le format is specied by the same label which is displayed in the le format combo box in the Amira le dialog. mem Prints out some memory statistics (available on Windows and Irix). quit Immediately quits Amira. remove {objectname -all -selected}
199
objectname removes the specied Amira object. -all remove all objects. -selected remove selected objects. removeTimeout procedure [arg] Unschedules a Tcl procedure previously scheduled with addTimeout. rename objectname newname Changes instance name of an object. Identical to objectname setLabel newname, except that it returns 1 if successful, and nothing if unsuccessful. sleep sec Wait for sec seconds. Amira will not process events in that time. source lename Loads and executes Tcl commands from the specied le. If the script le contains the extension .hx the load command may be used as well. system command Execute an external program. Do not use this unless you know what you are doing.
200
Chapter 5: Scripting
# Amira Script There are some Tcl les that are loaded automatically when Amira starts. At startup, the program looks for a le called .Amira in the current directory or in the home directory (see Section 4.4 (Start-up script) for details). If no such user-dened start-up script is found, the default initialization script Amira.init is loaded from the directory $AMIRA LOCAL/share/resources/Amira or $AMIRA ROOT/share/resources/Amira. This script then reads in all les ending with .rc from the share/resources subdirectory. The .rc les are needed to register modules and data types. Therefore one can customize the startup behavior of Amira by simply adding a new .rc le to that directory or by modifying the Amira.init le. Another way of executing Tcl code is to dene procedures that are associated with function keys. If predened procedures with the names onKeyF2, onKeyF3, ..., onKeyShiftF2, ..., onKeyCtrlF2, ..., onKeyCtrlShiftF2, ... exist, these procedures will be automatically called when the respective key is pressed in the Amira main window, console window, or viewer window. Note that F1 is reserved for help. To dene these procedures, write them into a le and source it or write them into Amira.init or in one of the .rc les. An example is proc onKeyF2 { } { echo "Key F2 was hit" viewer 0 viewAll } Finally, Tcl scripts can also be represented in the GUI and be combined with a user interface. In Amira this is called a script object. There is separate documentation for that.
201
sense to add new entries to an objects popup menu, causing a particular script to be executed. This sections describes how to achieve these goals by modifying Amira resource les or creating new ones. Amira resource les are located in the directory $AMIRA ROOT/share/resources, where $AMIRA ROOT denotes the directory where Amira has been installed. Resource les are just ordinary script les, although they are identied by the sufx .rc. When Amira is started all resource les in the resources directory are read. In a resource le, modules, editors, and IO routines are registered using special Tcl commands. Registering a module means to specify its name as it should appear in the popup menu, the type of objects it can be attached to, the name of the shared library or DLL the module is dened in, and so on. For example, the LabelVoxel module is registered by the following command in the le hxlattice.rc: module -name "LabelVoxel" \ -primary "HxUniformScalarField3 HxStackedScalarField3" \ -check { ![$PRIMARY hasInterface HxLabelLattice3] } \ -category "Labelling Compute" \ -class "HxLabelVoxel" \ -package "hxlattice" The different options of this command have the following meaning: The option -name species the name or label of the module as it will be printed in the popup menu. The option -primary says that this module can be attached to data objects of type HxUniformScalarField3 or HxStackedScalarField3. This means that LabelVoxel will be included in the popup menu of such objects only. With -check an additional Tcl expression is specied which is evaluated at run-time just before the menu is popped up. If the expression fails, the module is removed from the menu. In the case of the LabelVoxel module, it is checked if the input object provides a HxLabelLattice3 interface, i.e., if the input itself is a label eld. Although a label eld can be regarded as a 3D image, it makes no sense to perform a threshold segmentation on it. Therefore LabelVoxel is only provided for raw 3D images, but not for label elds.
202
Chapter 5: Scripting
The option -category says that LabelVoxel should appear in the Compute and Labelling submenus of the main popup menu. If a module should appear not in a submenu but in the popup menu itself, the category Main must be used. The option -class species the internal class name of the module. The internal class name of an object can be retrieved using the command getTypeId. It is this class name which has to be used for the -primary option described above, not the objects label dened by -name. Finally, the option -package species in which package (shared library or DLL) the module is dened in. Besides these standard options, additional Tcl commands to be executed after the module has been created can be specied using the additional option -proc. For example, imagine you are working in a medical project where you have to identify stereotactic markers in CT images of the head. Then it might be a good idea to add a customized version of the LabelVoxel module to the popup menu, which already denes appropriate material names and thresholds. This could be done by adding the following command either in a new resource le in $AMIRA ROOT/share/resources or directly in hxlattice.rc: module -name "Stereotaxy" \ -primary "HxUniformScalarField3 HxStackedScalarField3" \ -check { ![$PRIMARY hasInterface HxLabelLattice3] } \ -category "Labelling" \ -class "HxLabelVoxel" \ -package "hxlattice" \ -proc { $this regions setValue "Exterior Bone Markers"; $this fire; $this boundary01 setValue 150; $this boundary12 setvalue 300 } The variable $this used in the Tcl code above refers to the newly created module, i.e., to the LabelVoxel module. Note that the commands are executed before the module is connected to the source object for which the popup menu was invoked. Some modules do some special initialization when they are connected to a new input object. These initializations may overwrite values set using Tcl commands dened by a custom -proc option. In such a case you can explicitly connect the module to the input object via the command sequence
203
$this data connect $PRIMARY; $this fire; Here the Tcl variable $PRIMARY refers to the input object. The same variable is also used in Tcl expressions dened by a -check option, as described above. Besides creating custom popup menu entries based on existing modules, it is also possible to dene completely new entries which do nothing but execute Tcl commands. For example, we could add a new submenu Edit to the popup menu of every Amira object and put in the Hide, Remove, and Duplicate commands here which are normally contained in the Edit menu of the Amira main window. This can be achieved in the following way: module -name "Remove" \ -primary "HxObject" \ -proc { remove $source } \ -category "Edit" module -name "Hide" \ -primary "HxObject" \ -proc { $source hideIcon } \ -category "Edit" module -name "Duplicate" \ -primary "HxData" \ -proc { $source duplicate } \ -category "Edit" Of course, it is also possible to execute an ordinary Amira script or even an Amira script object with a -proc command.
204
Chapter 5: Scripting
<module> setPickCallback <proc> [ <EventType> ] viewer <n> setPickCallback <proc> [ <EventType> ] Only one callback can be attached to a given module or viewer. In order to detach the callback, just call the register command with no parameter: <module> setPickCallback viewer <n> setPickCallback The optional argument <EventType> refers to the kind of event that will invoke the callback. Other events will be ignored. This argument can take the following values: MouseButtonPress, MouseButtonRelease (any mouse button), VRButtonPress, VRButtonRelease (any 3D button), MouseButton1Press, MouseButton1Release, etc. (a specic mouse button), VRButton0Press, VRButton0Release, etc. (a specic 3D button). The default value is MouseButton1Press. The actual callback procedure <proc> is expected to take one argument, which is to be interpreted as an associative array and which encodes all the picking information. The following elements are dened in the argument array: object, the name of Amira object the picked geometry belongs to, x, the x coordinate of picked point, y, the y coordinate of picked point, z, the z coordinate of picked point, idx, the index of picked element, stateBefore, the modier state just before event occurs, stateAfter, the modier state just after event occurs.
The procedure should return 0 if the picking event was not handled, in which case other callback procedures could be invoked. Here is an example: proc pickCallback arg {
205
array set a $arg echo "$a(object) : picked element $a(idx)" return 1 } Note that any module is free to add specic information to this argument array. All elements can be displayed with: proc pickCallback arg { echo "arg = { $arg }" return 1 } Thus, some Amira modules append additional data: VertexView: idx is the picked point index. ClusterView: idx is the picked point index. LineSetView: idx is the picked line index, pt0 and pt1 the two points of the picked segment. SurfaceView: idx is the picked triangle index. GridVolume: idx is the picked triangle index, tetra0 and tetra1 the adjacent tetrahedra. GridBoundary: idx is the picked triangle index, originalIdx the index in the grid, tetra0 and tetra1 the adjacent tetrahedra.
206
Chapter 5: Scripting
Chapter 6
Demo Framework
Demo Framework adds a generalized framework for creating and steering demonstrations with Amira. Demonstrations are often prepared to present results of ones work to others. Speaking in terms of Amira, this means that scripts and data sets, e.g. .hx les and AmiraMesh les have been compiled and stored for presentation. After a while lots of scripts and their corresponding data les may have been spread over many disks and computers by many people. Now its time to rearrange the demos and make them useable by others. Demo Framework enables you to put your demo collection in order. It incorporates four major parts:
A directory and le structure containing the Amira scripts to execute the demos, their description and their data. The directory structure may include a grouping and can also resemble a project structure of the demos. Several scripts to select demos from the demo collection, utilities to download data from remote servers, helper scripts for demo steering, etc. A GUI for conveniently selecting and changing demo collections.
A nice and easy way to create demos is the DemoMaker, which is included in the base version of Amira. With the DemoMaker you can interactively create an animated sequence of actions of Amira modules.
It may also have these subdirectories: cacheddata/ This optional directory contains tar archives with the data sets for the demos in src/. It is lled when you download the data from a server. output/ This is the default name of the folder where you nd the selected demos if the selection has been done with the command-line tool. selection/ Here you will nd the selected demos if the selection has been done using the Demo GUI.
208
<?xml version="1.0" encoding="ISO-8859-1"?> <description style="project"> <!-- Use style="projectlist" in the very first description.xml file directly in the produc root directory! --> <title> Your Project Title <!-- (Keep this title _short_ and _meaningful_)! Dont start with "Visualization of" since this is the case in all demos. Consider that finding your within a huge list of titles might become difficul </title> <general> Your Short Description. <!-- Please, dont write a long story here - just two o sentences. The text should guide an untrained pres to explain your demo. -->
209
210
</general> <!-- you might want to register a staff tag here --> <staff> <person> <name>Your Name</name> <userid>yourname</userid> <email>yourname@yourdomain</email> <tel>xxx</tel> </person> <!-- This information will give the presenter the chan contact you in case your presence is desired or necessary. --> <!-- register more persons here --> </staff> <!-- Please provide a thumbnail for this demo (e.g., the teaser of your project page) --> <thumbnail src="gfx/eyecatcher.png"/> </description>
Note: Use projectlist as the value to the style attribute for the description .xml le in the directory $AMIRA DEMOS. The nal demo folders contain the Amira scripts, the gfx directory with one .png image for every demo step, and a description .xml le which may look similar to this:
<?xml version="1.0" encoding="ISO-8859-1"?> <description style="demo"> <title> Vector Field in a Bubble Chamber </title> <general> In this demo several visualization methods for vector fields are shown. The data set comes from ...
211
</general> <thumbnail src="gfx/teaser.png" /> <staff> <person status="responsible"> <name>Your Name</name> <userid>yourusername</userid> <email>youremailaddress</email> <tel>xxx</tel> </person> <!-- register more persons here --> </staff> <prepacked href="https://servername/prepackeddemodata"> <file src="bubble\_2006.06.22-1_data.tar.gz"/> </prepacked> <demo> <script file="bubble.hx"/> <steps> <step name="Vectors" playcommand="vectors"> Vector Arrows (For interactivity, pick plane and shift up or down) </step> <step name="LIC" playcommand="lic"> Line Integral Convolution (LIC) (For interactivity pick plane and shift forward or backward) </step> <!-- add more steps here --> </steps> </demo> </description> Note: You can use HTML tags to enhance titles and general descriptions within the description le. The XSL parser is very strict, so always use a /> at the end for single tags like br or p. Also be aware of the quite cumbersome encoding details. If you are writing German with umlauts, be sure that your editor also stores these characters as ISO-8859-1 encoding, also known as Latin1. Otherwise you will get surprising results in your HTML output. Each description le has a <title> and a <general> tag. Inside a <demo>
212
tag there must be a <script> tag and a <steps> tag lled with <step> tags. The <demo> tag can have an additional attribute, stepmode, which can be set to random or static. The latter should only be used for demos, where the sequence of demo steps is strictly required (e.g., later steps rely on data loaded by earlier steps etc.). If no stepmode is specied, random is assumed. The <script> tag has a lename of an Amira-script as an attribute. This script is executed whenever the corresponding demo is started. Use it to dene Tcl procedures for subsequent steps and to load necessary data sets and modules. The <step> tag takes an optional name and a mandatory playcommand attribute. An option is to register a jumpcommand attribute. Please write a short but meaningful description for each step. That way untrained users have a chance of presenting your demo as well. The content of playcommand is executed as a Tcl command to display the corresponding step. The content of jumpcommand is executed as a Tcl command to jump to the beginning of a step and display the rst image. This is useful if one wants to explain something before the step is executed. In demo description les only, the <description> tag may contain an optional <prepacked> tag that species the les to download. .tar les are untarred automatically by downloadData.tcl, and .tar.gz les are gunzipped before. You can register any number of <file> tags inside <prepacked>. The data to be tarred in order to use it as a prepacked le should be stored relative to $AMIRA DEMOS in a directory called $AMIRA DEMOS/data. A <staff> tag lled with <person> tags of which one may have the parameter status=responsible can be registered below <description> also. If you compiled your demo using DemoMaker, you are in good shape. Typing <DemoMakerName> writeDescriptionFile in the Amira console window pops up a le browser. An appropriate description.xml le is written with jumpcommand and playcommand supplied correctly. All you have to do is ll in the descriptions for the demo as a whole and for each step. Also, replace the step names with more descriptive ones. Also a title must be given before the description.xml le will work. A description le that does not follow the conventions mentioned above will be skipped when parsing of the demo le tree takes place.
213
Besides the explanation of the demo in the description le, a thumbnail image can be helpful to show what kind of view one can expect from a particular presentation. Thumbnails are shown in the Demo GUI and in the Amira help window when it is used for demo steering. Furthermore demos can be started and steered with a web browser. See below. If you have prepared your demos and set up selection as described below, start Amira and type: source $AMIRA DEMOS/<outputfolder>/<demodirectory>/makeSnapshots.hx in the Amira console. Here <outputfolder> is selection by default or, when using the command line tools, output resp. the name specied in the -o option of prepareDemos.tcl. After that there are as many stepN.png les as there are steps dened in the description le in a directory $AMIRA DEMOS/src/<demodirectory>/gfx/. If for some reason you need manually created thumbnails for a particular demo, proceed as follows: Start that demo, and invoke source $AMIRA DEMOS/setup/makeIcon.hx. After that a Tcl procedure makeIcon has been dened. Call it in the Amira console with makeIcon "<thumbnail filename>" <width> <height>. Do not give a lename extension, .png will be added automatically by makeIcon. If both values for width and height are given, the viewer will be resized accordingly. If one of these values set to 0, the viewer image will be scaled using Lanczos interpolation. Note: For better image quality, set your viewer size to a multiple of the thumbnail size (in the default case 150x150 for thumbnails = 900x900 viewer size). Also consider the contents of the viewer if there are many small features, they wont be visible in the thumbnail. As is often true, less is more. Final remark: Consider the description together with the thumbnail images as a storyboard. It should describe the story you want to tell the audience while presenting the demonstration. Indeed you nd a le storyboard.html in your output folder after you have setup a selection. It contains all descriptions and thumbnails of the whole selection together in one le. Useful for browsing and printing with your favourite webbrowser.
214
tvf bubble_2006.06.22-1_data.tar 2006-06-22 12:10:10 data/cfd/bubblechamber/ 2006-06-22 12:29:20 data/cfd/bubblechamber/physics.am 2006-06-22 12:29:01 data/cfd/bubblechamber/Blasensaeule.s
215
... 2006-06-22 12:10:10 data/cfd/bubblechamber/streamsurface.su ... 2006-06-22 12:29:20 data/cfd/bubblechamber/Vektorfeld_GW_01 In order to fetch all data sets, you must download them as follows prior to starting the demos: cd $AMIRA DEMOS/src tclsh $AMIRA ROOT/share/hxdemos-scripts/downloadData.tcl downloadData.tcl has no parameters or options! Note: downloadData.tcl downloads ALL data les mentioned in the prepacked tag of the description.xml les found in the recursively traversed directory tree! All downloaded les are stored in the directory $AMIRA DEMOS/cacheddata. Before downloadData.tcl downloads the les from the server, it checks to see if the les scheduled for downloading are already in the cacheddata directory. This ensures that a possibly time-consuming download is done only once. Then all les with the extensions .tar, .tar.gz or .tgz are unpacked to $AMIRA DEMOS/data while all other les are copied to that folder. Depending on the amount of data you stored on your data server, this may take a quite a while and use a lot of disk space. See below for downloading only those data les which are needed for a certain demo selection.
Demo GUI
The Demo GUI provides a very convenient way for selecting demos from a pool of available demos. It is also possible to change a demo selection afterwards. A demo selection can be saved in an Amira script le for running it later. For more information, see the Demo GUI documentation.
216
Command-line Tools
If for any reason the Demo GUI couldnt be used to select demos, you can use a command-line tool prepareDemos.tcl to do the selection. The command-line tools are $AMIRA ROOT/share/hxdemos-scripts. stored under
You can specify a selection of folders and steps as parameters to create adapted output in a subdirectory $AMIRA DEMOS/output. The subdirectory then contains a le named demosequence.hx which is an Amira script for executing the selected demos. demosequence.demo contains the demos and their steps and is used by the DemoSequence module for steering. Load the script into Amira to start the demos.
Additionally an index.html le which can be used to control the demos from a web browser. To do so, start Amira and execute the command httpd start in the console and afterwards direct your favorite web browser to the URL http://localhost:7000/<$AMIRA DEMOS>/<outputfolder>/index.html where <outputfolder> is output or the directory specied with the -o option. It is also possible to load the index.html le into Amira and start the demos from Amiras help window. The full syntax of prepareDemos.tcl is
prepareDemos.tcl [--help | {[--include] {folder [--steps <ste | --exclude <folderlist> }* | [--datainclude <folderl [--output <outputfolder>] | [--force | --download | --[all]packandgo <folder>] --include, --steps, --exclude, --output, --force,
-i: given folders are included recursive the output -s: string of type "5 8 2 1" defining se and order of steps, steps starting f -e: following folders are omitted in the recursion -o: specifies the outputfolder relative the demos directory -f: overwrites content in outputfolder o
Selecting Demos
217
packandgo-folder; if not given and folder exists, prepareDemos issues a warning and exit
--download, -d: downloads data needed by the selected --packandgo, -p: copies output and needed data to the specified folder --allpackandgo : copies output, all from src and needed to the specified folder --datainclude : given folders are included recursively the data folder, if --packandgo has be specified, too --help, -h: prints this helpscreen and exits The -o option allows you to specify an output folder different from the default folder named output. If the packandgo option is given at the same time this folder will be created under the pack-and-go folder. The --packandgo option copies all les recursively from the $AMIRA DEMOS/src folder to a directory src under the folder specied for this option. The needed data sets are then copied from the directory $AMIRA DEMOS/cacheddata into that folder, too. After that, you must unpack these tar les relative to the pack-and-go folder. In order to have the data ready in cacheddata, specify the --download option. As an alternative way to provide the needed data it is possible to supply a --datainclude option in conjunction with the --packandgo option. This option must have a selection of pathnames relative to $AMIRA DEMOS/data which are copied to a data folder under the pack-and-go folder. It is now possible to set the $AMIRA DEMOS environment variable to the pack and go folder. Note: Be sure not to have any / (slash) at the end of a path since this leads to wrong results. Please, dont use the options --datainclude and --include together in conjunction with --packandgo, cause it copies way too much into the packandgo folder. Example: cd $AMIRA DEMOS/src
218
tclsh $AMIRA ROOT/share/hxdemos-scripts/prepareDemos.tcl cfd/bubblechamber medicine/hyperthermia -s "1 2 5" --download --output mydemo This selects the entire bubble chamber demo and three steps from the hyperthermia demo and stores the necessary les in $AMIRA DEMOS/mydemo. The requested data sets for the two demos are stored under $AMIRA DEMOS/data if there is a <prepacked> tag in the appropriate description les. On Unix/Linux systems start Amira with $AMIRA ROOT/bin/start $AMIRA DEMOS/mydemo/demosequence.hx and on Windows systems load $AMIRA DEMOS/mydemo/demosequence.hx just after Amira has been started. Pack-and-Go Example: tclsh $AMIRA ROOT/share/hxdemos-scripts/prepareDemos.tcl --packandgo /media/disk/hxdemos brusselator microvisu/gigamosaic microvisu/synchrotron microvisu/smallnetwork This creates a folder named hxDemos under /media/disk/, selects four demos and puts the output into that folder. You also nd under that folder the needed data as tar les, named as described in the appropriate description .xml le.
6.3 Prerequisites
The following system tools and programs are used by Demo Framework: A recent version of tclsh and xsltproc is required for the scripts prepareDemos.tcl and downloadData.tcl. wget and either gtar or gzip and tar is downloadData.tcl. required for
On Unix/Linux systems all tools should already be installed. On Windows systems all tools should already be installed in cygwin as well. If xsltproc is missing, it is part of the package libxslt. Make sure that the PATH environment variable includes cygwin/bin to be able to use it via exec
Prerequisites
219
in Tcl scripts.
220
Part II
Chapter 7
Getting started with molecular visualization Structure and interdependence of the molecular data structures Essentials for displaying a molecule Alignment facilities in Molecular Pack Visualizing dynamic data Atom expressions
Getting Started - rst steps Selection, Labeling, and Masking - exploring a molecule Alignment of Molecules - visualizing dynamical data Molecular surfaces - wrapping a molecule Sequential and Structural Alignment - comparing molecules Molecule Editor - interactive manipulation of the molecule Molecular Interface - computing intersection surfaces Measurement - measuring distances and angles within a molecule
Note: If you want to visualize your own data, please refer to the section about data import in the Amira Users Guide. That section contains some general hints on how to import data sets into Amira.
7.1.1.1 Loading Data into the System In the following introduction we will consider a simple example to explain the basic functions of the MoleculeView module. Our example will be a small PDB (Protein Data Bank) structure consisting of 932 atoms in 213 residues. Load the le 2RNT.pdb data/molecules/pdb. into the Pool from the directory
A green icon labeled 2RNT.pdb will appear in the Pool. The green icon represents an object of type Molecule. Click on the green data icon with the left mouse button. In the Properties Area below the Pool information about the molecule, such
224
as the number of atoms etc., will be shown. In addition, other ports named Transformation, Selection Browser, and Transform, can be seen; they will be explained in later tutorials. 7.1.1.2 Displaying the Molecule with the MoleculeView Module The MoleculeView module is the basic display module for visualizing molecules. It allows you to display atoms as plates or balls and bonds as lines or cylinders. Click again on the green data icon in the Pool, this time using the right mouse button. A menu, containing several entries and submenus, will appear. Select the entry MoleculeView. A new yellow icon labeled MoleculeView appears in the Pool. Yellow icons, in general, represent display modules, i.e., modules that visualize objects in the viewer. The blue line between the icons indicates a connection between the objects. In this case the MoleculeView module reads data from the object represented by the green icon and visualizes it. The molecule is now displayed in the viewer as a wireframe. Using the left mouse button you can rotate the object; using the left and middle mouse buttons simultaneously you can zoom in and out. For these mouse operations to work, the viewer must be in viewing mode, in which case the mouse cursor is displayed as a hand. Whenever the MoleculeView module is active, the little square on the yellow MoleculeView icon is orange. You can deactivate the module by clicking on the square with the left mouse button. We will explore some basic ports of the MoleculeView module. Mode port: Choose another mode to see both atoms and bonds of the molecule, or just atoms. If atoms are shown, use the Atom Radius port to adjust the size of the atoms as desired. Quality port: If you choose the option correct, you can display a correct, i.e. threedimensional, image of the balls and sticks. Consider the trade-off between correct representation and slower rendering performance. Use the fast mode if you want to display a large molecule. If your graphics hardware is fast enough, you can use the correct mode even for large molecules.
225
Complexity port: In order to allow interactive rendering, the default complexity of the scene is rather low. In most cases this will be sufcient. However, if you want to make screen shots or if you have small molecules, you might want to increase the complexity. The Complexity port is displayed only if correct quality is selected. 7.1.1.3 Changing the Color Scheme The MoleculeView module allows the user to color the molecule according to levels, for example, atom level, residue level, secondary structure level, chain level, or user-dened levels. Each level has a number of attributes, the simplest of which is the index attribute. The default color scheme is to color the molecule according to the atom levels attribute atomic number, i.e., the atoms type. Click the Legend button of the Color port to display a small window decoding the colors you see in the viewer window. Choose residues from the rst pop-up menu and type from the second menu to color the molecule according to the residue type, here the amino acid type. The default colormap contains a constant color. Thus, currently all residues of the molecule have the same color. To change the colormap, right-click on the color bar of the Discrete CM port which has appeared below the Color port and select any other colormap. Try out different colormaps to nd a map that suits your purposes. Some people prefer the CPK color scheme for atoms and the amino acid colors as they are used in the RasMol program. You can set your preferences in the AmiraEdit menu by selecting the entry Preferences. Press the Molecules tab and set your preferences. Pressing the OK button saves your preferences permanently. Currently only amino acid colors are predened. Thus, if the molecule contains residues other than the standard amino acids, those residues will be colored with the default color (black).
226
7.1.1.4 Using the Draw Tool The draw tool appears in Amira in several modules. It enables you to select objects or parts of an object by drawing a line in the viewer. Press the Draw button of the Highlighting port and draw a line in the viewer window around the group of atoms you want to select. The atoms that were enclosed by the line will be highlighted. If the viewer is the active window, pressing the d key is equivalent to pressing the Draw button of the Highlighting port. To unhighlight all atoms, press the Clear button of the Highlighting port. Also try using the keys Ctrl and Shift while drawing a line. 7.1.1.5 Setting Colors for Selected Parts The Dene Colors port allows you to overwrite colors of the color scheme. Select some atoms using the draw tool. Press the Set button of the Dene Color port. Change the current color of the Color Editor and press OK. The previously highlighted atoms should now have the color selected in the color editor. This setting will be preserved even if the color scheme is changed. Unfortunately, the new setting will currently not appear in the color legend.
227
For this tutorial we will use the molecule 1IGM.pdb. Load the le 1IGM.pdb into the Pool from the directory data/molecules/pdb. Attach a MoleculeView module to the green object that has appeared, and change the Mode port to balls and sticks. 7.1.2.1 Interactive Selection with the MoleculeView Module In the rst tutorial you learned how to use the draw tool to select atoms within a molecule. The simplest way to select atoms, however, is to click on the atom of interest. In order to do so, the viewer must be in interaction mode. If the mouse cursor in the viewing window is depicted as a hand, you are in viewing mode. To change to interaction mode, you can either click on the arrow button in the upper right corner of the viewing window or press the Esc button while the viewing window is active. The mouse cursor will change to an arrow. Now click one of the atoms. The atom you selected should now be highlighted by a red frame around it. If you select another atom, the rst atom will be unhighlighted. In order to select more than one atom press the Ctrl key and keep it pressed while clicking additional atoms. Ctrl-clicking a highlighted atom a second time unhighlights it. Now change the Mode port of the MoleculeView back to sticks. Select residues from the rst menu of the MoleculeViews Color port. Choose a suitable colormap from the list of pre-loaded colormaps as described in the rst tutorial. The residues should now be colored according to their type. Now select an atom.
228
As result the whole residue should now be highlighted. The reason for this is that picking is bound to the coloring, by default. For example, if the color scheme is atoms, a click on an atom will only inuence the selection for this atom; if the scheme is residues, the atoms residue will be selected; if it is chains, the atoms chain will be selected, and so on. However, since this is very restrictive you can easily change the selection mode to the most common levels, i.e., atoms, residues, secondary structures, and chains. In order to choose a certain level for the selection you need to press certain keys in advance. Ctrl-Alt-Shift-a chooses the atoms level, a click on an atom will only inuence the selection for this atom. Ctrl-Alt-Shift-r, Ctrl-Alt-Shift-c and Ctrl-Alt-Shift-s choose residues, chains and secondary structure level respectively. To switch back to the default behavior, where coloring determines selection, press Ctrl-Alt-Shift-d. If you select some group and afterwards select a second one from the same level holding down the Shift-key all groups between the two will also be selected. Holding the Ctrl-key pressed while selecting groups allows you to select multiple groups and also to toggle a group when selecting it a second time. If you do any selection by clicking in the viewer there will be some output in the console window informing you about what you have selected, the amount of output can be customized via the Preferences dialog:
You can set your preferences in the AmiraEdit menu by selecting the entry Preferences. Press the Molecules tab and take a look on the options in chapter Selection Info: Molecule name determines that the name of the molecule, to which a selected group belongs, will be printed. Group name determines that the name of the selected group will be printed. Group attributes determines that not only the selected groups name but also all attribute values of the group will be printed in the console window. Explicit attributes restricts the output of attribute values to those attributes that are explicitly named in the text eld. Pressing the OK button saves your preferences permanently.
229
7.1.2.2 Using the MoleculeLabel Module So far you have seen that you can select atoms and groups of atoms by clicking on the molecule. The result of the picking is always printed in the console window. This might sufce in some cases. In other cases, however, it is necessary to label the molecule in the viewer so that you can easily track certain groups you are interested in. If you want to use this tool, here is how you do it. Click again on the icon 1IGM.pdb with the right mouse button. Select MoleculeLabel from the Display submenu. A second yellow icon labeled MoleculeLabel should have appeared in the Pool. By default, all clicks will now be handled by the MoleculeLabel module. This means that instead of highlighting groups when clicking on them they will now get labeled. Type Ctrl-Alt-Shift-r while the viewing window is active. Click on the molecule in the 3D viewer. This action should cause the residue of the selected atom to get labeled. Pressing Ctrl-Alt-Shift-a and clicking the same atom will result in the selected atom being labeled. The Ctrl- and Shift- keys have the same effect as when selecting groups. Label a few residues and atoms. Click on the MoleculeLabel icon to view its ports in the Properties Area. Change the color of the atom labels by pressing the color button of the Color port and selecting a different color in the color editor. Now select residues in the Levels port. The Attributes, Level Option, Buttons, Font Size, and Color ports now affect the residue labels. Increase the font size (which only increases the font size of the current level, i.e., residues). Select the name entry in the second menu of the Attributes port. The selected residues will now be labeled by their types and names. In order to understand the Options port of the MoleculeLabel module deselect the last option, replace attributes,
230
and set the entry of the second Attributes menu back to disabled. Now select a new residue, holding the Ctrl- key down. The new residue will only be labeled by its type. In contrast, the old residues are still labeled with type and name. If the rst option of the last port, handle clicks, is deselected, mouse clicks will be handled just as if the module MoleculeLabel did not exist. Deselect the handle clicks option. Select any residue. The residue is selected, not labeled. 7.1.2.3 Molecule Selection Browser In this section you will learn the basics about the molecule selection browser, which is a very important feature for the investigation of a molecule. The selection browser is a exible tool for selecting those parts of the molecule that you are interested in. Moreover, it allows you to easily combine different viewing modules into one viewer. Select the green icon 1IGM.pdb by clicking on it. Press the Show button of the Selection Browser port to open the browser. The scroll view of the browser currently contains three columns, one with the heading level/name, the second with the heading type, and the third with the heading MV which stands for MoleculeView. In the rst column, all residues of the molecule are displayed. The second column shows the residue type. Connect a BondAngleView to 1IGM.pdb by right-clicking the icon and choosing BondAngleView from the Display submenu. You will observe a new column in the selection browser, representing the BondAngleView (BAV) (see Figure 7.1). Changing the Appearance of MoleculeView and BondAngleView In order to get an image similar to Figure 7.2, we rst need to set the ports in the MoleculeView and the BondAngleView modules correctly. We begin with the
231
Figure 7.1: On the left, MoleculeView and BondAngleView displaying the molecule simultaneously. On the right, the Selection browser after connecting two viewing modules to the molecule.
232
MoleculeView module. Set the Mode port to balls. Set the Quality port to correct. Set the Atom Radius port to 1.0. For the BondAngleView continue as follows: Select the residues entry from the rst menu of the Color port. From the second menu of Color port, select the index entry. Right-click on the color bar of the Discrete CM port and select the colormap physics.icol, if this colormap is pre-loaded. Otherwise load it from the directory data/colormaps. We now only see the MoleculeView, since the triangles of the BondAngleView are hidden by the van der Waals spheres. In order to combine the two viewing modules into one image, continue with the next section. Highlighting and Masking with the Selection Browser We now want to use the selection browser to display parts of the molecule with the MoleculeView module and the rest with the BondAngleView module. In this section we will only use the selection browser, so all menu names etc. refer to this window. Select chains as new master level from the MasterLevel menu. You will now see three entries in the rst column: chains/L, chains/H, and chains/W. This means that the level chains contains three groups, named L, H, and W. In order to view the group chains/L with the MoleculeView and the other two groups with the BondAngleView, remove the check marks for chains/H and chains/W from the column with heading MV by clicking on them. To deselect the group chains/L for the BondAngleView, click on the respective box in the column BAV.
233
Figure 7.3: Displaying parts of the molecule with the MoleculeView module and the rest with the BondAngleView module.
Now you should see an image that is pretty close to that in Figure 7.3. However, the BondAngleView displays more triangles than in the gure. The BondAngleView in Figure 7.3 only displays backbone atoms. In order to achieve this right-click on the heading labeled BAV. A pop-up menu as in Figure 7.3 should appear. Select Backbone from the Restrict to submenu. The side-chain atoms should not be visible anymore. Next, you should explore the group chains/L a bit further. Click on the little icon left to it. After this action the residues contained in chain L will have appeared. Click on the little icon left to the residue L1. Type atoms/L4-L33 in the text eld labeled Expression, below the scroll window, and press the Replace button.
234
Atoms L4 to L8 and residues L2, L3, and L4 are highlighted in red. The residue L1 and the chain L are highlighted in green. The color red means that the whole group is selected, i.e., all its elements. Green denotes that the group is partially selected. See Figure 7.4. To get familiar with the browser, play around with it. If you need further information, just press the F1 button in the browser window or see the description of the Selection Browser.
235
7.1.3.1 Comparing two Molecules In this section we will compare two different three-dimensional structures of the same molecule. Load the data le alkane.zmf from the directory data/molecules/alkane. Select MolTrajectory from the pop-up menu of the alkane.zmf icon. Select Molecule from the pop-up menu of the MolTrajectory icon. Attach a MoleculeView module to the molecule. Repeat the last two steps, creating two new objects, Molecule2 and MoleculeView2 The alkane.zmf icon represents a bundle of molecular trajectories, in this case butane, pentane, and hexane. By attaching a MolTrajectory to it, we extract a single trajectory. By default, the rst trajectory, which is butane, is selected. We can now extract single time steps from the trajectory by attaching a Molecule object to the trajectory. We have done this twice since we want to compare two time steps with each other. Currently, both molecules extract the same time step. This is the reason for only seeing a single molecule. In order to get more information about the data structures, go to the section on molecular data structures. Select the MoleculeView icon and change the Mode port to balls and sticks and the Quality port to correct. Repeat this action for the MoleculeView2. Select the Molecule2 icon and change the value of the Time port to 2. You should now see two butane molecules in the viewer, slightly displaced. Right-click on the white square at the far left side of the Molecule2 icon and select AlignMaster from the pop-up menu. Connect the blue line to the Molecule icon. Select the Molecule2 icon. Press the all button of Molecule2s Select port. You have now aligned the molecules Molecule and Molecule2 using a least squares tting of all atoms. This only works for molecules with the same number of atoms.
236
In the following we will align the two molecules by considering only three carbon atoms. Deactivate the MoleculeView by clicking on the orange square of the MoleculeView icon. Ctrl-click on three consecutive carbon atoms. The frame of a red cube should appear around each of them. Activate the MoleculeView by clicking on the gray square on the MoleculeView icon. Select the Molecule2 icon and press the in slave button of the Select port. The three selected atoms should now t better onto the corresponding atoms of the object labeled Molecule.
7.1.3.2 Computing a Mean Molecule In this section we will compute a mean molecule of a metastable molecular conformation of butane. Remove the objects Molecule and Molecule2. Select the MolTrajectory icon. Load the data le but cluster 3 1.idx from the directory data/molecules/alkane. but cluster 3 1.idx is a subtrajectory of MolTrajectory, i.e., a subset of all congurations in the trajectory. Attach a molecule to the icon but cluster 3 1.idx. Select the MeanMolecule entry from the Compute submenu of but cluster 3 1.idxs pop-up menu. Right-click with the mouse on the white square at the far left side of the MeanMolecule icon and select AlignMaster. Connect the AlignMaster port to the Molecule icon by attaching the blue line to it.
237
Select the MeanMolecule icon and press the all button of the Select port of the MeanMolecule module. Press the Apply button to compute the mean molecule. Visualize the mean molecule but cluster 3 1.mean by attaching a MoleculeView to it. Connect the AlignMaster port of the module MeanMolecule to the but cluster 3 1.mean icon. Press the Apply button of the MeanMolecule module two or three times. You have now computed a mean molecule of the subtrajectory but cluster 3 1.idx. The AlignMaster is used to align all time steps before accumulating the atom positions. Changing the AlignMaster to the previously computed mean molecule and repeating the computation of the mean molecule will improve it. This procedure should converge. A better way to compute a mean molecule is to use the module PrecomputeAlignment, using the Multiple Alignment option of the Mode port. This module creates an object containing a transformation for each structure in the trajectory. This object can then get connected to the PrecomputeAlignment connection port of the MeanMolecule module. 7.1.3.3 Computing and Visualizing a Conguration Density For the subset of congurations contained in the subtrajectory but cluster 3 1.idx, we will now compute a conguration density and visualize it with the Isosurface display module. Select the entry CongurationDensity from the Compute submenu of but cluster 3 1.idxs pop-up menu. Connect the AlignMaster port of the CongurationDensity icon to the but cluster 3 1.mean icon. Select the CongurationDensity icon. Press the all button of the Select port. Press the Field button of the Compute port to compute the density. Visualize the created scalar eld but cluster 3 1.scalar with an isosurface by rst selecting the Isosurface entry from the Display submenu of the icons pop-up menu,
238
second, setting the Isosurfaces Threshold value to 0.1, and third, pressing the Apply button. Try different Threshold values. 7.1.3.4 Comparing Metastable Molecular Conformations The set of congurations in the subtrajectory but cluster 3 1.idx belongs to a metastable conformation of butane. In this section we will compute the density of a second metastable conformation and compare the two with each other. Select the MolTrajectory icon. Load the data le but cluster 3 2.idx from the directory data/molecules/alkane. Compute the mean molecule of the subtrajectory but cluster 3 2.idx by repeating the steps described above for the subtrajectory but cluster 3 1.idx. Visualize the second mean molecule with the MoleculeView module. Select three consecutive carbon atoms in the second mean molecule as was done in the rst tutorial. Attach the AlignMaster of the object but cluster 3 2.mean to the rst mean molecule but cluster 3 1.mean. Select the but cluster 3 2.mean icon and press the in slave button of the mean molecules Select port. The two mean molecules should now be aligned to each other, i.e., the three selected carbon atoms should superimpose. Compute the density for the second subtrajectory using the but cluster 3 2.mean molecule as AlignMaster. Visualize the computed density with an Isosurface module. Double-click on the colormap of the Isosurface2 module and select a different color to better distinguish the two isosurfaces from each other. You should now clearly see how the two conformations of butane differ. For larger molecules it might be interesting to color the isosurface according to the atoms colors. This can be done using the same CongurationDensity modules by selecting the Color Field option of the Field port. Attach the computed color eld to the
239
ColorField connection port of the Isosurface module. Notice that you can also visualize the densities with the Voltex module of the Display submenu.
7.1.4.1 Compute Molecular Surfaces In this section you will learn how to use the CompMolSurface module to compute molecular surfaces with different resolutions. You will also become familiar with some of the modules basic ports. Load the data le 2RNT.pdb from the directory data/molecules/pdb. Attach the CompMolSurface module to the green icon by selecting the corresponding entry from the Compute submenu of 2RNT.pdbs pop-up menu. Select the CompMolSurface icon. Press the Apply button. Attach the MolSurfaceView module to the newly created green icon, 2RNT-surf. You should now see a gray solvent excluded surface which is still pretty coarse. If you want a surface with better resolution, increase the number of points per A2 in the CompMolSurface module.
240
Press the Apply button again. Try different resolutions. Now select the no duplicate points option in the Options port. Press the Apply button.
Due to the last action, some sharp edges will have disappeared. If there are no duplicate points at sharp edges, the surface normals of the adjacent triangles will be interpolated, thus leading to a smoothing, which in this case might be undesired. However, this option is important if it is necessary to have a completely closed surface. Change the Quality port to faster. Press the Apply button. You should observe that some atoms disappear. This is due to the fact that now only one surface component will be computed. If the molecular surface consists of only one component, the whole surface will be computed. Since the underlying algorithm does not need to touch every single atom, but approximately only every second atom, the algorithm is much faster. If performance is an issue, you might consider using this option. 7.1.4.2 Compute Partial Surfaces In order to compute partial surfaces we need to select the atoms for which we want to compute their surface contribution. Open the selection browser. If you do not know how to do this, take a look at the second tutorial. Type within(residues/HET105, 5) in the browsers Expression command line. Press the selection browsers Replace button. All atoms within a distance of 5 A of the HET105 residue will now be selected. Reset the CompMolSurfaces Quality port back to correct. Select partial surface from the Options port of CompMolSurface. Press the Apply button.
241
Select adjacent patches from the Options port of CompMolSurface. Press the Apply button. The last action causes the partial surface to be expanded by the toroidal patches adjacent to the partial surface. 7.1.4.3 Molecular Surface of a Restricted Set of Atoms The molecule 2RNT.pdb contains some water molecules, which are in most cases not desired when computing the molecular surface. In order to exclude the water molecule from the surface computation open the selection browser again. In the selection browser scroll to the end of the list of residues. Click on one of the strings HOH in the type column. All residues of type HOH should now be highlighted. In the browser, right-click on the heading CMS which stands for CompMolSurface and select the entry Remove. Deselect partial surface in the CompMolSurface module. Press the Apply button. For the new surface only those residues that have a check mark in the selection browser were considered. You may combine this procedure with the partial surface computation described above. 7.1.4.4 Exploring the MolSurfaceView The MolSurfaceView module is already attached to the molecular surface. A second connection exists to the molecule 2RNT.pdb, from which data is read to enhance the visualization. Compute the whole molecular surface with a resolution of 2 points per A2 . Click on the MolSurfaceView icon to see its user interface in the Properties Area. Select molecule for the Color Mode.
242
Change the Color ports rst menu entry to residues. Select an appropriate colormap for the Discrete CM port by right-clicking on the color bar. Switch to interaction mode by clicking on the arrow button in the upper right corner of the viewing window. Click on the surface in the viewing window. All triangles belonging to the picked triangles residue will be highlighted. If the triangle belongs to two or even three (maximum) residues, all of those residues will be highlighted. Clicking on the surface with the middle mouse button displays information about the atom you clicked on in the upper left corner of the viewing window as long as you keep the mouse button pressed. If you Ctrl-click, the information will remain displayed even after releasing the mouse button until the next mouse click on the surface. Press the Highlighting ports Clear button to remove the selection. Change the Pick Action port to clipping. Pick any triangle of the surface. All triangles further away from the picked triangle than the distance given by the Selection Distance port will be cut off. All triangles within this distance will remain, however, only if they are connected to the picked triangle without leaving the sphere around the picked point. Press the All button of the Buffer port to display the whole surface. Change the Pick Action port to surface. Shift-click on the surface in the viewing window. All clicks on the surface will now be handled as you might be familiar with from the SurfaceView module.
243
The AlignSequences tool facilitates the comparison of two sequences. It can be applied to both proteins and nucleic acids except for t-rna molecules containing modied bases. The AlignSequences module is not highly advanced, but it might sufce for some purposes. Having done the sequential alignment, you can use the correspondence produced by the sequence alignment to do a structural alignment of the molecules. Load the les 1IGM.pdb and 2JEL.pdb from the directory data/molecules/pdb/ and connect a MoleculeView to each of them. You should know how to do this from the rst tutorial. For both MoleculeViews select residues from the rst menu of the Color port. A colormap (Discrete CM) with constant color will appear. To distinguish the molecules, choose a different color for one of them. In order to do so double-click on the colorbar (the Color Dialog should appear) and change the current color by dragging and dropping any of the custom colors. Press the OK button of the color editor.
7.1.5.1 Sequence Alignment We will now use the AlignSequences module to align the sequences of the two molecules. In the next section we will use the associated amino acid pairs for a structural alignment. Right-click on the 1IGM.pdb icon and select AlignSequences from the Compute submenu. Right-click the white square on the far left side of the AlignSequences icon. A pop-up menu displaying all connection ports opens. Select MoleculeB from it and connect the port to the 2JEL.pdb icon by clicking on it.
244
There should now be two blue lines connecting the AlignSequences icon with the 1IGM.pdb and 2JEL.pdb icons, respectively. Select the module AlignSequences by clicking on its icon in the Pool. Choose semiglobal from the second menu of the Align Type port. Press the Apply button. If the alignment has been successful, a window displaying several slightly different alignments will appear. Press the AcceptAll button. Then press the Close button. This action results in the alignments being written to the molecules as new levels. In order to check this, type 1IGM.pdb list in the Amira console window. In addition to levels such as atoms, bonds, residues, etc. you will also see levels named semiGlobalSeqAlign1 to semiGlobalSeqAlign10. 2JEL.pdb has the same levels with an equal number of groups. 7.1.5.2 Align Molecules by using the Mean Distance Criteria We can now use the levels semiGlobalSeqAlign* for a structural alignment. In order to do so, right-click the icon 1IGM.pdb and select AlignMolecules from the Alignment submenu. Right-click the white square at the far left side of the AlignMolecules icon, select the MoleculeB entry, and connect the module to 2JEL.pdb. Select the AlignMolecules icon to make it appear in the Properties Area. Select any of the levels named semiGlobalSeqAlign* in the AlignLevel port and press the Apply button. If you want to follow the alignment process, click the show alignment option before pressing the Apply button.
245
246
Open the selection browser and select the residue with the type XK2 (it is at the end of the list). Switch to the Tools tab in the molecule editor and press the bond-length table button in the Mode section. Then, press the add button in the Action section. Adding bonds in the bond length table mode will create new bonds in the selected part of the molecule by comparing the distances between the atoms with a table of average bond lengths. The result should now look like Figure 7.5. 7.1.6.3 Splitting the Molecule We now want to split the molecule into inhibitor and protein. If it is not currently selected, reselect the XK2 residue in the selection browser. Press the Split button on the Tools tab of the molecule editor. You will notice that the atoms of the inhibitor are no longer displayed by the MoleculeView and that a new object, 1HVRm2.pdb, has appeared in the Pool. This object contains the previously selected atoms of the ligand.
247
7.1.6.4 Adding another molecule The protein of the 1HVR entry is a protease which uses up one water molecule to split a polypeptide. We now want to add the water to the active site of the enzyme. Load the le h2o.pdb from the directory data/molecules/pdb. Go to the molecule editor and press the Add button in the Change Topology section. In the window that opens, all other molecules in the Pool will be shown. Select the h2o.pdb molecule and press OK. The atoms of the water molecule have now been copied to the 1HVRm.pdb object.
7.1.6.5 Moving Parts of the Molecule To concentrate our view on the region of interest we will reduce the molecular view to amino acids A25 and B25 between which the water molecule should be placed. Type r/name=?25 OR r/type=H2O into the selection browser and press the Add button. Now move your mouse on the MV heading, press the right mouse button, and activate the Replace option. With only the residues A25 and B25 and the water molecule displayed, all that is left to do is to drag the water molecule to its correct location. Select the water molecule in the selection browser (the residue at the end of the list). Switch to the Transform tab of the molecule editor. button in the Show the position of the transform dragger by pressing the Position section of the Transform tab. Left-click on the dragger and hold the mouse button down. You can now translate the dragger in different planes depending on the side you clicked on. Move the water molecule between the two amino acids as shown in Figure 7.6.
248
To reorient the water molecule, click on the green knobs of the dragger. They allow the dragger to rotate in different planes. Repeat the steps described above until you are satised with the result. To apply the changes that you made to the edited molecule, you must press the Apply button or end the editing by using the OK button.
249
Select the 2RNT.pdb icon in the Pool by clicking on it. Now click in the console window to activate it, and press the TAB key. The name of the selected icon, 2RNT.pdb, should appear in the console window. If it does not, please type 2RNT.pdb. On the same line, residues/HET105
type
define interface/substrate
The following text should now be written in the console window 2RNT.pdb define interface/substrate residues/HET105 Press the ENTER key. You have now dened the group substrate in the level interface. The group consists of the residue HET105. We will now dene the group receptor. Press the TAB key again, then type defregexp interface/receptor NOT residues/HET105 AND NOT residues/type=HOH With NOT residues/HET105 we exclude the substrate and with NOT residues/type=HOH we exclude all water molecules. Thus, the receptor is dened as consisting of all atoms not belonging to either the substrate or any water molecule. If you now list all levels by typing 2RNT.pdb list you will see an interface level containing two groups. Type 2RNT.pdb list interface and all groups of the interface level will be printed in the console window.
250
7.1.7.2 Computing the Interface We will now compute the interface between the receptor and the substrate. The interface between two molecules is dened as the surface equidistant to both molecules. For the approximation we compute, this might not be exactly true for all points on the surface. The module to compute the interface is called CompMolInterface. Now, to compute the interface, right-click the icon 2RNT.pdb and select CompMolInterface from the Compute submenu. Select the icon labeled CompMolInterface in the Pool. Choose interface from the Levels menu of the CompMolInterface module. Press the Apply button. Two objects result from this action, an interface object of type MolSurface, 2RNT-interface.surf, and a distance eld of type UniformScalarField3, 2RNTdistance.eld.
7.1.7.3 Visualizing the interface Finally, we will view the computed interface in the viewing window with the MolSurfaceView module. Right-click on the 2RNT-interface.surf icon and select MolSurfaceView. Right-click on the white square at the far left side of the MolSurfaceView icon and connect the ColorField port with the distance eld 2RNTdistance.eld. The user interface of the MolSurfaceView module should be visible in the Properties Area. Choose the eld option from the Color Mode port, resulting in a new port, Colormap, appearing in the user interface. Right-click on the colormap bar and choose any colormap.
251
Play around with the coloring by changing the colormap range. The full range of values can be seen when you select the 2RNT-distance.eld, i.e, click on it. Also, change the Cutoff distance in the CompMolInterface module, e.g., to 1.0, and the Voxel size, e.g., to 0.5. See what happens when you press the Apply button of the CompMolInterface module. Warning: If you choose a very small voxel size, the computation might take very long. Also, there might not be enough memory to store such a large distance eld. Usually, 1.0 or 0.5 are good values. After having done the steps described above, what you see should be similar to the Nuclease demo on the demo pages. The interface here, however, has been generated from two separate les.
7.1.8 Measurement
In this tutorial you will learn how to measure distances and angles between atoms in a molecule. For this tutorial it is necessary for you to have already done the tutorial 7.1.1. Load any molecule from the directory data/molecules/* and connect a MoleculeView to it. Select the MoleculeView by clicking on its icon in the Pool. Select balls and sticks Mode and fast Quality. Next, right-click on the MoleculeView icon, and select Measurement from the pop-up menu. The user interface of the Measurement tool should now be visible in the Properties Area. An Info port tells you that you need to select 2, 3, or 4 atoms. In order to do so, switch to interaction mode by pressing the ESC key or by pressing the arrow button in the upper right corner of the viewing window. You can now select single atoms in the viewer by clicking on them. If you click on one atom, the previously selected atom will be deselected. By using the Ctrl-key,
252
you can select more than one atom. Select 2, 3, or 4 atoms and observe what is being displayed in the user interface of the Measurement module. The Ctrl-key is also used to deselect atoms.
253
Figure 7.7: MoleculeView (left and middle) and BondAngleView (right) display the molecule simultaneously.
Some levels can build hierarchies. For example, a residue consists of a number of atoms, and a couple of residues may form a secondary structure. These levels and groups can be dened by le readers or interactively via Tcl commands.
254
BondAngleView, atom colors are assigned to the vertices and color is interpolated over the triangles. To determine the coloring you can choose a level, e.g., atoms, residues, secondary structures, or chains. Furthermore, you can choose one of the levels attributes. The coloring will then be done according to the groups attributes such that all atoms of the same group will have the same color. Color
A molecule may be colored according to various schemes. For example, each atom of a specic type may have the same color. Another possibility is to give all atoms belonging to a certain group the same color. The rst menu of the Color port species the group level, e.g., atoms, residues, secondary structures, or chains. The second menu allows you to decide which attribute of the specied level should be considered to color its groups. If you press the Legend button, a separate window will be opened, which displays a legend of the coloring, i.e. a table associating colors with attribute values according to the current coloring. Clicking on the text to the right of a color will select all atoms with this color. Continuous CM
This colormap is used to map values of oat attributes to colors. For optimal mapping, the colormap range must be set correctly. By default, the range is set to the minimum and maximum values that occur using the chosen color scheme, if the button in front of the rst text eld displays a capital L. The L means that the colormap uses a local range which allows you to modify the range without affecting the range of the same colormap used in other modules. By pressing the button you can toggle between local and global range. The default colormap has a constant color over the whole range. By leaving it constant you give all atoms the same color, which may be useful if you want to compare different molecules. For more information, see the section on colormaps. Discrete CM
Displaying Molecules
255
This colormap is used to map values of discrete attributes, like integers and strings, to colors. Dene Color
This port can be used to overwrite the standard colors of the selected color scheme. With the All button you can set a new color for all atoms. The Clear button unsets the user-dened colors for all atoms. The Set and Unset buttons operate on the set of highlighted atoms. These buttons can be used to set and unset the colors of those atoms, respectively.
256
molecule leaves the existing selection state of all atoms unchanged except for the newly selected atoms. If the selected atoms had been selected before, they will get deselected, otherwise they will get selected. On the one hand, this allows you to add atoms to the selection, on the other hand it also allows you to deselect atoms. If you select some group and afterwards select a second one from the same level holding down the Shift-key all groups between the two will also be selected. The Shift-key can also be used in conjunction with the Ctrl-key. If you do any selection by clicking in the viewer there will be some output in the console window informing you about what you have selected, the amount of output can be customized via the Preferences dialog, which is opened by choosing the Preferences entry from the Edit menu. The preferences concerning Molecular Pack are found on the Molecules tab. Highlighting
The second way to select parts of the molecule is by using the functionality of the Highlighting port. If you press the Box button, the molecules bounding box will be displayed. All atoms contained in the box will be highlighted. You can change the size of the box in interaction mode by clicking on the highlighted handles (usually in a light green) of the box. Keep the mouse button pressed and drag in the desired direction. Notice that the box will not exceed the molecules bounding box. You can also move the box within the bounding box by clicking on one of the boxs sides. Pressing the box button a second time hides the box. After pressing the Draw button, you can draw a line in the viewer window which selects all atoms that are inside the line. Pressing the Ctrl-key while drawing inverts the selection. With the Shift-key you can remove atoms from the selection. The Clear-key deselects all atoms and hides the box if it is visible.
Displaying Molecules
257
7.3.2.2 Filtering atoms Filtering atoms gives us the ability to hide parts of the molecule for a certain module. All viewing modules and some computational modules, such as the CompMolSurface module, contain a lter that keeps track of all atoms of a molecule which are currently in use. The term in use means that the module will only see the in use atoms and regard all other atoms as non-existing. Thus, a viewing module will only display the in use atoms, and the computational module CompMolSurface will compute the molecular surface ignoring the not in use atoms. Each lter will register itself at the molecules selection browser, so that you can easily determine the in use atoms of a module. For more information about how to do this, see the description of the selection browser. In most modules, the lters Buffer port will be visible, which adds to the convenience. The functionality of the Buffer port is described below. Buffer
Pressing Add will append the selected atoms to the in use atoms. The Remove button will delete the selected atoms from the in use list. Replace will rst clear the in use list and then add the selected atoms to it. Finally, the All and Clear buttons are shortcuts to delete or add all atoms from or to the in use list, respectively. The buffer can also be accessed via tcl commands. Each visualization module using a buffer offers the following set of commands: showAll All atoms are shown. hideAll All atoms are hidden. setVisible All selected atoms will be hidden. addVisible All selected atoms will be hidden. removeVisible Only selected atoms are shown.
258
This port allows you to specify how the molecule should be aligned. The possible options are: none: Atom coordinates are left as they are. center of gravity: The molecule is positioned to the coordinate center (center of gravity) by applying a translation. align to master: This mode requires a master molecule to be connected to the AlignMaster port which is used as a reference to which other molecules,
Aligning Molecules
259
the slaves, are aligned. We consider correspondences between atoms from the reference molecule, i.e. master, and atoms from the molecule to be aligned, i.e. slave. The alignment is done by minimizing the sum of squared distances between all corresponding atoms. precomputed: This option is only enabled if the PrecomputedAlignment connection port is connected to an alignment object that has been previously computed. If precomputed is chosen, the transformation will be taken directly from this object. external: This option indicates that the molecules global transform has been explicitly set, e.g., via the Tcl command setTransform or by using the Transform Editor. Select
This port becomes important if align to master is selected. It gives control over the atoms in the slave and the master that are used for the alignment. In the general case master and slave molecules are different, i.e. their numbers of atoms differ, and an alignment requires an explicit specication of pairs of atoms. This can be done by highlighting atoms in both molecules via the MoleculeView module and then pressing the in both button. Depending on whether the option menu is set to Set or Add, the highlighted atoms will either replace an existing list of selected atoms or otherwise will be appended to it. The matching between atoms in the two molecules is dened by their order of selection. The buttons all, in slave, and in master offer shortcuts for the frequent case of slave and master having the same number of atoms including the assumption that their order denes a natural matching. The easiest way is to use all atoms by pressing all. Selection of a subset can be done by highlighting in either the slave or the master and then pressing in slave, or in master, which will use the selected atoms in the respective molecule for the other molecule, too. Selection
260
If align to master is selected, this port displays the existing state of selection that is used to compute the alignment. Possible forms are: empty: No atoms are selected. At least three are necessary for an alignment. all atoms: Master and slave have the same number of atoms and all are used for the alignment. 0, 5, 6: A list of indices implies that master and slave have the same number of atoms and identical subsets have been selected. 0 7, 5 6, 6 5: A list of index pairs (master index slave index) indicates a matching resulting from individual selections in master and slave.
and
A MolTrajectory can be visualized via animation of single time steps by attaching a Molecule module to the MolTrajectory and then attaching a MoleculeView or
261
BondAngleView to the Molecule. The animation is controlled via the Molecules Time port. For MolTrajectories that represent metastable conformations, the modules MeanMolecule, PrecomputeAlignment, and CongurationDensity can be used. The MeanMolecule module aligns all steps of a trajectory and computes a mean molecule by averaging every atomic coordinate over all time steps. Instead of computing the mean molecule to a reference, as with the MeanMolecule module, the PrecomputeAlignment module allows you to nd the optimal transformation of each time step to minimize the overall sum of squared distances. With the RankTimeStep module you can search in a trajectory for a desired time step, using different criteria, such as the rmsd value to a given reference. The CongurationDensity module gives an impression of the fuzziness of the conformation by computing a probability density for the positions of atoms and bonds within a molecular trajectory. This density can then be visualized with the Isosurface and Voltex modules.
262
certain conditions to coordinates or bond structure. These are explained in section on operators.
7.6.2 Grammar
All possible syntaxes of atom expressions are shown in the following grammar. The different literals and operators are further explained in the following sections. atomExpr ( atomExpr ) | NOT atomExpr | atomExpr AND atomExpr | atomExpr OR atomExpr | WITHIN (atomExpr,oat) | BONDED (atomExpr[,int]) | GROUP (groupParts) | CS | atomSpecier hierName/[attrName=]ID groupPart | groupPart,groupParts groupSpecier | groupSpecier [bondOrderSymbolChar] groupSpecier [!] elementSymbol index
7.6.3 Literals
As mentioned in the overview, the simplest form of an atom expression is an atom specier. An atom specier consists of three literals: hierName, the optional attrName, and ID. hierName stands for a name of a hierarchy level (e.g., residues). The following abbreviations can be used for the most common levels: a=atoms, r=residues, b=bonds, s=secondary structure, c=chains attrName is optional and species the name of an attribute (e.g., temperature, occupancy, type, ...) of the given level. If it is omitted, the ID is assumed to specify the attribute name or index as shown by the list command. If an attribute name is given, the ID is assumed to stand for values of the attribute.
Atom Expressions
263
To see which hierarchy levels and respective attributes are dened for a given molecule, take a look at the Color port which is used in several modules. The right pull-down menu will show all available attributes for the level chosen in the left pull-down menu. ID species an identier of a member of the given level. If an attribute name is given, ID species a value of this attribute. It may contain wildcards such as * (any substring will match) and ? (any single charackter will match). For integer and oat attributes ranges can be used by delimiting the boundaries with a colon (i.e. atoms/index=5:10 selects all atoms with an index within this range). If no attribute name is given, the name attribute is used as a default. In this case, specifying a range will select all atoms whose index is between the index of the selected boundaries. (as an example, for a moelcule imported form PDB the residue name is the chain identier plus the residue index, thus r/L1:L5 selects residues 1 to 5 on the L chain). An exception to this is the atoms level. Molecules in Amira contain an atomic number attribute instead of an element symbol attribute. To select atoms via their element symbol you can simply type a/element. Thus the atom specier for all oxygen atoms a/O is equivalent to the atom specier a/atomic number=8. Instead of the = comparison you can also use the comparison operators < , > , >= and <= . These, however, are only available for index, integer and oat attributes, not for string attributes. Another atom expression form involving several literals is the groupParts expression which is used with the GROUP operator. Operators will be explained in the next section.
7.6.4 Operators
Logical Operators Several atomSpecier combinations can be used in one expression by linking them logically via the operators AND, OR, and NOT (&, |, and !). Priorities can be specied using usual parentheses ( and ). WITHIN(atomExpr,float) This operator selects all atoms which are nearer than oat A to any of the atoms specied by atomExpr. BONDED(atomExpr[,int]) With this operator, all atoms that are recursively connected to any atoms specied
264
by atomExpr will be chosen. You can optionally specify an integer value dening the maximal bond steps. If this is omitted, there will be no limit. CS CS species all currently selected (highlighted) atoms. GROUP(groupParts) The GROUP operator is a powerful tool to nd functional groups by searching for a certain atom and bond pattern in the molecular graph. To dene a graph as a search pattern (groupParts), you must divide it into linear pieces of sequential atoms (a groupPart). Each atom must be dened by its element symbol and an index which distinguishes it from other atoms with the same symbol but other indices (groupSpecier). Thus, C1C2C3 would be a groupPart consisting of three different groupSpeciers representing a chain of three carbons. This group part can now be combined with another group part by using one of its groupSpeciers as branch point (e.g., C2O1H1 for a hydroxyl group branching from the second carbon of the chain). At the beginning of each group specier, there can be an optional !. If it is given, the groupSpecier is only used for matching, but the corresponding atoms will not be selected. (Thus !C1O1H1 would nd the hydroxyl groups without selecting the anking carbon, which must be given, however, to avoid selecting structures, such as OH groups in H2O). If the atomSpecier in question appears several times (to dene branch points), it is sufcient to mark it with the exclamation mark once. Consecutive atomSpeciers in a groupPart are usually not divided from each other. This means that there must be a bond of any type between the consecutive atoms. If you want to dene the bond order further, you can give an optional bondOrderSymbol. (- for a single, = for a double, # for a triple and for an aromatic bond). Take a carboxyl group as an example. To dene the group pattern, the central carbon atom (C2) needs to be connected to three atoms: two oxygens (O1, O2), and one other carbon (C1). This can be done in the following way: GROUP(!C1C2O1,C2O2H1). Thus, the hydroxyl group (O2H1) is given as a branch of the CCO chain. There are, of course, several other ways to split this branch into linear pieces which you can easily nd yourself. If your molecule contains the bond type attribute, you can also make use of the double bond. Thus the expression becomes GROUP(!C1-C2=O1,C2-O2-H1). Notice: The keywords do not need to be in capital letters. Lower case letters, even a combination of lower and upper case letters, works as well.
Atom Expressions
265
7.6.5 Shortcuts
Molecular Pack also provides pre-dened shortcuts that have been assembled using the previously mentioned syntactical elements. The shortcuts can be found in your local Amira directory in share/molecules/atomExpr.cfg, and can be edited and supplemented. The standard aliases included in the current Amira release are listed in Table 7.1.
266
acidic acyclic aliphatic alkali alkaliearth all amino aromatic at backbone basic buried cg charged cyclic h2o helix halfmetallic halogens hetero hydrophobic ions metallic neutral noblegas nonmetallic nucleic nucleicbackbone polar proteinbackbone purine pyrimidine sheet sidechain site surface turn
acidic amino acids acyclic amino acids aliphatic amino acids atoms which are alkali metals atoms which are alkali earth metals selects everything amino acids aromatic amino acids adenine or thymine atoms of protein or DNA/RNA basic amino acids amino acids which are usually found inside the protein cytosine or guanine charged amino acids cyclic amino acids water molecules helices atoms which have half metallic properties halogenic atoms heterogenic atoms hydrophobic amino acids charged heterogenic atoms atoms which have metallic properties neutral amino acids atoms which have noble gas properties atoms which have nonmetallic properties nucleic acids backbone atoms of RNA/DNA polar amino acids backbone of a polypeptide adenine or guanine cytosine or thymine sheets atoms of the protein/RNA/DNA which do not belong to the backbone amino acids which tend to be found on the surface of molecules
Atom Expressions
267
268
Part III
Chapter 8
Conguration and startup VR Pack essentials Using a multi-pipe system Using a cluster system Flat screen congurations Immersive congurations Calibrating the tracking system
Working with VR Pack: 3D user interaction, including the 3D menu Writing VR Pack custom modules Reference sections
Cong le reference The AmiraVR control module The ShowCong module The tracker emulator
272
8.0.7.2
For immersive displays with head tracking or interaction with 3D input devices, VR Pack makes use of the VRCO trackd software in order to access the tracking system and controller devices. Trackd itself is not part of VR Pack. For more information about purchasing and installing trackd, please refer to www.vrco.com or 3dviz.mc.com. Before a tracking system can be used in VR Pack the trackd daemon (and possibly a trackd server) has to be started. The trackd daemon connects to the tracking system and controller device and provides the actual tracker and controller data in two shared memory segments, which are read by Amira.
8.0.7.3 Multiple displays and parallel rendering VR Pack can use simple congurations driven by a single graphics board, possibly using several video outputs (e.g. dual-head). It also supports congurations requiring more outputs than available from a single board (tiled or arbitrary multidisplays). Having a single screen or projector per graphics board may also be preferred for performance. This can be achieved either by using a multi-pipe computer hosting multiple graphics boards (section 8.0.8), or using a cluster of computers (section 8.0.9). VR Pack manages application synchronization and OpenGL frame buffer swap synchronization for all displays, so that the same content can rendered simultaneously on each display, yet possibly with a different viewpoint. A type of stereoscopic displays relies on active shutter glasses synchronized with the display, where the left and right eye images are rendered alternatively (OpenGL quadbuffered stereo). Active stereo requires synchronizing the video signals of the whole graphics boards. This can be achieved for instance with hardware framelock/genlock as provided by NVidia G cards. Passive stereoscopy, for instance using polarizing lter glasses, does not require video frame synchronization.
273
274
modules network and all data being replicated in clusters node memory. Changes of Amira modules made on a master node will be propagated to the slave nodes as lightweight command messages and executed synchronously: therefore the master and the slaves nodes execute the same processing steps. A special daemon running on slave nodes is responsible for starting the Amira instance upon requests of the master, once a cluster conguration is selected. The 2D mouse or a 3D input device can be used to interact with the application on the master node. 8.0.9.2 Requirements All nodes of the cluster should be of the same type. If different hardware is used, it is possible that the cluster will run out-of-sync for instance because of round-off errors. Rendering speed is limited by the slowest node of the cluster, including the master node. Therefore it is recommended that all cluster nodes including the master node have the same type of graphics board. All nodes of the graphics cluster must be able to communicate with each other via a TCP/IP connection. A standard 10 Mbit ethernet connection may be fast enough, since only synchronization commands are exchanged, rather than images or raw data blocks. For active stereoscopy, the graphics cards of the different cluster nodes must be genlocked with a genlock cable. Currently only a small number of graphics cards (such as WildCat, SUN Zulu, NVidia G boards) provide genlocking. Genlocking ensures that the video refresh cycles are synchronized. VR Pack itself only synchronizes OpenGL buffer swaps. Passive stereoscopy does not require genlocking. Installation path and data location. When Amira loads scripts or data below its installation directory, the relative path on the master is rooted to Amira installation directory on slaves. For instance, /master-path/Amira/data/xxx is translated into /slave-path/Amira/data/xxx. However it is highly recommended that all data les and scripts have the same absolute le path on all nodes of the cluster. Likewise, Amira should be installed at the same location on all nodes. For convenience, it is recommended to run Amira from a shared mounted le system. This ensures that the same scripts and cong les will be used on all cluster nodes. On a Linux or UNIX cluster, it is recommended to have a shared home direc-
275
tory. This ensures that some modules have consistent access to preferences settings stored in .AmiraRegistry. 8.0.9.3 Preparting cluster slave nodes Amira requires a daemon process to run on each slave node. This sections explains how this can be achieved automatically or manually. Using the Amira service Amira can manage services for automatic start-up of daemon processes such as the VR Pack daemon or the TeamWork Pack server. You may request installation of services during Amira installation, or you can control the services with a dedicated utility program provided with Amira. Note: To manage the Amira services, you must have administrator privileges (Windows) or root privileges (UNIX/Linux).
Just launch bin\arch-...-Optimize\hxservicemanager.exe on Windows, and bin/start -servicemanager on Linux. This tool manages VR Pack and TeamWork Pack services execution. Indeed, instead of the user launching the VR Pack daemon or the TeamWork Pack server manually, a service can be installed on the system so that it automatically starts these processes at system start-up. In order to install and start a service, click on the Start button. Then, clicking on the Stop button will stop and uninstall the service. Platform-dependent notes On Windows platforms: Once installed, services can be started or stopped from the services manager of the system that can be launched via the Control Panel (select Administrative tools, then Services) or with the following command: services.msc /s. To start an Amira service, select it in the list (hxvrdaemon or hxteamworkserver), then select Start from the Action menu. To restart the service, select it in the list, then select Restart from the
276
Action menu. To stop the service, select it in the list, then select Stop from the Action menu. Warning about virtual drives: Amira services does not support logical or network volumes. Indeed, such virtual drives do not exist in the service execution context. You must specify full paths constructed according to the universal naming convention (UNC), such as \\remotemachine\directory. For example, to install the service from a virtual drive S: targeting a distant mount point \\remotemachine\directory, do not launch the installer from S:, but from \\remotemachine\directory. Then, for the same reason, the user should not load data from virtual drives because Amira slaves cannot resolve virtual paths unless they are below %AMIRA ROOT%, in which case data paths are re-interpreted on slaves with
277
the local %AMIRA ROOT%. On Unix/Linux platforms: Amira services are implemented as daemons, started from the /etc/init.d directory. Once installed, services can be manually started or stopped using the appropriate script. For example, type /etc/init.d/hxvrdaemon stop to stop the VR Pack daemon. Note that this will not uninstall the daemon, that will be launched on next system start-up (or next init 5 mode switch in particular). One specic feature of Amira services on Linux platforms is that they can be executed as a given user, other than root. To do so, just type a valid login in the user eld, then restart the service to take the change into account. One other specic feature is that VR Pack daemons can installed on remote nodes of a cluster from the master node, provided the fact that %AMIRA ROOT% is the same on every machines. Just type the list of the nodes hostnames separated by space chars. Make sure that ssh is installed on all machines and congured to use RSA authentication protocol (public and private key les) so that you will not be prompted for password on any operation. Running daemon or server manually If the Amira service cannot be used for some reason, on can use manual start : For VR Pack: on Linux start Amira with command line option-clusterdaemon, on Windows start hxvrdaemon.exe For TeamWork Pack: launch the executable bin/arch-...Optimize/hxteamworkserver.exe on Windows or bin/start -teamworkserver on Linux On Windows, to start a daemon automatically after the computer is booted, a shortcut to the daemon executable can be added to the Start/Programs/Startup folder. 8.0.9.4 Running VR Pack on cluster The following steps are required to use cluster congurations: 1. Install VR Pack on every node of the graphics cluster under the same ab-
278
solute path name, or better yet, create a mounted le system with the same absolute path name on every node. 2. Create a standard VR Pack cong le describing the geometry of your display system (see the next sections about congurations). Then add a eld hostname in each screen section. This eld indicates on which node the screen will be rendered. The cong le must be stored on all nodes in the directory $AMIRA ROOT/share/config/vr. 3. Choose one node as the master node. After Amira installation, a daemon is started on the slave nodes, by a service on Windows systems or by inetd on Unix/Linux systems. Start VR Pack on the master and select your cluster conguration from the cong menu. Slave instances of VR Pack should now be started on all nodes specied in the cong le. To use the -clusterdaemon option, stop the daemon (see 8.0.9.3service management) and replace step 3 by the following steps: 1. Choose one node as the master node. On all other nodes start Amira with the command line option -clusterdaemon. With this option a little daemon is started, to which the master process can talk. The daemon automatically starts a slave instance of the real Amira if necessary. 2. Start VR Pack on the master node. Then select your cluster conguration from the cong menu. Slave instances of VR Pack should now be started on all nodes specied in the cong le. 3. Next you can load any standard Amira network script. For example, open the online help browser on the master node and choose one of the standard VR Pack tracking demos. The particular script will be loaded on all slaves as well. Once a script has been loaded, all standard VR Pack interaction modes are available in cluster mode too. 8.0.9.5 Limitations The primary focus of the VR Pack cluster version is on working in a VR environment. Consequently all manipulations performed in VR mode, e.g., via the 3D menu, will be properly synchronized. On the other hand, currently not all manipulations made on the master node via the conventional 2D user interface will be synchronized. Any kind of 2D mouse interaction in a 3D viewer window also will not be
279
synchronized in cluster mode. Thus you cannot draw a lasso area with the 2D mouse. Mouse manipulation and interaction are entirely disabled on slaves nodes. Transform editors and clip planes are synchronized in cluster mode, while other editors may be grayed out and not accessible. When loading a new cluster conguration le, Amira attempts to send the current network to slaves nodes for reloading after they are restarted. Data should be duplicated or shared in order to have the same path relative to script. This may also fail if default directory for temporary les are not the same path on master and slaves. You may check TMPDIR, TEMP or TMP environment variable depending on your system. 8.0.9.6 Troubleshooting cluster congurations Check that cluster slaves can be reached from master. ping <slave-hostname> or ping <slave-IP-adress> You can change hostnames with IP adresses in the conguration le. Check that cluster master can be reached from slave with master hostname with ping <master-hostname>. Otherwise, on the master node you can set the environment variable AMIRA HOSTNAME to the master hostname or IP address that can be used from slaves to reach the master. Check that Amira runs properly on each slaves. You may need to switch keyboard and mouse to each slave nodes for checking. You may rst try hint below. In order to show and check console output on slaves, you can reduce the channel size in SoScreen, and add in the conguration le: SoVRProperty { showSlaveConsole TRUE showSlaveGUI TRUE showSlaveCursor TRUE } showSlaveCursor should be set if you wish to use a mouse connected to a slave node. It is recommended to have one and only one screen dened for the master in the conguration le (SoScreen without specied hostname). Use SoVR-
280
Property with keepMasterViewerInsideGUI eld for convenience. Do not mix at and immersive screen denitions. Make sure that no rewall limits communication within the cluster (port 17234 and dynamic port are used).
281
A two-channel passive stereo conguration A super-wide conguration with soft-edge blending A tiled four-channel 2x2 monitor conguration
282
#Inventor V2.1 ascii Separator { SoScreen { name channelOrigin channelSize tileOrigin tileSize cameraMode } SoScreen { name channelOrigin channelSize tileOrigin tileSize cameraMode } }
The elds channelOrigin and channelSize indicate that the two windows exactly cover the left half and the right half of the desktop. The elds tileOrigin and tileSize indicate that both screens should display the full viewer window, i.e., there is no tiling at all. Finally, the eld cameraMode indicates that one screen should display the left eye view and the other the right eye view. Note that the graphics computer need not to support active stereo for this conguration. Controlling stereoscopy The AmiraVR module provides ports in order to change the default stereo parameters eye offset and stereo balance.
Here <offset> denotes the eye offset and <balance> denotes the stereo balance, i.e., the location of the zero parallax plane. Depending on the balance value objects appear to be in front of the projection screen or behind it.
283
The following standard Amira Tcl command can also be used: viewer 0 setStereo [-b <balance>] <offset> Active-to-passive conguration The simple conguration above may not be convenient if you often need to manipulate 2D user interface, windows and mouse cursor. Because these are displayed only once on the desktop, they are visible only on one eye and ghosted because or superimposed other image. Some graphics boards or special hardware support active stereo with conversion to passive stereo, automatically replicating desktop 2D users interface on both outputs. On Windows, you may check in the display properties panel the available settings of you graphics board for stereoscopy. On Linux, you may add active-to-passive settings in your X11 conguration, for instance in /etc/X11/XFree86Cong or /etc/X11/Xorg.conf, depending on your specic system and graphics board. It may look like this: Option "TwinView" "True" Option "TwinViewOrientation" "Clone" Option "Stereo" "4" Cluster congurations Here is a conguration for cluster, with 2 nodes. The graphics boards can be congured for single head way with full desktop used for each eye channel. The rendering performance can be dramatically improved as each graphics board has to render only half of the frames as compared to the dual-head conguration above. One of the nodes is used as master: the master Amira is started on the master node, where the used mouse and keyboard are attached. You can notice that the hostname doesnt need to be specied for the masters screen. Also the default channel and tile origin and size (0 0 and 1 1) are used for full scene display on full screen. #Inventor V2.1 ascii Separator { SoScreen { name
284
cameraMode LEFT_VIEW } SoScreen { name "Right eye view" hostname "slave.cluster" cameraMode RIGHT_VIEW } } Here is a conguration for cluster with 3 nodes. A third node is used as separate master, with default MONOSCOPIC cameraMode. The manipulations of 2D user interface will then be invisible in the left/right projected screen. The keepMasterViewerInsideGUI eld is used for convenience to force the master screen within a standard viewer window (then specifying channel size and origin would have no effect on the master). #Inventor V2.1 ascii Separator { SoVRProperty { keepMasterViewerInsideGUI TRUE } SoScreen { name "Master view" } SoScreen { name "Left eye view" hostname "slave1.cluster" cameraMode LEFT_VIEW } SoScreen { name "Right eye view" hostname "slave2.cluster" cameraMode RIGHT_VIEW } }
285
286
#Inventor V2.1 ascii Separator { SoScreen { name channelOrigin channelSize tileOrigin tileSize softEdgeOverlap softEdgeGamma } SoScreen { name channelOrigin channelSize tileOrigin tileSize softEdgeOverlap softEdgeGamma } }
The elds channelOrigin and channelSize indicate that the two windows exactly cover the left half and the right half of the desktop. The elds tileOrigin and tileSize indicate that both screens display an area of 0.6 times the width of the full tiled window. The rst screen displays the left half of that window, the second screen displays the right half. How to compute tileOrigin and tileSize elds ? The elds tileOrigin and tileSize dene to the portion of the full view volume, i.e. of the total virtual big screen, to be mapped onto a specic screen. Therefore, if width is the pixel width of one projector, overlap the amount of overlapping pixels, and n the number of projectors, the total pixel width of the screen is: total = (width - overlap)*(n-1) + width Then: tileSize x = width / total tileOrigin x = screen-index * (width - overlap) / total
287
Soft-edge blending elds The eld softEdgeOverlap species the relative width of the soft-edge region at the left, right, bottom, and top border of the screen. For the rst screen there is a 20 percent soft-edge region at the right border, for the second screen there is a 20 percent soft-edge region at the left border. Finally, the eld softEdgeGamma species the gamma factor for the soft-edge region. The gamma factor determines how the fading from full intensity to black is done. A gamma factor of one means a linear transition in terms of RGB values. However, since RGB values are usually not mapped linearly to light intensity by the video projector often a decrease of overall light intensity is observed in the overlap region. In order to compensate for this a gamma factor larger than one can be used. In order to facilitate the initial calibration of a super-wide projection system with soft-edge blending the AmiraVR module provides a special-purpose Tcl command setSoftEdge. This command is used in the following way: VRSettings setSoftEdge -g <gamma> <overlap> [<overlap>...] This command automatically creates a two-screen conguration similar to the one above. However, the correct values for tileSize, tileOrigin, and softEdgeOverlap are computed automatically from the relative overlap value. By gradually adapting this value the correct settings for a given but unknown setup of the projection system can be easily found. Curved screen displays Tiled display congurations are most often ne for curved displays, which are then handled like at displays. Immersive display conguration tting the actual screen geometry is required for using stereo with head tracking. Projection onto cylindrical or semi-spherical surfaces may also introduce some barrel-shaped distortions. Some special warping hardware can compensate such distortion.
288
monitors or projectors can be used. For some purposes it is useful to have a single viewer subdivided into 2x2 parts and each part being displayed by a different monitor. Such a conguration can be easily created using VR Pack. We assume that the graphics computer has two pipes with two channels each. The two pipes are congured as two separate X11 screens, :0.0 and :0.1. The left and right part of each screen is output on the two different channels of the particular pipe. Then the conguration les looks as follows: #Inventor V2.1 ascii Separator { SoScreen { name "Upper left monitor" display ":0.0" channelOrigin 0 0 channelSize 0.5 1 tileOrigin 0 0.5 tileSize 0.5 0.5 threadGroup 0 } SoScreen { name "Upper right monitor" display ":0.0" channelOrigin 0.5 0 channelSize 0.5 1 tileOrigin 0.5 0.5 tileSize 0.5 0.5 threadGroup 0 } SoScreen { name "Lower left monitor" display ":0.1" channelOrigin 0 0 channelSize 0.5 1 tileOrigin 0 0 tileSize 0.5 0.5 threadGroup 1
289
} SoScreen { name "Lower right monitor" display ":0.1" channelOrigin 0.5 1 channelSize 0.5 1 tileOrigin 0.5 0 tileSize 0.5 0.5 threadGroup 1 } } Multi-pipe rendering Since the two X11 screens :0.0 and :0.1 are driven by two independent graphics pipes it makes sense to perform the rendering on these pipes in parallel. This is done by assigning the corresponding screens two different thread groups. Note that for all common current graphics architectures it makes no sense to render multiple windows on the same pipe in parallel. Typically, this even implies a signicant performance decrease. Therefore, here we use only two thread groups instead of four. In order to actually activate parallel rendering Amira must be started with the command line option -mt. Alternatively, the environment variable AMIRA MULTITHREAD can be dened.
290
or on a Holobench. In fact, VR Pack supports any other oblique arrangement as well. Since the 3D position of the observer need to be known in order to compute correct perspective views, usually the observers eye position is tracked in an immersive environment. In VR Pack this so-called head tracking can be achieved using a variety of different tracking systems. Instead of accessing the tracking system directly an intermediate software layer is used, namely the trackd software of VRCO. trackd runs as a server, communicates with the tracking system, and stores the tracking data in a shared-memory areas which then is read by VR Pack. Using a second sensor not only the observers eye position can be tracked, but also the position of a virtual wand, i.e., a kind of pointing or interaction device to be held in a hand. For large planar screen congurations it sometimes also makes sense to use a virtual wand without head tracking. The images then will always be computed for a xed observers eye position and possible image icker due to noise in the tracking data is avoided, which is an advantage for 3D demonstrations in front of a larger audience. Obviously, immersive congurations are more difcult to setup than at screen congurations. Besides dening a suitable VR Pack conguration le, also the tracking system and the trackd daemon have to be properly initialized. Finally, the tracking system has to be calibrated for use with VR Pack. In the following sections we rst want to present some example cong les for common immersive environments. In particular cong les for a single-wall workbench, for a doublewall Holobench, and for a four-sided CAVE shall be discussed. The process of calibrating the tracking system and customizing 3D user interaction is described in subsequent sections. A Workbench conguration A Holobench conguration A CAVE conguration
291
fully horizontal and fully vertical position. For VR Pack there is no difference between these congurations, as long as the tracking system is calibrated in the right way. Traditionally a workbench is driven by a CRT projector using active stereo. However, today also passive stereo systems based on two LCD or DLP projectors become more common. In the cong le below we assume that an active stereo system is used, or that a passive stereo system is connected via an appropriate signal splitter. This means that the workbench can be used with any standard stereo-capable graphics computer. No dual-head or multi-pipe computer is necessary. An example of a single-screen workbench is shown in Figure 8.4. An VR Pack cong le for driving a single-screen immersive workbench with a tracked 3D input device but without head tracking is listed below. Instead of actually tracking the observers eye position in this case a xed default camera position is used. This can be useful for demonstrations in front of small or medium-size groups, since it produces less dget images. In addition, it saves a second sensor for the tracking system. #Inventor V2.1 ascii Separator { SoScreen {
292
} SoTracker { server "4147:4148" autoConnect TRUE wandTrackerId 0 headTrackerId -1 defaultCameraPosition 85 65 140 defaultObjectPosition 85 65 0 referencePoints [ 0 0 0, 170 0 0, 170 130 0, 0 130 0 } } Single screen conguration In the SoScreen section of the cong le the physical coordinates of the four corners of the workbench are dened. This can be done using an arbitrary righthanded coordinate system with arbitrary units. In this case the coordinates might be specied in centimeters. The origin of the coordinate system was chosen in the lower left corner of the screen. By default, a full-screen graphics window is opened when activating this conguration. The eld cameraMode indicates that the graphics window should be opened in active stereo mode by default. Tracking system conguration In the SoTracker section of the cong le the tracking system is described. First the shared memory ids of the trackd daemon as specied in the trackd.conf le are listed. The syntax is Id-of-controller-reader:Id-of-tracker-reader. For more information about setting up trackd please refer to section 8.0.18. The autoConnect eld indicates that a connection to the trackd server should be established automatically as soon as the conguration is activated. wandTrackerId denotes the trackd sensor id of the 3D input device. Head tracking is disabled by setting headTrackerId to -1. Instead the default camera position set in the line below is used. This position must be specied using the same coordinate system as
293
the screen. In this case the camera is located 140 cm in front of the screens center. The default object position is the position where the scene is placed by default (or whenever a view all request comes from the viewer). At the end of the cong le four reference points are specied, namely the four corners of the screen. Before the conguration can be actually used, the tracking system has to be calibrated (see section 8.0.18). This is done by placing the input device at the reference points and clicking an input button. Once the tracking system is calibrated, the cong le should be written by clicking the write cong button of the AmiraVR control module. The new cong le will contain the same information listed above, but in addition it will also contain some calibration data, e.g., the transformation between raw tracker coordinates and screen coordinates.
294
} SoScreen { name "Horizontal Screen (rotated)" lowerLeft 180 0 0 lowerRight 0 0 0 upperRight 0 0 110 upperLeft 180 0 110 channelOrigin 0.5 0 channelSize 0.5 1 cameraMode ACTIVE_STEREO } SoTracker { server "4147:4148" autoConnect TRUE wandTrackerId 1 headTrackerId 0 leftEyeOffset 6 0 0 rightEyeOffset 13 0 0 defaultCameraPosition 90 55 110 defaultObjectPosition 90 20 20 referencePoints [ 60 0 110, 120 0 110, 120 0 55, 60 0 } } Display conguration In the two SoScreen sections of the cong le the geometry of the Holobench is described by specifying the physical coordinates of the four corners of each screen. An arbitrary right-handed coordinate system with arbitrary units can be chosen. Here the coordinates are specied in centimetres and the origin was put
295
in the lower left corner of the vertical screen. Notice, that the horizontal screen was rotated by 180 degrees with respect to the vertical screen. I.e., instead of the upper left corner the lower right corner of the horizontal screen is located at the origin. This is because the horizontal image of a Holobench is usually projected that way. If the corresponding lower scan-lines of the two images meet at the border between the two screens artifacts due to delayed response of the active shutter glasses are avoided. The elds channelOrigin and channelSize indicate that the graphics window for the vertical screen should be opened on the left half of the desktop, while the graphics window for the horizontal screen should be opened on the right half. Both windows are opened in stereo mode by default as specied by cameraMode. Tracking system conguration In the SoTracker section of the cong le the tracking system is described. First the shared memory ids of the trackd daemon as specied in the trackd.conf le are listed. The syntax is Id-of-controller-reader:Id-of-tracker-reader. For more information about setting up trackd please refer to section 8.0.18. The autoConnect eld indicates that a connection to the trackd daemon should be established automatically as soon as the conguration is activated. wandTrackerId denotes the trackd sensor id of the 3D input device. headTrackerId denotes the trackd sensor id of the head sensor which is usually mounted at the shutter glasses. The elds leftEyeOffset and rightEyeOffset specify the actual position of the eyes with respect to the head sensor. Standing in front of the Holobench the x-axis points horizontally to the right, the y-axis points upwards, and the z-axis points towards the observer. In this case we assume the head sensor to be mounted on the left side of the glasses since both left and right eye have a positive offset in x-direction. The AmiraVR control module allows for interactive adjustment of the eye offset.
The default camera position and the default object position both are specied in the same coordinate system as the screens. The default camera position is only used if the tracking system is disconnected. The default object position is the position where the scene is placed by default (or whenever a view all request comes from
296
the viewer). At the end of the cong le four reference points are specied, namely four points on the horizontal screen. Before the conguration can be actually used, the tracking system has to be calibrated (see section 8.0.18). This is done by placing the input device at the reference points and clicking an input button. The reference points were chosen so that they can be easily accessed with the hand. In addition, it is important that the points are well inside the operating range of the tracking system. During calibration the raw coordinates of the wand sensor are displayed, so you can check if these values are reasonable. Once the tracking system is calibrated, the cong le should be written by clicking the write cong button of the AmiraVR control module. The new cong le will contain the same information listed above, but in addition it will also contain some calibration data, e.g., the transformation between raw tracker coordinates and screen coordinates.
297
SoScreen { name display lowerLeft lowerRight upperRight upperLeft channelOrigin channelSize cameraMode threadGroup } SoScreen { name display lowerLeft lowerRight upperRight upperLeft channelOrigin channelSize # # # #
If the bottom image is rotated try this: lowerLeft 300 0 0 lowerRight 0 0 0 upperRight 0 0 300
298
} SoScreen { name "Left" display ":0.1" lowerLeft 0 0 300 lowerRight 0 0 0 upperRight 0 300 0 upperLeft 0 300 300 channelOrigin 0 0 channelSize 0.5 1 cameraMode ACTIVE_STEREO threadGroup 1 } SoScreen { name "Right" display ":0.1" lowerLeft 300 0 0 lowerRight 300 0 300 upperRight 300 300 300 upperLeft 300 300 0 channelOrigin 0.5 0 channelSize 0.5 1 cameraMode ACTIVE_STEREO threadGroup 1 } SoTracker { server "4147:4148" autoConnect TRUE wandTrackerId 1 headTrackerId 0 leftEyeOffset 6 0 0 rightEyeOffset 13 0 0 defaultCameraPosition 50 50 100 defaultObjectPosition 50 50 0 referencePoints [ 0 150 100, 0 150 100, 100 150 0, 200 150 0, 300 150 100 ] } }
299
300
system). Also make sure that the trackd software and the tracking system itself are setup in the right way. Troubleshooting the tracker A number of factors can affect the tracking system and the returned sensors coordinates, and should be kept in mind when calibrating and using VR Pack, in particular for choosing the reference points used for calibration. Here is summary of the most common possible issues: Range. Symptom: instable or wrong tracker coordinates. The calibration reference points or working area may be too far away or hidden from the tracking system. You may check the physical range of your device. You may need to choose reference points closer to tracker, or off the screen(s), for instance using ruler to offset in front of the screen. Hemisphere. Symptom: mirrored coordinates along one axis, reversed rotations after calibration You should make sure that the tracker coordinates are reported in a righthanded coordinate system. Many electromagnetic tracking systems cannot distinguish between two opposite hemispheres. In the trackd.conf le you have to specify in which hemisphere you want to operate (e.g. +x, -z..., relative to emitter antenna orientation). If the wrong hemisphere is specied a left-handed coordinate system is used, which cannot be correctly calibrated in Amira. Magnetic perturbation. Symptom: instable/wrong coordinates. With electro-magnetic tracking systems you should avoid calibrating and working too close to metallic parts such as ferro-magnetic screen frames or sources of magnetic elds such as CRT display monitors. You may need to offset reference points off the screen. Acoustic perturbation. Symptom: instable/wrong coordinates. With acoustic or hybrid tracking systems, you may need to avoid calibrating and working too close from emitters/receivers. You may need to offset reference points off the screen. Optical perturbation. Symptom: inaccurate coordinates, intermittent or no detection. With optical trackers, some possible issues are occlusion, loss of accuracy at the limits of view eld, insufcient or excessive lighting. Depending on cameras location, you may need to offset reference points off the screen.
301
Sensor connection. Symptom: no coordinate change, or exchanged head/wand sensors. The serial port can be disconnected or busy (check system conguration). Wrong head or wand sensor identier may be specied in conguration le (headTrackerId, wandTrackerId). Amira can display on the screen coordinates and button status for checking. Heat. Symptom: intermittent failures. Some hardware may become unstable with excessive heat. Make sure cooling is sufcient. Report rate. Symptom: irregular moves. Report rate from trackd may need to be lowered with slow computers or increased for better accuracy. The symptom can also relate to graphics performance, with large data and low end hardware. Remember that using a multi-pipe or cluster rendering system can accelerate performance. Tracking conguration examples The VRCOs trackd daemon is used to collect device input for Amira. It is typically started with: trackd [-file <trackd-configuration-file>] (trackd.conf by default). Please refer to the trackd documentation for details on how to use and congure trackd. Here is an example of trackd.conf conguration le:
#----------------------------------------------------------------------------DefineDevice FOB fobirds 2 # Device: e.g. Ascensions Flock-of-Birds DeviceOption FOB srt 1 # standalone box (device-specific option) DeviceOption FOB port com1 # device attached to serial port com1 DeviceOption FOB baud 38400 # device communication baud rate DeviceOption FOB reset yes # reset device at start (optional, delays DeviceOption FOB mouse 1 # use 3D mouse controller (device-specifi DeviceOption FOB hemisphere +x # working hemisphere DeviceOption FOB reportrate 2 # sampling factor (device-specific, optio #Defines output DefineConnector ConnectorOption ConnectorOption for tracker info (head Shm1 shm out 2 # Shm1 key 4148 # Shm1 data tracker #
and wand position+orientation): report 2 sensors to application tracker shared memory key position+orientation for each sensor de
302
DefineConnector Shm2 shm out 1 # report 1 controller to application ConnectorOption Shm2 key 4147 # controller shared memory key ConnectorOption Shm2 data controller # buttons+valuators state for each cont #---------------------------------------------------------------------------
Here is an example of Amira VR conguration with corresponding tracking information: Separator { SoScreen { name "desk" lowerLeft 0 0 0 lowerRight 170 0 0 upperRight 170 130 0 upperLeft 0 130 0 cameraMode ACTIVE_STEREO } SoTracker { server "4127:4126" wandTrackerId 0 headTrackerId 1 defaultCameraPosition 85 65 140 defaultObjectPosition 85 65 0 referencePoints [ 0 0 0, 170 0 0, 170 130 0, 0 130 0 } } Notice the shared memory keys specied in server eld, corresponding to those specied in the trackd.conf le above The wandTrackerId and headTrackerId must correspond to the trackers sensors actually used for head and wand. Reference points for calibration are located at the corners of the screen. One should make sure that these points can be properly reach by the tracking system. Some trackd tips trackd -status displays conguration information, then once per second the
303
device inputs such as coordinates, orientation, buttons state.... Notice that Amira can also report tracker coordinates on the screen (see below). Input devices can be attached to remote machines. A trackd server can then fowards inputs to the trackd daemon running on the application machine, for which the trackd license must be set. trackd supports DirectX devices (mouses, 3D joysticks, etc...). Notice that device name can be dependent on international language used on your computer. A controller device can be used to emulate a tracker. 8.0.18.3 Calibration step by step Here is a complete step-by-step description of the calibration process. 1. Make sure that the trackd software is running and that the tracking system is operating. 2. Start Amira and choose the appropriate conguration from the main windows VR menu. 3. In the AmiraVR control module, connect to the tracking system if necessary. Activate the values toggle in order to display the current 3D coordinates in the upper left corner of the main screen. Make sure that the coordinates are changing if you move the 3D input device and the head sensor (unless head tracking is disabled in the VR Pack cong le). Also make sure that the button status changes if you press a button of the 3D input device. Note: Unless you are in calibration mode the coordinates reported by the values option are transformed coordinates, i.e., they are in the same coordinate system in which the screens in the cong le have been dened. Hint: If the wand tracker and the head tracker seem to be exchanged modify the elds wandTrackerId and headTrackerId in the VR Pack cong le. 4. Click the Calibrate button of the AmiraVR control module. You are now in calibration mode. A xed 2D control grid is displayed on all screens. You are requested to click at the rst reference point (highlighted in red). In the current version of VR Pack, the control grid is not guaranteed to match the actual reference points. However, you could choose the reference points in the cong le to be at the corners of the control grid (one third
304
and two thirds of the screen width in horizontal direction, one half of the screen height in vertical direction). Besides the number of the reference point its coordinates as specied in the cong le are displayed in the upper left corner of the main screen. Now move the 3D input device at the rst reference point and click any button of the device. Note: Make sure that the raw tracker coordinates which are displayed in the upper left corner of the main screen are valid at the reference point. Some devices just report zero values if the sensor is outside the operating range of the tracking system. Some other devices report non-sense values, typically with large oscillations. If you dont get stable values at a reference point, choose some other point in the VR Pack cong le. 5. Next you are asked to click at second reference point using the 3D input device. Repeat the above procedure until all reference points have been located. Note: If less than three different reference points are specied in the cong le, then by default the upper left, lower left, and lower right corners of the rst screen are used as reference points. You may want to specify other reference points or a larger number of reference points in order to improve accuracy. The reference points must not lie all on one line. However, they may well be located in a common plane, e.g., in the plane of the main screen. 6. Next, you need to align the glasses for head tracking. However, if head tracking is disabled in the VR Pack cong le, this step is omitted. Align the glasses parallel to the x-axis of the screen coordinate system. Usually the x-axis will oriented horizontally with respect to the front screen of the display system. The up-direction of the glasses should be aligned parallel to the y-axis of the screen coordinate system. Usually the y-axis will be oriented vertically with respect to the front screen. Once you have aligned the glasses click any button of the 3D input device. 7. Now camera calibration is done and correct stereoscopic images should be displayed. As a nal step you are requested to pick the wand in order to dene the wand offset. The wand avatar is displayed half-way between the current eye position (or the default camera position, if head tracking is dis-
305
abled) and the default object position. Now move the 3D input device near the origin of the wand (or at any other position) and click any button. The virtual wand remains stuck to the 3D input device in exactly that position. You can repeat this last calibration step any time by clicking on the pick wand button of the AmiraVR module. Hint: If you dont get a clear 3D image of the wand make sure left and right eye images are not exchanged. If the eyes are exchanged you get a result which somehow also looks 3D but which isnt comfortable to work with at all. Also make sure that the elds leftEyeOffset and rightEyeOffset are set correctly in the cong le. You can optionally tune stereo eye offset with AmiraVR control module. 8. At this point, the calibration is nished. You may now want to write a new VR Pack cong le (or to overwrite the original one) in order to save the calibration data permanently. This can be achieved most easily by pressing the write cong button of the AmiraVR control module. Pressing this button causes the Amira le browser to be activated. You can accept the name of the previous cong le or choose a new one. When reloading the new conguration calibrated tracker data will be generated automatically. You can verify the correctness of the calibration process by turning on the values toggle and moving the 3D input device to one of the reference points. The reported values should be almost the same as the coordinates of the reference point specied in the cong le. Manual calibration In some case you may want to enter directly in the conguration le the calibration information corresponding to the dened reference points. The calibration eld contains the tracker coordinates for 3 points with following coordinates relative to the screens reference dened by: origin x=0 y=0 z=0 point1 x=X y=0 z=0, where X is the physical width of the rst screen in cong le point2 x=0 y=1 z=0 For instance considering a screen of 170x130 cm, with tracker origin located in the center/botton of the screen and tracker coordinates reported in meters, with same axis x, y, z. - ReferencePoints: [0 0 0, 170 0 0, 170 130 0, 0 130 0] - Corresponding tracker coordinates: [0 0 0, 17 0 0, 17 13 0, 0 13 0]
306
- Resulting calibration eld: calibration [0 0 0, 17 0 0, 0 0.1 0] Checking immersive displays Here are some further hints for checking whether the immersive system is congured and working properly when used with stereo and head tracking: Does the virtual wand avatar follow the actual wand rotations ? With electromagnetic tracker, if rotations look wrong or reversed along some axis, the wand has probably crossed the trackers working hemisphere when calibrating. Change the working hemisphere in trackd.conf and calibrate again. Stereo disparity, reversed eyes ? If stereo effect looks too strong, uncomfortable or inconsistent, check screen coordinates in the conguration le and eye offset in conguration le or with the AmiraVR module. For reversed eyes you may either change eye offsets, or change your systems display properties, e.g. stereo reverse eyes in display control panel. Is the plane of projection located on the physical screen ? The screen projection of virtual objects located behind physical screen should look smaller as eyes get closer to the screen. Projection of virtual points located on the physical screen shouldnt move as eyes are moving. Otherwise check screen coordinates and tracker calibration. With multiple screens, do straight lines keep straight across screen edges ? Otherwise check screen coordinates, calibration, tracking, eye offset. Does wand avatar follow the sensor ? Otherwise check calibration and screen coordinates.
307
vided allowing the user to control the conventional 2D mouse pointer using the tracked 3D mouse. In the following these features will be described in more detail. In order to utilize 3D user interaction a tracked 3D input device with at least one button is required. By default Amira only interprets a single button. The easiest way to make use of additional buttons is to associate Tcl procedures with these buttons. This is described below in a section about Tcl event procedures.
The 3D menu User-dened 3D menu items 3D module controls Navigation modes Tcl event procedures The 2D mouse mode
308
Figure 8.6: VR Pack scene with 3D menu on the left and 3D user interface of the SurfaceView module on the right.
You can move the menu by pointing the wand on the blue header labeled 3D menu, clicking the main button of the 3D input device, and then moving the device while keeping the button pressed. When the wand is on the blue header a yellow frame is displayed, indicating that this element has focus. If you pop up the menu using the 3D menu toggle, the menu position will be reset to its default. In contrast, if you pop up the menu by double-clicking the 3D mouse button, the menu will be shown at its current position. In order to hide the menu again, click the red close button at the right side of the blue header element. Double-clicking the 3D input device again pops up the menu at its previous position. The 3D menu will also be available as an ordinary 2D sub-menu under the VR menu of the Amira main window. The 2D menu has the same structure as the 3D menu, and choosing an item from the 2D menu triggers the same actions as choosing an item from the 3D menu. This feature allows you to prepare and test a 3D menu on an ordinary desktop computer without an attached tracking system.
309
Calling the menu method with special parameters allows the user to add individual buttons or submenus to the main 3D menu. Each button or submenu has an id. This id can be used to modify the particular element afterwards. Whenever a button is pressed, a user-dened Tcl procedure is invoked. An example of how to create a two-level menu hierarchy is shown below. This example is taken from the le $AMIRA ROOT/share/demo/tracking/demomenu.hx contained in the VR Pack demo section. You can execute that script in order to see how the user-dened buttons work.
menu reset menu menu menu menu menu menu menu menu menu insertMenu insertMenu insertMenu insertMenu 0 0 0 0 0 -id -id -id -id 0 1 2 3 -text -text -text -text 0 1 2 4 5 "Medical" "Flow Dynamics" "Reconstruction" "Multi-Channel" "CT Slices" -proc "Menu0" "Isosurface" -proc "Menu0" "Surface model" -proc "Menu0" "Oblique slice" -proc "Menu0" "Pseudo-color" -proc "Menu0"
menu 1 insertItem -id 0 -text "Wing" -proc "Menu1" menu 1 insertItem -id 1 -text "Turbine ISL" -proc "Menu1" menu 1 insertItem -id 2 -text "Turbine LIC" -proc "Menu1" menu 2 insertItem -id 0 -text "Slice & Isosurface" -proc "Menu2" menu 2 insertItem -id 1 -text "Volume Rendering" -proc "Menu2" menu 2 insertItem -id 2 -text "Simplified Surface" -proc "Menu2" menu menu menu menu 3 3 3 3 insertItem insertItem insertItem insertItem -id -id -id -id 0 1 2 3 -text -text -text -text "Projection view" -proc "Menu3" "Slicing" -proc "Menu3" "Isosurface" -proc "Menu3" "Volume Rendering" -proc "Menu3"
proc Menu0 { id } { global AMIRA_ROOT switch $id \ 0 { load $AMIRA_ROOT/share/demo/medical/ctstack.hx } \ 1 { load $AMIRA_ROOT/share/demo/medical/isosurface.hx } \
310
2 3 4 5 6 }
{ { { { {
proc Menu1 { id } { global AMIRA_ROOT switch $id \ 0 { load $AMIRA_ROOT/share/demo/cfd/wing.hx } \ 1 { load $AMIRA_ROOT/share/demo/cfd/turbine-isl.hx } \ 2 { load $AMIRA_ROOT/share/demo/cfd/turbine-lic.hx } } proc Menu2 { id } { global AMIRA_ROOT switch $id \ 0 { load $AMIRA_ROOT/share/demo/recon/recon01.hx } \ 1 { load $AMIRA_ROOT/share/demo/recon/recon05.hx } \ 2 { load $AMIRA_ROOT/share/demo/recon/recon04.hx } }
proc Menu3 { id } { global AMIRA_ROOT switch $id \ 0 { load $AMIRA_ROOT/share/demo/multichannel/projectionview. 1 { load $AMIRA_ROOT/share/demo/multichannel/slicing.hx } \ 2 { load $AMIRA_ROOT/share/demo/multichannel/isosurfaces.hx 3 { load $AMIRA_ROOT/share/demo/multichannel/voltex.hx } }
The example above give a general idea of how to create a user-dened button hierarchy. The menu command provides some additional parameters. The general form of the menu command is as follows: menu [submenu-id [...]] cmd [options] Here submenu-id is the id of any submenu. The root level has no id at all. The rst level has one id, the second level has two ids, and so on.
311
a button for activating the 2D mouse mode (id 1000) a button for getting a list of all modules (id 1001) a button for getting a list of all data objects (id 1002) You can remove these default buttons using the command menu clear. In order to clear the menu and then reset the default buttons, use menu reset. The complete list of commands is this: menu reset Removes all buttons and sub-menus from the menu and restores the default layout with entries for mouse mode, modules, and data objects. This command can only be applied at the main level. menu [...] clear Removes all buttons and sub-menus from the specied menu. If applied at the main level also the default buttons (mouse mode, modules, and data) will be removed. menu [...] count Returns the number of entries (action buttons and sub-menu buttons) in the specied menu. menu [...] idAt index Returns the id of the item at position index. menu [...] insertItem [options] This command creates a new button and inserts it into the specied menu. The following options are available: -id id Species the id of the new button. -index index Species the position of the new button. If index is -1 (which is the default) the new button will be appended at the bottom of the menu. -text text Species the text to be displayed by the new button. -fg r g b Species the text or foreground color of the new button.
312
-bg r g b Species the background color of the new button. -proc proc The name of the Tcl procedure to be called when the button is pressed. Either an own procedure without arguments can be used for a button. Alternatively, a procedure with one argument can be used for all buttons in a menu. The argument then is set to the id of the pressed button (see example above). menu [...] insertMenu [options] This command creates a new sub-menu button and inserts it into the specied menu. The id of the new button can be used as a sub-menu id for the menu command itself. The same options as for insertItem can be used. In addition the following option is available: -type classtype If this option is specied a special sub-menu will be inserted which lists all objects of type classtype in the Amira Pool. For example, in order to get a list of all modules (like in the default menu) you should use insertMenu with -type HxModule. menu [...] changeItem id -text text Changes the text of an existing button. menu [...] removeItem id Removes an action button or sub-menu button from the menu. menu [...] connectItem id proc Connects a button to a Tcl procedure. The procedure will be called when the button is pressed. menu [...] disconnectItem id proc Disconnects a button from a Tcl procedure.
313
user interface looks very similar to the 2D user interface of the module which is normally shown in the Properties Area of the Amira main window. An example of the 3D user interface of the SurfaceView module is shown in Figure 8.6. The 3D user interface of every module can be moved independently from each other like the main 3D menu itself. Again, this is done by picking the header bar of the modules GUI. The GUI can be removed by clicking on the red close button at the right side of the header bar. On the left side an orange viewer toggle is displayed. As in the 2D interface a display module can be switched on or off by toggling this button. In 3D the ports of a module can be manipulated almost in the same way as in 2D. The only remarkable difference is that text input is not possible in 3D. Text elds with numerical values like the range of a colormap port or the data window of an OrthoSlice module still can be changed using a virtual slider. This is done by clicking into the text eld with the wand, and then moving the wand upwards or downwards while keeping the button pressed. As a general rule, every active element shows a yellow frame when the wand is pointing on it, i.e., when it has input focus.
314
315
vrButton0DblClickFallback, vrButton1DblClickFallback, ... Assuming that the default event handler is active (the one which checks the 3D menu and the Open Inventor scene graph), you can trigger certain actions when the user clicks into empty space. By default, when this happens one of the navigation mode handlers is activated. If you want to disable this feature you can dene a dummy vrButton0PressFallback procedure which always returns 1.
316
load $AMIRA ROOT/share/usersguide/tracking.html } In order to activate or deactivate the 2D mouse mode from Tcl, the VR Pack control module provides the command VRSettings enableMouseMode <value>, where <value> can be either 0 or 1. In order to check if 2D mouse mode is currently active, you can use VRSettings isMouseModeEnabled.
317
#include <Inventor/nodes/SoSeparator.h> #include #include #include #include <McHandle.h> <Amira/HxModule.h> <Amira/HxPortButtonList.h> <mypackage/mypackageAPI.h>
class MYPACKAGE_API MyVRDemo : public HxModule { HX_HEADER(MyVRDemo); public: MyVRDemo(); virtual void compute(); HxPortButtonList portAction; protected: MyVRDemo(); McHandle<SoSeparator> scene; McHandle<SoSeparator> activeCube; bool isMoving; SbVec3f refPos; SbMatrix refMatrix; SbRotation refRotInverse; void createScene(SoSeparator* scene); SoSeparator* checkCube(const SbVec3f& pos); void trackerEvent(SoEventCallback* node); void controllerEvent(SoEventCallback* node); static void trackerEventCB(void* userData, SoEventCallback* node); static void controllerEventCB(void* userData, SoEventCallback* node); }; #endif
318
#include <Amira/Hx3DWandBase.h> #include <mypackage/MyVRDemo.h> HX_INIT_CLASS(MyVRDemo,HxModule) MyVRDemo::MyVRDemo() : HxModule(HxObject::getClassTypeId()), portAction(this,"action",1) { isMoving = 0; portAction.setLabel(0,"Reset"); scene = new SoSeparator; createScene(scene); showGeom(scene); } MyVRDemo::MyVRDemo() { hideGeom(scene); } void MyVRDemo::compute() { if (portAction.isNew() && portAction.getIndex()==0) createScene(scene); } void MyVRDemo::createScene(SoSeparator* scene) { scene->removeAllChildren(); SoEventCallback* cb = new SoEventCallback; cb->addEventCallback(SoTrackerEvent::getClassTypeId(), trackerEventCB, this); cb->addEventCallback(SoControllerButtonEvent::getClassTypeId(), controllerEventCB, this); scene->addChild(cb); for (int j=0; j<4; j++) {
319
for (int i=0; i<4; i++) { SoSeparator* child = new SoSeparator; SoMatrixTransform* xform = new SoMatrixTransform; SbMatrix M; M.setTranslate(SbVec3f(i*3.f,j*3.f,0)); xform->matrix.setValue(M); SoMaterial* mat = new SoMaterial; float hue = (rand()%1000)/1000.; mat->diffuseColor.setHSVValue(hue,1.f,.8f); SoCube* cube = new SoCube; child->addChild(xform); child->addChild(mat); child->addChild(cube); scene->addChild(child); } } } SoSeparator* MyVRDemo::checkCube(const SbVec3f& p) { for (int iChild=1; iChild<scene->getNumChildren(); iChild++) { SoSeparator* child = (SoSeparator*) scene->getChild(iChild); SoMatrixTransform* xform = (SoMatrixTransform*) child->getChild(0); const SbMatrix& M = xform->matrix.getValue(); SbVec3f q; M.inverse().multVecMatrix(p,q); if (fabs(q[0])<1 && fabs(q[1])<1 && fabs(q[2])<1) { if (activeCube.ptr()!=child) { if (activeCube) { SoMaterial* mat = (SoMaterial*) activeCube->getChild(1); mat->emissiveColor = SbColor(0.f,0.f,0.f); } SoMaterial* mat = (SoMaterial*) child->getChild(1); mat->emissiveColor = mat->diffuseColor[0]; activeCube = child; } return activeCube; } } if (activeCube) {
320
SoMaterial* mat = (SoMaterial*) activeCube->getChild(1); mat->emissiveColor = SbColor(0.f,0.f,0.f); activeCube = 0; } return 0; } void MyVRDemo::trackerEventCB(void* userData, SoEventCallback* node) { MyVRDemo* me = (MyVRDemo*) userData; me->trackerEvent(node); } void MyVRDemo::trackerEvent(SoEventCallback* node) { SoTrackerEvent* e = (SoTrackerEvent*) node->getEvent(); Hx3DWandBase* wand = GET_WAND(e); if (activeCube && isMoving) { if (!wand->getButton(0)) { node->setHandled(); isMoving = 0; return; } SbMatrix T1; T1.setTranslate(-refPos); SbMatrix R; R.setRotate(refRotInverse*wand->orientation()); SbMatrix T2; T2.setTranslate(wand->origin());
SoMatrixTransform* xform = (SoMatrixTransform*) activeCube->getChild xform->matrix = SbMatrix(refMatrix*T1*R*T2); wand->setHighlight(true); node->setHandled(); return; } if (checkCube(wand->top())) node->setHandled(); } void MyVRDemo::controllerEventCB(void* userData, SoEventCallback* node) { MyVRDemo* me = (MyVRDemo*) userData; me->controllerEvent(node); }
321
void MyVRDemo::controllerEvent(SoEventCallback* node) { if (activeCube) { SoTrackerEvent* e = (SoTrackerEvent*) node->getEvent(); Hx3DWandBase* wand = GET_WAND(e);
if (wand->wasButtonPressed(0)) { SoMatrixTransform* xform = (SoMatrixTransform*) activeCube->getChi refRotInverse = wand->orientation().inverse(); refPos = wand->origin(); refMatrix = xform->matrix.getValue(); wand->setHighlight(true); isMoving = 1; } if (wand->wasButtonReleased(0)) isMoving = 0; node->setHandled(); } }
322
The user can dene an AMIRA VR CONFIGS PATH environment variable to use a different location at start-up. Then, at runtime, the list can be further changed or updated by using the Change Congs Path... item in the VR menu. SoScreen An SoScreen node can contain the elds detailed below. The eld content type is given inside brackets using Open Inventor conventions, ie. SoSFVec3f stands for a vector of 3 oat values, SoSFRotation is a rotation dened with 4 values represents an axis of rotation followed by the amount of right-handled rotation about that axis, in radians. For example, a 180 degree rotation about the Y axis is : 0 1 0 3.12159265 SoSFString name Vertical screen The name of the screen (not used internally) SoSFVec3f lowerLeft 0 0 0 The coordinates of the lower left corner of the screen. Any right-handed coordinate system can be used. It does not matter in which units the screen corners are dened because the transformation between the screen coordinates and the tracker coordinates is computed automatically when calibrating the tracking system. SoSFVec3f lowerRight 180 0 0 The coordinates of the lower right corner of the screen. SoSFVec3f upperRight 180 110 0 The coordinates of the upper right corner of the screen. SoSFVec3f upperLeft 0 110 0 The coordinates of the upper left corner of the screen. SoSFString display :0.1 Species on which X display the screen should be rendered. On a multi-pipe machine such as an SGI Onyx, either different X servers may run on the different pipes, or there may be one X server with multiple screens. Depending on the actual conguration either :1.0 or :0.1 should be specied in order to enable multi-pipe rendering for the second screen. If this eld is omitted, the window will be opened on the same display as the Amira user interface (determined by the value of the DISPLAY environment variable or by the -display command line option).
323
SoSFString hostname This eld is required if VR Pack will be run in cluster mode. It species on which node of a graphics cluster the particular screen should be rendered. The hostname can either be specied as a name or as a numeric IP address. See section 8.0.9 (Using VR Pack on a cluster). SoSFVec2f channelOrigin 0.0 0.0 Species the position of the upper left corner of the graphics window in relative coordinates. (0,0) is the upper left corner of the desktop, (1,1) is the lower right corner of the desktop. SoSFVec2f channelSize 0.5 1.0 Species the size of graphics window in relative coordinates. The size of the whole desktop is (1,1). In order to create a window covering the left half of the desktop, channelOrigin should be (0,0) and channelSize should be (0.5,1). SoSFVec2f tileOrigin 0.0 0.0 This eld is used in the case of a 2D tiled display instead of the elds lowerLeft, lowerRight, upperRight, and upperLeft. It species the origin of a rectangular part of a virtual big screen which should be rendered in the graphics window. The origin can be any point between (0,0) and (1,1). Here (0,0) denotes the LOWER left corner of the virtual big screen, and (1,1) denotes the UPPER right corner. SoSFVec2f tileSize 1.0 1.0 This eld is used in the case of a 2D tiled display instead of the elds lowerLeft, lowerRight, upperRight, and upperLeft. It species the size of a rectangular part of a virtual big screen which should be displayed in the graphics window. The size can be any value between (0,0) and (1,1). SoSFEnum cameraMode [ MONOSCOPIC LEFT VIEW RIGHT VIEW ACTIVE STEREO ] This eld species the camera mode used for the screen. The default is MONOSCOPIC. The values LEFT VIEW and RIGHT VIEW are used for passive stereo applications. If ACTIVE STEREO is specied, the window is opened in active stereo mode by default. SoSFEnum backgroundMode [ BG AS IS BG LOWER BG UPPER BG REVERSE ]
324
This eld affects how the default Amira gradient background is rendered on the screen. If BG LOWER or BG UPPER is specied, a uniform background with either the lower or upper color of the standard gradient background is used. This is useful for the oor or ceiling of a CAVE. SoSFInt32 threadGroup Screens with different thread groups are rendered in parallel using multiple threads, provided Amira has been started with the -mt command line option or the environment variable AMIRA MULTITHREAD has been set. If the same thread group is used for two different screens, these screens will always be rendered one after the other. Note that for all common current graphics architectures it makes no sense to render multiple windows on the same pipe in parallel. Typically, this even implies a signicant performance decrease. Usually, screens being rendered on the same pipe (same display but different channelOrigin or channelSize) should be assigned the same thread group. Thread group and -mt command line option are only relevant on multipipe systems and do not apply to cluster systems. SoMFFloat softEdgeOverlap This eld is used for soft-edge blending. It should contain exactly four oating-point values, indicating the size of the soft-edge region on the left, right, bottom, and top border of the screen relative to the total width or height of the screen. For example, in order to specify a 25% soft-edge at the right border, softEdgeOverlap should be [ 0.0, 0.25, 0.0, 0.0 ]. SoMFFloat softEdgeGamma This eld is used for soft-edge gamma correction. It should contain exactly four oating-point values, indicating the gamma value of the soft-edge region at the left, right, bottom, and top border of the screen. A gamma value of 1 means, that image intensity is linearly faded out to black. For most projectors, gamma values bigger than 1 are required to achieve good results. The default gamma value for all borders is 1.2. SoTracker An SoTracker node contains information about the tracking system. Usually it is not necessary to dene an SoTracker node for a tiled conguration, but only for true VR congurations which make use of the elds lowerLeft, lowerRight, upperRight, and upperLeft of SoScreen (see above).
325
SoSFString server 4127:4126 This eld species a string used to initialize the connection to the tracking system. In order to connect to a running VRCO trackd daemon, the string should contain the shared memory key of the trackd controller data, and the shared memory key of the trackd tracker data separated by a colon (controllerKey:trackerKey). The shared memory keys are dened in the trackd.conf le. SoSFBool autoConnect If this eld is set to TRUE, the connection to the tracking system will be established automatically when the conguration is loaded. The default value is FALSE. SoSFVec3f defaultCameraPosition 90 50 150 Denes the camera position to be used as long as there is no connection to the tracking system. This position is also used if the head tracker id (below) is -1. SoSFVec3f defaultObjectPosition 90 50 0 Denes the object position to be used as long as there is no connection to the tracking system. If there is a view all request in Amira (e.g., because the space bar of the keyboard was hit), the scene is centered at the default object position. In a CAVE it makes sense to choose the default object position in the center of the front wall. SoMFVec3f calibration The eld is used to store calibration data, i.e., data allowing the system to transform raw tracker data into the coordinate system in which the screens have been dened. Usually there is no need to set this eld manually. Instead, load a conguration le without calibration data, perform calibration in VR Pack, and then export a new cong le. SoSFRotation rotGlasses This eld is used for calibrating the orientation of the tracked stereo glasses. Usually there is no need to set this eld manually. SoSFRotation rotWand This eld is used for calibrating the orientation of the wand tracker. Usually there is no need to set this eld manually.
326
SoSFVec3f leftEyeOffset The center of the left eye with respect to the head tracker. For calibration, the glasses must be align parallel to the front screen. In this position the horizontal axis is the x-axis, the vertical axis is the y-axis, and the axis pointing towards the observer is the z-axis. The eye offsets are dened with respect to this coordinate system. The difference between the left eyes x-offset and the right eyes x-offset should be around 6.5 cm (average eye separation). SoSFVec3f rightEyeOffset The center of the right eye with respect to the head tracker. The same remarks as for leftEyeOffset apply. SoMFVec3f referencePoints Reference points used for calibrating the tracking system. If no reference points are specied, the user is asked to click at the upper left, lower left, and lower right corner of the rst screen dened in the cong le. Note that at least three different reference points are required and that these points must not lie on a common line. However, the reference points may well lie in a common plane, e.g., in the screen plane itself. SoSFInt32 wandTrackerId Species the id of the trackd sensor which should be used to control the wand. By default the wand sensor is assumed to have the id 0. SoSFInt32 headTrackerId Species the id of the trackd sensor which should be used to control the camera (head tracking). By default the head tracker is assumed to have the id 1. If -1 is specied for a head tracker id, the default camera position is used instead of actually querying a head sensor. SoSFInt32 headTrackingEnabled This eld determines if head tracking should be enabled or disabled by default if the conguration le is loaded. The default is TRUE. If the value is set to FALSE, head tracking is initially disabled, but can be activated later by pressing the head tracking toggle of the AmiraVR control module. However, headTrackerId must not be set to -1 in this case. SoSFString wandFile This is the name of an Open Inventor le which is used as the visual representation of the wand. The origin of the wand should be at (0,0,0). The
327
wand itself should point into the negative z direction. The wand is scaled so that the length 1 corresponds to 0.16 times the width of the rst screen in the cong le. The hot spot of the wand should be indicated by an SoInfo node containing a string x y z. Usually the hot spot will be something like 0 0 -1. The lename can be an absolute or relative path. If it is relative, the le is assumed to be in the same directory as the cong le itself (namely in share/cong/vr). SoSFString highlightWandFile This is the name of an Open Inventor le which is used as the visual representation of the wand in highlight state. The same remarks as for wandFile apply to this eld too. SoSFFloat wandScale This eld species a scaling factor applied to the wand geometry. By default, a value of 0.16 times the width of the rst screen is assumed. In order to change the length of the wand you can either specify a custom wand le with a hot spot different from 0 0 -1, or you can change the wand scale value. SoSFVec3f menuPosition Species the default position of the upper left corner of the 3D menu. By default it is placed in the upper left corner of the rst screen in the cong le. The values must be dened in the same coordinate system as the corners of the screens. SoSFRotation menuOrientation Species the orientation of the 3D menu. By default the horizontal axis of the menu, i.e., the text direction, is aligned to the x-axis of the VR coordinate system, while the vertical direction is aligned to the y-axis. This eld allows you to change the orientation by applying a rotation to the default orientation. The rotation is specied by four numbers. The rst three numbers dene the axis of rotation, and the fourth numbers denes the rotation angle in radians. SoSFFloat menuSize This eld species the default width of the 3D menu in the same coordinates in which the corners of the screens were dened. You can adjust this value to make the menu smaller or bigger.
328
SoSFString onLoad This eld denes a Tcl command which is executed after the conguration has been loaded. You can put additional initialization code here. For example, you may always want to load a particular script MenuInit.hx for initializing the 3D menu when a certain conguration is loaded. You can do this by dening onLoad load $AMIRA ROOT/MenuInit.hx. As another example you can show 3D menu with: onLoad AmiraVR options setValue 2 1 SoSFString onUnload This eld denes a Tcl command which is executed before a conguration is unloaded. SoSFString onConnect This eld denes a Tcl command which is executed after a connection to the tracking system has been established. SoSFString onDisconnect This eld denes a Tcl command which is executed after the connection to the tracking system has been disconnected. SoVRProperty An SoVRProperty node contains general information about the Amira user interface. SoSFBool showSlaveGUI FALSE Set TRUE to force the Amira GUI to be displayed on the slaves in cluster mode. Note that this interface is not synchronized from slaves, which means that anything done on one slave will not be forwarded to the others. SoSFBool showSlaveConsole FALSE Set TRUE to force the Amira Console to be displayed on the slaves in cluster mode. Note that this interface is not synchronized from slaves, which means that anything done on one slave will not be forwarded to the others. SoSFBool showSlaveCursor FALSE Set TRUE to display the mouse cursor on the slaves render areas in cluster mode. However, this is only a forbidden type cursor that cannot interact with the Amira render area.
329
SoSFBool keepMasterViewerInsideGUI FALSE In a cluster conguration, a screen must be dened on master node for correct synchronization, but this may disturb the user to have its main viewer in a oating window. Set the eld keepMasterViewerInsideGUI to TRUE to force the main viewer to be kept inside the standard GUI. This ag only has effect on the primary screen of a VR node. Conguration tips Here is a summary of some conguration settings that may be helpful to polish your conguration:
#Inventor V2.1 ascii SoVRProperty { keepMasterViewerInsideGUI TRUE } SoScreen { ... backgroundMode ... softEdgeOverlap ... softEdgeGamma ... } SoTracker { ... autoConnect TRUE headTrackingEnabled FALSE wandFile "myWandFile" highlightWandFile "myHWandFile" menuPosition 100 100 0 menuSize 50 onLoad "..." onConnect "..." onDisconnect "..." } Separator { PointLight {location 0 0 0} Separator {...} }
# # # #
Display configuration For consistent backround across scre Soft-edge region Soft-edge blending rate
# # # # # # #
Note that tracking systems must be r Starts without head tracking (can ac Open Inventor/VRML file for custom w Highlighted version
# Separator containing "environment sc # Useful e.g. in CAVEs # Fixed geometry relative to screens
330
port of the AmiraVR control module and press the connect button. After that the user interface dialog of the tracker emulator appears.
As mentioned before, the emulator emulates two spatial sensors designated as sensor0 and sensor1. For each of these sensors the position is changeable by three sliders, one for each direction. Alternatively, as well as to reach positions of greater distance than the sliders allow, one can type the values directly into the text entry elds to the right of the slider. The sensors rotation can be changed by selecting one of the main axes as the rotation axis and then further adjusting the rotation angle around this axis using the slider or the entry eld. To perform an additional rotation, simply select a different rotation axis and angle. The rotations are performed cumulatively. The current
331
rotation doesnt affect the orientation of the main rotation axes. The rotation center is always the current sensor position. To set the sensors rotation to the initial unrotated state, press the Reset button. In the buttons section one can toggle the emulated buttons state. As long as the checkbox is checked, the emulated button is down. If its unchecked, the emulated button is up.
332
Part IV
Chapter 9
Please follow the instructions below. Each step builds on the step before.
336
PRO: This builds a multiresolution le allowing full interactive view or local full resolution viewing. CON: This can be time consuming, with an initial pass and then the true conversion pass. Read from disk: read data blocks from disk, allowing almost continuous disk access. PRO: No need to generate an extra le. CON: Continuous access to disk. Slow with data sets larger than 4GB. Read in memory: load full data into memory and then access to memory only. PRO: Adapted for average sized data. CON: Requires as much RAM as your data set size. Usually not applicable for data sets greater than 500MB or 1GB. Please select Convert to LDA. Then, on the next dialog (Destination le), specify the LDA destination le. 3DHEAD.lda for instance (see Figure 9.4). Note: An .lda le can be loaded then, without any conversion required. Another option allows you to perform conversion in batch mode so you can run other processes while the conversion is done in the background.
337
338
339
340
341
342
Part V
This extension integrates the Visilog product by Noesis into Amira. The Quantication+ Pack, with its the wide range of image processing tools, can be used together with the 3D visualization and geometry reconstruction capabilities of Amira. A set of demos is provided. For details, see the documentation of the Visilog module.
345
346
Part VI
Chapter 10
Deconvolution introduction
ResolveRTs deconvolution provides powerful algorithms for improving the quality of microscopic images recorded by 3D wideeld and confocal microscopes. Two different methods are supported, namely a so-called non-blind and a blind deconvolution method, both based on iterative maximum-likelihood image restoration. In the rst case a measured or computed point spread function (PSF) is required. In the second case the PSF is estimated along with the data itself. The deconvolution documentation is organized as follows:
General remarks about image deconvolution Data aquisition and sampling rates Standard deconvolution tutorial Blind deconvolution tutorial Bead extraction tutorial Performance issues and multi-processing
The following modules are included: BeadExtract - obtain a PSF from a bead measurement Convolution - convolve two 3D images CorrectZDrop - corrects attenuation in z-direction
DataPreprocess - background and ateld correction Deconvolution - the actual deconvolution front-end FourierTransform - computes FFT and power spectrum PSFGenerate - calculates a theorectical PSF
350
age restoration. The other answer is that in a blind deconvolution algorithm a meaningful estimate of the PSF can only be computed if severe constraints are imposed. For example, a trivial solution of the blind deconvolution problem would be an image which is identical to the input image and a PSF with the shape of an ideal delta peak. Obviously, this solution isnt useful at all. Therefore, if for example confocal data is to be deconvolved, the algorithm ts the actual PSF in such a way that it looks like a possible measured PSF of a confocal microscope. More precisely, the t is constrained to be in agreement with the experimental parameters (the refractive index of the medium, the numerical aperture of the objective, and the voxel sizes). Sometimes this can lead to wrong results, for example when the confocal pinhole aperture of the microscope wasnt stopped down sufciently during confocal image acquisition, in which case the microscope actually didnt behave like a true confocal microscope. As a matter of fact you should try which approach provides the best results for your own image data, blind deconvolution or non-blind deconvolution with either a measured or an automatically computed PSF.
351
352
Saturated pixels are pixels which are clamped to either black or white because their actual intensity values are outside the range of representable intensities. In any case, saturation means a loss of information and thus prevents proper postprocessing or deconvolution. At the same time, a high background level should be avoided because it decreases the dynamic range of the imaging system and the deconvolution works worse. This means that empty regions not showing any uorescence should appear almost black. A background level close to zero is especially important when bead measurements are performed in order to extract an experimental point spread function. Details are discussed is a separate tutorial about bead extraction.
As an example we are going to use a confocal test data set (polytrichum.am) provided with the Amira deconvolution modules. The data le is located in the directory Amira-5/data/deconv. Load the data set polytrichum.am. Visualize it, for example, using a ProjectionView module. The data set shows four chloroplasts in a spore of the moss polytrichum commune.
353
single point source, or as a close approximation, the image of a single uorescing sub-resolution sphere. PSF images can either be computed from theory (see below) or they can be obtained from measurements. In the latter case tiny so-called beads are recorded under the same conditions as the actual object. This means that the same objective lens, the same dye and wavelength, and the same immersion medium are used. Typically, the images of multiple beads are averaged to obtain an estimate of a single PSF. Amira provides a module called BeadExtract facilitating this process. The use of this module is discussed in a separate tutorial about bead extraction. At this point let us simply load a measured PSF from a le. Load the data set polytrichum-psf.am. Use the ProjectionView module to visualize it. The PSF appears as a bright spot located in the middle of the image volume (Figure 10.1). It is important that the PSF is exactly centered. Otherwise, the deconvolved data set will be shifted with respect to the original image. Also, it is important that the PSF fades out to black at the boundaries. If this is not the case, the black level of the PSF image needs to be adjusted using the Arithmetic module. Finally, neither the PSF nor the image to be deconvolved should exhibit intensity attenuation artifacts, i.e., image slices with decreased average intensity due to excessive light absorption in other slices. If such artifacts are present, they can be removed using the CorrectZDrop module.
354
355
Border width: For deconvolution the image data has to be enlarged by a guardband region. Otherwise boundary artifacts can occur, i.e., information from one side of the data can be passed to the other. There is no need to make the border bigger than the size of the PSF. However, if the data set is dark at the boundaries, a smaller border width is sufcient. In our case, let us choose the border values 0, 0, and 8 in the x, y, and z direction. Iterations: The number of iterations of the deconvolution algorithm. Let us choose a value of 20 here. Initial estimate: Species the initial estimate of the deconvolution algorithm. If const is chosen a constant image is used initially. This is the most robust choice, yielding good results even if the input data is very noisy. We keep this option here. Overrelaxation: Overrelaxation is a technique to speed up the convergence of the iterative deconvolution process. In most cases the best compromise between speed and quality is xed overrelaxation. Therefore we keep this choice also. Method: Selects between standard (non-blind) and blind deconvolution. Let us specify the standard option here.
356
The actual deconvolution process is started by pressing the Apply button. Please press this button now. The deconvolution should take about 10 seconds on a modern computer. During the deconvolution the progress bar informs you about the status of the operation. Also, after every iteration a message is printed in the Amira console window indicating the amount of change of the data. If the change seems to be small enough, you can terminate the deconvolution procedure by pressing the Stop button. However, note that the stop button is evaluated only once between two consecutive iterations. When deconvolution is nished, a new data set called polytrichum.deconv appears in the Pool. You might take a look at the deconvolved data by moving the ProjectionView connection line from polytrichum.am to polytrichum.deconv.
357
Once the module is created again some parameters have to be entered. The resolution and the voxel size can be most easily specied by connecting the Data port of the PSGGen module to the image data set to be convolved. In our case, please connect this port to polytrichum.am. In order to generate a PSF, you also need to know the numerical aperture of the microscope objective, the wavelength of the emitted light (to be entered in micrometers!), and the refractive index of the immersion medium. In our test example these values are NA=1.4, lambda=0.58, and n=1.516 (oil medium). Also, change the microscopic mode from wideeld to confocal. After you press the Apply button, the computed PSF appears as an icon labelled PSF in the Pool. You can compare the theoretical PSF with the measured one using the OrthoSlice module. Youll notice that the measured PSF appears to be slightly wider. This is a common observation in many experiments. Once you have computed a theoretical PSF, you can perform non-blind deconvolution as described above. However, for convenience the Deconvolution module is also able to compute a theoretical PSF by itself. You can check this by disconnecting the Kernel port of the Deconvolution module. If no input is present at this port, additional input elds are shown, allowing you to enter the same parameters (numerical aperture, wavelength, refractive index, and microscopic mode) as in PSFGen. After these parameters have been entered, the deconvolution process again can be started by pressing the Apply button. Note that any previous result connected to the Deconvolution module will be over-
358
written when starting the deconvolution process again. Therefore, be sure to disconnect a previous result if you want to compare deconvolution with different input PSFs.
359
only provide a small guardband region of 8 voxels in x- and y-direction. In zdirection we do not provide any border because there are sufciently many empty slices below and above the actual neuron. The resulting size of the data arrays on which the computations are performed then is 256 x 256 x 256. Because 256 is a power of two (28), the Fast Fourier Transforms, the computationally most expensive part of the deconvolution algorithm, can be executed somewhat faster. Iterations: We choose a value of 25 here. Depending on the data, usually at least 10 iterations are required. With overrelaxation being enabled (see below), results usally dont improve much after 40 iterations. Initial estimate: Species the initial estimate of the deconvolution algorithm. Since there is not much noise present in the original alphalobe images it is safe to chose input data here. This causes the algorithm to converge even faster. Overrelaxation: Overrelaxation is a technique to speed up the convergence of the iterative deconvolution process. We enable overrelaxation by chosing the xed toggle. Regularization: We chose none here in order to do no regularization. Method: We chose blind here in order to select the blind deconvolution algorithm.
360
PSF Parameters: For alphalobe.am the numerical aperture is 0.5, the wavelength is 0.58 micrometers, and the refractive index is 1.33 (water). These parameters are required in order to apply certain constraints to the estimated point spread function. They are also used in order to compute an initial PSF. If a data set would be connected to the Kernel port of the deconvolution module, this data set would be used as the inital PSF with the given PSF parameters still acting as constraints. For example, you could provide a measured PSF and let it be tted to the actual data by the deconvolution algorithm. Microscopic mode: alphalobe.am is a wideeld data set, so select this option here.
361
Select the deconvolution job and press the Start button. You now have to wait about 20 minutes until the deconvolution job is nished. Once the job queue has been started, you can quit Amira. The batch jobs will be continued automatically. If Amira is still running when the deconvolution job exits then the result will be loaded automatically in Amira. Otherwise you have to restart Amira and load the deconvolved data set manually.
362
Figure 10.7: The Amira job dialog showing a pending deconvolution job.
Bead Measurements
The PSF is the image of a single point source recorded under the same conditions as the actual specimen. It can be approximated by the image of a uorescing subresolution microsphere, a so-called bead. Performing good bead measurements requires some practice and expertise. In order to obtain good results the following hints should be obeyed: 1. Use appropriate beads. It is important that the bead size be smaller than approximately 1/2 full width at half maximum (FWHM) of the PSF. Good sources for obtaining beads suitable for PSF measurements are Molecular Probes (http://www.probes.com/) or Polysciences (http://www.polysciences.com/). 2. The beads must be solid. Besides solid beads, there are also beads with the shape of a spherical shell, allowing to check the focus plane of a mircoscope. Such beads cannot be used as a source for PSF generation in the current version of Amira. 3. Dont record clusters of multiple beads. Sometimes multiple beads may glue together, appearing as a single big bright spot. Computing a PSF from such a spot obviously leads to wrong results.
363
4. Note that beads are not resistant to a variety of embedding media. In particular beads will be destroyed in xylene-based embedding media such as Permount (Fisher Scientic) and methyl salicylate (frequently used to clear up the tissue). As a substitute you might use immersion oil instead, which has a refractive index similar to methyl salicylate, for example. 5. Sample and beads should always be imaged as close to the coverslip as possible. When it is not possible to attach the sample to the coverslip, the beads should also be imaged in a comparable depth, embedded in the same mounting medium. Imaging the beads with better quality than the sample will yield a slightly blurred deconvolution result. However, when the PSF used for deconvolution is too wide, artifacts can arise during deconvolution. The objective lense should always be selected according to the mounting medium, i.e. if the sample is attached to the slide and embedded in a buffer of refractive index close to water, a severe loss of image quality can be expected when using an oil-immersion objective without a correction collar. Deconvolution of properly imaged data will allways be supperior to deconvolution of data suffering from aberrations. 6. Problems occur if the mounting medium remains liquid. In that case the sample distribution may not be permanent. If your specimen is to be embedded in water, you can try to immerse the beads in an agarose gel of moderate concentration instead. Attaching the small beads to the coverslip (for example by letting them dry) is often also sufcient for immobilization.
An example of an image data set containing multiple beads is provided in the le beads.am in the directory Amira-5/data/deconv. Load the data set beads.am. Visualize the data using a ProjectionView module.
364
Figure 10.8: Individual beads can be interactively identied using a Cursor module.
if it is clearly visible and if it is not superimposed by other beads (even when defocused), Selecting good beads is an interactive process. It is most easily accomplished using the ProjectionViews Cursor module. This module allows you to select a point in 3D space by clicking on one of the three planes of the ProjectionView module. The third coordinate is automatically set by looking for the voxel with the highest intensity. Points selected with the Cursor module can be stored in a LandmarkSet data object. Attach a Cursor module to the ProjectionView module. Click on any bead on one of the three planes. Store the current cursor position in a LandmarkSet object by pressing the Add button. Select and add some other beads too. The landmarks need not to be located exactly at the center of a bead. The exact center positions can be tted automatically later on. You can remove incorrect bead positions from the landmark set by invoking the landmark set editor. In order to activate the editor, select the landmark set object and press Landmark Editor button. If you want to add additional bead positions to an existing landmark set object, make sure that the master port of the landmark set object is connected to the Cursor module. Otherwise, a new landmark set object
365
will be created.
366
Figure 10.9: The BeadExtract module resamples and averages multiple beads.
In some cases you may want to average multiple beads recorded in different input data sets. This can be easily achieved by creating a Landmarks object for each input data set. For the rst input data set extract the beads as described above. For the other input data set also use the BeadExtract module. However, make sure that the PSF obtained from the rst input data set is connected as a result object to BeadExtract before pressing the Apply button. In order to use an existing PSF as a result object connect the Master port of the PSF to BeadExtract (once this is done the Resolution and Voxel size ports of BeadExtract become insensitive, see above). If an existing result is used new beads simply will be added into the existing data set. Therefore data sets should be scaled in intensity according to their quality prior to bead extraction and summation to obtain a suitable weighting of the individual extracted beads in the nal result.
367
Sometimes it is worth it to enlarge the border width a little bit in order to get a power of two. Although the algorithm works with data of any size, powers of two can be transformed somewhat faster. Another issue is memory consumption. Internally, several copies of the data set need to be allocated by the deconvolution algorithm. These copies should all t into memory at the same time (a specic variant of the algorithm suitable for working under low memory conditions will be provided in a later version). Besides the input data itself, the following number of working arrays are required by the different methods: 3 working arrays for the non-blind algorithm with no or with xed overrelaxation 5 working arrays for the non-blind algorithm with optimized overrelaxation 5 working arrays for the blind algorithm The number of voxels of a working array is the product of the number of voxels of the input data set plus the border with along each spatial dimension. The primitive data type of a working array is a 4-byte oating point number. For example, if the number of voxels of the input data set plus the border width is 256 x 256 x 256 (as for the alphalobe.am data set in the blind deconvolution tutorial), each working array will be about 64 MB, irrespective of the primitive data type of the input data set. Therefore at least 192 MB (3x4x256x256x256 bytes) are required for nonblind deconvolution with xed overrelaxation, and 320 MB (5x4x256x256x256
368
bytes) for blind deconvolution. Keep this in mind when conguring the computer on which to perform deconvolution! However, also note that for most platforms it usually doesnt make sense to have more than 1.5 GB of main memory. For more memory a 64-bit operating system is required. Finally, it should be mentioned that the deconvolution algorithm can make use of a multi-processor CPU board. Although you do not get twice the performance on a dual-processor PC, a speed-up of almost 1.5 can be achieved. By default, Amira uses as many processors as there are on the computer. If for some reason you want to use less processors you can set the environment variable AMIRA DECONV NUM THREADS to the number of processors you actually want to use simultaneously.
369
370
Chapter 11
1. 2. 3. 4. 5. 6.
Load data into Amira. Create a MultiChannelField and attach channels to it. Using OrthoSlice with a MultiChannelField. Using ProjectionView with a MultiChannelField. Using Voltex with a MultiChannelField. Saving multi-channel images in a single AmiraMesh le.
Figure 11.1: Data objects are connected to the MultiChannelField object with a right mouse click on the white square indicated by the arrow.
372
Figure 11.2: When connected to a MultiChannelField object the OrthoSlice module has additional check boxes corresponding to the number of connected channels.
Repeat the above procedure with channel2.info When the MultiChannelField is selected you will note that two entries, channel 1 and channel 2, appear in the modules control panel. Each entry has two range text elds and a colormap area. The range text elds work very much like those in OrthoSlice. Press the right mouse button over the colormap area to bring up a context menu that will allow you to connect a colormap, edit the colormap, and so forth. If constant color is selected, double clicking in the colormap area pops up a color dialog that lets you freely dene the color of each channel. Now perhaps it is a good idea to activate the pins corresponding to Channel 1 and Channel 2 in the Properties Area. This will keep the control elements of the MultiChannelField module permanent in the Properties Area.
373
Figure 11.3: Multi channel data visualized using the OrthoSlice module.
check boxes lets you selectively switch on/off each channel. First, we adjust the intensity mapping of each channel separately. Switch off channel 2 by deselecting its check box. Enter 23 and 200 in the min and max range elds of channel 1. As a result, weak stainings potentially unspecic staining disappear and those structures that exhibit good staining become even more intense. Click off channel 1 and click on channel two. Enter the values 8 and 200 in the min and max text elds of channel 2. Move through the slices to see the results.
374
Figure 11.4: Multi channel data visualized using the ProjectionView module.
ing on the icon and selecting ProjectionView from the Display submenu. As with the OrthoSlice, two new check boxes are shown in the modules control panel which can be used to display channels separately or simultaneously. In this way you may efciently adjust the color and intensity of each channel before displaying them simultaneously.
375
Figure 11.5: Multi channel data visualized using the Voltex module.
ory size, it is recommended to enter at least factors of 2 2 1 in the Downsample text elds of the Voltex module. Press the Apply button. Each time you want to display another channel, you must press the Apply button again.
376
Part VII
Chapter 12
found in the File Formats section of the users guide. A good choice is TIFF because it provides lossless compression and is readable on many different systems. You should also know the position in 3D of the lower left front corner of the brick youre going to import and the voxel size. Choose File/Open Data.... A File Dialog pops up. You can now select all of the 2D images comprising the brick. After you press Load, another dialog pops up:
Enter the position and the voxel size of your block. After you press OK, the les are loaded into one block. A new green icon will appear in the Pool. Select it and select File/Save Data As... to store it on disk. Name it 1ta.am. In this way you should proceed with all of your data.
380
Create a Mosaic by selecting Mosaic from the Create/Skeleton menu of the Amira main window. A green icon appears. When you select it you see that it contains no bricks. The buttons below the info line are used to add data objects. Press the add les button. Select the les, e.g 1ta.am, 1tb.am, 2ta.am, 2tb.am in the directory AMIRA ROOT/data/tutorials/skeleton. You can select multiple les at once by clicking on the rst one and shift clicking on the last one. Press Load. The selected les are added to the Mosaic. The Info port shows the overall number of the bricks added up to now. You can visualize the bricks with the DisplayMosaic module. Create a DisplayMosaic module by right clicking on the Mosaic and selecting Skeleton/DisplayMosaic from the context menu. Select the yellow DisplayMosaic icon and switch the highlighted brick by dragging the slider in the interation area. Save the Mosaic.
Aligning Bricks
381
382
overwrite. In the next step were going to resample every brick to an isotropic voxel size. This is only an optional step and might lead to smoother central lines in the following processing. But it increases size of the data on disk by a factor of about three. You should carefully consider whether you want to perform this step or not. Attach a Resample module to the brick loaded before and select Mode: voxel size and adjust Voxel size: z to get an isotropic result. Press Apply to start the resampling procedure and check the result. Attach the Resample module to the Template connection of the ApplyTemplateToMosaic module. Press Apply of the ApplyTemplateToMosaic module. All bricks are resampled and saved to the same position. It is a good idea to sample all bricks to an isotropic voxel size. It improves the result of the distance map and the skeletonization were going to apply. As a standard preltering procedure you should: Apply the ZDropCorrection. Apply a 2D median lter. Apply a 3D Gaussian lter with a small sigma (1 or smaller). If the results are not satisfactory, you should try to extend the preltering step.
383
Mosaic and selecting Skeleton/MosaicToLargeDiskData from the submenu in the context menu. Select the red MosaicToLargeDiskData icon. You can see some options in the Properties Area. The default options are ne for the tutorial. A default lename derived from the mosaic is displayed in the Filename port. You might want to override it. Press the Apply button. A new green icon which represents the new data object will appear in the Pool. After this the bricks will be loaded one after the other and will be sampled. This may take some time. Select the new green icon (titled Image). In the Properties Area some information about the data stored on disk is displayed. Next, Delete or switch off the DisplayMosaic module. Connect a BoundingBox to the Mosaic icon. Connect a BoundingBox to the Image icon. The second box is slightly bigger than the bounding box of the Mosaic. This is due to the border added by the MosaicToLargeDiskData module.
384
Select the red LatticeAccess icon. In the viewer you can see a dragger box in one corner of the bounding box of the Large Disk Data. You can click and drag the corners or the faces of the box to specify the subvolume you want to load. In the Properties Area the corresponding dimensions are displayed. Drag the box somewhere inside the volume (For this you need to switch the viewer into interaction mode). Press the Apply button. Attach an OrthoSlice to the new green icon (Image.view). Select the LatticeAccess object, then toggle on the auto-refresh check box. Drag the box in the viewer. By setting auto-refresh on, every time you drag the box an automatic reload is started and all modules downstream of the view are recomputed. This is an easy way to scan through the large volume. Try different display modules on the Image.view, e.g., an isosurface.
385
module to it as described above and have a look at the results. You might want to correct the result of the segmentation procedure manually. This might be useful to ll big vessels or remove uninteresting parts. Amira has a segmentation editor to perform this task. Due to the size of the data, you will have to work on subblocks of the whole data set. In the next step well calculate a distance map of the object. Attach a ChamferMap to the Image.labels icon by right clicking on it and selecting ChamferMap from the Skeleton submenu in the popup menu. Specify an lename (the default is OK for the tutorial). Press Apply. A new green icon named Image.dm will appear. Connect an LatticeAccess module and have a look at the distance map. The thinning procedure needs the labels and the distance map as input. Note: The thinning algorithm automatically detects endpoints of vessels. A parameter is used to distinguish them from noise on the surface of the vessels to avoid spurious branches. You might want to change this parameter manually in the console. Use Thinner setVar lenOfEnds 10 to set the length of the ends to 10 voxels before they are detected as unconnected ends. This is a rather large value leading to only a few branches. The drawback is that you also might miss real endpoints. It will be really hard to detect such errors during the network check. But in general we think it is a good idea to avoid spurious branches directly during thinning. Attach a Thinner to the Image.labels icon by right clicking on it and selecting Thinner from the Skeleton submenu in the popup menu. Connect the port for the distance map to the Image.dm icon. You can achieve this by right clicking on the white square on the left side of the ExtThinner icon and selecting Distmap. A blue line is attached to the mouse pointer; after you click on the Image.dm icon, the two modules are connected. Specify a lename (the default is ne for the tutorial). Press Apply. A new green icon named Image.thinned will appear and the thinning process is started. It may take some time before it nishes. We will directly go on and
386
convert the result into a lineset before visualizing it. Attach a TraceLines to the Image.thinned icon by right clicking on it and selecting TraceLines from the Skeleton submenu in the popup menu. Unselect the cluster toggle in the Properties Area. Press Apply. The new icon that is visible now in the Pool is a lineset, which you are probably already familiar with. You can visualize it by connecting a LineSetView. Create an LineSetView module by right clicking on the Image.lineset and selecting LineSetView from the context menu. The lines are rather jaggy because they connect centers of voxels. To get smoother lines you can use a Tcl command in the console. Type Image.lineset smooth into the Amira console window. You can repeat this if you would prefer even smoother lines. You can use the CheckNetwork module from the Skeleton submenu in the context menu to remove short ends. In the last step of this subsection we will compute a thickness for every point on the lines. For the thickness we use the values of the distance map. Attach an EvalOnLines to the Image.lineset icon by right clicking on it and selecting EvalOnLines from the Compute submenu in the popup menu. Connect the port for the distance map to the Image.dm icon. You can achieve this by right clicking on the white square on the left side of the EvalOnLines icon and selecting Field. A blue line is attached to the mouse pointer; after you click on the Image.dm icon, the two modules are connected. Press Apply. The module doesnt create a new data icon. It is more like an editor and changes the connected lineset. It adds a data value for every vertex in the lineset and calculates the value of the eld at the point of the vertex. You can visualize the data with the LineSetView. Select the LineSetView by clicking on it.
387
In the Properties Area there is a drop down menu called ColorMode. Click on it and select Data 0. Right click on the rectangular area in the row Colormap. A popup menu appears. Select physics.icol. Change the range of the colormap by clicking into text eld right of the colormap and type in 15. You see that the lines are now colored. The color is an indicator for the local radius of the original object.
388
displayed as tubes that reect the local thickness. Choose a rather small part of the lineset. Select the LineSetView. Click on the Shape drop down menu and select Circle. Click on the ScaleMode drop down menu and select Data 0. Move the ScaleFactor slider to 2.
In the viewer the lines are now displayed as tubes. The thickness is scaled with the data associated with the lines. Note: The data value associated with the lines is the local radius. The LineSetView scales by the local diameter. To scale to the physical size you therefore must use a ScaleFactor of 2. In the next step were going to load a part of the image data that is also determined by the SelectRoi module. You can then easily load the same subvolume from different lda les if you connect all LatticeAccess modules to one common SelectRoi module. Load the le Image that you saved before. Attach an LatticeAccess module to it (see above if you dont know how). Connect the Connection named ROI of the LatticeAccess to the SelectRoi module. This is done the same way as with the LineSetView. Select the LatticeAccess module, then press the Apply button. Attach a ProjectionView display module to the newly displayed green Image.view icon. You can do the same for the Image.labels le. All LatticeAccess modules you created are now restricted to the same volume and can easily be moved by one click-and-drag operation.
Check Network
389
Create a CheckNetwork module by right clicking on the Image.lineset and selecting CheckNetwork from the Skeleton submenu of the popup menu. Connect the SelectRoi connection of the CheckNetwork to the SelectRoi module (right click on the white square at the left of CheckNetwork, select SelectRoi, click on the yellow SelectRoi icon). Select the LatticeAccess module, and toggle on the auto-refresh check box. Adjust the size of the lines by selecting the LineSetView and changing the ScaleFactor slider to approximately 0.15. Select the CheckNetwork module. Press the Next Endpoint button. By repeating the last step you can jump through all endpoints.
390
Index
.Amira, 162, 201 Amira class structure, 148 data objects, 4 modules, 4 packs, 14 Amira DICOM Reader, 14 Amira Developer Pack, 14 Amira Mesh Pack, 14 Amira Molecular Pack, 14 Amira Quantication+ Pack, 15 Amira SEG-Y Reader, 15 Amira VR Pack, 15 Amira Very Large Data Pack, 15 Amira.init, 162, 201 AMIRA LOCAL, 161, 185 AMIRA ROOT, 185 abberation, 364 afne transformations, 153 agarose gel, 364 auto-save, 142 auto-select modules, 141 axial blur, 350 batch job, 361 bead extraction, 362 beads, 363 black level, 353 border width, 356, 360 boundary artifacts, 351 camera trackball, 130 CATIA 4, 15 CATIA 5, 15 check point les, 361 color depth, 164 command line options, 158 compute indicator, 141 confocal microscope, 351, 352 coordinates, 152 coverslip, 364 Create menu, 113 data import, 157 database default, 110 user-dened, 110 deconvolution blind, 350, 359 non-blind, 350 standard, 353 default directories, 160 Edit menu Copy, 109 Cut, 109 Database, 110
Delete, 109 Paste, 109 Preferences, 110 Select All, 109 editors, 5 embedding medium, 364 environment variables, 160 Explorer, 123 F1 key, 185 features, 6 le dialog changing directories, 137 lename lter, 138 popup menu, 138 selecting les, 138 File menu Jobs, 108 Open data, 106 Open Time Series, 106 Quit, 109 Recent Files, 108 Recent Networks, 108 Save Data, 106 Save Data As, 107 Save Network, 107 ring algorithm, 141 font size, 161, 162 Fourier transform, 368 function key, 163 procedure, 201 help for commands, 185 help browser, 116 searching, 117 hidden data objects, 141 hot-key procedure, 163, 201
IGES, 15 immersion medium, 364 in-plane sampling, 352 initial estimate, 356, 360 intensity attenuation, 354 job dialog, 361 Job dialog box, 139 Lanczos lter, 355 maximum-likelihood method, 350 Mecalog Radioss For Amira, 15 memory consumption, 368 microsphere, 363 multi-processing, 369 noise, 350, 352 numerical aperture, 352 Nyquist sampling, 352 oil immersion, 364 OpenGL driver, 164 optical sectioning microscopy, 350 out-of-focus light, 350, 359 overrelaxation, 356, 360 oversampling, 352 parameters of data objects, 154 performance, 368 Pool, 120 Pool menu Auto adjust range of colormaps, 112 Duplicate, 111 Duplicate mode, 112 Hide, 111 Remove, 111 Remove All, 112
392
INDEX
Rename, 111 Show, 112 Show All, 112 Port, 120 preferences, 140 PSF, 350, 354 theoretical, 357 reampling, 355 refracrtive index, 364 refractive index, 352 regular grid, 152 ResolveRT Pack, 15 sampling rate, 352 saturation, 353 save network, 141, 200 scalar elds, 150 scanned volume, 351 SCRIPTDIR, 186 SCRIPTFILE, 185 Scripting interface, 175 Skeleton Pack, 15 Snapshot dialog box, 146 Spacemouse, 161 start-up script, 162, 201 STEP, 15 stereo mode, 162 subapplication concept, 155 surface, 153 swap space, 164 system information dialog, 147 system requirements, 163 Linux, 165 Mac, 166 Windows, 164 Tcl, 175
Tcl introduction, 176 tetrahedral grids, 152 TNO Madymo For Amira, 15 Tracker Emulator, 330 troubleshooting, 164 undersampling, 352 vector elds, 151 VertexSets, 153 View menu Axis, 115 Background, 113 Console, 116 Easy fade, 116 Fading effect, 116 Fog, 115 FPS (frames-per-second), 116 Frame counter, 116 Layout, 113 Lights, 114 Measuring, 116 Transparency, 114 Viewer, 130 camera trackball, 130 Fullscreen, 134 Home, 132 Interact, 131 interaction mode, 130 Layout, 134 Measuring, 134 Perspective/Ortho toggle, 132 Pick, 131 rotate button , 132 Seek, 132 Set Home, 132 Snapshot, 134 Stereo, 133
INDEX
393
Trackball, 131 Translate, 131 View, 131 View All, 133 viewing directions (geographic), 133 viewing directions (seismic), 133 viewing directions Axial, Coronal, Sagittal, 133 viewing directions YZ, XZ, XY, 133 viewing mode, 131 Zoom, 132 zoom, 130 viewer toggles, 141 virtual memory, 164 wavelength, 352 wideeld data, 351 work area, 127
394
INDEX