Honglin Ye
National Radio Astronomy Observatory
MVC Architecture

3D View Capability Needed
One of the most important end products from a spectral line
observation is the brightness B as a function of right ascension α,declination δ and frequency ω. The B(α, δ, ω) is commonlyreferred to as a data cube or an image cube. In practice,brightness is obtained, for each frequency channel separately, asimages. While rendering a stack of such images in various ways
can illuminate the important aspects of a data cube, the processof finding relations between channels can be difficult and time
consuming. New instruments, such as ALMA and EVLA, which
can observe over a broad wavelength range and up to thousandsof channels, will present enormous challenges for the visualization
and analysis of large numbers of paged images. It is often
desirable to render the data cube as a whole to examine fromarbitrary viewing angle and for any clip region of interest. To meetsome of these needs in CASA, we developed a GUI based on the
Qt OpenGL module for viewing 3D data.

Qt OpenGL Module
OpenGL (Open Graphics Library) is a standard specification
defining a cross-language, cross-platform API for 3D graphics.
OpenGL provides a complete feature set for graphics operations
in a pipelined hardware accelerated architecture for triangle andpolygon rendering. OpenGL provides little support for GUI
programming issues. The Qt OpenGL module is a platformindependent Qt/C++ wrapper that opens an OpenGL display€
buffer where one can use the OpenGL API to render the contents.
Qt OpenGL module is easy to use in Qt/C++ applications.

State Machine
Select data

This application uses right hand display
coordinate system (X, Y, Z), where X is horizontal
pointing to right. Without rotation, the world
coordinates (α, δ, ω) of a cube are parallel to (X,Y, Z). A cut-off brightness value can be selected
such that pixels with lower B become
transparent. The pixels of B values above thethreshold are assigned to colored vertices. Thecube is to rotate about its centerSet threshold

Map color((α − α 0 ) /2,(δ − δ0 ) /2,(ω − ω 0 ) /2))

Set viewport

and the radius of the bounding sphere is2€
Rotate X, Y, Z €Render cube

3DController
Update viewModify data
3DDataGet data

3DView

Example: NGC 6503
NGC 6503 is a normal spiral galaxy,type Scd. The cube used in thisexample is observed using NRAO’s
VLA and processed using AIPS
package. The 3D views of the HI
distribution over the whole disk
show its spiral arms. 3D view does
not calculate the statistic momentsof the HI distribution. It shows the“surface” luminosity directly. By
adjusting the threshold and cube
orientation, one can quickly
examine detailed features of thespiral. One can adjust rotation
angles from keyboard arrow keys,
from the widget’s sliding bar or edit
box, and by mouse dragging overthe displayed object.
The inner structure of the spiral canbe revealed by setting the positionsof the “near” and “far” clipping
planes to view only a slice of the bigstructure. Each thin slice, e.g.,
depth=5, can be inspected byadjusting the “near” plane position tomove the slice backward or forward.
The figure on the left shows the HI
distribution in a slice that is parallelto the major axis of NGC 6503 (itsposition angle is about 30°).

2r = (α − α 0 ) + (δ − δ0 ) + (ω − ω 0 ) /2

Set clip region

Scale (Zoom)

2

This application consists of 3 major C++ classes, 3DData, 3DView,and 3DController. Each class implements the functions of acomponent in the MVC (Model, View, and Controller) design pattern.
3DData selects data and builds the image cube. It is purely
independent on 3DController and 3DView modules. 3DViewcomponent renders the OpenGL visual onto screen. It executes
3DController commands to update display contents. 3DController firsttakes user inputs from keyboard, mouse and control buttons, thenupdates Model's states, and finally notifies 3DView to render thecube.

The viewing volume is created with orthographic
projection of the shape of a cube and its
bounding planes are at ±r. The region of interest
can be further confined by 2 clipping planes
adjustable for Z=near and Z=near+depth. The
cube is then rotated in the order of X, Y and Zand scaled. Finally the cube is rendered on to
the screen and the controller is reset to listen to
the next user request.

If the 3 rotation angles are zero, thecube’s orientation is the same asthat in a usual 2D viewer, thus 3D
viewer acts as 2D viewer.

Acknowledgement
I thank Kumar Golap for his comments and suggestions about the 3D viewer. I greatly
benefited from reading 2009, AJ 137, pp. 4718-4733, by Eric Greisen, Kristine
Spekkens, and Gustaaf van Moorsel.