Skip to content
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

LanczosInterpolator crashes #212

Open
tpietzsch opened this issue Jun 6, 2018 · 6 comments · May be fixed by #213
Open

LanczosInterpolator crashes #212

tpietzsch opened this issue Jun 6, 2018 · 6 comments · May be fixed by #213
Assignees

Comments

@tpietzsch
Copy link
Member

It seems that LanczosInterpolator is broken. The following simple example crashes:

import net.imglib2.RealRandomAccess;
import net.imglib2.img.Img;
import net.imglib2.img.array.ArrayImgs;
import net.imglib2.interpolation.randomaccess.LanczosInterpolatorFactory;
import net.imglib2.type.numeric.real.FloatType;
import net.imglib2.view.Views;

public class FAILS
{
	public static void main( final String[] args )
	{
		final Img< FloatType > img = ArrayImgs.floats( 10 );
		final RealRandomAccess< FloatType > a = Views.interpolate( Views.extendBorder( img ), new LanczosInterpolatorFactory<>() ).realRandomAccess();
		a.setPosition( new int[] { 5 } );
		a.get();
	}
}

It throws

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 41
	at net.imglib2.interpolation.randomaccess.LanczosInterpolator.lookUpLanczos(LanczosInterpolator.java:224)
	at net.imglib2.interpolation.randomaccess.LanczosInterpolator.get(LanczosInterpolator.java:188)
	at net.imglib2.interpolation.randomaccess.LanczosInterpolator.get(LanczosInterpolator.java:50)
	at t4realviews.FAIL.main(FAIL.java:31)

Apparently this hasn't anything todo with size or dimensionality of the image.

@StephanPreibisch Do you want to fix it? Or should we just remove it. (Apparently nobody is using it or they would have discovered this problem...)

@StephanPreibisch
Copy link
Member

Hi, I’ll try to have a look at it, sometimes it is useful to try if it is an interpolation artifact ....

@axtimwalde
Copy link
Member

I guess this is my fault. Table not long enough?

@axtimwalde axtimwalde linked a pull request Jun 6, 2018 that will close this issue
@axtimwalde
Copy link
Member

However, I am wondering why it broke just now---used to work in all sorts of contexts?

@tpietzsch
Copy link
Member Author

I guess this is my fault. Table not long enough?

@axtimwalde Can you explain? Why is it your fault?
I tried to look at the history of LanczosInterpolator and it has not changed for years, apparently.

@ctrueden
Copy link
Member

ctrueden commented Jun 7, 2018

I was also confused, because the Ops notebooks use the LanczosInterpolatorFactory, and it has always worked great. I posted some working code in the PR #213.

@axtimwalde
Copy link
Member

@tpietzsch because I wrote the lookup stuff to make it faster. It's very possible that I did not consider specific edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants