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

io.github.mianalysis.mia.process.activecontour.ActiveContour 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.activecontour;

import java.awt.Polygon;

import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus;
import ij.gui.Overlay;
import ij.gui.Roi;
import ij.plugin.Duplicator;
import io.github.mianalysis.mia.process.activecontour.energies.BendingEnergy;
import io.github.mianalysis.mia.process.activecontour.energies.ElasticEnergy;
import io.github.mianalysis.mia.process.activecontour.energies.EnergyCollection;
import io.github.mianalysis.mia.process.activecontour.energies.PathEnergy;
import io.github.mianalysis.mia.process.activecontour.minimisers.GreedyMinimiser;
import io.github.mianalysis.mia.process.activecontour.physicalmodel.NodeCollection;
import io.github.mianalysis.mia.process.activecontour.visualisation.GridOverlay;

/**
 * Created by Stephen on 08/09/2016.
 */
public class ActiveContour {
    public static void main(String[] args) throws InterruptedException {
        new ImageJ();
        IJ.runMacro("waitForUser");

        ImagePlus ipl = IJ.getImage();
        Roi roi = ipl.getRoi();

        Polygon roiPoly = roi.getPolygon();
        int[] xCoords = roiPoly.xpoints;
        int[] yCoords = roiPoly.ypoints;

        // Reducing the number of points per contour
        int div = 5;
        int[] xCoordsSub = new int[(int) Math.floor(xCoords.length/div)];
        int[] yCoordsSub = new int[(int) Math.floor(yCoords.length/div)];

        for (int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy