diff --git a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java index c462a74d..07de4d84 100644 --- a/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java +++ b/src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java @@ -62,7 +62,10 @@ public class Split_Views implements PlugIn public static boolean defaultOptimize = true; public static boolean defaultAddIPs = true; - public static int defaultDensity = 100; + public static double defaultDensity = 100; + public static int defaultMinPoints = 20; + public static int defaultMaxPoints = 500; + public static double defaultError = 0.5; public static boolean defaultAssignIlluminations = true; @@ -92,10 +95,13 @@ public static boolean split( final long[] minStepSize, final boolean assingIlluminationsFromTileIds, final boolean optimize, - final int pointDensity, + final double pointDensity, + final int minPoints, + final int maxPoints, + final double error, final boolean display ) { - final SpimData2 newSD = SplittingTools.splitImages( data, overlap, targetSize, minStepSize, assingIlluminationsFromTileIds, optimize, pointDensity ); + final SpimData2 newSD = SplittingTools.splitImages( data, overlap, targetSize, minStepSize, assingIlluminationsFromTileIds, optimize, pointDensity, minPoints, maxPoints, error ); if ( display ) { @@ -148,7 +154,10 @@ public static boolean split( final SpimData2 data, final String fileName ) gd.addMessage( "Minimal image sizes per dimension: " + Util.printCoordinates( imgSizes.getB() ), GUIHelper.mediumstatusfont, Color.DARK_GRAY ); gd.addCheckbox( "Add_fake_interest_points", defaultAddIPs ); - gd.addNumericField( "Density (# per 100x100x100 px)", defaultDensity, 0 ); + gd.addNumericField( "Density (# per 100x100x100 px)", defaultDensity, 2 ); + gd.addNumericField( "Min_total number of points", defaultMinPoints, 0 ); + gd.addNumericField( "Max_total number of points", defaultMaxPoints, 0 ); + gd.addNumericField( "Artificial error (px)", defaultError, 2 ); gd.addMessage( "" ); if ( data.getSequenceDescription().getAllIlluminationsOrdered().size() == 1 ) @@ -183,7 +192,11 @@ public static boolean split( final SpimData2 data, final String fileName ) final long oz = defaultOverlapZ = closestLargerLongDivisableBy( Math.round( gd.getNextNumber() ), minStepSize[ 2 ] ); final boolean addIPs = defaultAddIPs = gd.getNextBoolean(); - final int density = defaultDensity = addIPs ? (int)Math.round( gd.getNextNumber() ) : 0; + final double density = defaultDensity = addIPs ? gd.getNextNumber() : 0; + final int minPoints = defaultMinPoints = addIPs ? (int)Math.round(gd.getNextNumber()) : 0; + final int maxPoints = defaultMaxPoints = addIPs ? (int)Math.round(gd.getNextNumber()) : 0; + final double error = defaultError = addIPs ? gd.getNextNumber() : 0; + final boolean assignIllum; if ( data.getSequenceDescription().getAllIlluminationsOrdered().size() == 1 ) assignIllum = defaultAssignIlluminations = gd.getNextBoolean(); @@ -207,7 +220,7 @@ public static boolean split( final SpimData2 data, final String fileName ) return false; } - return split( data, saveAs, new long[]{ sx, sy, sz }, new long[]{ ox, oy, oz }, minStepSize, assignIllum, optimize, density, choice == 0 ); + return split( data, saveAs, new long[]{ sx, sy, sz }, new long[]{ ox, oy, oz }, minStepSize, assignIllum, optimize, density, minPoints, maxPoints, error, choice == 0 ); } public static Pair< HashMap< String, Integer >, long[] > collectImageSizes( final AbstractSpimData< ? > data ) diff --git a/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java b/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java index 1513ad4e..37ae34b2 100644 --- a/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java +++ b/src/main/java/net/preibisch/mvrecon/headless/splitting/TestSplitting.java @@ -71,7 +71,10 @@ public static void main( String[] args ) throws SpimDataException minStepSize, true, true, - 100 ); + 100, + 20, + 50, + 0.5 ); // drosophila with 1000 views final ViewSetupExplorer< SpimData2 > explorer = new ViewSetupExplorer<>( newSD, fileOut, new XmlIoSpimData2( "" ) ); diff --git a/src/main/java/net/preibisch/mvrecon/process/splitting/SplittingTools.java b/src/main/java/net/preibisch/mvrecon/process/splitting/SplittingTools.java index 03402c23..5ba59654 100644 --- a/src/main/java/net/preibisch/mvrecon/process/splitting/SplittingTools.java +++ b/src/main/java/net/preibisch/mvrecon/process/splitting/SplittingTools.java @@ -77,8 +77,9 @@ public class SplittingTools { //public static boolean assingIlluminationsFromTileIds = false; - public static double error = 0.5; - public static int minPoints = 20; + //public static double error = 0.5; + //public static int minPoints = 20; + //public static int maxPoints = 500; /** * @@ -89,6 +90,9 @@ public class SplittingTools * @param assingIlluminationsFromTileIds - use illumination attribute to remember former tiles * @param optimize - whether to optimize overlap size * @param pointDensity - how many points per 100x100x100 volume + * @param minPoints - min number of generated points per pair + * @param maxPoints - max number of generated points per pair + * @param error - artifical error for matching points * @return */ public static SpimData2 splitImages( @@ -98,7 +102,10 @@ public static SpimData2 splitImages( final long[] minStepSize, final boolean assingIlluminationsFromTileIds, final boolean optimize, - final int pointDensity) { + final double pointDensity, + final int minPoints, + final int maxPoints, + final double error ) { final TimePoints timepoints = spimData.getSequenceDescription().getTimePoints(); final List< ViewSetup > oldSetups = new ArrayList<>(); @@ -248,7 +255,7 @@ public static SpimData2 splitImages( for ( int d = 0; d < n; ++d ) numPixels *= intersection.dimension( d ); - final int numPoints = Math.max( minPoints, (int)Math.round( Math.ceil( pointDensity * numPixels / (100.0*100.0*100.0) ) ) ); + final int numPoints = Math.min( maxPoints, Math.max( minPoints, (int)Math.round( Math.ceil( pointDensity * numPixels / (100.0*100.0*100.0) ) ) ) ); System.out.println(numPixels / (100.0*100.0*100.0) + " " + numPoints ); final List< InterestPoint > otherPoints;