From c6199d34074de59daf9cc02a293df59cab02baf2 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Mon, 6 Nov 2023 22:16:59 +0100 Subject: [PATCH] Make [Abstract|Volatile]SpimSource fields private --- src/main/java/bdv/AbstractSpimSource.java | 51 ++++++++++++----------- src/main/java/bdv/SpimSource.java | 7 ++-- src/main/java/bdv/VolatileSpimSource.java | 9 ++-- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/main/java/bdv/AbstractSpimSource.java b/src/main/java/bdv/AbstractSpimSource.java index 6fa30eb7..67731110 100644 --- a/src/main/java/bdv/AbstractSpimSource.java +++ b/src/main/java/bdv/AbstractSpimSource.java @@ -57,19 +57,19 @@ public abstract class AbstractSpimSource< T extends NumericType< T > > implements Source< T > { - protected static class ImgKey + private static class ImgKey { - protected final int timepoint; + private final int timepoint; - protected final int level; + private final int level; - protected final Interpolation method; + private final Interpolation method; - protected final ThreadGroup threadGroup; + private final ThreadGroup threadGroup; private final int hashcode; - public ImgKey( + ImgKey( final int timepoint, final int level, final Interpolation method, @@ -109,37 +109,37 @@ public boolean equals( final Object obj ) } } - protected int currentTimePointIndex; + private int currentTimePointIndex; - protected boolean currentTimePointIsPresent; + private boolean currentTimePointIsPresent; - protected final AffineTransform3D[] currentSourceTransforms; + private final AffineTransform3D[] currentSourceTransforms; - protected final int setupId; + private final int setupId; - protected final String name; + private final String name; - protected final List< TimePoint > timePointsOrdered; + private final List< TimePoint > timePointsOrdered; - protected final Map< ViewId, ViewRegistration > viewRegistrations; + private final Map< ViewId, ViewRegistration > viewRegistrations; - protected final Set< ViewId > missingViews; + private final Set< ViewId > missingViews; - protected final VoxelDimensions voxelDimensions; + private final VoxelDimensions voxelDimensions; - protected final int numMipmapLevels; + private final int numMipmapLevels; - protected final static int numInterpolationMethods = 2; + private final static int numInterpolationMethods = 2; - protected final static int iNearestNeighborMethod = 0; + private final static int iNearestNeighborMethod = 0; - protected final static int iNLinearMethod = 1; + private final static int iNLinearMethod = 1; - protected final InterpolatorFactory< T, RandomAccessible< T > >[] interpolatorFactories; + private final InterpolatorFactory< T, RandomAccessible< T > >[] interpolatorFactories; - protected final UncheckedCache< ImgKey, RandomAccessibleInterval< T > > cachedSources; + private final UncheckedCache< ImgKey, RandomAccessibleInterval< T > > cachedSources; - protected final UncheckedCache< ImgKey, RealRandomAccessible< T > > cachedInterpolatedSources; + private final UncheckedCache< ImgKey, RealRandomAccessible< T > > cachedInterpolatedSources; @SuppressWarnings( "unchecked" ) public AbstractSpimSource( final AbstractSpimData< ? > spimData, final int setupId, final String name ) @@ -181,9 +181,10 @@ public AbstractSpimSource( final AbstractSpimData< ? > spimData, final int setup for ( int level = 0; level < numMipmapLevels; level++ ) currentSourceTransforms[ level ] = new AffineTransform3D(); + currentTimePointIndex = -1; } - protected void loadTimepoint( final int timepointIndex ) + void loadTimepoint( final int timepointIndex ) { currentTimePointIndex = timepointIndex; currentTimePointIsPresent = isPresent( timepointIndex ); @@ -206,9 +207,9 @@ protected void loadTimepoint( final int timepointIndex ) } } - protected abstract AffineTransform3D[] getMipmapTransforms(); + abstract AffineTransform3D[] getMipmapTransforms(); - protected abstract RandomAccessibleInterval< T > getImage( final int timepointId, final int level ); + abstract RandomAccessibleInterval< T > getImage( int timepointId, int level ); @Override public boolean isPresent( final int t ) diff --git a/src/main/java/bdv/SpimSource.java b/src/main/java/bdv/SpimSource.java index c8fe9d4b..526e5a53 100644 --- a/src/main/java/bdv/SpimSource.java +++ b/src/main/java/bdv/SpimSource.java @@ -36,7 +36,7 @@ public class SpimSource< T extends NumericType< T > > extends AbstractSpimSource< T > { - protected final ViewerSetupImgLoader< T, ? > imgLoader; + private final ViewerSetupImgLoader< T, ? > imgLoader; @SuppressWarnings( "unchecked" ) public SpimSource( final AbstractSpimData< ? > spimData, final int setup, final String name ) @@ -44,7 +44,6 @@ public SpimSource( final AbstractSpimData< ? > spimData, final int setup, final super( spimData, setup, name ); final AbstractSequenceDescription< ?, ?, ? > seq = spimData.getSequenceDescription(); imgLoader = ( ViewerSetupImgLoader< T, ? > ) ( ( ViewerImgLoader ) seq.getImgLoader() ).getSetupImgLoader( setup ); - loadTimepoint( 0 ); } @Override @@ -54,13 +53,13 @@ public T getType() } @Override - protected RandomAccessibleInterval< T > getImage( final int timepointId, final int level ) + RandomAccessibleInterval< T > getImage( final int timepointId, final int level ) { return imgLoader.getImage( timepointId, level ); } @Override - protected AffineTransform3D[] getMipmapTransforms() + AffineTransform3D[] getMipmapTransforms() { return imgLoader.getMipmapTransforms(); } diff --git a/src/main/java/bdv/VolatileSpimSource.java b/src/main/java/bdv/VolatileSpimSource.java index 42d1d3dd..587fb130 100644 --- a/src/main/java/bdv/VolatileSpimSource.java +++ b/src/main/java/bdv/VolatileSpimSource.java @@ -42,9 +42,9 @@ public class VolatileSpimSource< V extends Volatile< ? > & NumericType< V > > extends AbstractSpimSource< V > implements MipmapOrdering { - protected final ViewerSetupImgLoader< ?, V > imgLoader; + private final ViewerSetupImgLoader< ?, V > imgLoader; - protected final MipmapOrdering mipmapOrdering; + private final MipmapOrdering mipmapOrdering; @SuppressWarnings( "unchecked" ) public VolatileSpimSource( final AbstractSpimData< ? > spimData, final int setup, final String name ) @@ -56,7 +56,6 @@ public VolatileSpimSource( final AbstractSpimData< ? > spimData, final int setup mipmapOrdering = ( ( MipmapOrdering ) imgLoader ); else mipmapOrdering = new DefaultMipmapOrdering( this ); - loadTimepoint( 0 ); } @Override @@ -66,13 +65,13 @@ public V getType() } @Override - protected RandomAccessibleInterval< V > getImage( final int timepointId, final int level ) + RandomAccessibleInterval< V > getImage( final int timepointId, final int level ) { return imgLoader.getVolatileImage( timepointId, level ); } @Override - protected AffineTransform3D[] getMipmapTransforms() + AffineTransform3D[] getMipmapTransforms() { return imgLoader.getMipmapTransforms(); }