diff --git a/pom.xml b/pom.xml index cfb970d2d52ef68ac54521fcc1b219cde62ea64d..fb4a752df21d4e5148ad61de4c2b074f92b88da0 100644 --- a/pom.xml +++ b/pom.xml @@ -7,18 +7,11 @@ <parent> <groupId>org.bioimageanalysis.icy</groupId> <artifactId>pom-icy</artifactId> - <version>3.0.0-a.1</version> + <version>3.0.0-a.3</version> </parent> <artifactId>spot-detection-utilities</artifactId> - <version>2.0.0-a.1</version> + <version>2.0.0-a.2</version> <name>Detection Utilities</name> - - <repositories> - <repository> - <id>icy</id> - <url>https://nexus-icy.pasteur.cloud/repository/icy/</url> - </repository> - </repositories> </project> \ No newline at end of file diff --git a/src/main/java/plugins/nchenouard/spot/Detection.java b/src/main/java/plugins/nchenouard/spot/Detection.java index f28d23dc5ddc7dacef28f026b9a47ec42da1b9c6..5c88f29696100b88f6f54ea831582f4205278002 100644 --- a/src/main/java/plugins/nchenouard/spot/Detection.java +++ b/src/main/java/plugins/nchenouard/spot/Detection.java @@ -1,5 +1,5 @@ /* - * 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 @@ -22,7 +22,7 @@ import org.bioimageanalysis.icy.common.reflect.ClassUtil; import org.bioimageanalysis.icy.io.xml.XMLPersistent; import org.bioimageanalysis.icy.io.xml.XMLUtil; import org.bioimageanalysis.icy.model.overlay.Overlay; -import org.bioimageanalysis.icy.system.IcyExceptionHandler; +import org.bioimageanalysis.icy.system.logging.IcyLogger; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -36,10 +36,8 @@ import java.lang.reflect.Constructor; */ public class Detection extends Overlay implements Cloneable, XMLPersistent { - @Override public Object clone() throws CloneNotSupportedException { - final Detection clone = (Detection) super.clone(); clone.x = x; @@ -53,7 +51,6 @@ public class Detection extends Overlay implements Cloneable, XMLPersistent { clone.originalColor = new Color(originalColor.getRGB()); return clone; - } /** @@ -209,7 +206,6 @@ public class Detection extends Overlay implements Cloneable, XMLPersistent { */ @Override public boolean loadFromXML(final Node node) { - final Element detectionElement = (Element) node; x = XMLUtil.getAttributeDoubleValue(detectionElement, "x", 0); @@ -228,7 +224,6 @@ public class Detection extends Overlay implements Cloneable, XMLPersistent { */ @Override public boolean saveToXML(final Node node) { - final Element detectionElement = (Element) node; XMLUtil.setAttributeDoubleValue(detectionElement, "x", x); @@ -263,27 +258,18 @@ public class Detection extends Overlay implements Cloneable, XMLPersistent { } } catch (final Exception e) { - System.err.println("********* TrackManager.createDetection('" + className + "', ...) error :"); - IcyExceptionHandler.showErrorMessage(e, false); - System.err.println("The object is maybe not compatible (should have a default constructor with no arguments and extends Detection)"); - System.err.println("Loading as a the default Detection object."); - + IcyLogger.error( + Detection.class, + e, + "TrackManager.createDetection('" + className + "', ...)", + "The object is maybe not compatible (should have a default constructor with no arguments and extends Detection)" + ); + + IcyLogger.warn(Detection.class, "Loading as the default Detection object."); // Load as a default detection. - result = new Detection(); - } return result; } - } - - - - - - - - - diff --git a/src/main/java/plugins/nchenouard/spot/DetectionResult.java b/src/main/java/plugins/nchenouard/spot/DetectionResult.java index fa7e09e11519743ae6e438ea775e40940fe94e6e..ffaff2bd40607072f7b8907a4ad8842c3ddc16f0 100644 --- a/src/main/java/plugins/nchenouard/spot/DetectionResult.java +++ b/src/main/java/plugins/nchenouard/spot/DetectionResult.java @@ -1,5 +1,5 @@ /* - * 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 @@ -25,7 +25,6 @@ import org.bioimageanalysis.icy.model.sequence.Sequence; import java.util.TreeMap; import java.util.Vector; - /** * A class to manage detection results * @@ -76,11 +75,11 @@ public class DetectionResult extends Plugin { this.sourceSequence = seq; } - @Override + /*@Override protected void finalize() throws Throwable { results.clear(); super.finalize(); - } + }*/ public DetectionResult() { results = new TreeMap<>(); diff --git a/src/main/java/plugins/nchenouard/spot/Point3D.java b/src/main/java/plugins/nchenouard/spot/Point3D.java index aeb4b1f654c4571c720446f763640446422a43c3..c11965208b9aa3435494c0aa86c569a8d910ca73 100644 --- a/src/main/java/plugins/nchenouard/spot/Point3D.java +++ b/src/main/java/plugins/nchenouard/spot/Point3D.java @@ -1,5 +1,5 @@ /* - * 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,10 +18,12 @@ package plugins.nchenouard.spot; +import org.jetbrains.annotations.Contract; +import org.jetbrains.annotations.NotNull; + import java.awt.geom.Point2D; public class Point3D { - @Override public String toString() { return "Point3D[" + x + "," + y + "," + z + "]"; @@ -29,7 +31,9 @@ public class Point3D { public double x, y, z; + @Contract(pure = true) public Point3D() { + // } public Point3D(final double x, final double y, final double z) { @@ -44,7 +48,7 @@ public class Point3D { this.z = 0; } - public Point3D(final double[] coord) { + public Point3D(final double @NotNull [] coord) { this.x = coord[0]; this.y = coord[1]; if (coord.length > 2) diff --git a/src/main/java/plugins/nchenouard/spot/Spot.java b/src/main/java/plugins/nchenouard/spot/Spot.java index 604e12c1e7594332c371cfd34d31066aa885e9cb..16034413576aca3a07b73a1ee92d25f1c62a35ea 100644 --- a/src/main/java/plugins/nchenouard/spot/Spot.java +++ b/src/main/java/plugins/nchenouard/spot/Spot.java @@ -1,5 +1,5 @@ /* - * 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,7 +18,9 @@ package plugins.nchenouard.spot; -import org.bioimageanalysis.icy.system.IcyExceptionHandler; +import org.bioimageanalysis.icy.system.logging.IcyLogger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.PrintStream; import java.text.NumberFormat; @@ -26,7 +28,6 @@ import java.text.ParseException; import java.util.ArrayList; public class Spot { - public Point3D mass_center; public double minIntensity; public double maxIntensity; @@ -60,7 +61,7 @@ public class Spot { this.point3DList = new ArrayList<>(point3DList); } - public static Spot load(String line) { + public static @Nullable Spot load(@NotNull String line) { if (line.startsWith("detection")) { String[] tmpTab = line.split("\\["); tmpTab = tmpTab[1].split("]"); @@ -75,7 +76,7 @@ public class Spot { s.mass_center.z = nf.parse(coordinates[2]).intValue(); } catch (final ParseException e) { - IcyExceptionHandler.showErrorMessage(e, true); + IcyLogger.error(Spot.class, e); return null; } return s; @@ -84,7 +85,7 @@ public class Spot { return null; } - public void save(final PrintStream printOut, final int num) { + public void save(final @NotNull PrintStream printOut, final int num) { printOut.print("detection{" + num + "} = ["); printOut.print(mass_center.x + ","); printOut.print(mass_center.y + ",");