From 05ae0a7f1926dd499532cca42208467c21745c0f Mon Sep 17 00:00:00 2001 From: Kota Miura Date: Thu, 24 May 2012 10:31:23 +0200 Subject: [PATCH] changed the package name to gmm --- .../ext/GrayLevelClassMixtureModeling.java | 224 ------------------ .../gmm/GrayLevelClassMixtureModeling.java | 224 ++++++++++++++++++ .../{ext => gmm}/MixtureModeling_.java | 2 +- 3 files changed, 225 insertions(+), 225 deletions(-) delete mode 100644 src/emblcmci/ext/GrayLevelClassMixtureModeling.java create mode 100644 src/emblcmci/gmm/GrayLevelClassMixtureModeling.java rename src/emblcmci/{ext => gmm}/MixtureModeling_.java (99%) diff --git a/src/emblcmci/ext/GrayLevelClassMixtureModeling.java b/src/emblcmci/ext/GrayLevelClassMixtureModeling.java deleted file mode 100644 index 100b534..0000000 --- a/src/emblcmci/ext/GrayLevelClassMixtureModeling.java +++ /dev/null @@ -1,224 +0,0 @@ -package emblcmci.ext; - -/* - * Mixture Modeling algorithm - * - * Copyright (c) 2003 by Christopher Mei (christopher.mei@sophia.inria.fr) - * and Maxime Dauphin - * - * This plugin is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this plugin; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* This code was downloaded from - * http://rsbweb.nih.gov/ij/plugins/mixture-modeling.html - * - */ - -import java.util.*; -import ij.*; -import ij.process.*; - -/** This class implements a GrayLevelClassMixtureModeling. - **/ - -public class GrayLevelClassMixtureModeling { - public static int[] histogram; - /** The index must vary between 1 and 253 - C1 : [0;index] - C2 : [index+1; 255] - **/ - private int index; - private float mu1, mu2; - private float sigma2_1, sigma2_2; - private float mult1, mult2; - private float twoVariance1, twoVariance2; - private float max1, max2; - private int cardinal1, cardinal2; - private int cardinal; - - private int INDEX_MIN = 1; - private int INDEX_MAX = 253; - private int MIN = 0; - public static final int MAX = 255; - - public GrayLevelClassMixtureModeling(ByteProcessor img) { - cardinal = img.getWidth()*img.getHeight(); - histogram = img.getHistogram(); - index = INDEX_MIN-1; - //setValues(); - } - - public boolean addToIndex() { - index++; - - if(!(index<=INDEX_MAX)) - return false; - - setValues(); - return true; - } - - private float calculateMax(int index) { - float sum = histogram[index]; - float num = 1; - if(index-1>=0) { - sum += histogram[index-1]; - num++; - } - if(index+1=0) { + sum += histogram[index-1]; + num++; + } + if(index+1