From daef07af070e588ff9cf2e5fb1c8d0361be9cb70 Mon Sep 17 00:00:00 2001 From: Stephan Preibisch Date: Fri, 3 May 2024 15:20:15 -0400 Subject: [PATCH] support min_inlier_factor throughout --- .../pairwise/GeometricHashingGUI.java | 6 +++++- .../plugin/interestpointregistration/pairwise/RGLDMGUI.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/GeometricHashingGUI.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/GeometricHashingGUI.java index c567c9ba4..042ca7efb 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/GeometricHashingGUI.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/GeometricHashingGUI.java @@ -41,6 +41,7 @@ public class GeometricHashingGUI extends PairwiseGUI public static int defaultModel = 2; public static boolean defaultRegularize = true; public static int defaultRANSACIterationChoice = 1; + public static float min_inlier_factor = 3f; protected TransformationModelGUI model = null; protected RANSACParameters ransacParams; @@ -81,6 +82,7 @@ public void addQuery( final GenericDialog gd ) gd.addMessage( "" ); gd.addSlider( "Allowed_error_for_RANSAC (px)", 0.5, 100.0, RANSACParameters.max_epsilon ); + gd.addSlider( "Inlier_factor (minimal amount of inliers)", 1, 20, min_inlier_factor ); gd.addChoice( "Number_of_RANSAC_iterations", RANSACParameters.ransacChoices, RANSACParameters.ransacChoices[ defaultRANSACIterationChoice ] ); } @@ -105,6 +107,7 @@ public boolean parseDialog( final GenericDialog gd ) final int redundancy = GeometricHashingParameters.redundancy = (int)Math.round( gd.getNextNumber() ); final float ratioOfDistance = GeometricHashingParameters.ratioOfDistance = (float)gd.getNextNumber(); final float maxEpsilon = RANSACParameters.max_epsilon = (float)gd.getNextNumber(); + final float inlierFactor = min_inlier_factor = (float)gd.getNextNumber(); final int ransacIterations = RANSACParameters.ransacChoicesIterations[ defaultRANSACIterationChoice = gd.getNextChoiceIndex() ]; final float minInlierRatio; @@ -116,13 +119,14 @@ else if ( ratioOfDistance >= 1.5 ) minInlierRatio = RANSACParameters.min_inlier_ratio / 100; this.ghParams = new GeometricHashingParameters( model.getModel(), GeometricHashingParameters.differenceThreshold, ratioOfDistance, redundancy ); - this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, RANSACParameters.min_inlier_factor, ransacIterations ); + this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, inlierFactor, ransacIterations ); IOFunctions.println( "Selected Paramters:" ); IOFunctions.println( "model: " + defaultModel ); IOFunctions.println( "redundancy: " + redundancy ); IOFunctions.println( "ratioOfDistance: " + ratioOfDistance ); IOFunctions.println( "maxEpsilon: " + maxEpsilon ); + IOFunctions.println( "inlierFactor: " + inlierFactor ); IOFunctions.println( "ransacIterations: " + ransacIterations ); IOFunctions.println( "minInlierRatio: " + minInlierRatio ); diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/RGLDMGUI.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/RGLDMGUI.java index f9e25d748..5ccf7a89b 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/RGLDMGUI.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/interestpointregistration/pairwise/RGLDMGUI.java @@ -47,6 +47,7 @@ public class RGLDMGUI extends PairwiseGUI public static int defaultModel = 2; public static boolean defaultRegularize = true; public static int defaultRANSACIterationChoice = 1; + public static float min_inlier_factor = 3f; protected TransformationModelGUI model = null; protected RGLDMParameters parameters; @@ -88,6 +89,7 @@ public void addQuery( final GenericDialog gd ) gd.addMessage( "" ); gd.addSlider( "Allowed_error_for_RANSAC (px)", 0.5, 100.0, RANSACParameters.max_epsilon ); + gd.addSlider( "Inlier_factor (minimal amount of inliers)", 1, 20, min_inlier_factor ); gd.addChoice( "RANSAC_iterations", RANSACParameters.ransacChoices, RANSACParameters.ransacChoices[ defaultRANSACIterationChoice ] ); } @@ -113,6 +115,7 @@ public boolean parseDialog( final GenericDialog gd ) final int redundancy = RGLDMParameters.redundancy = (int)Math.round( gd.getNextNumber() ); final float ratioOfDistance = RGLDMParameters.ratioOfDistance = (float)gd.getNextNumber(); final float maxEpsilon = RANSACParameters.max_epsilon = (float)gd.getNextNumber(); + final float inlierFactor = min_inlier_factor = (float)gd.getNextNumber(); final int ransacIterations = RANSACParameters.ransacChoicesIterations[ defaultRANSACIterationChoice = gd.getNextChoiceIndex() ]; final float minInlierRatio; @@ -124,7 +127,7 @@ else if ( ratioOfDistance >= 1.5 ) minInlierRatio = RANSACParameters.min_inlier_ratio / 100; this.parameters = new RGLDMParameters( model.getModel(), RGLDMParameters.differenceThreshold, ratioOfDistance, numNeighbors, redundancy ); - this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, RANSACParameters.min_inlier_factor, ransacIterations ); + this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, inlierFactor, ransacIterations ); IOFunctions.println( "Selected Paramters:" ); IOFunctions.println( "model: " + defaultModel ); @@ -132,6 +135,7 @@ else if ( ratioOfDistance >= 1.5 ) IOFunctions.println( "redundancy: " + redundancy ); IOFunctions.println( "ratioOfDistance: " + ratioOfDistance ); IOFunctions.println( "maxEpsilon: " + maxEpsilon ); + IOFunctions.println( "inlierFactor: " + inlierFactor ); IOFunctions.println( "ransacIterations: " + ransacIterations ); IOFunctions.println( "minInlierRatio: " + minInlierRatio );