Skip to content

Commit

Permalink
Clean up net.imglib2.converter a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 7, 2024
1 parent dc99660 commit 8686fb0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@

package net.imglib2.converter;

import java.util.Iterator;

import net.imglib2.AbstractWrappedInterval;
import net.imglib2.IterableInterval;
import net.imglib2.View;

/**
* TODO
*
*
*/
abstract public class AbstractConvertedIterableInterval< A, B > extends AbstractWrappedInterval< IterableInterval< A > > implements IterableInterval< B >, View
{
Expand All @@ -62,10 +60,4 @@ public Object iterationOrder()
{
return sourceInterval.iterationOrder();
}

@Override
abstract public AbstractConvertedCursor< A, B > cursor();

@Override
abstract public AbstractConvertedCursor< A, B > localizingCursor();
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,16 @@

/**
* TODO
*
*
*/
abstract public class AbstractConvertedIterableRandomAccessibleInterval< A, B, S extends RandomAccessible< A > & IterableInterval< A > > extends AbstractWrappedInterval< S > implements IterableInterval< B >, RandomAccessibleInterval< B >, View
abstract public class AbstractConvertedIterableRandomAccessibleInterval< A, B, S extends IterableInterval< A > >
extends AbstractWrappedInterval< S > implements RandomAccessibleInterval< B >, View
{
public AbstractConvertedIterableRandomAccessibleInterval( final S source )
{
super( source );
}

@Override
abstract public AbstractConvertedRandomAccess< A, B > randomAccess();

@Override
abstract public AbstractConvertedRandomAccess< A, B > randomAccess( Interval interval );

@Override
public long size()
{
Expand All @@ -72,9 +67,4 @@ public Object iterationOrder()
return sourceInterval.iterationOrder();
}

@Override
abstract public AbstractConvertedCursor< A, B > cursor();

@Override
abstract public AbstractConvertedCursor< A, B > localizingCursor();
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,20 @@
*/
abstract public class AbstractConvertedRandomAccessibleInterval< A, B > extends AbstractWrappedInterval< RandomAccessibleInterval< A > > implements RandomAccessibleInterval< B >, View
{

protected final RandomAccessibleInterval< A > source;

public AbstractConvertedRandomAccessibleInterval( final RandomAccessibleInterval< A > source )
{
super( source );
this.source = source;
}

@Override
abstract public AbstractConvertedRandomAccess< A, B > randomAccess();
public long size()
{
return sourceInterval.size();
}

@Override
abstract public AbstractConvertedRandomAccess< A, B > randomAccess( Interval interval );

public Object iterationOrder()
{
return sourceInterval.iterationOrder();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,19 @@

import java.util.function.Supplier;

import net.imglib2.AbstractWrappedInterval;
import net.imglib2.Cursor;
import net.imglib2.Interval;
import net.imglib2.IterableInterval;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.View;
import net.imglib2.converter.AbstractConvertedRandomAccessibleInterval;
import net.imglib2.converter.BiConverter;
import net.imglib2.type.Type;

/**
* TODO
*
*/
public class BiConvertedRandomAccessibleInterval< A, B, C > extends AbstractWrappedInterval< RandomAccessibleInterval< A > > implements RandomAccessibleInterval< C >, View
public class BiConvertedRandomAccessibleInterval< A, B, C > extends AbstractConvertedRandomAccessibleInterval< A, C >
{
protected final RandomAccessibleInterval< B > sourceIntervalB;

Expand Down Expand Up @@ -166,17 +165,4 @@ public BiConvertedCursor< A, B, C > localizingCursor()
{
return new BiConvertedCursor<>( sourceInterval.localizingCursor(), sourceIntervalB.cursor(), converterSupplier, convertedSupplier );
}

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

@Override
public Object iterationOrder()
{
return sourceInterval.iterationOrder();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,18 @@

import java.util.function.Supplier;

import net.imglib2.AbstractWrappedInterval;
import net.imglib2.Cursor;
import net.imglib2.Interval;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.View;
import net.imglib2.converter.AbstractConvertedRandomAccessibleInterval;
import net.imglib2.converter.Converter;
import net.imglib2.type.Type;

/**
* TODO
*
*/
public class ConvertedRandomAccessibleInterval< A, B > extends AbstractWrappedInterval< RandomAccessibleInterval< A > > implements RandomAccessibleInterval< B >, View
public class ConvertedRandomAccessibleInterval< A, B > extends AbstractConvertedRandomAccessibleInterval< A, B >
{
final protected Supplier< Converter< ? super A, ? super B > > converterSupplier;

Expand All @@ -75,13 +74,13 @@ public ConvertedRandomAccessibleInterval(
@Override
public ConvertedRandomAccess< A, B > randomAccess()
{
return new ConvertedRandomAccess< A, B >( sourceInterval.randomAccess(), converterSupplier, convertedSupplier );
return new ConvertedRandomAccess<>( sourceInterval.randomAccess(), converterSupplier, convertedSupplier );
}

@Override
public ConvertedRandomAccess< A, B > randomAccess( final Interval interval )
{
return new ConvertedRandomAccess< A, B >( sourceInterval.randomAccess( interval ), converterSupplier, convertedSupplier );
return new ConvertedRandomAccess<>( sourceInterval.randomAccess( interval ), converterSupplier, convertedSupplier );
}

/**
Expand Down Expand Up @@ -147,16 +146,4 @@ public Cursor< B > localizingCursor()
{
return new ConvertedCursor<>( sourceInterval.localizingCursor(), converterSupplier, convertedSupplier );
}

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

@Override
public Object iterationOrder()
{
return sourceInterval.iterationOrder();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
* TODO
*
*/
// TODO: Deprecate this? Every RandomAccessibleInterval is now a IterableInterval. So, does this add anything over WriteConvertedRandomAccessibleInterval?
public class WriteConvertedIterableRandomAccessibleInterval< A, B, S extends RandomAccessible< A > & IterableInterval< A > > extends AbstractConvertedIterableRandomAccessibleInterval< A, B, S >
{
private final Supplier< SamplerConverter< ? super A, B > > converterSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@

import java.util.function.Supplier;

import net.imglib2.AbstractWrappedInterval;
import net.imglib2.Cursor;
import net.imglib2.Interval;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.converter.AbstractConvertedRandomAccessibleInterval;

/**
* TODO
*
*/
public class WriteConvertedRandomAccessibleInterval< A, B > extends AbstractWrappedInterval< RandomAccessibleInterval< A > > implements RandomAccessibleInterval< B >
public class WriteConvertedRandomAccessibleInterval< A, B > extends AbstractConvertedRandomAccessibleInterval< A, B >
{
private final Supplier< SamplerConverter< ? super A, B > > converterSupplier;

Expand All @@ -67,13 +66,13 @@ public WriteConvertedRandomAccessibleInterval(
@Override
public WriteConvertedRandomAccess< A, B > randomAccess()
{
return new WriteConvertedRandomAccess< A, B >( sourceInterval.randomAccess(), converterSupplier );
return new WriteConvertedRandomAccess<>( sourceInterval.randomAccess(), converterSupplier );
}

@Override
public WriteConvertedRandomAccess< A, B > randomAccess( final Interval interval )
{
return new WriteConvertedRandomAccess< A, B >( sourceInterval.randomAccess( interval ), converterSupplier );
return new WriteConvertedRandomAccess<>( sourceInterval.randomAccess( interval ), converterSupplier );
}

@Override
Expand All @@ -93,16 +92,4 @@ public Cursor< B > localizingCursor()
{
return new WriteConvertedCursor<>( sourceInterval.localizingCursor(), converterSupplier );
}

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

@Override
public Object iterationOrder()
{
return sourceInterval.iterationOrder();
}
}

0 comments on commit 8686fb0

Please sign in to comment.