Skip to content

Commit

Permalink
exposed FirstTileWins fusion as cmd-line parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed Jun 5, 2024
1 parent 59b50dd commit 5b71948
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public class SparkAffineFusion extends AbstractSelectableViews implements Callab
@Option(names = { "--masks" }, description = "save only the masks (this will not fuse the images)")
private boolean masks = false;

@Option(names = { "--firstTileWins" }, description = "use firstTileWins fusion strategy (default: false - using weighted average blending fusion)")
private boolean firstTileWins = false;

@Option(names = "--maskOffset", description = "allows to make masks larger (+, the mask will include some background) or smaller (-, some fused content will be cut off), warning: in the non-isotropic coordinate space of the raw input images (default: 0.0,0.0,0.0)")
private String maskOffset = "0.0,0.0,0.0";

Expand Down Expand Up @@ -369,7 +372,8 @@ else if ( uint16 )
uint16,
minIntensity,
range,
blockSize ) );
blockSize,
firstTileWins ) );

if ( this.downsamplings != null )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public class WriteSuperBlock implements VoidFunction< long[][] >

private final int[] blockSize;

private final boolean firstTileWins;

public WriteSuperBlock(
final String xmlPath,
final boolean preserveAnisotropy,
Expand All @@ -101,7 +103,8 @@ public WriteSuperBlock(
final boolean uint16,
final double minIntensity,
final double range,
final int[] blockSize )
final int[] blockSize,
final boolean firstTileWins )
{
this.xmlPath = xmlPath;
this.preserveAnisotropy = preserveAnisotropy;
Expand All @@ -117,6 +120,7 @@ public WriteSuperBlock(
this.minIntensity = minIntensity;
this.range = range;
this.blockSize = blockSize;
this.firstTileWins = firstTileWins;
}

/**
Expand Down Expand Up @@ -246,14 +250,28 @@ else if ( uint16 )
else
type = new FloatType();

// final RandomAccessibleInterval< NativeType > source = Fusion.fuseVirtual(
final RandomAccessibleInterval< NativeType > source = FusionFirstWins.fuseVirtual(
dataLocal,
overlappingBlocks.overlappingViews(),
fusedBlock,
type,
minIntensity,
range );
final RandomAccessibleInterval< NativeType > source;

if ( firstTileWins )
{
source = FusionFirstWins.fuseVirtual(
dataLocal,
overlappingBlocks.overlappingViews(),
fusedBlock,
type,
minIntensity,
range );
}
else
{
source = Fusion.fuseVirtual(
dataLocal,
overlappingBlocks.overlappingViews(),
fusedBlock,
type,
minIntensity,
range );
}

N5Helper.saveBlock( source, executorVolumeWriter, n5Dataset, gridPos );
}
Expand Down

0 comments on commit 5b71948

Please sign in to comment.