All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mianalysis.mia.process.voxel.AbstractSphere Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.6.12
Show newest version
package io.github.mianalysis.mia.process.voxel;

import java.util.ArrayList;

public abstract class AbstractSphere {
    protected ArrayList x = new ArrayList<>();
    protected ArrayList y = new ArrayList<>();
    protected ArrayList z = new ArrayList<>();

    public static boolean inSphere(int xx, int yy, int zz, int r) {
        return Math.sqrt(xx * xx + yy * yy + zz * zz) <= r;
    }

    public int[] getX() {
        int[] xx = new int[x.size()];
        int i = 0;
        for (int xxx : x)
            xx[i++] = xxx;

        return xx;

    }

    public int[] getY() {
        int[] yy = new int[y.size()];
        int i = 0;
        for (int yyy : y)
            yy[i++] = yyy;

        return yy;

    }

    public int[] getZ() {
        int[] zz = new int[z.size()];
        int i = 0;
        for (int zzz : z)
            zz[i++] = zzz;

        return zz;

    }

    public int[][] getSphere() {
        int[] x_sph = getX();
        int[] y_sph = getY();
        int[] z_sph = getZ();

        int[][] sph = new int[x_sph.length][3];
        for (int i = 0; i < x_sph.length; i++) {
            sph[i][0] = x_sph[i];
            sph[i][1] = y_sph[i];
            sph[i][2] = z_sph[i];
        }

        return sph;

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy