Skip to content

Commit

Permalink
flip argument order for convert()
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 15, 2024
1 parent ee8cb05 commit c15b51d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 26 deletions.
26 changes: 13 additions & 13 deletions src/main/java/net/imglib2/view/fluent/RaView.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public interface RaView< T, V extends RaView< T, V > > extends RandomAccessible<
{
RandomAccessible< T > delegate();

static < T, V extends RaView< T, V > > RaView< T, ? > wrap( final RandomAccessible< T > delegate )
static < T, V extends RaView< T, V > > RaView< T, V > wrap( final RandomAccessible< T > delegate )
{
return ( RaView< T, V > ) () -> delegate;
}
Expand Down Expand Up @@ -335,18 +335,18 @@ default RraView< T > interpolate( final Interpolation< T > interpolation )
* U>} that reads a value from its first argument and writes a converted
* value to its second argument.
*
* @param converter
* converts pixel values from {@code T} to {@code U}
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param <U>
* target pixel type
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param converter
* converts pixel values from {@code T} to {@code U}
*
* @return a converted view
*/
default < U > RaView< U, ? > convert(
final Converter< ? super T, ? super U > converter,
final Supplier< U > targetSupplier )
final Supplier< U > targetSupplier,
final Converter< ? super T, ? super U > converter )
{
return wrap( Converters.convert2( delegate(), converter, targetSupplier ) );
}
Expand All @@ -361,18 +361,18 @@ default RraView< T > interpolate( final Interpolation< T > interpolation )
* from its first argument and writes a converted value to its second
* argument.
*
* @param converterSupplier
* converts pixel values from {@code T} to {@code U}
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param <U>
* target pixel type
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param converterSupplier
* converts pixel values from {@code T} to {@code U}
*
* @return a converted view
*/
default < U > RaView< U, ? > convert(
final Supplier< Converter< ? super T, ? super U > > converterSupplier,
final Supplier< U > targetSupplier )
final Supplier< U > targetSupplier,
final Supplier< Converter< ? super T, ? super U > > converterSupplier )
{
return wrap( Converters.convert2( delegate(), converterSupplier, targetSupplier ) );
}
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/net/imglib2/view/fluent/RaiView.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,18 @@ default RaiView< T > expand( Extension< T > extension, long... border )
* U>} that reads a value from its first argument and writes a converted
* value to its second argument.
*
* @param converter
* converts pixel values from {@code T} to {@code U}
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param <U>
* target pixel type
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param converter
* converts pixel values from {@code T} to {@code U}
*
* @return a converted view
*/
@Override
default < U > RaiView< U > convert(
final Converter< ? super T, ? super U > converter,
final Supplier< U > targetSupplier )
final Supplier< U > targetSupplier, final Converter< ? super T, ? super U > converter )
{
return wrap( Converters.convert2( delegate(), converter, targetSupplier ) );
}
Expand All @@ -461,19 +460,18 @@ default < U > RaiView< U > convert(
* from its first argument and writes a converted value to its second
* argument.
*
* @param converterSupplier
* converts pixel values from {@code T} to {@code U}
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param <U>
* target pixel type
* @param targetSupplier
* creates instances of {@code U} for storing converted values
* @param converterSupplier
* converts pixel values from {@code T} to {@code U}
*
* @return a converted view
*/
@Override
default < U > RaiView< U > convert(
final Supplier< Converter< ? super T, ? super U > > converterSupplier,
final Supplier< U > targetSupplier )
final Supplier< U > targetSupplier, final Supplier< Converter< ? super T, ? super U > > converterSupplier )
{
return wrap( Converters.convert2( delegate(), converterSupplier, targetSupplier ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void main( String[] args )
RealRandomAccessible< DoubleType > doubleView = img.view()
.extend( Extension.zero() )
.permute( 0, 1 )
.convert( ( i, o ) -> o.set( i.get() ), DoubleType::new )
.convert( DoubleType::new, ( i, o ) -> o.set( i.get() ) )
.interpolate( Interpolation.lanczos() );

RandomAccess< IntType > access = img.view()
Expand Down

0 comments on commit c15b51d

Please sign in to comment.