From 797989ffbaf3bd12cbd1e4f4643a8f0dec85f826 Mon Sep 17 00:00:00 2001 From: Stephan Preibisch Date: Wed, 10 Jul 2024 11:17:40 -0400 Subject: [PATCH] fixes for maxSpots --- .../bigstitcher/spark/SparkInterestPointDetection.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/preibisch/bigstitcher/spark/SparkInterestPointDetection.java b/src/main/java/net/preibisch/bigstitcher/spark/SparkInterestPointDetection.java index 5636473..468e73a 100644 --- a/src/main/java/net/preibisch/bigstitcher/spark/SparkInterestPointDetection.java +++ b/src/main/java/net/preibisch/bigstitcher/spark/SparkInterestPointDetection.java @@ -141,7 +141,7 @@ public enum Localization { NONE, QUADRATIC }; protected boolean prefetch = false; - @Option(names = {"--maxSpots" }, required = true, description = "limit the number of spots per view (choose the brightest ones), e.g. --maxSpots 10000 (default: NO LIMIT)") + @Option(names = {"--maxSpots" }, description = "limit the number of spots per view (choose the brightest ones), e.g. --maxSpots 10000 (default: NO LIMIT)") protected int maxSpots = -1; @Option(names = "--blockSize", description = "blockSize for running the interest point detection - at the scale of detection (default: 512,512,128)") @@ -592,7 +592,7 @@ public Void call() throws Exception System.out.println( Group.pvid( viewId ) + ": " + myIpsNewId.size() ); - if ( maxSpots > 0 ) + if ( maxSpots > 0 && maxSpots < myIpsNewId.size() ) { // filter for the brightnest N spots final ArrayList< Pair< Double, InterestPoint > > combinedList = new ArrayList<>(); @@ -609,11 +609,11 @@ public Void call() throws Exception for ( int i = 0; i < maxSpots; ++i ) { myIntensities.add( combinedList.get( i ).getA() ); - myIpsNewId.add( combinedList.get( i ).getB() ); + myIpsNewId.add( new InterestPoint( i, combinedList.get( i ).getB().getL() ) ); // new id's again ... } - } - System.out.println( Group.pvid( viewId ) + " (after applying maxSpots): " + myIpsNewId.size() ); + System.out.println( Group.pvid( viewId ) + " (after applying maxSpots): " + myIpsNewId.size() ); + } interestPoints.put(viewId, myIpsNewId);