Create a True Color Image in an RGB frame
Return to the DS9 Users Manual
Most astronomical images map color to intensity level, e.g. lighter tones may correspond to a brighter intensity level in a greyscale image. An alternative way of presenting data is via an image that correllates color and energy.
ds9 has the capability to create an RGB image and interactively adjust many of its parameters to achieve optimal display results.
If you encounter any problems, please email saord @ cfa.harvard.edu.
- Creating an RGB Frame
- Apply Energy Filters
- Smoothing the Data (optional)
- Adjusting the Scale Parameters
- Adding a Coordinate Grid
- Saving the Output
- Figure 1: RGB window
- Figure 2: Lock menu in the RGB window
- Figure 3: RGB frame with three files loaded
- Figure 4: Energy-filtered RGB data
- Figure 5: Data smoothed with a Gaussian of radius three
- Figure 6: The adjusted pixel distribution for scaling
- Figure 7: Coordinate Grid parameters dialog box
- Figure 8: Final three-color image with coordinate grid overlaid
To use the three-color capabilities of ds9, the data must be loaded into a special RGB frame. This frame will contain all three files, stacked together in separate layers.
This thread uses Chandra data from an observation of Cas A (ObsID 198); the level=2 event file is named "casa.fits". The same file is loaded into each layer of the RGB frame; different energy filters will be applied to the layers in a later step.
There are two options for creating the RGB frame:
The command-line syntax can be used to create the RGB frame and load the three files into the red, green, and blue layers:
unix% ds9 -rgb -red casa.fits \ -green casa.fits \ -blue casa.fits &
ds9 will open with the three files in one frame. The RGB window (Figure 1) should open as well. If it doesn't, open it from the "Frame → RGB..." menu.
To load the files from the ds9 GUI:
Choose "New Frame RGB" from the "Frame" menu.
When the new frame is created, the RGB window (Figure 1) should open as well. If it doesn't, open it from the "Frame → RGB..." menu.
Make sure the "Red" band is selected in the "Current" column of the RGB window, then choose "File → Open..." in the main ds9 window and select the red file.
Change the current band to "Green" in the RGB window and open the green file.
Change the current band to "Blue" in the RGB window and open the blue file.
Each frame of the RGB image may have different binning, scaling, smoothing, and colorbars applied to it. You can "lock" the frames together, so that the setting is applied to all three frames at once. This is done with the Lock menu in the RGB window (Figure 2); all four options are checked in this thread.
Use the binning and zoom options in ds9 to adjust the image so that the full region of interest is visible. Figure 3 uses binning=2 and zoom=1. The "Scale" is set to "log: minmax"
The following energy bands are used for the RGB layers:
- red (soft band): 200-1500 eV
- green (medium band): 1500-2500 eV
- blue (hard band): 2500-8000 eV
The values are just guidelines and may need to be adjusted for your analysis.
To filter the data, first select the Red frame from the RGB window. Open the Bin → Binning Parameters dialog box and type "energy=200:1500" in the Bin Filter field. Choose "Apply" and the ds9 display will be updated to reflect the energy filter.
Without closing the Binning Parameters box, select the Green frame. Type "energy=1500:2500" in the Bin Filter field and choose "Apply" again. Repeat these two steps for the Blue layer, using the filter "energy=2500:8000".
The colors in the image, as seen in Figure 4, are correlated to the energy of the data.
Smoothing can help bring out finer features in the data by removing statistical noise. It is an optional step; experiment with smoothing to see if it improves the appearance of your data.
The smoothing capability in ds9 lets you interactively smooth the data. Note that for quantitative data analysis, smoothing should be done with the appropriate data analysis software; ds9 does a nice job for publication purposes.
Choose "Smooth" from the "Analysis" menu and the ds9 display is updated with the results of smoothing. The "Smooth" option can be toggled on and off during your ds9 session.
Open the "Smoothing Parameters..." dialog box from the same menu to adjust the function and kernel radius of the smoothing. This data were smoothed with a Gaussian function with radius of two. The results are shown in Figure 5.
This data is being displayed with a "log: minmax" scale. That means that ds9 stretches the scale to encompass the range of pixel values in the file. Adjusting the minimum and maximum scale values sets a threshold for the background data and brings out features.
To change the minimum and maximum values, open the "Scale → Scale Parameters" dialog box. The pixel distribution shown is for the band selected as "Current" in the RGB window; when the a different band is selected, the histogram of pixel values is updated to match.
To adjust the values, use the cursor to grab the red (minimum) or green (maximum) vertical lines on the plot and drag them to the desired location. You can type a value in to the "Low" or "High" field and hit "Apply" to set the limits.
A basic guideline for setting the low value is to minimize the contribution of the background. That is, adjust the minimum of each band until the background of the image is flat (i.e. solid black). For the maximum value, bringing it in to the last data point in the pixel distribution is usually sufficient.
For ObsID 198 with the smoothing applied, the following limits were chosen (listed as "low:high" pairs):
- Red - 0.4 : 20
- Green - 0.3 : 35
- Blue - 0.1 : 10
Figure 6 shows the image with the new pixel value limits set.
To add a coordinate grid to the image, choose the "Coordinate Grid" option from the "Analysis" menu. Then choose "Coordinate Grid Parameters" from the same menu to open the preferences dialog (Figure 7).
From the preferences box, you can change the color, font, line style (solid or dash), and line thickness for all elements of the grid. The font style, size, and color can be edited, and you can add titles. It is also possible to turn off the display of individual items via the "View" menu.
In Figure 8, we have turned off the grid lines and border. The axes have been changed to "Exterior Axes" (from the "Type" menu).
Once you are happy with your true color image, there are a number of output options in ds9.
Image formats: from the "File → Save Image As..." menu, you can choose JPG, PNG, or TIFF file formats.
Postscript: to create a postscript file, go to "File → Print..." and select "Print To: File".
Currently it is not possible to save the state of the ds9 imager, meaning that you cannot save the composite RGB frame and reopen later for further analysis.
|04 Jun 2009||Original version|
Return to the DS9 Users Manual