-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lanczos range #213
base: master
Are you sure you want to change the base?
Lanczos range #213
Conversation
Without this patch, the following Groovy script works in my up-to-date version of Fiji (with imglib2 5.3.0): #@ ImageJ ij
import net.imagej.Dataset
import net.imagej.ImageJ
import net.imglib2.interpolation.randomaccess.LanczosInterpolatorFactory
image = ij.scifio().datasetIO().open("/Users/curtis/data/clown.jpg")
ij.ui().show(image)
interp = new LanczosInterpolatorFactory()
double[] scaleDown = [0.5, 0.5, 1]
Object small = ij.op().run("scaleView", image, scaleDown, interp)
ij.ui().show(small)
double[] scaleUp = [2.5, 2.5, 1]
Object large = ij.op().run("scaleView", image, scaleUp, interp)
ij.ui().show(large)
double[] scaleWeird = [2.2, 0.6, 1]
Object stretched = ij.op().run("scaleView", image, scaleWeird, interp)
ij.ui().show(stretched) And with the patch, it also works. |
Maybe the difference is that |
This script also works: #@ ImageJ ij
import net.imagej.Dataset
import net.imagej.ImageJ
import net.imglib2.interpolation.randomaccess.LanczosInterpolatorFactory
image = ij.scifio().datasetIO().open("/Users/curtis/data/clown.jpg")
image32 = ij.op().convert().float32(image)
ij.ui().show(image32)
interp = new LanczosInterpolatorFactory()
double[] scaleDown = [0.5, 0.5, 1]
Object small = ij.op().run("scaleView", image32, scaleDown, interp)
ij.ui().show(small)
double[] scaleUp = [2.5, 2.5, 1]
Object large = ij.op().run("scaleView", image32, scaleUp, interp)
ij.ui().show(large)
double[] scaleWeird = [2.2, 0.6, 1]
Object stretched = ij.op().run("scaleView", image32, scaleWeird, interp)
ij.ui().show(stretched) |
3b9e2c2
to
4b28755
Compare
I rebased the final float[] f = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
final Img<FloatType> img = ArrayImgs.floats(f, f.length);
final RealRandomAccess<FloatType> a = Views.interpolate(Views.extendBorder(
img), new LanczosInterpolatorFactory<>()).realRandomAccess();
for (int i=0; i<img.dimension(0); i++) {
a.setPosition(new int[] { i });
System.out.println(a.get());
a.setPosition(new float[] { i + 0.5f });
System.out.println(a.get());
} I found that changing @axtimwalde Does that shed any light on the issue? |
Does that fix #212 ?