Skip to content

Commit

Permalink
Add .convert() example
Browse files Browse the repository at this point in the history
  • Loading branch information
tpietzsch committed May 15, 2024
1 parent 642e05b commit e3f312c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.imglib2.RealRandomAccessible;
import net.imglib2.img.array.ArrayImgs;
import net.imglib2.type.numeric.integer.IntType;
import net.imglib2.type.numeric.real.DoubleType;
import net.imglib2.view.fluent.RaView.Interpolation;
import net.imglib2.view.fluent.RaiView.Extension;

Expand All @@ -19,6 +20,12 @@ public static void main( String[] args )
.extend( Extension.zero() )
.interpolate( Interpolation.lanczos() );

RealRandomAccessible< DoubleType > doubleView = img.view()
.extend( Extension.zero() )
.permute( 0, 1 )
.convert( ( i, o ) -> o.set( i.get() ), DoubleType::new )
.interpolate( Interpolation.lanczos() );

RandomAccess< IntType > access = img.view()
.extend( Extension.border() )
.interpolate( Interpolation.nLinear() )
Expand Down

0 comments on commit e3f312c

Please sign in to comment.