Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,14 @@
<bigdataviewer-core.version>10.6.1</bigdataviewer-core.version>
<bigdataviewer-vistools.version>1.0.0-beta-36</bigdataviewer-vistools.version>
-->
<imglib2.version>7.1.4</imglib2.version>
<imglib2-algorithm.version>0.18.0</imglib2-algorithm.version>
<bigdataviewer-core.version>10.6.4</bigdataviewer-core.version>
<imglib2.version>8.0.0</imglib2.version>
<imglib2-cache.version>1.0.0-beta-20</imglib2-cache.version>
<imglib2-algorithm.version>0.18.2</imglib2-algorithm.version>
<bigdataviewer-core.version>10.6.5</bigdataviewer-core.version>
<bigdataviewer-n5.version>1.0.2</bigdataviewer-n5.version>

<spim_data.version>2.3.5</spim_data.version>
<multiview-reconstruction.version>7.0.5</multiview-reconstruction.version>
<multiview-reconstruction.version>8.0.0</multiview-reconstruction.version>
<BigStitcher.version>2.5.0</BigStitcher.version>

<n5-universe.version>2.3.0</n5-universe.version>
Expand Down Expand Up @@ -284,6 +287,11 @@
<groupId>ome</groupId>
<artifactId>formats-gpl</artifactId>
</exclusion>
<!-- in n5-google-cloud -->
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import net.imglib2.FinalInterval;
import net.imglib2.Interval;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.algorithm.blocks.BlockAlgoUtils;
import net.imglib2.algorithm.blocks.BlockSupplier;
import net.imglib2.converter.Converter;
import net.imglib2.converter.RealUnsignedByteConverter;
Expand Down Expand Up @@ -558,7 +559,7 @@ else if ( dataType == DataType.UINT16 )
}

//final RandomAccessibleInterval img;
final BlockSupplier blockSupplier;
final BlockSupplier< ? > blockSupplier;
final FinalInterval interval = new FinalInterval( bbMin, bbMax );

if ( masks )
Expand Down Expand Up @@ -605,6 +606,7 @@ else if ( dataType == DataType.UINT16 )
registrations,
dataLocal.getSequenceDescription().getViewDescriptions(),
fusionType,//fusion.getFusionType(),
Double.NaN,
null, // map<old,new> will go here
1, // linear interpolation
coefficients, // intensity correction
Expand All @@ -622,7 +624,7 @@ else if ( dataType == DataType.UINT16 )
blockMax[ d ] = Math.min( Intervals.zeroMin( interval ).max( d ), blockMin[ d ] + gridBlock[1][ d ] - 1 );

final RandomAccessibleInterval image;
final RandomAccessibleInterval img = BlkAffineFusion.arrayImg( blockSupplier, new FinalInterval( blockMin, blockMax ) );
final RandomAccessibleInterval img = BlockAlgoUtils.arrayImg( blockSupplier, new FinalInterval( blockMin, blockMax ) );

// 5D OME-ZARR CONTAINER
if ( storageType == StorageFormat.ZARR )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,13 @@ public enum Method { FAST_ROTATION, FAST_TRANSLATION, PRECISE_TRANSLATION, ICP }
@Option(names = { "-rmir", "--ransacMinInlierRatio" }, description = "ransac min inlier ratio (default: 0.1)")
protected Double ransacMinInlierRatio = 0.1;

@Option(names = { "-rmif", "--ransacMinInlierFactor" }, description = "ransac min inlier factor, i.e. how many time the minimal number of matches need to found, e.g. affine needs 4 matches, 3x means at least 12 matches required (default: 3.0)")
protected Double ransacMinInlierFactor = 3.0;
@Option(names = { "-rmni", "--ransacMinNumInliers" }, description = "ransac minimal number of required inliers (default: 12)")
protected Integer ransacMinNumInliers = 12;

@Option(names = { "-rmc", "--ransacMultiConsensus" }, description = "ransac perform multiconsensus matching (default: false)")
protected boolean ransacMultiConsensus = false;



@Option(names = { "-ime", "--icpMaxError" }, description = "ICP max error in pixels (default: 5.0)")
protected Double icpMaxError = 5.0;

Expand Down Expand Up @@ -220,7 +223,8 @@ else if ( ransacIterations == null )
final int ransacIterations = this.ransacIterations;
final double ransacMaxEpsilon = this.ransacMaxError;
final double ransacMinInlierRatio = this.ransacMinInlierRatio;
final double ransacMinInlierFactor = this.ransacMinInlierFactor;
final int ransacMinNumInliers = this.ransacMinNumInliers;
final boolean ransacMultiConsensus = this.ransacMultiConsensus;
final double icpMaxError = this.icpMaxError;
final int icpMaxIterations = this.icpIterations;
final boolean icpUseRANSAC = this.icpUseRANSAC;
Expand Down Expand Up @@ -300,7 +304,7 @@ else if ( ransacIterations == null )
System.out.println( Group.pvid( element.getKey() ) + ", '" + subElement.getKey() + "' : " + subElement.getValue().size() );
}

final RANSACParameters rp = new RANSACParameters( (float)ransacMaxEpsilon, (float)ransacMinInlierRatio, (float)ransacMinInlierFactor, ransacIterations );
final RANSACParameters rp = new RANSACParameters( (float)ransacMaxEpsilon, (float)ransacMinInlierRatio, ransacMinNumInliers, ransacIterations, ransacMultiConsensus );
final Model< ? > model = createModelInstance(transformationModel, regularizationModel, lambda);

final MatcherPairwise< InterestPoint > matcher = createMatcherInstance(
Expand Down Expand Up @@ -424,7 +428,7 @@ else if ( ransacIterations == null )
groupedInterestpoints.put( task.vB, ipGrouping.group( task.vB ) );
IOFunctions.println( task.vA + " <=> " + task.vB + ": Grouping interestpoints for " + task.vB + " (" + ipGrouping.countBefore() + " >>> " + ipGrouping.countAfter() + ")" );

final RANSACParameters rp = new RANSACParameters( (float)ransacMaxEpsilon, (float)ransacMinInlierRatio, (float)ransacMinInlierFactor, ransacIterations );
final RANSACParameters rp = new RANSACParameters( (float)ransacMaxEpsilon, (float)ransacMinInlierRatio, ransacMinNumInliers, ransacIterations, ransacMultiConsensus );
final Model< ? > model = createModelInstance(transformationModel, regularizationModel, lambda);

final MatcherPairwise< GroupedInterestPoint< ViewId > > matcher = createMatcherInstance(
Expand Down Expand Up @@ -609,7 +613,7 @@ else if ( registrationMethod == Method.PRECISE_TRANSLATION )
rp.getMinInlierRatio(),
rp.getMaxEpsilon(),
rp.getNumIterations(),
Math.round( rp.getMinInlierFactor() * model.getMinNumMatches() ) );
rp.getMinNumMatches() );
matcher = new IterativeClosestPointPairwise<>( ip );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@

public class SparkIntensityMatching extends AbstractSelectableViews
{
public enum IntensityMatchingMethod
{
RANSAC, HISTOGRAM
}

@Option(names = { "--numCoefficients" }, description = "number of coefficients per dimension (default: 8,8,8)")
private String numCoefficientsString = "8,8,8";

Expand All @@ -52,19 +57,23 @@ public class SparkIntensityMatching extends AbstractSelectableViews
@Option(names = { "--minNumCandidates" }, description = "minimum number of (non-discarded) overlapping pixels required to match overlapping coefficient regions (default: 1000)")
private int minNumCandidates = 1000;

@Option(names = {"--method"}, defaultValue = "RANSAC", showDefaultValue = CommandLine.Help.Visibility.ALWAYS,
description = "Method to match intensities between overlapping views: RANSAC or HISTOGRAM")
private IntensityMatchingMethod intensityMatchingMethod;

@CommandLine.Option(names = { "--numIterations" }, description = "number of RANSAC iterations (default: 1000)")
private int iterations = 1000;

@CommandLine.Option(names = { "--maxEpsilon" }, description = "maximal allowed transfer error (default: 5.1)")
@CommandLine.Option(names = { "--maxEpsilon" }, description = "maximal allowed transfer error (default: 5.1, only for RANSAC method)")
private double maxEpsilon = 0.02 * 255;

@CommandLine.Option(names = { "--minInlierRatio" }, description = "minimal ratio of of inliers to number of candidates (default: 0.1)")
@CommandLine.Option(names = { "--minInlierRatio" }, description = "minimal ratio of of inliers to number of candidates (default: 0.1, only for RANSAC method)")
private double minInlierRatio = 0.1;

@CommandLine.Option(names = { "--minNumInliers" }, description = "minimally required absolute number of inliers (default: 10)")
@CommandLine.Option(names = { "--minNumInliers" }, description = "minimally required absolute number of inliers (default: 10, only for RANSAC method)")
private int minNumInliers = 10;

@CommandLine.Option(names = { "--maxTrust" }, description = "reject candidates with a cost larger than maxTrust * median cost (default: 3)")
@CommandLine.Option(names = { "--maxTrust" }, description = "reject candidates with a cost larger than maxTrust * median cost (default: 3, only for RANSAC method)")
private double maxTrust = 3.0;

private SpimData2 dataGlobal;
Expand Down Expand Up @@ -100,6 +109,7 @@ public Void call() throws Exception
final double minInlierRatio = this.minInlierRatio;
final int minNumInliers = this.minNumInliers;
final double maxTrust = this.maxTrust;
final IntensityMatchingMethod method = this.intensityMatchingMethod;

new ViewPairCoefficientMatchesIO( outputURI ).writeCoefficientsSize( coefficientsSize );

Expand Down Expand Up @@ -156,8 +166,18 @@ public Void call() throws Exception
viewPairRDD.foreach( views -> {
final SpimData2 dataLocal = Spark.getSparkJobSpimData2( xmlURI );
System.out.println( "(" + new Date( System.currentTimeMillis() ) + "): " + views._1().getViewSetupId() + "<>" + views._2().getViewSetupId() );
final ViewPairCoefficientMatches matches = IntensityCorrection.match( dataLocal, views._1(), views._2(), renderScale, coefficientsSize,
minIntensityThreshold, maxIntensityThreshold, minNumCandidates, iterations, maxEpsilon, minInlierRatio, minNumInliers, maxTrust );

final ViewPairCoefficientMatches matches;
if ( method == IntensityMatchingMethod.RANSAC )
{
matches = IntensityCorrection.matchRansac( dataLocal, views._1(), views._2(), renderScale, coefficientsSize,
minIntensityThreshold, maxIntensityThreshold, minNumCandidates, iterations, maxEpsilon, minInlierRatio, minNumInliers, maxTrust );
}
else // method == IntensityMatchingMethod.HISTOGRAM
{
matches = IntensityCorrection.matchHistograms( dataLocal, views._1(), views._2(), renderScale, coefficientsSize,
minIntensityThreshold, maxIntensityThreshold, minNumCandidates );
}
final ViewPairCoefficientMatchesIO matchWriter = new ViewPairCoefficientMatchesIO(outputURI);
matchWriter.write( matches );
} );
Expand Down