Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 7, 2024
1 parent c6773da commit 0ed5e33
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 60 deletions.
6 changes: 1 addition & 5 deletions src/main/java/net/imglib2/img/Img.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

package net.imglib2.img;

import net.imglib2.IterableInterval;
import net.imglib2.RandomAccessibleInterval;

/**
Expand All @@ -45,10 +44,7 @@
* @author Stephan Saalfeld
* @author Stephan Preibisch
*/
public interface Img< T >
extends
RandomAccessibleInterval< T >,
IterableInterval< T >
public interface Img< T > extends RandomAccessibleInterval< T >
{
/**
* Get a {@link ImgFactory} that creates {@link Img}s of the same kind as
Expand Down
24 changes: 1 addition & 23 deletions src/main/java/net/imglib2/img/cell/CellGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@

import java.util.Arrays;

import net.imglib2.Cursor;
import net.imglib2.FinalInterval;
import net.imglib2.FlatIterationOrder;
import net.imglib2.Interval;
import net.imglib2.IterableInterval;
import net.imglib2.Localizable;
import net.imglib2.Point;
import net.imglib2.Positionable;
Expand All @@ -48,7 +45,6 @@
import net.imglib2.util.IntervalIndexer;
import net.imglib2.util.Intervals;
import net.imglib2.util.Util;
import net.imglib2.view.RandomAccessibleIntervalCursor;

/**
* Defines {@link AbstractCellImg} geometry and translates between image, cell,
Expand Down Expand Up @@ -708,7 +704,7 @@ public RandomAccess< Interval > copy()
}
}

public class CellIntervals implements RandomAccessibleInterval< Interval >, IterableInterval< Interval >
public class CellIntervals implements RandomAccessibleInterval< Interval >
{
private final long size = Intervals.numElements( numCells );

Expand Down Expand Up @@ -742,30 +738,12 @@ public RandomAccess< Interval > randomAccess( final Interval interval )
return randomAccess();
}

@Override
public Cursor< Interval > cursor()
{
return new RandomAccessibleIntervalCursor<>( this );
}

@Override
public Cursor< Interval > localizingCursor()
{
return cursor();
}

@Override
public long size()
{
return size;
}

@Override
public FlatIterationOrder iterationOrder()
{
return new FlatIterationOrder( this );
}

@Override
public Interval getType()
{
Expand Down
25 changes: 1 addition & 24 deletions src/main/java/net/imglib2/util/Grid.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,14 @@
package net.imglib2.util;

import java.util.Arrays;
import java.util.Iterator;

import net.imglib2.Cursor;
import net.imglib2.FinalInterval;
import net.imglib2.FlatIterationOrder;
import net.imglib2.Interval;
import net.imglib2.IterableInterval;
import net.imglib2.Point;
import net.imglib2.Positionable;
import net.imglib2.RandomAccess;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.cell.CellGrid;
import net.imglib2.view.RandomAccessibleIntervalCursor;

/**
* Defines a regular grid on an interval and translates between interval and grid
Expand Down Expand Up @@ -499,7 +494,7 @@ public RandomAccess< Interval > copy()
}
}

public class CellIntervals implements RandomAccessibleInterval< Interval >, IterableInterval< Interval >
public class CellIntervals implements RandomAccessibleInterval< Interval >
{
private final long size = Intervals.numElements( numCells );

Expand Down Expand Up @@ -533,30 +528,12 @@ public RandomAccess< Interval > randomAccess( final Interval interval )
return randomAccess();
}

@Override
public Cursor< Interval > cursor()
{
return new RandomAccessibleIntervalCursor<>( this );
}

@Override
public Cursor< Interval > localizingCursor()
{
return cursor();
}

@Override
public long size()
{
return size;
}

@Override
public FlatIterationOrder iterationOrder()
{
return new FlatIterationOrder( this );
}

@Override
public Interval getType()
{
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/net/imglib2/view/IntervalView.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

import net.imglib2.AbstractInterval;
import net.imglib2.Cursor;
import net.imglib2.FinalInterval;
import net.imglib2.Interval;
import net.imglib2.IterableInterval;
import net.imglib2.RandomAccess;
Expand All @@ -54,7 +55,7 @@
* created through the {@link Views#interval(RandomAccessible, Interval)} method
* instead.
*/
public class IntervalView< T > extends AbstractInterval implements RandomAccessibleInterval< T >, IterableInterval< T >, View
public class IntervalView< T > extends AbstractInterval implements RandomAccessibleInterval< T >, View
{
/**
* The source {@link RandomAccessible}.
Expand Down Expand Up @@ -101,11 +102,7 @@ public IntervalView( final RandomAccessible< T > source, final Interval interval
*/
public IntervalView( final RandomAccessible< T > source, final long[] min, final long[] max )
{
super( min, max );
assert ( source.numDimensions() == min.length );

this.source = source;
this.fullViewRandomAccessible = null;
this( source, FinalInterval.wrap( min, max ) );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class IterableRandomAccessibleInterval< T > extends AbstractWrappedInterv
{
public static < T > IterableRandomAccessibleInterval< T > create( final RandomAccessibleInterval< T > interval )
{
return new IterableRandomAccessibleInterval< T >( interval );
return new IterableRandomAccessibleInterval<>( interval );
}

public IterableRandomAccessibleInterval( final RandomAccessibleInterval< T > interval )
Expand All @@ -76,7 +76,7 @@ public FlatIterationOrder iterationOrder()
@Override
public Cursor< T > cursor()
{
return new RandomAccessibleIntervalCursor< T >( sourceInterval );
return new RandomAccessibleIntervalCursor<>( sourceInterval );
}

@Override
Expand Down

0 comments on commit 0ed5e33

Please sign in to comment.