Package mgui.geometry.volume
Class VolumeFunctions
java.lang.Object
mgui.geometry.volume.VolumeFunctions
public class VolumeFunctions
extends java.lang.Object
Utility class providing various functions for use on volume data (Volume3DInt and its descendants).
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classVolumeFunctions.Operationstatic classVolumeFunctions.VolumeAxisstatic classVolumeFunctions.VolumeRotationAngle -
Constructor Summary
Constructors Constructor Description VolumeFunctions() -
Method Summary
Modifier and Type Method Description static voidapplyMask(org.jogamp.java3d.ImageComponent3D iComp, int index, int x, int y, int width, int height, VolumeMaskOptions_old params)Applies a voxel mask to an ImageComponent3D object, using the parameters in params.static Volume3DIntapplyRotation(VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle, Volume3DInt volume, InterfaceProgressBar progress_bar)Rotates aGrid3Dabout one of its basis vectors (axes), either 90, 180, or 270 degrees, resizes the relevant dimensions, and returns the new grid.static Volume3DIntapplyRotationBlocking(VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle, Volume3DInt volume)Rotates aGrid3Dabout one of its basis vectors (axes), either 90, 180, or 270 degrees, resizes the relevant dimensions, and returns the new grid.static Volume3DIntapplyRotationBlocking(VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle, Volume3DInt volume, InterfaceProgressBar progress_bar)Rotates aVolume3DIntabout one of its basis vectors (axes), either 90, 180, or 270 degrees, resizes the relevant dimensions, and returns the new grid.static intbyteToInt(byte b)static PointSet3DIntfindMaximaBlocking(Volume3DInt volume, java.lang.String source_column, java.lang.String mask_column, java.lang.String label_column)Returns a global maximum for a given volume or within a given mask, or mulitple maxima from a set of masks, specified bymask_column.static booleangetBlobsFromVolume(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, ProgressUpdater progress, int min_blob, double threshold)Finds connected blobs in a thresholded volume.static java.util.ArrayList<MguiNumber>getBlobsFromVolumeBlocking(Volume3DInt volume, java.lang.String column, ProgressUpdater progress, int min_blob, double threshold)Finds connected blobs in a thresholded volume.static bytegetByteValue(double d)static WindowedColourModelgetColourModel()static WindowedColourModelgetColourModel(int transferType)static WindowedColourModelgetColourModel(int transferType, ColourMap cmap)static WindowedColourModelgetColourModel(int transferType, ColourMap cmap, boolean setAlpha)static WindowedColourModelgetColourModel(int transferType, ColourMap cmap, double scale, double intercept, double window_width, double window_mid, boolean setAlphaFromIntensity)static java.awt.image.BufferedImagegetCompositeRSliceImage(Volume3DInt volume, int r)Returns a composite image from an R-slice plane and a volumestatic java.awt.image.BufferedImagegetCompositeRSliceImage(Volume3DInt volume, int r, java.util.ArrayList<java.lang.String> ordered_columns, java.util.ArrayList<WindowedColourModel> colour_models, java.util.ArrayList<java.lang.Double> alphas)Returns a composite image from an R-slice plane, volume, and set of colour models and composite alphas.static java.awt.image.BufferedImagegetCompositeRSliceImage(Volume3DInt volume, int r, java.util.ArrayList<java.lang.String> ordered_columns, java.util.ArrayList<WindowedColourModel> colour_models, java.util.ArrayList<java.lang.Double> alphas, java.util.ArrayList<java.lang.Boolean> include)Returns a composite image from an R-slice plane, volume, and set of colour models and composite alphas.static java.awt.image.BufferedImagegetCompositeSliceImage(Volume3DInt volume, int orientation, int section)Returns a composite image from an S,T, or R-slice plane, determined bysection, andvolume.static java.awt.image.BufferedImagegetCompositeSliceImage(Volume3DInt volume, int orientation, int section, java.util.ArrayList<java.lang.String> ordered_columns, java.util.ArrayList<WindowedColourModel> colour_models, java.util.ArrayList<java.lang.Double> alphas, java.util.ArrayList<java.lang.Boolean> include)Returns a composite image from an image plane, volume, determined byorientation, and set of colour models and composite alphas.static doublegetDoubleValue(byte b)static doublegetGaussianSmoothedValue(Volume3DInt volume, int[] voxel, int channel, org.jogamp.vecmath.Vector3f normal, float sigma_normal, float sigma_tangent, float cutoff)Computes a value forvoxelwhich is the weighted average of a Gaussian sampling of its neighbouring voxels, where the Gaussian is defined by a normal vector, its corresponding plane, and the sigma parameterssigma_normalandsigma_tangent.static HistogramgetHistogram(Volume3DInt volume, int bins)Returns a histogram for the current column ofvolume.static HistogramgetHistogram(Volume3DInt volume, int t, int bins, double min, double max)Returns a histogram for the current column ofvolume.static HistogramgetHistogram(Volume3DInt volume, java.lang.String column, int t, int bins, double min, double max)Returns a histogram for the vertex columncolumnofvolume.static Volume2DIntgetIntersectionCompositeImage(Volume3DInt volume, Plane3D plane, boolean setAlpha)Returns an Volume2DInt object representing the intersection of the given 3D compositevolumewithplane.static Volume2DIntgetIntersectionImage(Volume3DInt volume, Plane3D plane, boolean setAlpha)static Volume2DIntgetIntersectionImage(Volume3DInt volume, Plane3D plane, boolean setAlpha, org.jogamp.vecmath.Matrix4d transform)static Volume3DIntgetIntMaskedByValue(Volume3DInt volume, double comp_value)Returns an integer mask ofgrid, where a voxel has value = 1, whengrid(i,j,k,v) == comp_value(within tolerance), and 0 otherwise.static Volume3DIntgetIntMaskedByValue(Volume3DInt volume, double comp_value, boolean round)Returns an integer mask ofgrid, where a voxel has value = 1, whengrid(i,j,k,v) == comp_value(within tolerance), and 0 otherwise.static Volume3DIntgetInvertedVolume(Volume3DInt volume)Returns aGrid3Dobject whose data is the inverse ofgrid.static Volume3DIntgetInvertedVolume(Volume3DInt volume, java.lang.String column)Returns aGrid3Dobject whose data is the inverse ofgrid.static Volume3DIntgetInvertedVolume(Volume3DInt volume, java.lang.String column, ProgressUpdater progress)Returns aGrid3Dobject whose data is the inverse ofgrid.static bytegetMappedValueByte(Volume3DInt volume, int x, int y, int z)Returns the value of voxel [i,j,k] mapped with its colour model, as abyte.static doublegetMappedValueDouble(Volume3DInt volume, int x, int y, int z)static boolean[][][]getMask(Grid3D grid, VolumeMaskOptions_old params)Applies a voxel mask to an ImageComponent3D object, using the parameters in params.static java.awt.image.BufferedImage[]getMaskedCompositeImages(Volume3DInt volume)Returns a set of composite images, comprised of all data columns specified for the composite, with alpha values and ordering as specified in the Volume3DInt object.static java.awt.image.BufferedImagegetMaskedCompositeRSliceImage(Volume3DInt volume, int r, boolean[][][] mask)Returns a composite image from an R-slice plane, volume, and set of colour models and composite alphas.static java.awt.image.BufferedImage[]getMaskedImages(Volume3DInt volume)Produces a stack of R-planar images fromvolume, based upon the current data column and its associated colour map.static java.awt.image.BufferedImage[]getMaskedImages(Volume3DInt volume, java.lang.String column)Produces a stack of R-planar images fromvolume, based upon the data incolumnand its associated colour map.static int[]getNeighbouringVoxels(Grid3D grid, int[] voxel, int n)Returns the indices off all first neighbours ofvoxel, plusvoxel.static int[]getNeighbouringVoxels(Grid3D grid, org.jogamp.vecmath.Point3f point)Returns the indices off all first neighbours of the voxel enclosingpoint, plus that voxel.static int[]getNeighbouringVoxels(Grid3D grid, org.jogamp.vecmath.Point3f point, int n)Returns the indices off all first neighbours of the voxel enclosingpoint, plus that voxel.static java.awt.image.BufferedImagegetOverlayImage(java.util.ArrayList<java.awt.image.BufferedImage> images, WindowedColourModel colour_model)Compiles an overlay from the list of images by adding them one-by-one starting from the last element (since this will be on the bottom).static PointSet3DIntgetRoiCentroidsBlocking(Volume3DInt volume, java.lang.String source_column, int[] value_range, int min_size, boolean map_values, java.lang.String label_column, ProgressUpdater progress)Finds the centroids for all ROIs (identified as voxels with the same value).protected static Box3DgetRotatedBox(Box3D box, VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle)protected static int[]getRotatedDims(int[] dims, VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle)protected static int[]getTrilinearVoxels(Grid3D grid, org.jogamp.vecmath.Point3f point)Returns the trilinear neighbourhood ofpoint, which includes the 8 voxels surrounding and enclosing it.static org.jogamp.vecmath.Point3fgetVolumeSpaceMidPoint(Grid3D grid, int voxel)Returns the midpoint of this voxel ingrid's coordinate space.static org.jogamp.vecmath.Point3fgetVolumeSpaceMidPoint(Grid3D grid, int[] voxel)Returns the midpoint of this voxel ingrid's coordinate space.static byteintToByte(int i)static booleanisInMask(int i, int j, int k, VolumeMaskOptions_old params)Determines whether the voxel at i, j, k is in the mask specified by params.static voidmapVolumeToVolumeEV(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value.static booleanmapVolumeToVolumeEV(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value.static voidmapVolumeToVolumeEV(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value.protected static booleanmapVolumeToVolumeEVBlocking(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value.static voidmapVolumeToVolumeInterp(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value.static booleanmapVolumeToVolumeInterp(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value.static voidmapVolumeToVolumeInterp(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value.protected static booleanmapVolumeToVolumeInterpBlocking(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value.static Volume3DIntperformOperationBlocking(Volume3DInt volume, java.lang.Double value, VolumeFunctions.Operation op, ProgressUpdater progress)Performs the specified operation on one grid and a constant value, and returns and new volume.static Volume3DIntperformOperationBlocking(Volume3DInt volume1, Volume3DInt volume2, VolumeFunctions.Operation op, ProgressUpdater progress)Performs the specified operation on the two volumes, and returns the result as a newGrid3Dinstance.static intpowerOfTwo(int value)static int[]rotate(int[] coords, int[] dims, int axis, int rotation)static int[]rotateDims(int[] dims, int axis, int rotation)Returns new dimensions for a rotation about a basis axis.static booleansmoothVolumeGaussian(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, double fwhm, double max_radius)Geometrically smooths values fromsource_columninvolumewith an isotropic Gaussian smoothing kernel with a full-width-at-half-maximum offwhm.static booleansmoothVolumeGaussian(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, double fwhm, double max_radius, ProgressUpdater progress, double default_value)Geometrically smooths values fromsource_columninvolumewith an isotropic Gaussian smoothing kernel with a full-width-at-half-maximum offwhm.static booleansmoothVolumeGaussianBlocking(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, double fwhm, double max_radius, ProgressUpdater progress, double default_value)Geometrically smooths values fromsource_columninvolumewith an isotropic Gaussian smoothing kernel with a full-width-at-half-maximum offwhm.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
VolumeFunctions
public VolumeFunctions()
-
-
Method Details
-
getMappedValueByte
Returns the value of voxel [i,j,k] mapped with its colour model, as abyte. Uses the current vertex data column.- Parameters:
volume-x-y-z-- Returns:
-
getMappedValueDouble
-
getMaskedImages
Produces a stack of R-planar images fromvolume, based upon the current data column and its associated colour map. If the volume is currently in composite mode, returns the masked composite images.- Parameters:
volume-- Returns:
-
getMaskedImages
public static java.awt.image.BufferedImage[] getMaskedImages(Volume3DInt volume, java.lang.String column)Produces a stack of R-planar images fromvolume, based upon the data incolumnand its associated colour map.- Parameters:
volume-- Returns:
-
getMaskedCompositeImages
Returns a set of composite images, comprised of all data columns specified for the composite, with alpha values and ordering as specified in the Volume3DInt object. Images will be masked by the volume's current set of masks, if any are set.- Parameters:
volume-- Returns:
-
getMaskedCompositeRSliceImage
public static java.awt.image.BufferedImage getMaskedCompositeRSliceImage(Volume3DInt volume, int r, boolean[][][] mask)Returns a composite image from an R-slice plane, volume, and set of colour models and composite alphas. Columns render from bottom to top. Image will be masked bymask.- Parameters:
volume-models-alphas-
-
getCompositeRSliceImage
public static java.awt.image.BufferedImage getCompositeRSliceImage(Volume3DInt volume, int r, java.util.ArrayList<java.lang.String> ordered_columns, java.util.ArrayList<WindowedColourModel> colour_models, java.util.ArrayList<java.lang.Double> alphas)Returns a composite image from an R-slice plane, volume, and set of colour models and composite alphas. Columns render from bottom to top.- Parameters:
volume-models-alphas-
-
getCompositeRSliceImage
public static java.awt.image.BufferedImage getCompositeRSliceImage(Volume3DInt volume, int r, java.util.ArrayList<java.lang.String> ordered_columns, java.util.ArrayList<WindowedColourModel> colour_models, java.util.ArrayList<java.lang.Double> alphas, java.util.ArrayList<java.lang.Boolean> include)Returns a composite image from an R-slice plane, volume, and set of colour models and composite alphas. Columns render from bottom to top.- Parameters:
volume-models-alphas-
-
getCompositeSliceImage
public static java.awt.image.BufferedImage getCompositeSliceImage(Volume3DInt volume, int orientation, int section)Returns a composite image from an S,T, or R-slice plane, determined bysection, andvolume. Columns render from bottom to top.- Parameters:
volume-orientation- - 0 = S, 1 = T, 2 = Rsection- specifies which section to render
-
getCompositeSliceImage
public static java.awt.image.BufferedImage getCompositeSliceImage(Volume3DInt volume, int orientation, int section, java.util.ArrayList<java.lang.String> ordered_columns, java.util.ArrayList<WindowedColourModel> colour_models, java.util.ArrayList<java.lang.Double> alphas, java.util.ArrayList<java.lang.Boolean> include)Returns a composite image from an image plane, volume, determined byorientation, and set of colour models and composite alphas. Columns render from bottom to top.- Parameters:
volume-models-alphas-orientation- - 0 = S, 1 = T, 3 = Rsection- specifies which section to render
-
getCompositeRSliceImage
Returns a composite image from an R-slice plane and a volume- Parameters:
volume-- Returns:
-
getColourModel
-
getColourModel
-
getColourModel
-
getColourModel
public static WindowedColourModel getColourModel(int transferType, ColourMap cmap, boolean setAlpha) -
getColourModel
public static WindowedColourModel getColourModel(int transferType, ColourMap cmap, double scale, double intercept, double window_width, double window_mid, boolean setAlphaFromIntensity) -
getIntersectionImage
public static Volume2DInt getIntersectionImage(Volume3DInt volume, Plane3D plane, boolean setAlpha)Returns an Volume2DInt object representing the intersection of the given 3Dvolumewithplane. Returnsnullif the volume does not intersect the plane.- Parameters:
volume-plane-- Returns:
- Volume2DInt object, in plane coordinates relative to its reference point
-
getIntersectionImage
public static Volume2DInt getIntersectionImage(Volume3DInt volume, Plane3D plane, boolean setAlpha, org.jogamp.vecmath.Matrix4d transform)Returns an Volume2DInt object representing the intersection of the given 3Dvolumewithplane. Returnsnullif the volume does not intersect the plane.- Parameters:
volume-plane-- Returns:
- Volume2DInt object, in plane coordinates relative to its reference point
-
getIntersectionCompositeImage
public static Volume2DInt getIntersectionCompositeImage(Volume3DInt volume, Plane3D plane, boolean setAlpha)Returns an Volume2DInt object representing the intersection of the given 3D compositevolumewithplane. Returnsnullif the volume does not intersect the plane.- Parameters:
volume-plane-- Returns:
- Volume2DInt object, in plane coordinates relative to its reference point
-
getInvertedVolume
Returns aGrid3Dobject whose data is the inverse ofgrid.- Parameters:
grid-column-- Returns:
-
getInvertedVolume
Returns aGrid3Dobject whose data is the inverse ofgrid.- Parameters:
grid-column-- Returns:
-
getInvertedVolume
public static Volume3DInt getInvertedVolume(Volume3DInt volume, java.lang.String column, ProgressUpdater progress)Returns aGrid3Dobject whose data is the inverse ofgrid.- Parameters:
volume- - Volume to invertcolumn- - Column to invert- Returns:
-
smoothVolumeGaussian
public static boolean smoothVolumeGaussian(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, double fwhm, double max_radius)Geometrically smooths values fromsource_columninvolumewith an isotropic Gaussian smoothing kernel with a full-width-at-half-maximum offwhm. Writes the results totarget_column. Iftarget_columndoesn't exist, it will be created with the same data type assource_column. If it exists, it will maintain its current data type and its values will be overwritten.target_columncan be the same assource_column.- Parameters:
volume-source_column-target_column-fwhm- Full-width at half maximum of Gaussian kernelmax_radius- Maximum radius at which to obtain values for smoothing. Values of 0 or less specify an infinite radius (not recommended)- Returns:
-
smoothVolumeGaussian
public static boolean smoothVolumeGaussian(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, double fwhm, double max_radius, ProgressUpdater progress, double default_value)Geometrically smooths values fromsource_columninvolumewith an isotropic Gaussian smoothing kernel with a full-width-at-half-maximum offwhm. Writes the results totarget_column. Iftarget_columndoesn't exist, it will be created with the same data type assource_column. If it exists, it will maintain its current data type and its values will be overwritten.target_columncan be the same assource_column.- Parameters:
volume-source_column-target_column-fwhm-max_radius-- Returns:
-
smoothVolumeGaussianBlocking
public static boolean smoothVolumeGaussianBlocking(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, double fwhm, double max_radius, ProgressUpdater progress, double default_value)Geometrically smooths values fromsource_columninvolumewith an isotropic Gaussian smoothing kernel with a full-width-at-half-maximum offwhm. Writes the results totarget_column. Iftarget_columndoesn't exist, it will be created with the same data type assource_column. If it exists, it will maintain its current data type and its values will be overwritten.target_columncan be the same assource_column.- Parameters:
volume-source_column-target_column-fwhm-max_radius-- Returns:
-
getGaussianSmoothedValue
public static double getGaussianSmoothedValue(Volume3DInt volume, int[] voxel, int channel, org.jogamp.vecmath.Vector3f normal, float sigma_normal, float sigma_tangent, float cutoff)Computes a value forvoxelwhich is the weighted average of a Gaussian sampling of its neighbouring voxels, where the Gaussian is defined by a normal vector, its corresponding plane, and the sigma parameterssigma_normalandsigma_tangent.- Parameters:
grid- grid from which to compute valuevoxel- voxel for which to compute a valuenormal- normal direction of Gaussian distributionsigma_normal- sigma of Gaussian in normal directionsigma_tangent- sigma of Gaussian in tangent directioncutoff- value at which to bound search space, in multiples of sigma- Returns:
-
performOperationBlocking
public static Volume3DInt performOperationBlocking(Volume3DInt volume1, Volume3DInt volume2, VolumeFunctions.Operation op, ProgressUpdater progress)Performs the specified operation on the two volumes, and returns the result as a newGrid3Dinstance. Uses the current vertex data columns.- Parameters:
grid1-grid2-op-- Returns:
-
performOperationBlocking
public static Volume3DInt performOperationBlocking(Volume3DInt volume, java.lang.Double value, VolumeFunctions.Operation op, ProgressUpdater progress)Performs the specified operation on one grid and a constant value, and returns and new volume.- Parameters:
grid-value-op-- Returns:
-
applyMask
public static void applyMask(org.jogamp.java3d.ImageComponent3D iComp, int index, int x, int y, int width, int height, VolumeMaskOptions_old params)Applies a voxel mask to an ImageComponent3D object, using the parameters in params.- Parameters:
grid- Grid3D object upon which to apply maskparams- specifies the parameters describing the mask
-
getMask
Applies a voxel mask to an ImageComponent3D object, using the parameters in params.- Parameters:
grid- Grid3D object upon which to apply maskparams- specifies the parameters describing the mask
-
getOverlayImage
public static java.awt.image.BufferedImage getOverlayImage(java.util.ArrayList<java.awt.image.BufferedImage> images, WindowedColourModel colour_model)Compiles an overlay from the list of images by adding them one-by-one starting from the last element (since this will be on the bottom).- Parameters:
images-- Returns:
- the overlaid image
-
getIntMaskedByValue
Returns an integer mask ofgrid, where a voxel has value = 1, whengrid(i,j,k,v) == comp_value(within tolerance), and 0 otherwise.- Parameters:
grid-value-- Returns:
-
getIntMaskedByValue
public static Volume3DInt getIntMaskedByValue(Volume3DInt volume, double comp_value, boolean round)Returns an integer mask ofgrid, where a voxel has value = 1, whengrid(i,j,k,v) == comp_value(within tolerance), and 0 otherwise.- Parameters:
grid-value-round- If true, rounds the grid value before comparison- Returns:
-
isInMask
Determines whether the voxel at i, j, k is in the mask specified by params.- Parameters:
i-j-k-params-- Returns:
- true if voxel is in mask shape, false otherwise
-
applyRotation
public static Volume3DInt applyRotation(VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle, Volume3DInt volume, InterfaceProgressBar progress_bar)Rotates aGrid3Dabout one of its basis vectors (axes), either 90, 180, or 270 degrees, resizes the relevant dimensions, and returns the new grid.Note: only operates currently on the default channel.
TODO: implement this on generic channel
- Parameters:
axis- The spatial axis about which to rotate (one of S, T, or R).
-
applyRotationBlocking
public static Volume3DInt applyRotationBlocking(VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle, Volume3DInt volume)Rotates aGrid3Dabout one of its basis vectors (axes), either 90, 180, or 270 degrees, resizes the relevant dimensions, and returns the new grid.Note: only operates currently on the default channel.
TODO: implement this on generic channel
- Parameters:
axis- The spatial axis about which to rotate (one of S, T, or R).angle- The angle to rotate (one of 90, 180, 270)grid- The grid to rotate
-
applyRotationBlocking
public static Volume3DInt applyRotationBlocking(VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle, Volume3DInt volume, InterfaceProgressBar progress_bar)Rotates aVolume3DIntabout one of its basis vectors (axes), either 90, 180, or 270 degrees, resizes the relevant dimensions, and returns the new grid.Note: only operates currently on the default channel.
TODO: implement this on generic channel
- Parameters:
axis- The spatial axis about which to rotate (one of S, T, or R).angle- The angle to rotate (one of 90, 180, 270)grid- The grid to rotateprogress_bar- The progress bar to track progress; can benull.
-
getRotatedDims
protected static int[] getRotatedDims(int[] dims, VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle) -
getRotatedBox
protected static Box3D getRotatedBox(Box3D box, VolumeFunctions.VolumeAxis axis, VolumeFunctions.VolumeRotationAngle angle) -
rotateDims
public static int[] rotateDims(int[] dims, int axis, int rotation)Returns new dimensions for a rotation about a basis axis. -
rotate
public static int[] rotate(int[] coords, int[] dims, int axis, int rotation) -
powerOfTwo
public static int powerOfTwo(int value) -
getByteValue
public static byte getByteValue(double d) -
intToByte
public static byte intToByte(int i) -
getDoubleValue
public static double getDoubleValue(byte b) -
byteToInt
public static int byteToInt(byte b) -
getHistogram
Returns a histogram for the current column ofvolume.- Parameters:
volume-bins-- Returns:
-
getHistogram
Returns a histogram for the current column ofvolume.- Parameters:
volume-t-bins-min-max-- Returns:
-
getHistogram
public static Histogram getHistogram(Volume3DInt volume, java.lang.String column, int t, int bins, double min, double max)Returns a histogram for the vertex columncolumnofvolume.- Parameters:
volume- The volume for which to produce a histogramcolumn- The name of the column for which to produce a histogramt- The temporal index (0 for 3D volumes)bins- The number of bins in the histogrammin- The minimum of the range to usemax- The maximum of the range to use- Returns:
-
mapVolumeToVolumeEV
public static void mapVolumeToVolumeEV(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value. If no enclosing voxel exists, assigns a value of 0.- Parameters:
volume_source-volume_target-column_source-column_target-
-
mapVolumeToVolumeEV
public static void mapVolumeToVolumeEV(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value. If no enclosing voxel exists, assigns a value of 0.- Parameters:
volume_source-volume_target-column_source-column_target-progress-
-
mapVolumeToVolumeEV
public static boolean mapVolumeToVolumeEV(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value. If no enclosing voxel exists, assignsdefault_value. This method is equivalent to "nearest-neighbour" interpolation.- Parameters:
volume_source-volume_target-column_source-column_target-default_value-- Returns:
-
mapVolumeToVolumeEVBlocking
protected static boolean mapVolumeToVolumeEVBlocking(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using the enclosing voxel to assign the value. If no enclosing voxel exists, assignsdefault_value.- Parameters:
volume_source-volume_target-column_source-column_target-default_value-- Returns:
-
mapVolumeToVolumeInterp
public static void mapVolumeToVolumeInterp(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value. Themethodmust be one of:- nearest neighbour
- tri-linear
- tri-cubic
- Parameters:
volume_source-volume_target-column_source-column_target-method-
-
mapVolumeToVolumeInterp
public static void mapVolumeToVolumeInterp(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value. Themethodmust be one of:- nearest neighbour
- tri-linear
- tri-cubic
- Parameters:
volume_source-volume_target-column_source-column_target-method-progress-
-
mapVolumeToVolumeInterp
public static boolean mapVolumeToVolumeInterp(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value. Themethodmust be one of:- nearest neighbour
- tri-linear
- tri-cubic
- Parameters:
volume_source-volume_target-column_source-column_target-method-default_value-- Returns:
-
mapVolumeToVolumeInterpBlocking
protected static boolean mapVolumeToVolumeInterpBlocking(Volume3DInt volume_source, Volume3DInt volume_target, java.lang.String column_source, java.lang.String column_target, java.lang.String method, java.util.ArrayList<java.lang.Object> parameters, double default_value, ProgressUpdater progress)Mapsvolume_sourcetovolume_target, using interpolation from all overlapping voxels to assign the value. Themethodmust be one of:- nearest neighbour
- tri-linear
- tri-cubic
- Parameters:
volume_source-volume_target-column_source-column_target-default_value-- Returns:
-
getVolumeSpaceMidPoint
Returns the midpoint of this voxel ingrid's coordinate space.- Parameters:
grid-voxel-- Returns:
-
getVolumeSpaceMidPoint
Returns the midpoint of this voxel ingrid's coordinate space.- Parameters:
grid-voxel-- Returns:
-
getTrilinearVoxels
Returns the trilinear neighbourhood ofpoint, which includes the 8 voxels surrounding and enclosing it. Returns a list of 8 absolute indices, where a negative value indicate the neighbouring voxel is outside the bounds.Voxels are arranged as:
0 -> [0 0 0]
1 -> [1 1 1]- Parameters:
grid-point-- Returns:
-
getNeighbouringVoxels
Returns the indices off all first neighbours of the voxel enclosingpoint, plus that voxel.- Parameters:
grid-point-- Returns:
-
getNeighbouringVoxels
Returns the indices off all first neighbours of the voxel enclosingpoint, plus that voxel.- Parameters:
grid-point-- Returns:
-
getNeighbouringVoxels
Returns the indices off all first neighbours ofvoxel, plusvoxel.- Parameters:
grid-point-- Returns:
-
getBlobsFromVolume
public static boolean getBlobsFromVolume(Volume3DInt volume, java.lang.String source_column, java.lang.String target_column, ProgressUpdater progress, int min_blob, double threshold)Finds connected blobs in a thresholded volume.- Parameters:
volume- Volume to searchcolumn- Column to searchmin_blob- Minimum size (in voxels) at which to include a blobthreshold- Value to threshold the volume- Returns:
-
getBlobsFromVolumeBlocking
public static java.util.ArrayList<MguiNumber> getBlobsFromVolumeBlocking(Volume3DInt volume, java.lang.String column, ProgressUpdater progress, int min_blob, double threshold)Finds connected blobs in a thresholded volume.- Parameters:
volume- Volume to searchcolumn- Column to searchmin_blob- Minimum size (in voxels) at which to include a blobthreshold- Value to threshold the volume- Returns:
-
findMaximaBlocking
public static PointSet3DInt findMaximaBlocking(Volume3DInt volume, java.lang.String source_column, java.lang.String mask_column, java.lang.String label_column)Returns a global maximum for a given volume or within a given mask, or mulitple maxima from a set of masks, specified bymask_column. Will optionally add labels based onlabel_column.- Parameters:
volume-source_column-mask_column-max_point-label_column-- Returns:
-
getRoiCentroidsBlocking
public static PointSet3DInt getRoiCentroidsBlocking(Volume3DInt volume, java.lang.String source_column, int[] value_range, int min_size, boolean map_values, java.lang.String label_column, ProgressUpdater progress)Finds the centroids for all ROIs (identified as voxels with the same value). Optionally maps values of the source column to the point set.- Parameters:
volume- Volume containing ROIssource_column- Column identifying the ROIs; should be of type INTEGER, otherwise values will be roundedvalue_range- The range of values outside which to exclude ROIsmin_size- Minimal size of an ROI (in voxels) at which to generate a centroidmap_values- Iftrue, maps the value of the ROI index to the point set- Returns:
-