Package jhd.FloodFill
Class Offsets
java.lang.Object
jhd.FloodFill.Offsets
- Direct Known Subclasses:
FloodFill
,GDT3D
,HybridFloodFill
public class Offsets
extends java.lang.Object
A class with static methods for working with voxel offsets
- Offsets are used to quickly access the indices of voxels touching a central voxel by simply adding the offset to the voxel's 1D, 2D or 3D index.
- Offsets arrays are in decreasing order of connectivity, in 3D Face touching(0-5), Edge touching (6-17)and finally Corner touching(17-25).
- The connectivity of a flood is determined by how far down the list one goes.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Offsets.PointDesc
Class for 2D and 3D pixel offset and value information -
Method Summary
Modifier and Type Method Description static Offsets.PointDesc[]
get1dOffsets2D(int width, int height)
Get the absolute 1D offsets of pixels surrounding a 2D central pixelstatic Offsets.PointDesc[]
get1dOffsets2D(int width, int height, double pixWidth, double pixHeight)
Get the absolute 1D offsets and center-to-center distances of pixels surrounding a 2D central pixel, pixel units must be the samestatic Offsets.PointDesc[]
get1dOffsets3D(int width, int height, int depth)
Get the absolute 1D offsets of voxels surrounding a 3D central voxelstatic Offsets.PointDesc[]
get1dOffsets3D(int width, int height, int depth, double pixWidth, double pixHeight, double pixDepth)
Get the absolute 1D offsets and center-to-center distances of voxels surrounding a central voxel, voxel units must be the samestatic java.lang.String[]
GetConnectivityChoices()
static int
GetConnectivityValue(java.lang.String connectivityChoice)
static Offsets.PointDesc[]
getIndexOffsets2D()
Get the index offsets of pixels surrounding a 2D central pixel, eg offset(-1,0) is to the left, if the central pixel is (27,32) the one to the left is(26,32)static Offsets.PointDesc[]
getIndexOffsets2D(double pixWidth, double pixHeight)
Get the index offsets and distance of pixels surrounding a central pixel, eg offset(-1,-1) is (left,up) , if the central pixel is (27,32) the one to the left,up is(26,31) and the distance is √ pixWidth2 + pixHeight2, voxel units must be the same.static Offsets.PointDesc[]
getIndexOffsets3D()
Get the index offsets of voxels surrounding a central voxel, eg offset(-1,-1,-1) (left,up,forward), if the voxel pixel is (27,32,57) the one to the left,up,forward is(26,31,56)static Offsets.PointDesc[]
getIndexOffsets3D(double pixWidth, double pixHeight, double pixDepth)
Get the index offsets and distance of voxels surrounding a central voxel, eg offset(-1,-1,-1) (left,up,forward), if the voxel pixel is (27,32,57) the one to the left,up,forward is(26,31,56) and the distance is √ pixWidth2 + pixHeight2 + pixDepth2 , voxel units must be the same.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
GetConnectivityChoices
public static java.lang.String[] GetConnectivityChoices()- Returns:
- A list of voxel connection types "Face","Face & Edge","Face, Edge &Corners"
-
GetConnectivityValue
public static int GetConnectivityValue(java.lang.String connectivityChoice)- Parameters:
connectivityChoice
- A string returned from GetConnectivityChoices- Returns:
- The maximum index of the offset array for the requested connectivity e.g. maxIndex = 6 for Face connected voxels, use for(i=0;i<maxIndex;i++)
-
get1dOffsets2D
Get the absolute 1D offsets of pixels surrounding a 2D central pixel- Parameters:
width
- image width in pixelsheight
- image height in pixels- Returns:
- An PointDesc array of offsets from a 1D index, face(0-3), face&edge(0-7)
-
get1dOffsets2D
public static Offsets.PointDesc[] get1dOffsets2D(int width, int height, double pixWidth, double pixHeight)Get the absolute 1D offsets and center-to-center distances of pixels surrounding a 2D central pixel, pixel units must be the same- Parameters:
width
- image width in pixelsheight
- image height in pixelspixWidth
- pixel width in physical unitspixHeight
- pixel height in physical units- Returns:
- An PointDesc array of 1D offsets and physical distances
-
get1dOffsets3D
Get the absolute 1D offsets of voxels surrounding a 3D central voxel- Parameters:
width
- image width in pixelsheight
- image height in pixelsdepth
- depth width in pixels- Returns:
- An PointDesc array of offsets from a 1D index, 3D face(0-5) 3D face&edge(0-17), 3D face,edge,corners(0-25)
-
get1dOffsets3D
public static Offsets.PointDesc[] get1dOffsets3D(int width, int height, int depth, double pixWidth, double pixHeight, double pixDepth)Get the absolute 1D offsets and center-to-center distances of voxels surrounding a central voxel, voxel units must be the same- Parameters:
width
- image width in pixelsheight
- image height in pixelsdepth
- image width in pixelspixWidth
- pixel width in physical unitspixHeight
- pixel height in physical unitspixDepth
- pixel depth in physical units- Returns:
- An PointDesc array of offsets and physical distances, face(0-5), face&edge(0-17), face,edge,corners(0-25)
-
getIndexOffsets2D
Get the index offsets of pixels surrounding a 2D central pixel, eg offset(-1,0) is to the left, if the central pixel is (27,32) the one to the left is(26,32)- Returns:
- a list of i,j 2D offsets, face(0-3), face&edge(0-7)
-
getIndexOffsets2D
Get the index offsets and distance of pixels surrounding a central pixel, eg offset(-1,-1) is (left,up) , if the central pixel is (27,32) the one to the left,up is(26,31) and the distance is √ pixWidth2 + pixHeight2, voxel units must be the same.- Parameters:
pixWidth
- pixel width in physical unitspixHeight
- pixel height in physical units- Returns:
- a list of i,j 2D offsets and distances, face(0-3), face&edge(0-7)
-
getIndexOffsets3D
Get the index offsets of voxels surrounding a central voxel, eg offset(-1,-1,-1) (left,up,forward), if the voxel pixel is (27,32,57) the one to the left,up,forward is(26,31,56)- Returns:
- A PointDesc array of i,j,k offsets, face(0-5), face&edge(0-17),face,edge,corners(0-25)
-
getIndexOffsets3D
public static Offsets.PointDesc[] getIndexOffsets3D(double pixWidth, double pixHeight, double pixDepth)Get the index offsets and distance of voxels surrounding a central voxel, eg offset(-1,-1,-1) (left,up,forward), if the voxel pixel is (27,32,57) the one to the left,up,forward is(26,31,56) and the distance is √ pixWidth2 + pixHeight2 + pixDepth2 , voxel units must be the same.- Parameters:
pixWidth
- pixel width in physical unitspixHeight
- pixel height in physical unitspixDepth
- pixel depth in physical units- Returns:
- An PointDesc array of I,J,K offsets and physical distances from the central voxel, face(0-5), face&edge(0-17) 3D face(0-9), face,edge,corners(0-25)
-