Keywords: front-page

## Lab: Window and Level Contrast Enhancement

[Exercises] [Workspace]

Purpose: The purpose of this lab is to experiment with the window and level technique for image contrast enhancement.

Activities:

1. Determine statistical information for a given data set and calculate the histogram.

   1. Select the image $DIP/data/spine.kdf and display it using operators User defined and Display Image.

      1. Glyphs:Input/Output:Data Files:User defined
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

   2. Determine the maximum and minimum values in the image using the operators Statistics and File Viewer.

      1. Glyphs:Data Manip:Analysis & Information:Statistics
      2. Glyphs:Input/Output:Information:File Viewer
      3. Open the Statistics pane and select the "minimum" and "maximum" options.
      4. Connect the operators and run the network.

   3. Obtain the histogram and plot it. Use operators Histogram and Display 2D Plot.

      1. Glyphs:Data Manip:Histogram Operators:Histogram
      2. Glyphs:Visualization:Plot Display:Display 2D Plot
      3. Open the Histogram pane and set the "Number of bins" and "Minimum" parameters using the maximum and minimum values determined in the previous step.

2. Apply the Window and Level technique.

   1. From the histogram, choose an "Intensity of Interest (IOI)" range. A set of good values for this image range from 1050 to 1150. This gives a window of 100.
   2. First clip the intensity value outside the desired range using the operator Clip Outside.

      1. Glyphs:Data Manip:Threshold & Clip Operators:Clip Outside
      2. Open the Clip Outside pane and set the cutoff values to be the lower and upper values determined in step A.

   3. Normalize the image (0 to 255) using the Normalize operator and display the results.

      1. Glyphs:Data Manip:Data Conversion:Normalize
      2. Glyphs:Visualization:Non-Interactive Display:Display Image

3. You can interactively enhance the image using this "window and level" technique by using the Edit Image glyph.

   1. Glyphs:Visualization:Interactive Display:Edit Image
   2. Click on the "Threshold" option to show the threshold pane
   3. Select "Window Contrast Enhancement" in the Threshold window
   4. Drag with the mouse the "Upper" horizontal scrooling bar to dinamically change the windown and level enhancement parameters applied to the image.

Exercises

1. Experiment by changing the "Window" and "Level" parameters.

Khoros Workspace
Execute the visual program c4s3window-level.wk