Skip to content

Commit

Permalink
fix: adjust default values for inverse estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Oct 16, 2024
1 parent b5eba1b commit d7e2f7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 10 additions & 1 deletion src/main/java/bdv/img/WarpedSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,19 @@ private Interval estimateBoundingInterval( final int t, final int level )
// the transform is thread safe here by copying

source.getSourceTransform(t, level, tmpSrcTransform);
InvertibleRealTransform xfmcopy = xfm.copy();
if( xfm instanceof WrappedIterativeInvertibleRealTransform) {
// TODO this should not be necessary - fix in WrappedIterativeInvertibleRealTransform
// workaround for now
@SuppressWarnings("rawtypes")
WrappedIterativeInvertibleRealTransform copy = (WrappedIterativeInvertibleRealTransform)xfmcopy;
copy.getOptimzer().setMaxStep(500);
}

RealTransformSequence seq = new RealTransformSequence();
// build the inverse transform
seq.add(tmpSrcTransform);
seq.add(xfm.copy().inverse());
seq.add(xfmcopy.inverse());
seq.add(tmpSrcTransform.inverse());

final Interval res = bboxEst.estimatePixelInterval( seq, source.getSource( t, level ) );
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/bigwarp/transforms/BigWarpTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public InvertibleRealTransform getTransformation( final int index, final boolean
final WrappedIterativeInvertibleRealTransform<?> tpsXfm = (WrappedIterativeInvertibleRealTransform< ? >) solver.solve( tableModel, index );
tpsXfm.getOptimzer().setMaxIters(maxIterations);
tpsXfm.getOptimzer().setTolerance(inverseTolerance);
tpsXfm.getOptimzer().setMaxStep(500);
invXfm = tpsXfm;
}
else
Expand Down Expand Up @@ -560,20 +561,18 @@ public void initializeInverseParameters( BigWarpData<?> bwData )
final int N = bwData.numTargetSources();

double val;
double highestResDim = 0;
double highestResDim = 1;

for( int i = 0; i < N; i++ )
{
// SourceAndConverter< ? > src = bwData.sources.get( bwData.targetSourceIndices[ i ]);
final SourceAndConverter< ? > src = bwData.getTargetSource( i );

final String name = src.getSpimSource().getName();
if( name.equals( "WarpMagnitudeSource" ) ||
name.equals( "JacobianDeterminantSource" ) ||
name.equals( "GridSource" ) )
if( name.equals( "WarpMagnitudeSource" ) || name.equals( "JacobianDeterminantSource" ) || name.equals( "GridSource" ) )
{
continue;
}

final AffineTransform3D xfm = new AffineTransform3D();
src.getSpimSource().getSourceTransform( 0, 0, xfm );

Expand Down

0 comments on commit d7e2f7e

Please sign in to comment.