GPU-accelerated image processing in ImageJ using CLIJ
This list shows benchmarked operations and short Java code visualising how the operations were called. The full implementation of individual operation calls can be found in the respective Java classes: https://github.com/clij/clij-benchmarking-jmh/tree/master/src/main/java/net/haesleinhuepf/clij/benchmark/jmh
Operation | ImageJ | CLIJ |
AddImagesWeighted2D | ImageCalculator ic = new ImageCalculator(); output = ic.run("Add create", input1, input2); |
clij.op().addImagesWeighted(input1, input2, output, 1f, 1f); |
AddImagesWeighted3D | ImageCalculator ic = new ImageCalculator(); output = ic.run("Add create stack", input1, input2); |
clij.op().addImagesWeighted(input1, input2, output, 1f, 1f); |
AddScalar2D | IJ.run(input, "Add...", "value=1"); |
clij.op().addImageAndScalar(input, output, 1f); |
AddScalar3D | IJ.run(input, "Add...", "value=1 stack"); |
clij.op().addImageAndScalar(input, output, 1f); |
AutoThreshold2D | IJ.setAutoThreshold(input, "Default dark"); IJ.run(input, "Convert to Mask", "method=Default background=Dark black"); |
clij.op().automaticThreshold(input, output, "Default"); |
AutoThreshold3D | IJ.setAutoThreshold(input, "Default dark"); IJ.run(input, "Convert to Mask", "method=Default background=Dark black"); |
clij.op().automaticThreshold(input, output, "Default"); |
BinaryAnd2D | ImageCalculator ic = new ImageCalculator(); output = ic.run("AND create", input1, input2); |
clij.op().binaryAnd(input1, input2, output); |
BinaryAnd3D | ImageCalculator ic = new ImageCalculator(); output = ic.run("AND create stack", input1, input2); |
clij.op().binaryAnd(input1, input2, output); |
Erode2D | IJ.run(input, "Erode", ""); |
clij.op().erodeSphere(input, output); |
Erode3D | import process3d.Erode_; output = new Erode_().erode(input, 1, true); |
clij.op().erodeSphere(input, output); |
FixedThreshold2D | IJ.setThreshold(input, 128, 255); IJ.run(input, "Convert to Mask", "method=Default background=Dark black"); |
clij.op().threshold(input, output, 128f); |
FixedThreshold3D | IJ.setThreshold(input, 128, 255); IJ.run(input, "Convert to Mask", "method=Default background=Dark black"); |
clij.op().threshold(input, output, 128f); |
Flip2D | IJ.run(input, "Flip Horizontally", ""); |
clij.op().flip(input, output, true, false); |
Flip3D | IJ.run(input, "Flip Horizontally", "stack"); |
clij.op().flip(input, output, true, false, false); |
GaussianBlur2D | IJ.run(input, "Gaussian Blur...", "sigma=" + sigma); |
clij.op().blur(input, output, sigma, sigma); |
GaussianBlur3D | IJ.run(input, "Gaussian Blur 3D...", "x=" + sigma + " y=" + sigma + " z=" + sigma); |
clij.op().blur(input, output, sigma, sigma, sigma); |
MaximumZProjection | IJ.run(input, "Z Project...", "projection=[Max Intensity]"); |
clij.op().maximumZProjection(input, output); |
Mean2D | IJ.run(input, "Mean...", "radius=" + radius); |
kernelSize = CLIJUtilities.radiusToKernelSize( radius); clij.op().meanSphere(input, output, kernelSize, kernelSize); |
Mean3D | IJ.run(input, "Mean 3D...", "x=" + radius + " y=" + radius + " z=" + radius); |
kernelSize = CLIJUtilities.radiusToKernelSize( radius); clij.op().meanSphere(input, output, kernelSize, kernelSize, kernelSize); |
Median2D | IJ.run(input, "Median...", "radius=" + radius); |
kernelSize = CLIJUtilities.radiusToKernelSize( radius); clij.op().medianSphere(input, output, kernelSize, kernelSize); |
Median3D | IJ.run(input, "Median 3D...", "x=" + radius + " y=" + radius + " z=" + radius); |
kernelSize = CLIJUtilities.radiusToKernelSize( radius); clij.op().medianSphere(input, output, kernelSize, kernelSize, kernelSize); |
Minimum2D | IJ.run(input, "Minimum...", "radius=" + radius); |
kernelSize = CLIJUtilities.radiusToKernelSize( radius); clij.op().minimumSphere(input, output, kernelSize, kernelSize); |
Minimum3D | IJ.run(input, "Minimum 3D...", "x=" + radius + " y=" + radius + " z=" + radius); |
kernelSize = CLIJUtilities.radiusToKernelSize( radius); clij.op().minimumSphere(input, output, kernelSize, kernelSize, kernelSize); |
MultiplyScalar2D | IJ.run(input, "Multiply...", "value=2"); |
clij.op().multiplyImageAndScalar(input, output, 2f); |
MultiplyScalar3D | IJ.run(input, "Multiply...", "value=2 stack"); |
clij.op().multiplyImageAndScalar(input, output, 2f); |
RadialReslice | input.setRoi(new Line(input.getWidth() / 2, input.getWidth() / 2, 0, 0)); Radial_Reslice_Copy rr = new Radial_Reslice_Copy(); rr.setup("", input); rr.run(input.getProcessor()); |
numberOfAngles = 360; angleStepSize = 1.0f; effectiveNumberOfAngles = (int)((float) numberOfAngles / angleStepSize); maximumRadius = (int)Math.sqrt( Math.pow(input.getWidth() / 2, 2) + Math.pow(input.getHeight() / 2, 2)); ClearCLBuffer output = clij.createCLBuffer( new long[]{maximumRadius, input.getDepth(), effectiveNumberOfAngles}, input.getNativeType()); clij.op().radialProjection(input, output, angleStepSize); |
Rotate2D | IJ.run(input, "Rotate 90 Degrees Left", ""); |
clij.op().rotateLeft(input, output); |
Rotate3D | IJ.run(input, "Rotate 90 Degrees Left", ""); |
clij.op().rotateLeft(input, output); |