Skip to content

Commit

Permalink
fix bug if #tiles=2 for optimizing splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed May 10, 2024
1 parent 4b36449 commit f2c2485
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ public static ArrayList< Interval > distributeIntervalsFixedOverlap( final Inter
if ( lastImageSize <= s / 2 )
{
// increase image size until lastImageSize goes towards zero, then large
System.out.println( "small" );

do
{
Expand All @@ -373,7 +374,7 @@ public static ArrayList< Interval > distributeIntervalsFixedOverlap( final Inter
delta = lastImageSize - currentLastImageSize;

lastImageSize = currentLastImageSize;
//System.out.println( lastSize + ": " + lastImageSize + ", delta=" + delta );
System.out.println( lastSize + ": " + lastImageSize + ", delta=" + delta );
}
while ( delta > 0 );

Expand All @@ -382,6 +383,7 @@ public static ArrayList< Interval > distributeIntervalsFixedOverlap( final Inter
else
{
// decrease image size until lastImageSize is maximal
System.out.println( "large" );

do
{
Expand All @@ -390,7 +392,7 @@ public static ArrayList< Interval > distributeIntervalsFixedOverlap( final Inter
delta = lastImageSize - currentLastImageSize;

lastImageSize = currentLastImageSize;
//System.out.println( lastSize + ": " + lastImageSize + ", delta=" + delta );
System.out.println( lastSize + ": " + lastImageSize + ", delta=" + delta );
}
while ( delta < 0 );

Expand Down Expand Up @@ -444,14 +446,20 @@ public static ArrayList< Interval > distributeIntervalsFixedOverlap( final Inter

public static long lastImageSize( final long l, final long s, final long o)
{
return o + ( l - 2 * ( s-o ) - o ) % ( s - 2 * o + o );
}
long size = o + ( l - 2 * ( s-o ) - o ) % ( s - 2 * o + o );

public static double numCenterBlocks( final double l, final double s, final double o )
{
return ( l - 2.0 * ( s-o ) - o ) / ( s - 2.0 * o + o );
// this happens when it is only two overlapping images
if ( size < 0 )
size = l + size;

return size;
}

//public static double numCenterBlocks( final double l, final double s, final double o )
//{
// return ( l - 2.0 * ( s-o ) - o ) / ( s - 2.0 * o + o );
//}

public static ArrayList< Pair< Long, Long > > splitDim(
final Interval input,
final int d,
Expand Down Expand Up @@ -482,11 +490,11 @@ public static ArrayList< Pair< Long, Long > > splitDim(

public static void main( String[] args )
{
Interval input = new FinalInterval( new long[]{ 0 }, new long[] { 2048 - 1 } );
Interval input = new FinalInterval( new long[]{ 0 }, new long[] { 14192 - 1 } );

long[] overlapPx = new long[] { 17 };
long[] targetSize = new long[] { 500 };
long[] minStepSize = new long[] { 32 };
long[] overlapPx = new long[] { 128 };
long[] targetSize = new long[] { 6000 };
long[] minStepSize = new long[] { 64 };

targetSize[ 0 ] = Split_Views.closestLongDivisableBy( targetSize[ 0 ], minStepSize[ 0 ] );
overlapPx[ 0 ] = Split_Views.closestLargerLongDivisableBy( overlapPx[ 0 ], minStepSize[ 0 ] );
Expand Down

0 comments on commit f2c2485

Please sign in to comment.