io.github.mianalysis.mia.process.voxel.SphereSolid Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mia-algorithms Show documentation
Show all versions of mia-algorithms Show documentation
ModularImageAnalysis (MIA) is an ImageJ plugin which provides a modular framework for assembling image and object analysis workflows. Detected objects can be transformed, filtered, measured and related. Analysis workflows are batch-enabled by default, allowing easy processing of high-content datasets.
package io.github.mianalysis.mia.process.voxel;
import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.ImageStack;
public class SphereSolid extends AbstractSphere {
public static void main(String[] args) {
SphereSolid sphereSolid = new SphereSolid(45);
int[] x = sphereSolid.getX();
int[] y = sphereSolid.getY();
int[] z = sphereSolid.getZ();
new ImageJ();
ImagePlus ipl = IJ.createImage("", 100, 100, 100, 8);
ImageStack ist = ipl.getStack();
for (int i = 0; i < x.length; i++) {
ist.setVoxel(x[i] + 50, y[i] + 50, z[i] + 50, 255);
}
ipl.show();
}
public SphereSolid(int r) {
for (int xx = -r; xx < r; xx++) {
for (int yy = -r; yy < r; yy++) {
for (int zz= -r; zz < r; zz++) {
if (inSphere(xx,yy,zz,r)) {
x.add(xx);
y.add(yy);
z.add(zz);
}
}
}
}
}
}