Commit 6efbfb6c authored by Krzysztof Gonciarz's avatar Krzysztof Gonciarz
Browse files

Fix for RC

parent f779d72f
...@@ -5,6 +5,7 @@ import java.awt.GraphicsEnvironment; ...@@ -5,6 +5,7 @@ import java.awt.GraphicsEnvironment;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import ij.IJ; import ij.IJ;
import ij.ImageJ;
import ij.ImagePlus; import ij.ImagePlus;
import ij.Macro; import ij.Macro;
import ij.macro.Interpreter; import ij.macro.Interpreter;
...@@ -244,4 +245,20 @@ public class RegionCompetition implements PlugInFilter { ...@@ -244,4 +245,20 @@ public class RegionCompetition implements PlugInFilter {
MosaicUtils.reorganize(iOutputFileNamesSuffixes, fileNameNoExt, directory, 1); MosaicUtils.reorganize(iOutputFileNamesSuffixes, fileNameNoExt, directory, 1);
} }
} }
public static void main(String[] args) {
// set the plugins.dir property to make the plugin appear in the Plugins menu
Class<?> clazz = RegionCompetition.class;
String url = clazz.getResource("/" + clazz.getName().replace('.', '/') + ".class").toString();
String pluginsDir = url.substring("file:".length(), url.length() - clazz.getName().length() - ".class".length());
System.setProperty("plugins.dir", pluginsDir);
new ImageJ();
// ImagePlus image = IJ.openImage("https://upload.wikimedia.org/wikipedia/commons/3/3f/Bikesgray.jpg");
// image.show();
// run the plugin
IJ.runPlugIn(clazz.getName(), "");
}
} }
...@@ -172,7 +172,7 @@ public class GuiRC { ...@@ -172,7 +172,7 @@ public class GuiRC {
for (int i = 0; i < energyValues.length; ++i) { for (int i = 0; i < energyValues.length; ++i) {
energyItems[i] = energyValues[i].toString(); energyItems[i] = energyValues[i].toString();
} }
gd.addChoice("E_data", energyItems, iSettings.energyFunctional.name()); gd.addChoice("E_data", energyItems, iSettings.energyFunctional.toString());
Choice choiceEnergy = (Choice) gd.getChoices().lastElement(); Choice choiceEnergy = (Choice) gd.getChoices().lastElement();
{ {
Button optionButton = new Button("Options"); Button optionButton = new Button("Options");
...@@ -200,7 +200,7 @@ public class GuiRC { ...@@ -200,7 +200,7 @@ public class GuiRC {
for (int i = 0; i < regularizationValues.length; ++i) { for (int i = 0; i < regularizationValues.length; ++i) {
regularizationItems[i] = regularizationValues[i].toString(); regularizationItems[i] = regularizationValues[i].toString();
} }
gd.addChoice("E_length", regularizationItems, iSettings.regularizationType.name()); gd.addChoice("E_length", regularizationItems, iSettings.regularizationType.toString());
Choice choiceRegularization = (Choice) gd.getChoices().lastElement(); Choice choiceRegularization = (Choice) gd.getChoices().lastElement();
{ {
...@@ -227,9 +227,9 @@ public class GuiRC { ...@@ -227,9 +227,9 @@ public class GuiRC {
final InitializationType[] initTypes = InitializationType.values(); final InitializationType[] initTypes = InitializationType.values();
final String[] initializationItems = new String[initTypes.length]; final String[] initializationItems = new String[initTypes.length];
for (int i = 0; i < initTypes.length; ++i) { for (int i = 0; i < initTypes.length; ++i) {
initializationItems[i] = initTypes[i].name(); initializationItems[i] = initTypes[i].toString();
} }
gd.addChoice("Initialization", initializationItems, iSettings.initType.name()); gd.addChoice("Initialization", initializationItems, iSettings.initType.toString());
// save reference to this choice, so we can handle it // save reference to this choice, so we can handle it
Choice initializationChoice = (Choice) gd.getChoices().lastElement(); Choice initializationChoice = (Choice) gd.getChoices().lastElement();
......
...@@ -9,23 +9,40 @@ public class SquasshSegmentationTest extends CommonBase { ...@@ -9,23 +9,40 @@ public class SquasshSegmentationTest extends CommonBase {
@Test @Test
public void testGenerateSeriesOfSquassh() { public void testGenerateSeriesOfSquassh() {
// String path = "/Users/gonciarz/Documents/MOSAIC/work/testInputs/Crop_12-12.tif"; // String path = "/Users/gonciarz/small.tif";
// ImagePlus ip = loadImagePlus(path); // ImagePlus ip = loadImagePlus(path);
// //
// double[][][] img = ImgUtils.ImgToZXYarray(ip); // double[][][] img = ImgUtils.ImgToZXYarray(ip);
// short[][] blank = new short[img[0].length][img[0][0].length]; // short[][] blank = new short[img[0].length][img[0][0].length];
// //
// int numOfSteps = 256; // int numOfSteps = 20;
// short[][][] out = new short[numOfSteps][][]; // float fromVal = 0;
// float toVal = 0.2f;
// float fromValInt = 0.2f;
// float toValInt = 0.8f;
// short[][][] out = new short[numOfSteps *numOfSteps][][];
// for (int j = 0; j < numOfSteps; j++) {
// for (int i = 0; i < numOfSteps; i++) { // for (int i = 0; i < numOfSteps; i++) {
// System.out.println(i * (1.0/(numOfSteps))); // System.out.println(i * (1.0/(numOfSteps)));
// SegmentationParameters sp = new SegmentationParameters(4, 1, 0.1, i * (1.0/(numOfSteps-1)), true, SegmentationParameters.IntensityMode.AUTOMATIC, SegmentationParameters.NoiseModel.GAUSS, 1, 1, 0); // SegmentationParameters sp = new SegmentationParameters(
// 4, // num threads
// 1, // interpolation (multiplication factor)
// i * (toVal - fromVal) / numOfSteps, // regularization
// j * (toValInt - fromValInt) / numOfSteps, // min obj intensity
// true, // exclude z edges
// SegmentationParameters.IntensityMode.AUTOMATIC, // intensity mode
// SegmentationParameters.NoiseModel.GAUSS, // noise model
// 1, // sigma xy
// 1, // sigma z
// 0, // min regions intensity
// 2); // min region size
// SquasshSegmentation ss = new SquasshSegmentation(img, sp, 0, 255); // SquasshSegmentation ss = new SquasshSegmentation(img, sp, 0, 255);
// ss.run(); // ss.run();
// out[i] = (ss.iRegionsList.size() > 0) ? ss.iLabeledRegions[0] : blank; // out[i +j * numOfSteps] = (ss.iRegionsList.size() > 0) ? ss.iLabeledRegions[0] : blank;
// } // }}
// ImagePlus outImg = ImgUtils.ZXYarrayToImg(ConvertArray.toDouble(out), "Output"); // ImagePlus outImg = ImgUtils.ZXYarrayToImg(ConvertArray.toDouble(out), "Output");
// IJ.saveAsTiff(outImg, "/tmp/out.tif"); // IJ.saveAsTiff(outImg, "/tmp/out.tif");
// System.out.println("Range: " +fromVal +"-"+toVal + " step: " + (toVal - fromVal) / numOfSteps);
} }
@Test @Test
......
package mosaic.plugins; package mosaic.plugins;
import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
import mosaic.test.framework.CommonBase; import mosaic.test.framework.CommonBase;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment