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

ndimage tests test_affine_transform_general and higher order parameters #210

Closed
martinschorb opened this issue May 5, 2021 · 4 comments
Closed

Comments

@martinschorb
Copy link
Contributor

Hi,

I am working on a dask-image implementation of ndimage.rotate. The functionality is there and I am now trying to get the tests up and running similar to affine_transform.

Now this test

is run with orders 1 to 6.

However, when I try to run the same configuration for my rotate function the tests fail because in dask-image's affine_transform I get an additional blurring:

ndinterp/__init__.py:118: UserWarning: Currently, `dask_image.ndinterp.affine_transform` doesn't support `prefilter=True`. Proceeding with `prefilter=False`, which if order > 1 can lead to the output containing more blur than with prefiltering.

I am wondering how these tests run with affine_transform with higher orders while still producing the same image as scikit. For my rotation transformation you clearly see the extra blur.

@m-albert
Copy link
Collaborator

m-albert commented May 5, 2021

I am working on a dask-image implementation of ndimage.rotate. The functionality is there and I am now trying to get the tests up and running similar to affine_transform.

Cool :)

Regarding the testing: dask_image.ndinterp.affine_transform only supports prefilter=False, so in the tests we compare to the result of ndimage.affine_transform also run with prefilter=False:

# transform with scipy
image_t_scipy = ndimage.affine_transform(
image, matrix, offset,
output_shape=output_shape,
order=interp_order,
mode=interp_mode,
prefilter=False)

See this comment for some background: #24 (comment)

@martinschorb
Copy link
Contributor Author

I have some weird behaviour that I don't fully understand (this is my first time using pytest).

  • when I do not pass output_chunks on to affine_transform the test run fine, except for the timeouts. I always get Unknown pytest.mark.timeout - is this a typo?. Something seems to be missing in my pytest configuration because the timeout tests run fine with your affine_transform.
  • when I pass output_chunks without any modifications, many tests fail:
    The reason for this: the images from ndimage and dask-image simply are not the same. There is a very small number of voxels that significantly differ.

Why is that the case, when the only thing that differs is output_chunks being present?

I generate them with

    output_chunks = [input_output_chunksize_per_dim[1]] * n

just like in your test...

Maybe you could have a look at what I've done:
#213

@martinschorb
Copy link
Contributor Author

OK, it seems there is also a test failure with the [1,1,1] chunk size when the timeouts actually work.

@m-albert
Copy link
Collaborator

m-albert commented May 7, 2021

Wrote a response in the PR #213!

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

No branches or pull requests

2 participants