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


reduce

Printer Friendly View | TOC | Home

Reduce the pixel dimensions of an image

Overview Parameters Example 1 Example 2

Description

This program reduces a cube to a given proportion of the original or to specific pixel dimensions.

The reduction method options include either averaging the pixels (AVERAGE) or selecting the closest pixel at the window center (NEAREST) when generating a sub-sampled cube. More information is included under the Parameter Group headings.

For Level1:

  • All keywords in the input file label are propagated to the output file
  • An AlphaCube group with the original size is created in the output cube labels
  • Coordinates returned in qview are accurate if SPICE kernels are present in the labels

For Level2 or Mosaic:

  • The Scale and PixelResolution are recomputed if SSCALE and LSCALE are equal
  • The Mapping Group is removed if SSCALE and LSCALE are not equal
  • Coordinates are returned in qview only if the Mapping group was propagated
  • Use the same value for SSCALE and LSCALE if the reduced cubes will be mosaicked together

Use the ONS and ONL parameters with caution because the scaling factor for the samples and lines may be different in the output cube. Within this application, special pixels are considered invalid and will be replaced depending on the settings for VALIDPER and VPER_REPLACE parameters.


Categories


History

Jeff Anderson1995-11-06 Original version
Tracie Sucharski2002-10-12 Ported to Isis 3.0, Separated magcube into reduce and enlarge.
Tracie Sucharski2003-05-13 Read in ons/onl as integers not doubles.
Stuart Sides2003-05-16 Modified schema location from astrogeology... to isis.astrogeology..."
Stuart Sides2003-07-29 Modified filename parameters to be cube parameters where necessary
Jeff Anderson2004-07-14 Fixed propagation bug
Tracie Sucharski2004-07-15 Forget to change ons/onl minimum inclusive values from 1.0 to 1 during the 2003-5-13 change.
Drew Davidson2005-08-17 Added example
Tracie Sucharski2006-04-03 Fixed bug in average algorithm, forgot to divide Vper by 100.
Jeff Anderson2006-09-19 Fixed problems when program ran in batchlist
Sean Crosby2007-02-28 Program now updates output file's mapping keywords
Steven Koechle2008-01-23 Changed so if it failed VPER the output cube would get null values. Now processes cube bands from user input correctly
Steven Lambright2008-05-13 Removed references to CubeInfo
Steven Koechle2008-05-15 Added radio button for VPER options to allow original functionality.
Steven Lambright2008-12-22 The "Scale" keyword in the Projection group in the labels is now being updated if this program is run on a projected cube.
Mackenzie Boyd2009-09-03 Added keyword REDUCTION_TYPE to allow for clear switching between ons, onl and sscale, lscale. Fixed problem involving cube remaining open after an exception.
Janet Barrett2009-10-22 Now uses the SubArea class to produce output cube labels with corrected Mapping, Instrument, and AlphaCube groups.
Travis Addair2009-11-12 Improved documentation, changed parameter names, and updated examples.
Travis Addair2009-12-09 Updated documentation and changed parameters STOTAL and LTOTAL back to ONS and ONL, respectively.
Sharmila Prasad2011-04-26 Ported the reduce by near and average functionality from the app to base/objs/Reduce class
Sharmila Prasad2011-10-07 Fixed bug #0000463 regarding memory leak
Sharmila Prasad2012-02-01 Fixed bug #0000681 - reduce in ISIS 3.3.0 is ignoring the +N band identifier
Tracie Sucharski2013-01-16 Fixed an intermittent bug which caused a round off error which resulted in the output bands beyond band 1 being all NULL. Fixes #1385.
Ella Mae Lee2013-11-06 Updated the documentation and fixed incorrect information. Fixes #1691.

Parameter Groups

Files

Name Description
FROM Input cube to reduce
TO Output cube

Scaling Parameters

Name Description
ALGORITHMReduction method algorithm (Average, Nearest-Neighbor)
MODE Image reduction mode (SCALE or TOTAL)
SSCALESample scaling factor inverse
LSCALELine scaling factor inverse
ONSNumber of samples in output
ONLNumber of lines in output
VALIDPERValid percentage
VPER_REPLACEReplacement method when VALIDPER is not met
X

Files: FROM


Description

Use this parameter to select the filename. All bands within the file will be scaled down.

Type cube
File Mode input
Filter *.cub
Close Window
X

Files: TO


Description

This file will contain the results of the reduced cube. The output cube may not have all the keywords propagated to the output file depending on the reduction method chosen, and the type of input file.

Type cube
File Mode output
Filter *.cub
Close Window
X

Scaling Parameters: ALGORITHM


Description

Select the algorithm to use to reduce the image. The AVERAGE option will compute the output value by averaging the input pixels. The NEAREST option will assign the input pixel that is closest to the center of the window being analyzed as the output value.

Type string
Default AVERAGE
Option List:
Option Brief Description
AVERAGEAverage surrounding pixels Use pixel averaging to reduce the image.
NEARESTNearest-Neighbor Use the nearest-neighbor algorithm to reduce the image.
Close Window
X

Scaling Parameters: MODE


Description

Select between reducing the image to a proportion of the original (use a scaling factor inverse) or to specific pixel dimensions (define total number of pixels).

Type string
Default SCALE
Option List:
Option Brief Description
SCALE Reduce by a scaling factor inverse Reduces the input image by a scaling factor inverse. The scaling factor inverse must be specified in the SSCALE and LSCALE parameters, respectively.

Exclusions

  • ONS
  • ONL

Inclusions

  • SSCALE
  • LSCALE
TOTAL Reduce to specified pixel dimensions (samples, lines) Reduces the input image to a total number of pixels. The number of pixels in the output image must be specified in the ONS and ONL parameters, respectively.

Exclusions

  • SSCALE
  • LSCALE

Inclusions

  • ONS
  • ONL
Close Window
X

Scaling Parameters: SSCALE


Description

This is the scaling factor inverse for the sample direction. For example, SSCALE=4 will reduce the number of samples by 1/4th.

Type double
Default 1.0
Minimum 1.0 (inclusive)
Close Window
X

Scaling Parameters: LSCALE


Description

This is the scaling factor inverse for the line direction. For example, LSCALE=4 will reduce the number of lines by 1/4th.

Type double
Default 1.0
Minimum 1.0 (inclusive)
Close Window
X

Scaling Parameters: ONS


Description

The number of samples desired in the output cube. This value must be less than or equal to the number of samples in the input image.

Type integer
Minimum 1 (inclusive)
Close Window
X

Scaling Parameters: ONL


Description

The number of lines desired in the output cube. This value must be less than or equal to the number of lines in the input image.

Type integer
Minimum 1 (inclusive)
Close Window
X

Scaling Parameters: VALIDPER


Description

This parameter specifies what percentage of the pixels need to be valid (non-special pixels) to determine the output value based on the reduction method chosen. For example, scaling down by a factor of two results in a 2x2 window (four pixels) being reduced to one pixel. If VALIDPER is set to 50, then at least two of the four pixels (50%) must be valid. If this criterion is met, then the result is derived using the valid input pixels based on the chosen algorithm. Otherwise, the output pixel is assigned a NULL value by default or the closest pixel if "NEAREST" is chosen for VPER_REPLACE.

Type double
Default 50
Close Window
X

Scaling Parameters: VPER_REPLACE


Description

This parameter specifies the method to use when the value specified for VALIDPER is not met. The resultant pixel will be filled based on whether NULL or NEAREST is chosen for this parameter. The default is to replace with a NULL value if nothing is defined by the user.

Type string
Default NULL
Option List:
Option Brief Description
NULLNULL replacement Assign a NULL value when VALIDPER is not met.
NEARESTNearest-Neighbor replacement Use the nearest-neighbor algorithm to assign a value when VALIDPER is not met. The output pixel will be set to the input pixel which is closest to the center of the window being analyzed.
Close Window

Example 1

Reduce the image using different scale factor inverse

Description

In this example, the sample scale factor inverse is 2 (sscale=2) and no other parameter is entered. This implies that the default settings will be used for all the parameters except for sscale. The number of samples will be scaled down by a factor of 2, not scaled up. There will be no reduction in the number of lines because nothing was entered for lscale, and "lscale=1" is the default. Since the default mode of reduction is "SCALE," the mode parameter does not need to be specified.

Command Line

reduce from=peaks.cub to=reducedPeaks.cub sscale=2.0
In this example, the image will be scaled down by a factor of 2, not scaled up. No reduction in the lines will be made. The pixels that do not meet the VALIDPER setting will be set to NULL in the output file.

GUI Screenshot

GUI for REDUCE

Example GUI

Screenshot of the GUI with parameters set to perform a reduction of the input image. The default setting "algorithm=average mode=scale lscale=1 validper=50 vper_replace=NULL" will be used.

Input Image

The input image before reduction.

Input image for the reduce application

Parameter Name: FROM

This is the input image that will be reduced.

Output Image

The image after reduction.

Output image from the reduce application

Parameter Name: TO

This is the reduced image. Though it has been scaled down so that it can be viewed in a web browser, the essential change can still be observed. The distortion is noticeable because the output file has been reduced in the sample direction but not in the line direction. The output image is half as wide as the input image but is the same height, and the features are compressed in one direction.


Example 2

Reduce the image using the pixel dimensions

Description

Reduce the image by setting the number of samples to 150, and the number of lines to 250. The parameter Mode must be set to "Total" when the ONS and ONL parameters are used.

Command Line

reduce from=peaks.cub to=totalPeaks.cub mode=total ons=150 onl=250
In this example, the input image will be reduced to specific pixel dimensions. The parameter "mode" is set to "total" and the default settings will be used for the remaining parameters.

GUI Screenshot

GUI for REDUCE

Example GUI

Screenshot of the GUI with parameters set to perform a sample and line reduction to a total number of pixels. The default settings for "algorithm," "validper," and "vper_replace" will be used.

Input Image

The input image before reduction.

Input image for reduce application

Parameter Name: FROM

This is the image that will be reduced.

Output Image

The image after reduction.

Output image from the reduce application

Parameter Name: TO

This is the reduced image. Though it has been scaled down so that it can be viewed in a web browser, the essential change can still be observed. The distortion is noticeable because the output cube is not as wide as the input cube, and the features are compressed in one direction. The output cube has 1/3 the number of samples and 1/2 the number of lines as the input cube.