From 9c800dbaed07009686a10d3957832dbd91fc50c5 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Mon, 18 Mar 2024 12:00:42 +0100 Subject: [PATCH 1/3] Add note --- .../java/net/preibisch/mvrecon/process/fusion/FusionTools.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java b/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java index 0725f9931..6ec563ea8 100644 --- a/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java +++ b/src/main/java/net/preibisch/mvrecon/process/fusion/FusionTools.java @@ -666,6 +666,7 @@ else if ( imgType == ImgDataType.PRECOMPUTED ) * @param border - the target blending border, e.g. 0 * @param transformationModel - the transformation model used to map from the (downsampled) input to the output */ + // NOTE (TP) blending and border are modified public static void adjustBlending( final BasicViewDescription< ? > vd, final float[] blending, final float[] border, final AffineTransform3D transformationModel ) { adjustBlending( vd.getViewSetup().getSize(), Group.pvid( vd ), blending, border, transformationModel ); From b9fba61bb0f22a7147addd523d8b658cdde89ed7 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Mon, 18 Mar 2024 12:01:35 +0100 Subject: [PATCH 2/3] 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 From 28cc4b0e001eb3bccfbfb05f5eb607a721eb0427 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Mon, 18 Mar 2024 12:01:59 +0100 Subject: [PATCH 3/3] Remove redundant generics --- .../AbstractTransformedIntervalRandomAccessible.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedIntervalRandomAccessible.java b/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedIntervalRandomAccessible.java index e8ced8ae3..33c157af3 100644 --- a/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedIntervalRandomAccessible.java +++ b/src/main/java/net/preibisch/mvrecon/process/fusion/transformed/AbstractTransformedIntervalRandomAccessible.java @@ -40,7 +40,7 @@ public abstract class AbstractTransformedIntervalRandomAccessible implements Ran final protected int n; - protected InterpolatorFactory< FloatType, RandomAccessible< FloatType > > interpolatorFactory = new NLinearInterpolatorFactory< FloatType >(); + protected InterpolatorFactory< FloatType, RandomAccessible< FloatType > > interpolatorFactory = new NLinearInterpolatorFactory<>(); public AbstractTransformedIntervalRandomAccessible( final Interval interval, // from ImgLoader @@ -60,12 +60,12 @@ public AbstractTransformedIntervalRandomAccessible( public void setLinearInterpolation() { - this.interpolatorFactory = new NLinearInterpolatorFactory< FloatType >(); + this.interpolatorFactory = new NLinearInterpolatorFactory<>(); } public void setNearestNeighborInterpolation() { - this.interpolatorFactory = new NearestNeighborInterpolatorFactory< FloatType >(); + this.interpolatorFactory = new NearestNeighborInterpolatorFactory<>(); } @Override