# Changing Image Contrast

## Changing image contrast

There are several ways of changing the image contrast in MIPAV:

### Changing image contrast using the right mouse button

Changing image contrast

The right mouse button provides a very simple way of changing image contrast. To do so, open an image and then hold down the right mouse button and drag it around the screen. The cursor changes from a red cross to one that is shown in Figure 23. To restore an image to its original appearance, refer to Restoring images to their original appearance.

When you drag the cursor up and down or across the image, the image may become darker and gradually disappear or become lighter in appearance. At some points you may be able to create a negative of the image.

The image transformation function used in a gray-scale lookup table
Three examples of 8-bit gray-scale LUT transform functions, (a) a one-to-one transformation mapping the intensity range [0-255] to [0-255]. (b) A linear LUT function highlighting only pixels lying within the range [74-197], (c) A non-linear gamma transformation function
The Level and Window dialog box

The basic concept that lays behind the window/level concept is to apply a linear gray-scale transform function, in the form of a lookup table (LUT) specified by these two parameters - window and level. These two parameters defined a specific subset (or range) of pixel intensities to be displayed. The end result after applying window/level function is that pixel intensities corresponding to the defined subset of the entire dynamic range are highlighted, while pixel intensities that are falling outside the specified range are changed to be within that range.

### LUT processing

In the LUT processing technique each pixel in the input image is mapped to the corresponding pixel in the output image, with the new pixel intensity taking on a value specified by the chosen LUT.

One way of specifying a linear gray-scale transform function is to define 2 parameters:

• The width of the LUT where the slope is nonzero - this corresponds to the Window parameter,
• And the center of that segment - this corresponds to the Level parameter.

Holding the window constant while adjusting the level has the effect of moving the non-zero slope portion of the transform to the left or to the right.

The Adjust Window and Level icon on the Image toolbar provides another way to change the contrast of images.

### The Level and Window dialog box

Move each slider up or down to change the contrast of the image. The changes are immediately effective in the image.

1. Open an image file. The image appears in an image window.
2. Click Adjust Window and Level. The Level & Window dialog box appears.
3. In the dialog box, move each slider up or down to change the contrast of the image. The changes are immediately effective in the image. Click Close when done.

## Improving contrast by generating and modifying histograms

The Lookup Table window

To generate a histogram of an image, you can use the Lookup Table icon or call LUT > Histogram LUT. To obtain a histogram summary, which is in the tabular form, use the Algorithms > Histogram Tools > Histogram Summary command.

### Look up tables (LUT)

Look up tables (LUT) are data stored in the computer that is used to substitute new values for each pixel during the processing. LUT indicates the intensity of each voxel in the image and, in MIPAV, allows you to remap the original intensities to other intensities. LUT indicates what number is to be substituted for each pixel value during the processing of the image, however processing with this LUT does not change the image. One of the advantages of digital processing is that the processing parameters (factors) can be selected to produce images with different contrast characteristics. See also LUT Processing.

Transfer function reflects the relationship between the original image intensity values and how they are mapped into the LUT. The line in the LUT represents the transfer function.

The Histogram dialog box

### To generate a histogram for an image:

1. Open an image. The image appears in an image window.
2. Do either of the following: click Lookup Table icon or select LUT > Histogram-LUT. For images that do not contain VOIs, the Lookup Table window opens.
3. For images that contain VOIs, the Histogram dialog box appears. In the dialog box, select either Whole image or VOI region(s).
4. Click OK. A progress message appears. After a few moments, the Lookup Table window opens.

To change back to the original grayscale intensities, click Gray LUT in the MIPAV window.

## Lookup Table dialog box

 File Open LUT-Opens a previously saved LUT file. LUT files have an. LUT extension. Save LUT-Saves the LUT displayed in this window in a LUT file. Open user defined LUT- opens a file with the user defined LUT. Save user defined LUT- saves a user defined LUT. Open Transfer Functions-Opens a previously saved transfer function. Transfer function files have a .FUN extension. Save Transfer Functions-Saves the transfer function displayed in this window to a file. Close LUT-Closes the LUT window. The Lookup Table dialog box Utilities Change number of colors-Allows you to change the number of colors displayed in the image. Valid values are 2 to 256. CT function-Allows you to select a preset LUT that is appropriate for the image content. Values are abdomen, head, lung, mediastinum, spine, and vertebrae. Invert LUT-Creates a negative of the image. Reset transfer function-resets the chosen LUT back to Gray LUT. Reset histogram and LUT A-Returns image A to its original values. Reset histogram and LUT B-Returns image B to its original values. This command is only available if two images are open. LUT toolbar - Gray LUT; - Red LUT; - Green LUT; - Blue LUT; - Cool-Hot LUT; - Gray/Blue/Red LUT; - Hot Metal LUT; - Spectrum LUT; - Skin LUT; - Bone LUT; - Stripped LUT; - Invert LUT. Functions toolbar - Transfer function; - Reset Transfer function; - Even Distributed Transfer function; - Dual Trashed function; - Dual Inverse Trashed function; - CT preset function; - Edit Alpha function; - Edit Red LUT; - Edit Green function; - Edit Blue function; - Open user Defined LUT; - Save User Defined LUT; - Generate LUT. Update (real-time) Changes the image as you make changes to the LUT, which allows you to see the effect of your changes immediately on the image. Log scale (histogram) Displays the image's histogram count in log scale along the Y axis. Interpolate image Displays image using interpolation, which reduces pixilated image to appear more smooth. Caution: Depending on the memory resources of your workstation, interpolation can be very lengthy. 0 to 1 LUT adjustment Appears only for in the ImageB tab when two images are loaded in the same image frame.It processes the image for contrast as follows: for contrast <0, it uses a linear function to calculate the entire contrast look-up-table; for contrast 0, the contrast look-up-table is an identity table, and for contrast greater than 0, a linear function is used to calculate the linear region and for regions near min and max, the nonlinear function y=xn is used. . Number of colors Allows you to change the number of colors displayed in the image. LUT Displays the image intensities. Upper threshold Lower threshold Fill value The threshold options is a tool for setting thresholds for a gray level of the image in order to segment the image into an object and a background. This tool does applys a pceudo color (spesified in the Fill Value parameter) to the image, to show the pixels selected by the threshold setting, that is, those pixels with values equal to and between the thresholds.

## Applying color to images using predefined LUTs

MIPAV provides a variety of pseudo-color LUTs. When a pseudo-color LUT is applied to an image, the grayscale intensities are remapped to the pseudo-color intensity values.

### Using interpolation to smooth images

If you are zooming in on a portion of an image and want to reduce the appearance of pixilations in the image, make sure to select the Interpolate image check box. Interpolation smooths the pixilation.

#### To apply a pseudo-color LUT

1. Open an image.
2. Select the image window.
3. Click Displays Lookup Table icon to call the Lookup Table dialog box.
4. In the dialog box that appears, select one of the LUTs on the LUT toolbar.
5. Check the Update (real-time) box.
6. MIPAV immediately applies the LUT to the image.

To change back to the original grayscale intensities, click Gray LUT in the MIPAV window.

### Creating negatives of images with Invert LUT

An image before and after inversion

To create a negative image

1. Select the image window of the image you want to invert.
2. Click Invert LUT.

Based on the 256-step color values scale, MIPAV assigns the inverse value to each pixel of the image (refer to Figure 27).

Tips: You may wish to apply a LUT to the image or adjust the histogram of the image first before applying creating the negative.The Invert LUT icon is a toggle. To change the image back to its previous appearance, simply select Invert LUT again. To change the image back to its original appearance, select Reset LUT.

Note: Invert LUT appears on two different windows: in the Image toolbar in the MIPAV window (select Toolbars > Image toolbar to display the toolbar) and in the LUT toolbar in the Lookup Table window.

## Restoring images to their original appearance

To return to the original appearance of the image, click Reset LUT.

In addition, you can click the Gray icon to restore the image to grayscale if you have changed it or added colors.

## Comparing images using alphablending

Alphablending is a technique that adds transparency information to translucent objects. When two images share the same window such as when you are loading the image, you can adjust the alphablending settings so that you can see a blend of both images and can compare overlapping regions in two datasets. See also Opening and loading image files.

To use the alphablending function

1. Open the first image, then load the second image in the same window.
2. Adjust the alphablending slider at the bottom of the MIPAV window.
3. Move the slider to select the best ratio for the datasets of interest.
4. The level of translucency for one image is inversely proportional to the other. Thus, if image A is 75 percent transparent (25 percent opaque), then image B is 75 percent opaque (25 percent transparent). See also Image A and Image B.
The MIPAV window showing the alphablending slider at the bottom of the window