ISIS Application Documentation
    Normalize columns or lines in a cube
  
            Description
              Categories
              Groups
              History
          Description
        
    
    The program accomplishes the fairly straightforward task of taking an input
    cube and outputting normalized values. These values may be represented as
    a table, PVL (parameter value language), or an entire output cube.
    
    Normalization may be done with respect to lines or with respect to columns.
    If the user were to normalize by line, the program would take a pass through
    the data in order to determine statistics for each line. Cubenorm will then
    pass through each pixel again and normalize each one based on the line in
    which that pixel is located.
    
    The normalization itself may be thought of as applying either a multiplicative
    correction or a subtractative correction. Consider the average of a column
    of data. Each pixel may be normalized by subtracting a normalization factor
    or multiplying by a normalization factor. Additionally, the user may decide
    to use a normalization factor based on the median instead of the average.
  
 
          Categories
        
Applications
                Parameter Groups
            
Files and options
| 
                    Name
                     | 
                    Description
                     | 
| FROM | 
          Input cube
         | 
| TO | 
          Optional output cube
         | 
| STATS | 
          Optional stats file
         | 
| FORMAT | Format type of STATS file (TABLE or PVL) | 
Optional Statistics Source
| 
                    Name
                     | 
                    Description
                     | 
| STATSOURCE | Input source of statistics to apply to FROM cube | 
| FROMSTATS | Optional statistics input file source | 
Normalization options
| 
                    Name
                     | 
                    Description
                     | 
| DIRECTION | Direction in which statistics and operations operate | 
| NORMALIZER | 
        	 Apply normalization using average or median
  	      | 
| MODE | 
             Apply coefficients through subtraction or division
          | 
| PRESERVE | Preserve the input image median/average | 
Files and options:
                        FROM
                         Description
                       
          Use this parameter to select input file
        
| 
                             Type
                            | cube | 
| 
                               File Mode
                              | input | 
| 
                               Filter
                              | 
          *.cub
         | 
 
Files and options:
                        TO
                         Description
                       
         Output file with input columns divided by the column average
        
| 
                             Type
                            | cube | 
| 
                               File Mode
                              | output | 
| 
                               Pixel Type
                              | real | 
| 
                               Internal Default
                              | 
        No Output file will be created
         | 
 
Files and options:
                        STATS
                         Description
                       
          Statistical output of each column
          (band #, column #, valid pixels, average, median, std, min, max)
        
| 
                             Type
                            | filename | 
| 
                               File Mode
                              | output | 
| 
                               Internal Default
                              | 
        No Output file will be created
         | 
 
Files and options:
                        FORMAT
                         Description
                       
         Specify the format type of the statistics file, either
         use tabular or PVL style format.
         
| 
                             Type
                            | string | 
| 
                               Default
                              | TABLE | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| TABLE |  Create TABLE output  | 
            Statistics data to be generated in tabluar form, each
            sample column is placed in a row in the tabluar output.
             | 
 
| PVL | Create PVL output | 
               Statistics data to be in PVL (Parameter Value
               Language) format
             | 
 
 
 | 
 
Optional Statistics Source:
                        STATSOURCE
                         Description
                       
               
                   This option is intended to be used when the statistics come from
                   a source other than the input cube (default).  cubenorm initial
                   derives all its statistics from the input cube and applies it as
                   specified by the user in the same run.  This works for most
                   conditions but does not works so well with abrupt changes
                   in brightness such as craters or poles.
               
               
                   With this option, it is now possible to have the statistics come
                   a file in a format compatable with the STATS output file.  This can
                   be a TABLE or PVL formatted input file.  This allows statistics
                   from other cubenorm runs to be used as input statistics source.
                   It also allows intermediate processing on the FROM stats to
                   apply additional smoothing or culling techniques.
               
           
| 
                             Type
                            | string | 
| 
                               Default
                              | CUBE | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| CUBE | Statistics are computed from FROM input cube | 
                       This is the old behavior.  The statistics are computed from
                       the input cube as specified by the FROM parameter.  They
                        are also applied to the TO file if specifed in the same run.
                   Exclusions
 | 
 
| TABLE | Statistics are provided in FROMSTATS in TABLE format | 
                       This option requires a filename in FROMSTATS with TABLE formatted
                       data.  This format is the same format as is generated in the STATS
                       output file.
                    | 
 
| PVL | Statistics are provided in FROMSTATS in PVL format | 
                       This option requires a filename in FROMSTATS with PVL formatted
                       data.  This format is the same format as is generated in the STATS
                       output file.
                    | 
 
 
 | 
 
Optional Statistics Source:
                        FROMSTATS
                         Description
                       
              
                  This optional file provides the statistics that are applied to the input
                  FROM file.   Its format must be TABLE or PVL and consistant with
                  the STATS file output format.
              
              
                  If this option is utilized, the statistics gathering step is bypassed.
              
          
| 
                             Type
                            | filename | 
| 
                               File Mode
                              | input | 
| 
                               Filter
                              | *.txt | 
 
Normalization options:
                        DIRECTION
                         Description
                       
        	This is the direction in which normalization occurs. If the user chooses
        	to process by column, they intend to take in an entire column of data
        	and normalize based on the average or median of that column for each
        	pixel in that column. If they choose to process by line, they intend to
        	do the same for each pixel, but with respect to lines.
         
| 
                             Type
                            | string | 
| 
                               Default
                              | COLUMN | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| COLUMN |  Normalize columns  | 
              Gather statistics by moving left to right through the cube
             | 
 
| LINE | Normalize lines | 
	           Gather statistics by moving from top to bottom through the cube
             | 
 
 
 | 
 
Normalization options:
                        NORMALIZER
                         Description
                       
           This option is used to select if column or line is normalized using its average or median
         
| 
                             Type
                            | string | 
| 
                               Default
                              | MEDIAN | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| MEDIAN | Use column/line median when normalizing | 
                  This option will use the median of the column/line when normalizing each column/line
                | 
 
| AVERAGE | Use column/line average when normalizing | 
                   This option will use the average of the column/line when normalizing each column/line
                 | 
 
 
 | 
 
Normalization options:
                        MODE
                         Description
                       
           This option is used to select select how normalization coefficients are applied, either subtracting or dividing by
           the average or median.
         
| 
                             Type
                            | string | 
| 
                               Default
                              | DIVIDE | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| DIVIDE | Divide column/row by its median/average | 
                  This option will divide each column (or row) by its normalizer (median or average).
                | 
 
| SUBTRACT | Subtract median/average from column/row | 
                   This option will subtract the normalizer (median or average) from each column (or row).
                 | 
 
 
 | 
 
Normalization options:
                        PRESERVE
                         Description
                       
              This option is used to preserve the average/median of the input image.  If turned off, the output image
              average of the data will be one (unity) for the DIVIDE mode or zero for the SUBTRACT mode.
          
| 
                             Type
                            | boolean | 
| 
                               Default
                              | TRUE | 
 
              History
          
| Eric Eliason | 2004-06-15 | 
      Original version (as colnorm)
     | 
| Drew Davidson | 2005-07-06 | 
      Added options for subtractative corrections
     | 
| Drew Davidson | 2005-07-06 | 
      Added process by line option and rename to cubenorm
     | 
| Drew Davidson | 2005-07-06 | 
      Modified unit test to take new options in to account
     | 
| Jeff Anderson | 2005-09-09 | 
      Major reworking and bug fixes
     | 
| Drew Davidson | 2005-10-24 | 
      Specialized to run using input files.
     | 
| Kris Becker | 2007-01-11 | 
      Incorporate UA cubenorm_plus version functionality
     | 
| Christopher Austin | 2008-03-17 | 
      Changed a single valid pixel's RowCol's Standard Deviation to 0 instead of 
      Isis:Null.  When reading in a table file, all Standard Deviations less 
      than 0 are considered 0.
     | 
| Steven Lambright | 2008-05-13 | 
      Removed references to CubeInfo 
     | 
| Steven Koechle | 2008-09-02 | 
      Fixed check in getstats method that sees whether you are processing by 
      line or column.
     | 
| Steven Lambright | 2009-07-30 | 
      Removed redundancy of having static global variables
     |