3D

### 3-D Frames

> Previous versions of SAOImage DS9 would allow users to load 3-D data into the traditional 2-D frames, and would allow users to step through successive z-dimension pixel slices of the data cube. To visualize the 3-D data in DS9 v. 7.0, a new module, encompassed by the new `Frame 3D` option, allows users to load and view data cubes in multiple dimensions.

> The new module implements a simple ray-trace algorithm. For each pixel on the screen, a ray is projected back into the view volume, based on the current viewing parameters, returning a data value if the ray intersects the FITS data cube. To determine the value returned, there are 2 methods available, Maximum Intensity Projection (MIP) and Average Intensity Projection (AIP). MIP returns the maximum value encountered, AIP returns an average of all values encountered. At this point, normal DS9 operations are applied, such as scaling, clipping and applying a color map.

> Rendering time is independent upon the actual data cube size. Instead, the time it takes to render is based on how many rays are needed to project the data cube upon the screen in the view volume and the current zoom factor. The new module requires no special hardware or graphical processor unit (GPU) and the rendering time is adequate for interactive GUI manipulation on most computers. The rendering engine is developed using the POSIX thread library, allowing multiple light weight processes to be spawned to complete an image in parallel. The number of threads actually generated is a user specified parameter. Since all modern hardware contain multiple CPU cores, the default value is 8 threads. For larger work stations, this number can be increase. For every doubling in the number of CPU cores available, rendering times decrease approximately 75%.

> > `Example:`
> > `# create 3d frame, load fits file`
> > `# set view angle to az 45 el 30 deg`
> > `# set rendering method to Average Intensity Projection`
> > `% ds9 -3d mycube.fits` `-3d vp 45 30` `-3d method aip`
> > `% xpaset -p ds9 3d`
> > `% xpaset -p ds9 file mycube.fits`
> > `% xpaset -p ds9 3d vp 45 30`
> > `% xpaset -p ds9 3d method aip`

> All 2-D graphics, regions, cross hairs, contours, and coordinate grids, are applied to the current slice, which is selected by the user. When the user wishes to match or lock a 2-D image and to a 3-D data cube, the current slice is used to determine the rendering solution. The user can crop the data cube for all 3 axes via the command line or the GUI. The new module also supports FITS event files binned into a data cube.
> All printing support has been extended to the new 3-D module. The user may generate 3-D images in Postscript, JPEG, TIFF, and other formats, just as in the 2-D case. Furthermore, native printing is supported for the Windows version.
> DS9 analysis macros have been enhanced to fully support the new 3-D module, allowing the user to invoke external analysis tasks based on the current view parameters and to return results back into DS9 in the form of text, plot, 2-D image, or 3-D image.