Skip to content

Commit

Permalink
no reason for the weight function to be serializable anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed Aug 18, 2023
1 parent fe4d967 commit 16daba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,13 @@ public static void main( final String[] args ) throws IOException
final BlockCollection< ?, AffineModel2D, ?, ZBlockFactory > blockCollection =
solverSetup.setupSolve( cmdLineSetup.blockModel(), cmdLineSetup.stitchingModel() );

/*
// test weight function

BlockData<?, AffineModel2D, ?, ZBlockFactory> b = blockCollection.allBlocks().get( 0 );

for ( int z = b.minZ() - 1; z <= b.maxZ() + 1; ++z )
{
System.out.println( z + ": " + b.createWeightFunctions().get( 2 ).apply( (double)z ) );
}

System.exit( 0 );
*/

//
// multi-threaded solve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,18 @@ public static List< ZBlockInit > defineBlockLayout( final int minZ, final int ma
return Stream.concat( leftSets.stream(), rightSets.stream() ).collect( Collectors.toList() );
}

@SuppressWarnings("unchecked")
@Override
public ArrayList<Function<Double, Double>> createWeightFunctions( final BlockData<?, ?, ?, ZBlockFactory > block )
{
// we also define our own distance functions
// here, xy doesn't matter, only z
final ArrayList< Function< Double, Double > > weightF = new ArrayList<>();

weightF.add( (Function< Double, Double > & Serializable )(x) -> 0.0 );
weightF.add( (Function< Double, Double > & Serializable )(y) -> 0.0 );
weightF.add( (x) -> 0.0 );
weightF.add( (y) -> 0.0 );
// TODO: has to be between 0 and 1
// TODO: needs the Block to know
weightF.add( (Function< Double, Double > & Serializable )(z) ->
weightF.add( (z) ->
1.0 - Math.min( 1, Math.max( 0,
( Math.abs( z - ( ( block.maxZ() - block.minZ() ) / 2. + block.minZ() ) ) /
( ( block.maxZ() - block.minZ() ) / 2. + 0.01) ) // first and last z-slice not 0.0
Expand Down

0 comments on commit 16daba3

Please sign in to comment.