Skip to content

Commit

Permalink
Make [Abstract|Volatile]SpimSource fields private
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed Nov 6, 2023
1 parent a373b0f commit c6199d3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
51 changes: 26 additions & 25 deletions src/main/java/bdv/AbstractSpimSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
Expand All @@ -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 )
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/bdv/SpimSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@

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 )
{
super( spimData, setup, name );
final AbstractSequenceDescription< ?, ?, ? > seq = spimData.getSequenceDescription();
imgLoader = ( ViewerSetupImgLoader< T, ? > ) ( ( ViewerImgLoader ) seq.getImgLoader() ).getSetupImgLoader( setup );
loadTimepoint( 0 );
}

@Override
Expand All @@ -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();
}
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/bdv/VolatileSpimSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -56,7 +56,6 @@ public VolatileSpimSource( final AbstractSpimData< ? > spimData, final int setup
mipmapOrdering = ( ( MipmapOrdering ) imgLoader );
else
mipmapOrdering = new DefaultMipmapOrdering( this );
loadTimepoint( 0 );
}

@Override
Expand All @@ -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();
}
Expand Down

0 comments on commit c6199d3

Please sign in to comment.