Skip to content

Commit 794c9f2

Browse files
committed
Fix FastGauss
There was an error, in one of the equations for calculating a determinant.
1 parent c3232dd commit 794c9f2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/net/imglib2/algorithm/convolution/fast_gauss/FastGaussCalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private Parameters( final int _M, final double sigma )
239239

240240
final double D11 = r_3 - r_5 * C_35 - r_7 * C_37;
241241
final double D21 = p_3 - p_5 * C_35 - p_7 * C_37;
242-
final double D31 = p_3 * r_5 + p_5 * r_7 + C_37 - p_5 * r_3 - p_7 * r_5 * C_37;
242+
final double D31 = p_3 * r_5 + p_5 * r_7 * C_37 - p_5 * r_3 - p_7 * r_5 * C_37;
243243
final double D41 = p_5 * r_7 * C_35 + p_7 * r_3 - p_3 * r_7 - p_7 * r_5 * C_35;
244244

245245
final double D12 = r_1 - r_5 * C_15 - r_7 * C_17;

src/test/java/net/imglib2/algorithm/gauss3/GaussTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import net.imglib2.util.Localizables;
1919
import net.imglib2.util.Util;
2020
import net.imglib2.view.Views;
21-
import org.junit.Ignore;
2221
import org.junit.Test;
2322

2423
import java.util.function.BiFunction;
@@ -53,7 +52,6 @@ public void testGauss3()
5352
assertImagesEqual( 24, secondDerivativeX( expected ), secondDerivativeX( result ) );
5453
}
5554

56-
@Ignore( "The FastGauss currently deals poorly with an offset in the image." )
5755
@Test
5856
public void testFastGauss()
5957
{
@@ -129,6 +127,8 @@ private RandomAccessibleInterval< T > secondDerivativeX( RandomAccessibleInterva
129127
private void assertImagesEqual( int expectedSnr, RandomAccessibleInterval< ? extends RealType< ? > > a, RandomAccessibleInterval< T > b )
130128
{
131129
double actualSnr = snr( a, b );
130+
if ( Double.isNaN( actualSnr ) )
131+
fail( "Either the expected or the actual image contains NaN values." );
132132
if ( expectedSnr > actualSnr )
133133
fail( "The SNR is lower than expected, expected: " + expectedSnr + " dB actual: " + actualSnr + " dB" );
134134
}

0 commit comments

Comments
 (0)