Home

User Documentation

Getting Started
Learn More
Explore in Detail
Get Inspired

Contributor Documentation

Getting Started
Learn More
Explore in Detail
Get Inspired

Quick Links

Software Manual
AstroDiscuss
GitHub
API Reference

Documentation Versions


ISIS 2

Documentation
Tutorials
Technical Documents
USGS

ISIS Application Documentation


median

Standard View | TOC | Home

Set pixels to median of surrounding pixel values

Description
Categories
Groups
Examples
History


Description

This program accepts a user-defined boxcar and loops through the input image. It finds the median pixel value in the boxcar, and sets the output center pixel to that median value. This will acheive a "blurring" effect, similar to the lowpass filter.

Categories


Parameter Groups

Files

Name Description
FROM Input Cube
TO Output Cube

Boxcar Size

Name Description
SAMPLES Number of samples in Boxcar
LINES Number of lines in Boxcar

Boxcar settings

Name Description
LOW The minimum value of a valid pixel
HIGH The maximum value of a valid pixel
MINOPT Sets minimum to be either a count or a percentage
MINIMUM Minimum boxcar pixels required for filter
REPLACEMENT Replacement value if minimum number of pixels does not exist

Non-Special Pixel Filtering

Name Description
FILTER The style of filtration

Special Pixel Filtering

Name Description
NULL Filter NULL Pixels
HRS Filter HRS Pixels
HIS Filter HIS Pixels
LRS Filter LRS Pixels
LIS Filter LIS Pixels

Files: FROM

Description

This is the cube from which we will gather our data.

Type cube
File Mode input
Filter *.cub

Files: TO

Description

This is the cube to which we will write the modified data.

Type cube
File Mode output
Filter *.cub

Boxcar Size: SAMPLES

Description

This will determine how many samples the boxcar will have. This value must be odd and cannot exceed twice the number of samples in the cube. Note that the larger the boxcar size, the slower the program will run. The size of the boxcar will also have an impact on the blurring effect. The larger the boxcar, the greater the blurring.

Type integer
Minimum 1 (inclusive)
Odd This value must be an odd number

Boxcar Size: LINES

Description

This will determine how many lines the boxcar will have. This value must be odd and cannot exceed twice the number of lines in the cube. Note that the larger the boxcar size, the slower the program will run. The size of the boxcar will also have an impact on the blurring effect. The larger the boxcar, the greater the blurring.

Type integer
Minimum 1 (inclusive)
Odd This value must be an odd number

Boxcar settings: LOW

Description

This value indicates the minimum value of a valid pixel. If a pixel holds a value below the minimum value, it will either be filtered or skipped over, depending on user input in the "Filter Style" area.

Type double
Internal Default Use all
Less Than
  • HIGH

Boxcar settings: HIGH

Description

This value indicates the maximum value of a valid pixel. If a pixel holds a value over the maximum value, it will either be excluded or included, depending on user input in the "Filter Style" area.

Type double
Internal Default Use all
Greater Than
  • LOW

Boxcar settings: MINOPT

Description

This parameter determines whether the minimum parameter is to be interpreted as a count of pixels, or a percentage of all pixels in the boxcar.

Type string
Default COUNT
Option List:
Option Brief Description
COUNT Minimum valid pixel count This option indicates that the minimum is a minimum count of pixels required for filtering.
PERCENTAGE Minimum valid pixel percentage This option indicates the the minimum parameter is to be interpreted as a percentage of the total pixels in the boxcar.

Boxcar settings: MINIMUM

Description

This is the minimum number of valid pixels required in a boxcar for filtering to begin.

Type double
Default 1

Boxcar settings: REPLACEMENT

Description

This determines what to put in the center pixel, if there are not enough valid pixels in the boxcar to meet the minimum requirement. The default is to replace it with the current value, and the other option will replace it with NULL.

Type string
Default CENTER
Option List:
Option Brief Description
CENTER Center pixel value This sets the center pixel of the boxcar to the input value if there are not enough valid pixels to meet the minimum requirement.
NULL Pixel value NULL This sets the center pixel of the boxcar to the special pixel value of NULL, if there are not enough valid pixels to meet minimum requirement.

Non-Special Pixel Filtering: FILTER

Description

These options determine which pixels are to be included in the filtering process. ALL filters all pixels, regardless of value, VALID only filters those pixels with values between LOW and HIGH, and INVALID only filters those pixels with values outside LOW and HIGH. Note that these only determine which Non-Special pixels to filter. Also, the median will only be calculated from pixel values between LOW and HIGH.

Type string
Default ALL
Option List:
Option Brief Description
ALL Filter All This option filters all Non-Special pixels, regardless of value. It only filters Special Pixels indicated by the user, and the median will only be calculated from pixel values between LOW and HIGH.
INSIDE Filter Piexls Between Low and High This option filters only those pixels with values between LOW and HIGH, as well as any Special Pixels indicated by the user, and the median will only be calculated from pixel values between LOW and HIGH.
OUTSIDE Filter Pixels Outside Low and High This option filters only those pixels with values outside LOW and HIGH, as well as any Special Pixels indicated by the user, and the median will only be calculated from pixel values between LOW and HIGH.

Special Pixel Filtering: NULL

Description

This determines whether NULL pixels are considered valid for the purposes of filtering. This, along with the user input in the "Filter Style" section, will determine whether NULL pixels are included in the filter.

Type boolean
Default TRUE

Special Pixel Filtering: HRS

Description

This determines whether HRS pixels are considered valid for the purposes of filtering. This, along with the user input in the "Filter Style" section, will determine whether HRS pixels are included in the filter.

Type boolean
Default TRUE

Special Pixel Filtering: HIS

Description

This determines whether HIS pixels are considered valid for the purposes of filtering. This, along with the user input in the "Filter Style" section, will determine whether HIS pixels are included in the filter.

Type boolean
Default TRUE

Special Pixel Filtering: LRS

Description

This determines whether LRS pixels are considered valid for the purposes of filtering. This, along with the user input in the "Filter Style" section, will determine whether LRS pixels are included in the filter.

Type boolean
Default TRUE

Special Pixel Filtering: LIS

Description

This determines whether LIS pixels are considered valid for the purposes of filtering. This, along with the user input in the "Filter Style" section, will determine whether LIS pixels are included in the filter.

Type boolean
Default TRUE

Examples


Example 1

Running median with a 3x3 boxcar

Description

This demonstrates running the median program on a sample cube using a 3x3 boxcar.

Command Line

median from= peaks.cub to=3x3median.cub samples=3 lines=3
This demonstrates the commands necessary to run median on a file named "peaks.cub" with a 3x3 boxcar. The small size of the boxcar will only produce a slight blur.

GUI Screenshot

median gui

Example GUI

Screenshot of the GUI set to filter all pixels for the image using a 3x3 boxcar.

Input Image

input cube

Input image before medain filter

Parameter Name: FROM

This is the original cube. The areas of greatest interest are those with a great deal of contrast such as edges.

Output Image

median output

Output of 3x3 boxcar median filter

Parameter Name: TO

This is the image after the filter. You may notice that the whole image is slightly softer, particularly around areas of sharp contrast. Due to the small size of the boxcar, the effect is subtle and difficult to notice.


Example 2

Running median with a 15x15 boxcar

Description

This demonstrates running the median program on a sample cube using a 15x15 boxcar.

Command Line

median from= peaks.cub to=15x15median.cub samples=15 lines=15
This demonstrates the commands necessary to run median on a file named "peaks.cub" with a 15x15 boxcar. The large size of the boxcar produces a marked blurring effect.

GUI Screenshot

median gui

Example GUI

Screenshot of the GUI set to filter all pixels for the image using a 15x15 boxcar.

Input Image

input cube

Input image before medain filter

Parameter Name: FROM

This is the original cube. The areas of greatest interest are those with a great deal of contrast such as edges.

Output Image

median output

Output of 3x3 boxcar median filter

Parameter Name: TO

This is the output image for a 15x15 boxcar. You will notice the entire image is noticeably blurrier. It is now virtually impossible to make out any but the largest of features.


History

Brendan George2005-11-04 Original version
Brendan George2006-06-05 Added Minopt parameter, modified user interface
Brendan George2006-06-19 Modified user interface