public class RATSQuadtree extends Object
Modifier and Type | Field and Description |
---|---|
boolean |
bverbose
produce informative messages flag
|
int[] |
dim
the width and height of the images
|
int |
level
the level of this family
|
double[] |
minSzPx
the minimum allowed size in pixels
|
float |
sum
the sum of pixels at this level
|
double |
x0
the coords of this level
|
double |
x1
the coords of this level
|
double |
y0
the coords of this level
|
double |
y1
the coords of this level
|
Constructor and Description |
---|
RATSQuadtree(int[] dim,
double minSzPx)
This is the entry constructor for the top level leaf
|
RATSQuadtree(int[] dim,
double[] minSzPx)
This is the entry constructor for the top level leaf
|
RATSQuadtree(int[] dim,
double[] minSzPx,
int level,
double x0,
double y0,
double x1,
double y1,
RATSQuadtree theParent)
This constructor is used by a Quadtree as it creates its children
|
Modifier and Type | Method and Description |
---|---|
int |
countLeaflets(int level)
This methods returns the number of leaflets for a given level
|
int |
countLevels()
This method returns the number of subsequent generations plus itself.
|
void |
drawBounds(ij.ImagePlus imp)
This method draws the rectangle
|
void |
drawBounds(int drawLevel,
ij.ImagePlus imp)
This method will draw the box for the leaf
|
void |
drawCenter(ij.ImagePlus imp)
This method will draw the center of the box
|
void |
fillWithSums(ij.process.ImageProcessor ip)
Fills the sum values.
|
int[] |
getArrayDim(float[][] arr)
Returns a two element array of [width,height]
|
int[] |
getArrayDim(RATSQuadtree[][] arr)
Returns a two element array of [width,height]
|
double[] |
getCenter()
Returns the center coordinates as [x,y]
|
String |
getChildName(RATSQuadtree qc)
Returns the two letter quadrant code for the provided child as (NW, NE, SW, SE, or NA)
|
RATSQuadtree[][] |
getChildren()
Returns the children of this leaf
|
double[] |
getCoordsDouble()
Returns the coordinates rounded to integer [x0, y0, x1, y1]
|
int[] |
getCoordsInteger()
Returns the coordinates rounded to integer [x0, y0, x1, y1]
|
int[] |
getDim(Object[][] arr)
Returns a two element array of [width,height] for the given input array.
|
double[] |
getDimDouble()
Returns the dimensions of the leaflet as double
|
int[] |
getDimInteger()
Returns the dimensions of the leaflet as integer
|
int |
getLevel()
Returns the level of this quadtree
|
RATSQuadtree[][] |
getLevel(int theLevel)
Returns an array of leaflets in [nw,ne,sw,se] order
|
String |
getName()
Returns the two letter quadrant code for the quadtree
|
RATSQuadtree |
getParent()
Returns the parent of this leaf
|
float[] |
getPixelsFloat(ij.ImagePlus imp)
This method returns the pixels enclosed in this leaflet.
|
float[] |
getPixelsFloat(ij.process.ImageProcessor ip)
This method returns the pixels enclosed in this leaflet.
|
RATSQuadtree[][] |
getSiblings()
Returns the siblings of this leaf
|
float[][] |
getSumArrayFloat(int theLevel,
ij.ImagePlus imp)
Returns a 2d array of the sums for the level specified
The is really for the top level leaf
|
float[][] |
getSumArrayFloat(int theLevel,
ij.process.ImageProcessor ip)
Returns a 2d array of the sums for the level specified
The is really for the top level leaf
|
float |
getSumFloat()
Returns the sum (which may not have been assigned, so use this after
filling the leaves with the sums.
|
float |
getSumFloat(ij.ImagePlus imp)
Returns the sum of the pixels enclosed in this leaflet
|
float |
getSumFloat(ij.process.ImageProcessor ip)
Returns the sum of the pixels enclosed in this leaflet
|
boolean |
hasChildren()
Returns true if this leaf has children
|
float[][] |
makeArrayFloat(int theLevel)
This method creates a 2d array for the level specified.
|
public boolean bverbose
public int[] dim
public int level
public double[] minSzPx
public double x0
public double y0
public double x1
public double y1
public float sum
public RATSQuadtree(int[] dim, double minSzPx)
dim
- the size of the original imageminSzPx
- the minimum allowed leaf size in pixels (used for both x and y)public RATSQuadtree(int[] dim, double[] minSzPx)
dim
- the size of the original imageminSzPx
- the minimum allowed leaf size in pixels [minx, miny]public RATSQuadtree(int[] dim, double[] minSzPx, int level, double x0, double y0, double x1, double y1, RATSQuadtree theParent)
dim
- the size of the original imageminSzPx
- the minumum leaf size in pixelslevel
- the assigned tree level\x0
- the left coordy0
- the top coordx1
- the right coordy1
- the bottom coordtheParent
- reference to the parent quadtree.public void fillWithSums(ij.process.ImageProcessor ip)
public int[] getDimInteger()
public double[] getDimDouble()
public double[] getCenter()
public int[] getCoordsInteger()
public double[] getCoordsDouble()
public String getChildName(RATSQuadtree qc)
qc
- the RATSQuadtree childpublic String getName()
public int getLevel()
public boolean hasChildren()
public RATSQuadtree[][] getChildren()
public RATSQuadtree getParent()
public RATSQuadtree[][] getSiblings()
public RATSQuadtree[][] getLevel(int theLevel)
theLevel
- the zero-based index of the level to retrievepublic float getSumFloat(ij.ImagePlus imp)
imp
- The ImagePlus image of pixelspublic float getSumFloat(ij.process.ImageProcessor ip)
ip
- The imageProcessor of pixelspublic float getSumFloat()
public float[][] getSumArrayFloat(int theLevel, ij.ImagePlus imp)
theLevel
- the zero-based index levelpublic float[][] getSumArrayFloat(int theLevel, ij.process.ImageProcessor ip)
theLevel
- the zero-based index levelpublic float[] getPixelsFloat(ij.ImagePlus imp)
imp
- the ImagePlus with the pixelspublic float[] getPixelsFloat(ij.process.ImageProcessor ip)
ip
- the ImageProcessor with the pixelspublic int countLeaflets(int level)
level
- The zero based level indexpublic int countLevels()
public void drawBounds(ij.ImagePlus imp)
imp
- the ImagePlus on to which to draw the boundspublic void drawCenter(ij.ImagePlus imp)
imp
- the ImagePlus onto which to draw the centerpublic void drawBounds(int drawLevel, ij.ImagePlus imp)
drawLevel
- the depth of leaves to drawimp
- the ImagePlus onto which to drawpublic float[][] makeArrayFloat(int theLevel)
theLevel
- the level to create an array for.public int[] getArrayDim(RATSQuadtree[][] arr)
arr
- The nxn array of quadtreespublic int[] getArrayDim(float[][] arr)
arr
- the nxm element array of floatspublic int[] getDim(Object[][] arr)
arr
- a nxm arrayCopyright © 2015–2021 Fiji. All rights reserved.