Created
March 4, 2020 16:19
-
-
Save bogovicj/e861d488f024d2da9752f1875ab5171c to your computer and use it in GitHub Desktop.
Demonstration cubic bspline interpolation with imglib2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ Dataset img | |
#@ Boolean(value=true) precompute | |
/** | |
* Prerequisite: | |
* Get the bspline branch of bogovicj's (my) fork of imglib2: | |
* git clone -b bspline [email protected]:bogovicj/imglib2.git | |
* | |
* Install it: | |
* mvn -Dscijava.app.directory=<your_Fiji_directory> install | |
* | |
*/ | |
import net.imglib2.*; | |
import net.imglib2.view.*; | |
import net.imglib2.realtransform.*; | |
import net.imglib2.interpolation.randomaccess.*; | |
import bdv.util.*; | |
if( precompute ) | |
{ | |
interpTarget = img; | |
factory = new BSplineInterpolator( img ); | |
} | |
else | |
{ | |
interpTarget = Views.extendZero( img ); | |
factory = new CardinalBSplineInterpolatorFactory(); | |
} | |
// show original image | |
BdvOptions opts = BdvOptions.options(); | |
bdv = BdvFunctions.show( img, "img", opts); | |
// show interpolated image | |
imgInterp = Views.interpolate( interpTarget, factory ); | |
BdvFunctions.show( imgInterp, img, "img interp", opts.addTo( bdv )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment