From 12dcb90d38786f17c72d330003372ab81d1fa8ff Mon Sep 17 00:00:00 2001 From: Jean-Yves TINEVEZ Date: Tue, 23 Jul 2024 11:41:37 +0200 Subject: [PATCH] Add the smoothing scale param to the 2D labeling methods as well. Not implemented yet, but at least symmetric with the 2D case. --- .../plugin/trackmate/detection/SpotRoiUtils.java | 16 ++++++++++++++-- .../trackmate/gui/editor/LabkitImporter.java | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/fiji/plugin/trackmate/detection/SpotRoiUtils.java b/src/main/java/fiji/plugin/trackmate/detection/SpotRoiUtils.java index 0a4ba51f2..5e3078861 100644 --- a/src/main/java/fiji/plugin/trackmate/detection/SpotRoiUtils.java +++ b/src/main/java/fiji/plugin/trackmate/detection/SpotRoiUtils.java @@ -121,7 +121,13 @@ public static < R extends IntegerType< R >, S extends RealType< S > > List< Spot final double smoothingScale, final RandomAccessibleInterval< S > qualityImage ) { - final Map< Integer, List< Spot > > map = from2DLabelingWithROIMap( labeling, origin, calibration, simplify, qualityImage ); + final Map< Integer, List< Spot > > map = from2DLabelingWithROIMap( + labeling, + origin, + calibration, + simplify, + smoothingScale, + qualityImage ); final List< Spot > spots = new ArrayList<>(); for ( final List< Spot > s : map.values() ) spots.addAll( s ); @@ -144,7 +150,7 @@ public static < R extends IntegerType< R >, S extends RealType< S > > List< Spot * @param * the type of the quality image. Must be real, scalar. * @param labeling - * the labeling, must be zero-min and 2D.. + * the labeling, must be zero-min and 2D. * @param origin * the origin (min pos) of the interval the labeling was * generated from, used to reposition the spots from the zero-min @@ -154,6 +160,11 @@ public static < R extends IntegerType< R >, S extends RealType< S > > List< Spot * @param simplify * if true the polygon will be post-processed to be * smoother and contain less points. + * @param smoothingScale + * if strictly larger than 0, the mask will be smoothed before + * creating the mesh, resulting in smoother meshes. The scale + * value sets the (Gaussian) filter radius and is specified in + * physical units. If 0 or lower than 0, no smoothing is applied. * @param qualityImage * the image in which to read the quality value. * @return a map linking the label integer value to the list of spots, with @@ -164,6 +175,7 @@ public static < R extends IntegerType< R >, S extends RealType< S > > Map< Integ final double[] origin, final double[] calibration, final boolean simplify, + final double smoothingScale, final RandomAccessibleInterval< S > qualityImage ) { if ( labeling.numDimensions() != 2 ) diff --git a/src/main/java/fiji/plugin/trackmate/gui/editor/LabkitImporter.java b/src/main/java/fiji/plugin/trackmate/gui/editor/LabkitImporter.java index 95bb352dd..2cc4b82d2 100644 --- a/src/main/java/fiji/plugin/trackmate/gui/editor/LabkitImporter.java +++ b/src/main/java/fiji/plugin/trackmate/gui/editor/LabkitImporter.java @@ -305,6 +305,7 @@ private Map< Integer, List< Spot > > getSpots( final RandomAccessibleInterval< T new double[] { 0., 0. }, calibration, simplify, + smoothingScale, rai ); }