Package gov.nih.mipav.model.algorithms
Class AlgorithmDConvolver
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmDConvolver
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmDConvolver extends AlgorithmBase
Convolves kernel with a 2D or 3D image - only pixels where the kernel is completely contained in the image are convolved, otherwise they are set to zero. This is reasonable since data at the edges of images is rarely used and large kernels should not be used since it is much faster to perform FFT, filter, and IFFT. The break even point is probably around a kernel size of 11 or so.Since this class extends the AlgorithmDConvolverBase class that extends the Thread class it can be run in its own thread by invoking algoConvolver3DObj.start(); It can also be invoked without a new thread by calling the the run() method directly (ie. algoConvolver3DObj.run()).
- Source image is exported (locked and unlocked by export)
- Kernel is exported
- Image is convolved with kernel
- Return
- Version:
- 0.1 Aug 1, 1997
- Author:
- Matthew J. McAuliffe, Ph.D.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
bilateral
private boolean
blue
private boolean
combined2D3D
private boolean
doXY
private boolean
entireImage
private boolean
green
private double
intensityGaussianDenom
private double[]
kernelBuffer
private double[]
kernelBufferX
private double[]
kernelBufferX2
private double[]
kernelBufferXX
private double[]
kernelBufferXXX
private double[]
kernelBufferXXY
private double[]
kernelBufferXXZ
private double[]
kernelBufferXY
private double[]
kernelBufferXYY
private double[]
kernelBufferXYZ
private double[]
kernelBufferXZ
private double[]
kernelBufferXZZ
private double[]
kernelBufferY
private double[]
kernelBufferY2
private double[]
kernelBufferYY
private double[]
kernelBufferYYY
private double[]
kernelBufferYYZ
private double[]
kernelBufferYZ
private double[]
kernelBufferYZZ
private double[]
kernelBufferZ
private double[]
kernelBufferZZ
private double[]
kernelBufferZZZ
private int[]
kExtents
The image data to convolve.private boolean
nms2
private boolean
nms2e
private boolean
nms3
private boolean
nms3e
private double[]
outputBuffer
private boolean
red
private boolean
sqrtXY
private boolean
sqrtXYZ
-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXZ, double[] kernelYZ, double[] kernelZZ, boolean entireImage, int[] kExtents)
AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXZ, double[] kernelYZ, double[] kernelZZ, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY, double[] kernelXXZ, double[] kernelXZZ, double[] kernelXYZ, double[] kernelYYZ, double[] kernelYZZ, double[] kernelZZZ, int[] kExtents, boolean entireImage)
AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY, int[] kExtents, boolean entireImage)
AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelXX, double[] kernelXY, double[] kernelYY, int[] kExtents, boolean entireImage)
AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelX2, double[] kernelY2, int[] kExtents, boolean entireImage, boolean combined2D3D)
AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, int[] kExtents, boolean entireImage)
AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, int[] kExtents, boolean entireImage, boolean sqrtXY)
AlgorithmDConvolver(ModelImage srcImage, double[] kernel, int[] kExtents, boolean entireImage, boolean image25D)
Sets the source and kernel images and calls the appropriate method based on image dimensionality.AlgorithmDConvolver(ModelImage srcImage, double[] kernel, int[] kExtents, boolean entireImage, boolean image25D, double intensityGaussianDenom)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
convolve2D(int startSlice, int endSlice)
private void
convolve2D3D(int start, int end, double[] iImage, int index, int min3DLength, int max3DLength)
private void
convolve2DBilateral(int startSlice, int endSlice)
private void
convolve2DNMS(int startSlice, int endSlice)
private void
convolve2DNMSE(int startSlice, int endSlice)
static double
convolve2DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve2DPt(WildMagic.LibFoundation.Mathematics.Vector2f pt, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve2DPtMed(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve2DPtNMS(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelXX, double[] kernelXY, double[] kernelYY)
A static function that convolves a kernel with an image at a position.static double
convolve2DPtNMSE(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY)
A static function that convolves a kernel with an image at a position.static double
convolve2DPtSqrtXY(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY)
A static function that convolves a kernel with an image at a position.static double
convolve2DRGBPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an RGB image at a position.static double
convolve2DRGBPtSqrtXY(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY)
A static function that convolves a kernel with an RGB image at a position.private void
convolve2DSqrtXY(int startSlice, int endSlice)
private void
convolve2DXY(int startSlice, int endSlice)
private void
convolve3D(int start, int end, double[] iImage, int index)
private void
convolve3DBilateral(int start, int end, double[] iImage, int index)
private void
convolve3DNMS(int start, int end, double[] iImage, int index)
private void
convolve3DNMSE(int start, int end, double[] iImage, int index)
static double
convolve3DPt(double[] pt, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve3DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve3DPt(WildMagic.LibFoundation.Mathematics.Vector3f kPt, ModelImage kImage, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve3DPtMed(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolve3DPtNMS(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXZ, double[] kernelYZ, double[] kernelZZ)
A static function that convolves a kernel with an image at a position.static double
convolve3DPtNMSE(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY, double[] kernelXXZ, double[] kernelXZZ, double[] kernelXYZ, double[] kernelYYZ, double[] kernelYZZ, double[] kernelZZZ)
A static function that convolves a kernel with an image at a position.static double
convolve3DPtXYZ(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ)
A static function that convolves a kernel with an image at a position.static double
convolve3DRGBPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an RGB image at a position.static double
convolve3DRGBPtXYZ(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ)
A static function that convolves a kernel with an RGB image at a position.private void
convolve3DXYZ(int start, int end, double[] iImage, int index)
static double[]
convolveBilateral2DCIELabPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with an CIELab image at a position.static double
convolveBilateral2DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with an image at a position.static double[]
convolveBilateral3DCIELabPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with a CIELab image at a position.static double
convolveBilateral3DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with an image at a position.static void
convolveBlock3D(int start, int end, int lpv, double[] iImage, int[] iExtents, int[] kExtents, double[] kernel, ModelImage oImage)
static double
convolveWhole2DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.static double
convolveWhole3DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position The convolution is performed only if the whole kernel fits inside the image.void
finalize()
Prepares this class for destruction.private static double
getBilinear(int i, double dx, double dy, int[] iExtents, double[] image)
Performs bilinear interpolation of image data.double[]
getOutputBuffer()
Returns the output bufferprivate static double
getTrilinear(int i1, double dx, double dy, double dz, int[] iExtents, double[] image)
Performs trilinear interpolation of image data.static byte[]
getTrilinearC(int i1, double dx, double dy, double dz, int[] iExtents, byte[] image)
Performs trilinear interpolation of image data.boolean
isBlue()
boolean
isGreen()
boolean
isRed()
void
run2D()
Begins the execution of the 2D convolver.void
run3D()
Begins the execution of the 3D convolver.void
run4D()
void
runAlgorithm()
Begins execution of the convolver.void
setBlue(boolean blue)
void
setColorChannels(boolean red, boolean green, boolean blue)
void
setGreen(boolean green)
void
setRed(boolean red)
-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
kExtents
private int[] kExtents
The image data to convolve.
-
kernelBuffer
private double[] kernelBuffer
-
kernelBufferX
private double[] kernelBufferX
-
kernelBufferY
private double[] kernelBufferY
-
kernelBufferZ
private double[] kernelBufferZ
-
kernelBufferX2
private double[] kernelBufferX2
-
kernelBufferY2
private double[] kernelBufferY2
-
kernelBufferXX
private double[] kernelBufferXX
-
kernelBufferXY
private double[] kernelBufferXY
-
kernelBufferYY
private double[] kernelBufferYY
-
kernelBufferXZ
private double[] kernelBufferXZ
-
kernelBufferYZ
private double[] kernelBufferYZ
-
kernelBufferZZ
private double[] kernelBufferZZ
-
kernelBufferXXX
private double[] kernelBufferXXX
-
kernelBufferXXY
private double[] kernelBufferXXY
-
kernelBufferXYY
private double[] kernelBufferXYY
-
kernelBufferYYY
private double[] kernelBufferYYY
-
kernelBufferXXZ
private double[] kernelBufferXXZ
-
kernelBufferXZZ
private double[] kernelBufferXZZ
-
kernelBufferXYZ
private double[] kernelBufferXYZ
-
kernelBufferYYZ
private double[] kernelBufferYYZ
-
kernelBufferYZZ
private double[] kernelBufferYZZ
-
kernelBufferZZZ
private double[] kernelBufferZZZ
-
red
private boolean red
-
blue
private boolean blue
-
green
private boolean green
-
outputBuffer
private double[] outputBuffer
-
entireImage
private boolean entireImage
-
doXY
private boolean doXY
-
sqrtXY
private boolean sqrtXY
-
sqrtXYZ
private boolean sqrtXYZ
-
nms2
private boolean nms2
-
nms2e
private boolean nms2e
-
nms3
private boolean nms3
-
nms3e
private boolean nms3e
-
combined2D3D
private boolean combined2D3D
-
intensityGaussianDenom
private double intensityGaussianDenom
-
bilateral
private boolean bilateral
-
-
Constructor Detail
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernel, int[] kExtents, boolean entireImage, boolean image25D)
Sets the source and kernel images and calls the appropriate method based on image dimensionality.- Parameters:
srcImage
-kernel
-kExtents
-entireImage
-image25D
-
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernel, int[] kExtents, boolean entireImage, boolean image25D, double intensityGaussianDenom)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, int[] kExtents, boolean entireImage, boolean sqrtXY)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, int[] kExtents, boolean entireImage)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelXX, double[] kernelXY, double[] kernelYY, int[] kExtents, boolean entireImage)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY, int[] kExtents, boolean entireImage)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXZ, double[] kernelYZ, double[] kernelZZ, boolean entireImage, int[] kExtents)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXZ, double[] kernelYZ, double[] kernelZZ, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY, double[] kernelXXZ, double[] kernelXZZ, double[] kernelXYZ, double[] kernelYYZ, double[] kernelYZZ, double[] kernelZZZ, int[] kExtents, boolean entireImage)
-
AlgorithmDConvolver
public AlgorithmDConvolver(ModelImage srcImage, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelX2, double[] kernelY2, int[] kExtents, boolean entireImage, boolean combined2D3D)
-
-
Method Detail
-
isRed
public boolean isRed()
-
setRed
public void setRed(boolean red)
-
isBlue
public boolean isBlue()
-
setBlue
public void setBlue(boolean blue)
-
isGreen
public boolean isGreen()
-
setGreen
public void setGreen(boolean green)
-
setColorChannels
public void setColorChannels(boolean red, boolean green, boolean blue)
-
convolve2DPt
public static final double convolve2DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolveBilateral2DPt
public static final double convolveBilateral2DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with an image at a position. The intensity difference between the center pixel and the indexed pixel is used in a Gaussian in the weighing. The intensity Gaussian is (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma))* exp(-intensityDifference**2/intenDenom) Since the same (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma) term would appear in every weight term, it would cancel out by appearing in both the numerator and denominator in (sum / norm) and so can be omitted.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel dataintensityGaussianDenom
-- Returns:
- the value of the pixel after convolution with the kernel
-
convolve2DPtSqrtXY
public static final double convolve2DPtSqrtXY(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve2DPtNMS
public static final double convolve2DPtNMS(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelXX, double[] kernelXY, double[] kernelYY)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel datakernelXX
- kernel datakernelXY
- kernel datakernelYY
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve2DPtNMSE
public static final double convolve2DPtNMSE(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel datakernelXXX
- kernel datakernelXXY
- kernel datakernelXYY
- kernel datakernelYYY
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve2DPt
public static final double convolve2DPt(WildMagic.LibFoundation.Mathematics.Vector2f pt, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.- Parameters:
pt
- doubleing point indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve2DPtMed
public static final double convolve2DPtMed(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position. This version seems to just be used by AlgorithmDConvolverLapMedianess.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
- See Also:
gov.nih.mipav.model.AlgorithmDConvolvers.AlgorithmDConvolverLapMedianess
-
convolve2DRGBPt
public static final double convolve2DRGBPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an RGB image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolveBilateral2DCIELabPt
public static final double[] convolveBilateral2DCIELabPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with an CIELab image at a position. The CIE76 intensity difference between the center pixel and the indexed pixel is used in a Gaussian in the weighing. The intensity Gaussian is (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma))* exp(-intensityDifference**2/intenDenom) Since the same (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma) term would appear in every weight term, it would cancel out by appearing in both the numerator and denominator in (sum / norm) and so can be omitted.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel dataintensityGaussianDenom
-- Returns:
- the L*,a*,b* of the pixel after convolution with the kernel
-
convolve2DRGBPtSqrtXY
public static final double convolve2DRGBPtSqrtXY(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY)
A static function that convolves a kernel with an RGB image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve3DPt
public static final double convolve3DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolveBilateral3DPt
public static final double convolveBilateral3DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with an image at a position. The intensity difference between the center pixel and the indexed pixel is used in a Gaussian in the weighing. The intensity Gaussian is (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma))* exp(-intensityDifference**2/intenDenom) Since the same (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma) term would appear in every weight term, it would cancel out by appearing in both the numerator and denominator in (sum / norm) and so can be omitted.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel dataintensityGaussianDenom
-- Returns:
- the value of the pixel after convolution with the kernel
-
convolve3DPtXYZ
public static final double convolve3DPtXYZ(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel datakernelZ
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve3DPtNMS
public static final double convolve3DPtNMS(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXX, double[] kernelXY, double[] kernelYY, double[] kernelXZ, double[] kernelYZ, double[] kernelZZ)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel datakernelZ
- kernel datakernelXX
- kernel datakernelXY
- kernel datakernelYY
- kernel datakernelXZ
- kernel datakernelYZ
- kernel datakernelZZ
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve3DPtNMSE
public static final double convolve3DPtNMSE(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ, double[] kernelXXX, double[] kernelXXY, double[] kernelXYY, double[] kernelYYY, double[] kernelXXZ, double[] kernelXZZ, double[] kernelXYZ, double[] kernelYYZ, double[] kernelYZZ, double[] kernelZZZ)
A static function that convolves a kernel with an image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel datakernelZ
- kernel datakernelXXX
- kernel datakernelXXY
- kernel datakernelXYY
- kernel datakernelYYY
- kernel datakernelXXZ
- kernel datakernelXZZ
- kernel datakernelXYZ
- kernel datakernelYZZ
- kernel datakernelZZZ
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolveBlock3D
public static final void convolveBlock3D(int start, int end, int lpv, double[] iImage, int[] iExtents, int[] kExtents, double[] kernel, ModelImage oImage)
- Parameters:
start
-end
-lpp
- length per voxel, for example 4 for RGB image.iImage
-iExtents
-kExtents
-kernel
-oImage
-
-
convolve3DPt
public static final double convolve3DPt(double[] pt, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.- Parameters:
pt
- doubleing point indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve3DPtMed
public static final double convolve3DPtMed(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position. This version seems to just be used by AlgorithmDConvolverLapMedianess.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
- See Also:
gov.nih.mipav.model.AlgorithmDConvolvers.AlgorithmDConvolverLapMedianess
-
convolve3DRGBPt
public static final double convolve3DRGBPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an RGB image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolveBilateral3DCIELabPt
public static final double[] convolveBilateral3DCIELabPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel, double intensityGaussianDenom)
A static function that convolves a kernel with a CIELab image at a position. The CIE76 intensity difference between the center pixel and the indexed pixel is used in a Gaussian in the weighing. The intensity Gaussian is (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma))* exp(-intensityDifference**2/intenDenom) Since the same (1.0/(Math.sqrt(2.0 * Math.PI) * intensitySigma) term would appear in every weight term, it would cancel out by appearing in both the numerator and denominator in (sum / norm) and so can be omitted.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel dataintensityGaussianDenom
-- Returns:
- the L*,a*,b* of the pixel after convolution with the kernel
-
convolve3DRGBPtXYZ
public static final double convolve3DRGBPtXYZ(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernelX, double[] kernelY, double[] kernelZ)
A static function that convolves a kernel with an RGB image at a position.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernelX
- kernel datakernelY
- kernel datakernelZ
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolveWhole2DPt
public static final double convolveWhole2DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position. The convolution is performed only if the whole kernel fits inside the image.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel or 0 if the kernel does not fit wholly within the image
-
convolveWhole3DPt
public static final double convolveWhole3DPt(int pix, int[] iExtents, double[] image, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position The convolution is performed only if the whole kernel fits inside the image.- Parameters:
pix
- index indicating location of convolutioniExtents
- image dimensionsimage
- image datakExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel or 0 if the kernel does not fit wholly within the image
-
convolve3DPt
public static final double convolve3DPt(WildMagic.LibFoundation.Mathematics.Vector3f kPt, ModelImage kImage, int[] kExtents, double[] kernel)
A static function that convolves a kernel with an image at a position.- Parameters:
kExtents
- kernel dimensionskernel
- kernel data- Returns:
- the value of the pixel after convolution with the kernel
-
convolve2D
private final void convolve2D(int startSlice, int endSlice)
-
convolve2DBilateral
private final void convolve2DBilateral(int startSlice, int endSlice)
-
convolve2DXY
private final void convolve2DXY(int startSlice, int endSlice)
-
convolve2DSqrtXY
private final void convolve2DSqrtXY(int startSlice, int endSlice)
-
convolve2DNMS
private final void convolve2DNMS(int startSlice, int endSlice)
-
convolve2DNMSE
private final void convolve2DNMSE(int startSlice, int endSlice)
-
convolve3D
private final void convolve3D(int start, int end, double[] iImage, int index)
-
convolve3DBilateral
private final void convolve3DBilateral(int start, int end, double[] iImage, int index)
-
convolve2D3D
private final void convolve2D3D(int start, int end, double[] iImage, int index, int min3DLength, int max3DLength)
-
convolve3DXYZ
private final void convolve3DXYZ(int start, int end, double[] iImage, int index)
-
convolve3DNMS
private final void convolve3DNMS(int start, int end, double[] iImage, int index)
-
convolve3DNMSE
private final void convolve3DNMSE(int start, int end, double[] iImage, int index)
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
run2D
public void run2D()
Begins the execution of the 2D convolver.
-
run3D
public void run3D()
Begins the execution of the 3D convolver.
-
run4D
public void run4D()
-
runAlgorithm
public void runAlgorithm()
Begins execution of the convolver.- Specified by:
runAlgorithm
in classAlgorithmBase
-
getBilinear
private static double getBilinear(int i, double dx, double dy, int[] iExtents, double[] image)
Performs bilinear interpolation of image data.- Parameters:
i
- index into imagedx
- change in x from integerdy
- change in y from integeriExtents
- dimensions of imageimage
- image data- Returns:
- the bilinearly interpolated value
-
getTrilinear
private static double getTrilinear(int i1, double dx, double dy, double dz, int[] iExtents, double[] image)
Performs trilinear interpolation of image data.- Parameters:
i1
- index into imagedx
- change in x from integerdy
- change in y from integerdz
- change in z from integeriExtents
- dimensions of imageimage
- image data- Returns:
- the trilinearly interpolated data value
-
getTrilinearC
public static byte[] getTrilinearC(int i1, double dx, double dy, double dz, int[] iExtents, byte[] image)
Performs trilinear interpolation of image data.- Parameters:
i1
- index into imagedx
- change in x from integerdy
- change in y from integerdz
- change in z from integeriExtents
- dimensions of imageimage
- image data- Returns:
- the trilinearly interpolated data value
-
getOutputBuffer
public double[] getOutputBuffer()
Returns the output buffer- Returns:
- buffer that contains the data after convolution
-
-