uk.ac.starlink.treeview
Class StatsValues

java.lang.Object
  extended by uk.ac.starlink.treeview.StatsValues

public class StatsValues
extends Object

Calculates statistics for an NDArray. All stats are calculated in the constructor, and the results are accessible via final public fields when it's done.

Author:
Mark Taylor (Starlink)

Field Summary
 long[] maxPosition
          The position of the maximum valued pixel.
 Number maxValue
          The maximum good-valued pixel; type reflects numeric type of array.
 double mean
          The mean of all the non-bad pixel values.
 long[] minPosition
          The position of the minimum valued pixel.
 Number minValue
          The minimum good-valued pixel; type reflects numeric type of array.
 long numGood
          The number of good pixels used.
 double total
          The sum of all the non-bad pixel values.
 double variance
          The variance of all the non-bad pixel values.
 
Constructor Summary
StatsValues(uk.ac.starlink.array.NDArray nda)
          Construct an object containing the statistics of a given NDArray.
StatsValues(uk.ac.starlink.array.NDArray nda, uk.ac.starlink.array.ChunkStepper stepper)
          Construct an object containing the statistics of a given NDArray, specifying the chunk stepper.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

total

public final double total
The sum of all the non-bad pixel values.


mean

public final double mean
The mean of all the non-bad pixel values.


variance

public final double variance
The variance of all the non-bad pixel values.


numGood

public final long numGood
The number of good pixels used.


minValue

public final Number minValue
The minimum good-valued pixel; type reflects numeric type of array.


maxValue

public final Number maxValue
The maximum good-valued pixel; type reflects numeric type of array.


minPosition

public final long[] minPosition
The position of the minimum valued pixel.


maxPosition

public final long[] maxPosition
The position of the maximum valued pixel.

Constructor Detail

StatsValues

public StatsValues(uk.ac.starlink.array.NDArray nda)
            throws IOException
Construct an object containing the statistics of a given NDArray.

Throws:
IOException

StatsValues

public StatsValues(uk.ac.starlink.array.NDArray nda,
                   uk.ac.starlink.array.ChunkStepper stepper)
            throws IOException
Construct an object containing the statistics of a given NDArray, specifying the chunk stepper. This can be used monitor progress by subclassing ChunkStepper and putting callbacks in, e.g. to control a JProgressBar (at time of writing there is an example of this in Treeview).

Parameters:
nda - the array to calculate stats for
stepper - a stepper supplying the blocks in which the calculation is done. Must have getTotalLength the same as the number of pixels in nda
Throws:
IOException - if there is trouble reading the array
IllegalArgumentException - if stepper.getTotalLength()!=nda.getShape().getNumPixels()


Copyright © 2002-2017 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.