Skip to content

Commit

Permalink
make density double, add maxNumPoints
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed May 16, 2024
1 parent 8ebf061 commit f49ee6d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
25 changes: 19 additions & 6 deletions src/main/java/net/preibisch/mvrecon/fiji/plugin/Split_Views.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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();
Expand All @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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( "" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
*
Expand All @@ -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(
Expand All @@ -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<>();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f49ee6d

Please sign in to comment.