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
Branches icy-3.0.0
No related merge requests found
.idea/
/build*
/workspace
setting.xml
release/
target/
.settings/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
icy.log
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
.project
*.ipr
### Eclipse ###
.apt_generated
.classpath
**/.DS_Store
\ No newline at end of file
.factorypath
.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 @@
<parent>
<groupId>org.bioimageanalysis.icy</groupId>
<artifactId>pom-icy</artifactId>
<version>2.2.0</version>
<version>3.0.0-a.1</version>
</parent>
<!-- Project Information -->
<artifactId>kmeans-color-quantization</artifactId>
<version>2.0.0</version>
<version>2.0.0-a.1</version>
<name>KMeans Color Quantization</name>
<description>Quantize a color image in any given number of colors.</description>
......@@ -68,8 +68,7 @@
<repositories>
<repository>
<id>icy</id>
<name>Icy's Nexus</name>
<url>https://icy-nexus.pasteur.fr/repository/Icy/</url>
<url>https://nexus-icy.pasteur.cloud/repository/icy/</url>
</repository>
</repositories>
</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.
* Icy is free software: you can redistribute it and/or modify
......@@ -18,13 +18,16 @@
package plugins.nherve.colorquantization;
import icy.gui.util.ComponentUtil;
import icy.gui.util.GuiUtil;
import icy.main.Icy;
import icy.preferences.XMLPreferences;
import icy.sequence.Sequence;
import icy.swimmingPool.SwimmingObject;
import icy.system.IcyExceptionHandler;
import org.bioimageanalysis.icy.Icy;
import org.bioimageanalysis.icy.extension.plugin.annotation_.IcyPluginIcon;
import org.bioimageanalysis.icy.extension.plugin.annotation_.IcyPluginName;
import org.bioimageanalysis.icy.gui.GuiUtil;
import org.bioimageanalysis.icy.gui.component.ComponentUtil;
import org.bioimageanalysis.icy.model.sequence.Sequence;
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.toolbox.Algorithm;
import plugins.nherve.toolbox.NherveToolbox;
......@@ -68,6 +71,8 @@ import java.util.Map;
*
* @author Nicolas HERVE - nicolas.herve@pasteur.fr
*/
@IcyPluginName("KMeans Color Quantization")
@IcyPluginIcon(path = "/KMeansColorQuantization_icon.png")
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>";
......@@ -145,7 +150,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
}
@Override
public void fillInterface(final JPanel mainPanel) {
public void fillInterface(final @NotNull JPanel mainPanel) {
currentlyRunning = null;
final XMLPreferences preferences = getPreferences();
......@@ -224,7 +229,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
preferences.putBoolean("dsp", cbDisplay.isSelected());
}
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
* java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
@Override
public void actionPerformed(final ActionEvent e) {
public void actionPerformed(final @NotNull ActionEvent e) {
final JButton b = (JButton) e.getSource();
if (b == null) {
return;
......@@ -272,7 +277,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
}
}
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();
......@@ -304,7 +309,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* @param seg the seg
* @return the some stats
*/
private void getSomeStats(final Segmentation seg) {
private void getSomeStats(final @NotNull Segmentation seg) {
final DecimalFormat df = new DecimalFormat("0");
Algorithm.out("id;label;h1;h2;h3");
for (final Mask m : seg) {
......@@ -325,7 +330,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* @throws NumberFormatException the number format 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;
seg = doClusteringKM(currentSequence);
......@@ -346,7 +351,7 @@ public class KMeansColorQuantization extends SingletonPlugin implements ActionLi
* @throws SegmentationException the segmentation 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 nbi2 = Integer.parseInt(tfNbIteration2.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