From b9fba61bb0f22a7147addd523d8b658cdde89ed7 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Mon, 18 Mar 2024 12:01:35 +0100 Subject: [PATCH] Use RealTypeConverters.convert instead of Converters.convert --- .../AbstractTransformedImgRandomAccess.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedImgRandomAccess.java b/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedImgRandomAccess.java index fc37c753b..86cbf778f 100644 --- a/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedImgRandomAccess.java +++ b/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedImgRandomAccess.java @@ -27,9 +27,11 @@ import net.imglib2.RealRandomAccess; import net.imglib2.converter.Converters; import net.imglib2.converter.RealFloatConverter; +import net.imglib2.converter.RealTypeConverters; import net.imglib2.interpolation.InterpolatorFactory; import net.imglib2.type.numeric.RealType; import net.imglib2.type.numeric.real.FloatType; +import net.imglib2.util.Util; import net.imglib2.view.Views; public abstract class AbstractTransformedImgRandomAccess< T extends RealType< T > > extends AbstractTransformedIntervalRandomAccess @@ -58,17 +60,13 @@ public AbstractTransformedImgRandomAccess( // extend input image and convert to floats final RandomAccessible< FloatType > input; - if ( FloatType.class.isInstance( Views.iterable( img ).cursor().next() ) ) + if ( Util.getTypeFromInterval( img ) instanceof FloatType ) { - input = (RandomAccessible< FloatType >)img; + input = ( RandomAccessible< FloatType > ) img; } else { - input = - Converters.convert( - img, - new RealFloatConverter< T >(), - new FloatType() ); + input = RealTypeConverters.convert( img, new FloatType() ); } // make the interpolator