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

io.github.mianalysis.mia.process.voxel.MidpointCircle 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.8
Show newest version
package io.github.mianalysis.mia.process.voxel;

// Implementation of the midpoint circle algorithm
// Described at https://en.wikipedia.org/wiki/Midpoint_circle_algorithm (accessed 12-07-2016)

import java.util.ArrayList;

import io.github.mianalysis.mia.process.math.ArrayFunc;

public class MidpointCircle {
	int[] x_oct;
	int[] y_oct;

	public MidpointCircle(int r) {
		int x = r;
		int y = 0;
		int dec = 1-x;

		ArrayList x_temp = new ArrayList();
		ArrayList y_temp = new ArrayList();

		while (x >= y) {
			x_temp.add(x);
			y_temp.add(y);

			y++;

			if (dec <= 0) {
				dec += 2*y+1;
			} else {
				x--;
				dec += 2*(y-x)+1;
			}			
		}
		
		if (r==1) { //For consistency with the r=1 result from imglib2 (and thus TrackMate)
			x_oct = new int[]{0, 1};
			y_oct = new int[]{1, 0};
		} else {
			x_oct = new int[x_temp.size()];
			y_oct = new int[y_temp.size()];

			for (int i=0;i x_quad_f_al = new ArrayList();

		for (int i=0;i y_quad_f_al = new ArrayList();

		for (int i=0;i x_half_f_al = new ArrayList();
		for (int i=0;i y_half_f_al = new ArrayList();
		for (int i=0;i x_circ_f_al = new ArrayList();
		for (int i=0;i y_circ_f_al = new ArrayList();
		for (int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy