Skip to content
Snippets Groups Projects
Commit 6824c117 authored by Thomas  MUSSET's avatar Thomas MUSSET
Browse files

updated pom to v2.0.0-a.1, fix classes accordingly to new architecture, added...

updated pom to v2.0.0-a.1, fix classes accordingly to new architecture, added icon, updated .gitignore
parent 232f36c7
No related branches found
No related tags found
No related merge requests found
.idea/ /build*
/workspace
setting.xml
release/
target/ target/
.settings/ !.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
icy.log
### IntelliJ IDEA ###
.idea/
*.iws
*.iml *.iml
.project *.ipr
### Eclipse ###
.apt_generated
.classpath .classpath
**/.DS_Store .factorypath
\ No newline at end of file .project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
**/.DS_Store
Icon?
\ No newline at end of file
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
<parent> <parent>
<groupId>org.bioimageanalysis.icy</groupId> <groupId>org.bioimageanalysis.icy</groupId>
<artifactId>pom-icy</artifactId> <artifactId>pom-icy</artifactId>
<version>2.2.0</version> <version>3.0.0-a.1</version>
</parent> </parent>
<!-- Project Information --> <!-- Project Information -->
<artifactId>kmeans-color-quantization</artifactId> <artifactId>kmeans-color-quantization</artifactId>
<version>2.0.0</version> <version>2.0.0-a.1</version>
<name>KMeans Color Quantization</name> <name>KMeans Color Quantization</name>
<description>Quantize a color image in any given number of colors.</description> <description>Quantize a color image in any given number of colors.</description>
...@@ -68,8 +68,7 @@ ...@@ -68,8 +68,7 @@
<repositories> <repositories>
<repository> <repository>
<id>icy</id> <id>icy</id>
<name>Icy's Nexus</name> <url>https://nexus-icy.pasteur.cloud/repository/icy/</url>
<url>https://icy-nexus.pasteur.fr/repository/Icy/</url>
</repository> </repository>
</repositories> </repositories>
</project> </project>
\ No newline at end of file
/* /*
* Copyright (c) 2010-2023. Institut Pasteur. * Copyright (c) 2010-2024. Institut Pasteur.
* *
* This file is part of Icy. * This file is part of Icy.
* Icy is free software: you can redistribute it and/or modify * Icy is free software: you can redistribute it and/or modify
...@@ -18,13 +18,16 @@ ...@@ -18,13 +18,16 @@
package plugins.nherve.colorquantization; package plugins.nherve.colorquantization;
import icy.gui.util.ComponentUtil; import org.bioimageanalysis.icy.Icy;
import icy.gui.util.GuiUtil; import org.bioimageanalysis.icy.extension.plugin.annotation_.IcyPluginIcon;
import icy.main.Icy; import org.bioimageanalysis.icy.extension.plugin.annotation_.IcyPluginName;
import icy.preferences.XMLPreferences; import org.bioimageanalysis.icy.gui.GuiUtil;
import icy.sequence.Sequence; import org.bioimageanalysis.icy.gui.component.ComponentUtil;
import icy.swimmingPool.SwimmingObject; import org.bioimageanalysis.icy.model.sequence.Sequence;
import icy.system.IcyExceptionHandler; import org.bioimageanalysis.icy.model.swimmingPool.SwimmingObject;
import org.bioimageanalysis.icy.system.logging.IcyLogger;
import org.bioimageanalysis.icy.system.preferences.XMLPreferences;
import org.jetbrains.annotations.NotNull;
import plugins.nherve.maskeditor.MaskEditor; import plugins.nherve.maskeditor.MaskEditor;
import plugins.nherve.toolbox.Algorithm; import plugins.nherve.toolbox.Algorithm;
import plugins.nherve.toolbox.NherveToolbox; import plugins.nherve.toolbox.NherveToolbox;
...@@ -68,6 +71,8 @@ import java.util.Map; ...@@ -68,6 +71,8 @@ import java.util.Map;
* *
* @author Nicolas HERVE - nicolas.herve@pasteur.fr * @author Nicolas HERVE - nicolas.herve@pasteur.fr
*/ */
@IcyPluginName("KMeans Color Quantization")
@IcyPluginIcon(path = "/KMeansColorQuantization_icon.png")
public class KMeansColorQuantization extends SingletonPlugin implements ActionListener { public class KMeansColorQuantization extends SingletonPlugin implements ActionListener {
private static final String HELP = "<html>" + "<p align=\"center\"><b>" + HelpWindow.getTagFullPluginName() + "</b></p>" + "<p align=\"center\"><b>" + NherveToolbox.getDevNameHtml() + "</b></p>" + "<p align=\"center\"><b>" + NherveToolbox.getCopyrightHtml() + "</b></p>" + "<hr/>" + "<p>" + HelpWindow.getTagPluginName() + NherveToolbox.getLicenceHtml() + "</p>" + "<p>" + NherveToolbox.getLicenceHtmllink() + "</p>" + "</html>"; private static final String HELP = "<html>" + "<p align=\"center\"><b>" + HelpWindow.getTagFullPluginName() + "</b></p>" + "<p align=\"center\"><b>" + NherveToolbox.getDevNameHtml() + "</b></p>" + "<p align=\"center\"><b>" + NherveToolbox.getCopyrightHtml() + "</b></p>" + "<hr/>" + "<p>" + HelpWindow.getTagPluginName() + NherveToolbox.getLicenceHtml() + "</p>" + "<p>" + NherveToolbox.getLicenceHtmllink() + "</p>" + "</html>";
...@@ -145,7 +150,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -145,7 +150,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
} }
@Override @Override
public void fillInterface(final JPanel mainPanel) { public void fillInterface(final @NotNull JPanel mainPanel) {
currentlyRunning = null; currentlyRunning = null;
final XMLPreferences preferences = getPreferences(); final XMLPreferences preferences = getPreferences();
...@@ -224,7 +229,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -224,7 +229,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
preferences.putBoolean("dsp", cbDisplay.isSelected()); preferences.putBoolean("dsp", cbDisplay.isSelected());
} }
catch (final NumberFormatException e) { catch (final NumberFormatException e) {
IcyExceptionHandler.showErrorMessage(e, true); IcyLogger.error(this.getClass(), e, "Error parsing color space.");
} }
} }
...@@ -235,7 +240,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -235,7 +240,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/ */
@Override @Override
public void actionPerformed(final ActionEvent e) { public void actionPerformed(final @NotNull ActionEvent e) {
final JButton b = (JButton) e.getSource(); final JButton b = (JButton) e.getSource();
if (b == null) { if (b == null) {
return; return;
...@@ -272,7 +277,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -272,7 +277,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
} }
} }
catch (final SupportRegionException | SegmentationException | InterruptedException | InvocationTargetException | MaskException | NumberFormatException | SignatureException e1) { catch (final SupportRegionException | SegmentationException | InterruptedException | InvocationTargetException | MaskException | NumberFormatException | SignatureException e1) {
logError(e1.getClass().getName() + " : " + e1.getMessage()); IcyLogger.error(this.getClass(), e1, "Error while clustering.");
} }
}); });
currentlyRunning.start(); currentlyRunning.start();
...@@ -304,7 +309,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -304,7 +309,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* @param seg the seg * @param seg the seg
* @return the some stats * @return the some stats
*/ */
private void getSomeStats(final Segmentation seg) { private void getSomeStats(final @NotNull Segmentation seg) {
final DecimalFormat df = new DecimalFormat("0"); final DecimalFormat df = new DecimalFormat("0");
Algorithm.out("id;label;h1;h2;h3"); Algorithm.out("id;label;h1;h2;h3");
for (final Mask m : seg) { for (final Mask m : seg) {
...@@ -325,7 +330,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -325,7 +330,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* @throws NumberFormatException the number format exception * @throws NumberFormatException the number format exception
* @throws SignatureException the signature exception * @throws SignatureException the signature exception
*/ */
private Segmentation doClustering(final Sequence currentSequence) throws SupportRegionException, SegmentationException, MaskException, NumberFormatException, SignatureException { private @NotNull Segmentation doClustering(final Sequence currentSequence) throws SupportRegionException, SegmentationException, MaskException, NumberFormatException, SignatureException {
final Segmentation seg; final Segmentation seg;
seg = doClusteringKM(currentSequence); seg = doClusteringKM(currentSequence);
...@@ -346,7 +351,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi ...@@ -346,7 +351,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* @throws SegmentationException the segmentation exception * @throws SegmentationException the segmentation exception
* @throws NumberFormatException the number format exception * @throws NumberFormatException the number format exception
*/ */
private Segmentation doClusteringKM(final Sequence currentSequence) throws SupportRegionException, SegmentationException, NumberFormatException { private Segmentation doClusteringKM(final @NotNull Sequence currentSequence) throws SupportRegionException, SegmentationException, NumberFormatException {
final int nbc2 = Integer.parseInt(tfNbCluster2.getText()); final int nbc2 = Integer.parseInt(tfNbCluster2.getText());
final int nbi2 = Integer.parseInt(tfNbIteration2.getText()); final int nbi2 = Integer.parseInt(tfNbIteration2.getText());
final double stab2 = Double.parseDouble(tfStabCrit2.getText()); final double stab2 = Double.parseDouble(tfStabCrit2.getText());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment