Class SummedAreaTable
java.lang.Object
org.eclipse.dawnsci.analysis.dataset.impl.SummedAreaTable
This code is based on:
http://en.wikipedia.org/wiki/Summed_area_table
This class can calculate the sum of a box region very fast
compared to ROIProfile. Therefore for instance if calculating
means of ROIs within a given plot, create a SummedAreaTable and
do the calculation through that.
I(x,y) = i(x,y) + I(x-1,y) + I(x,y-1) - I(x-1,y-1)
getDouble(...) and
set(Object, ...)
On Dataset are slow. Therefore we have replaced these with absolute index.
-
Constructor Summary
ConstructorsConstructorDescriptionSummedAreaTable(org.eclipse.january.dataset.Dataset image) Calls SummedAreaTable(Image, false)SummedAreaTable(org.eclipse.january.dataset.Dataset image, boolean willRequireVariance) Constructs the summed table. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetBoxFanoFactor(int[] point, int... box) Get the variance for a given box.doubleGet the variance for a given box.doublegetBoxMean(int[] point, int... box) doubledoublegetBoxSum(int[] point, int... box) doublegetBoxSum(IRectangularROI box) Give a point point, this will return the sum of a box around it.doublegetBoxVariance(int[] point, int... box) Get the variance for a given box.doubleGet the variance for a given box.doublegetDouble(int i, int j) org.eclipse.january.dataset.DatasetgetFanoImage(int radius) Creates a fano image where each pixel is the fano factor for a give box surrounding it.org.eclipse.january.dataset.DatasetgetFanoImage(int... box) Creates a fano image where each pixel is the fano factor for a give box surrounding it.org.eclipse.january.dataset.DatasetgetMeanImage(int radius) Creates a mean image where each pixel is the mean for a give box surrounding it.org.eclipse.january.dataset.DatasetgetMeanImage(int... box) int[]getShape()
-
Constructor Details
-
SummedAreaTable
Calls SummedAreaTable(Image, false)- Parameters:
image-- Throws:
Exception
-
SummedAreaTable
public SummedAreaTable(org.eclipse.january.dataset.Dataset image, boolean willRequireVariance) throws Exception Constructs the summed table.- Parameters:
image-willRequireVariance- set to true if you know that you need fano or variance- Throws:
Exception
-
-
Method Details
-
getFanoImage
Creates a fano image where each pixel is the fano factor for a give box surrounding it. This operation has improved speed because it uses the summed area table to compute a fast mean and variance for a given square.- Parameters:
radius-- Returns:
- fano factor image using box passed in.
- Throws:
Exception
-
getFanoImage
Creates a fano image where each pixel is the fano factor for a give box surrounding it. This operation has improved speed because it uses the summed area table to compute a fast mean and variance for a given box.- Parameters:
box-- Returns:
- fano factor image using box passed in.
- Throws:
Exception
-
getMeanImage
Creates a mean image where each pixel is the mean for a give box surrounding it. This operation has improved speed because it uses the summed area table to compute a fast mean and variance for a given square.- Parameters:
radius-- Returns:
- mean image using box passed in.
- Throws:
Exception
-
getMeanImage
- Throws:
Exception
-
getBoxSum
Give a point point, this will return the sum of a box around it. The box should really be an odd number such that the point is in the center- Parameters:
box-- Returns:
- the sum of a box around point of shape box
- Throws:
Exception
-
getBoxMean
- Parameters:
box-- Returns:
- mean from the summed area table
- Throws:
Exception
-
getBoxSum
- Parameters:
point-box-- Returns:
- sum of box
- Throws:
Exception
-
getBoxMean
- Parameters:
box-- Returns:
- mean from the summed area table
- Throws:
Exception
-
getBoxVariance
Get the variance for a given box. (1/n)(S2 - S1^2/n) Where: S1 is sum of box ( D+A-B-C of sum ) S2 is sum^2 of box ( D+A-B-C of sum ) n is number of pixels box covers- Parameters:
box-- Returns:
- variance
- Throws:
Exception
-
getBoxVariance
Get the variance for a given box. (1/n)(S2 - S1^2/n) Where: S1 is sum of box ( D+A-B-C of sum ) S2 is sum^2 of box ( D+A-B-C of sum2 ) n is number of pixels box covers- Throws:
Exception
-
getBoxFanoFactor
Get the variance for a given box. (1/n)(S2 - S1^2/n) Where: S1 is sum of box ( D+A-B-C of sum ) S2 is sum^2 of box ( D+A-B-C of sum ) n is number of pixels box covers- Parameters:
box-- Returns:
- variance
- Throws:
Exception
-
getBoxFanoFactor
Get the variance for a given box. (1/n)(S2 - S1^2/n) Where: S1 is sum of box ( D+A-B-C of sum ) S2 is sum^2 of box ( D+A-B-C of sum2 ) n is number of pixels box covers- Throws:
Exception
-
getShape
public int[] getShape() -
getDouble
public double getDouble(int i, int j)
-