dask-image icon indicating copy to clipboard operation
dask-image copied to clipboard

`ndimage` tests `test_affine_transform_general` and higher order parameters

Open martinschorb opened this issue 4 years ago • 4 comments

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 https://github.com/dask/dask-image/blob/43f9f7e695950ff43f6c7bc7f677c29b0420717d/tests/test_dask_image/test_ndinterp/test_affine_transformation.py#L86 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.

martinschorb avatar May 05 '21 09:05 martinschorb

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:

https://github.com/dask/dask-image/blob/43f9f7e695950ff43f6c7bc7f677c29b0420717d/tests/test_dask_image/test_ndinterp/test_affine_transformation.py#L56-L62

See this comment for some background: https://github.com/dask/dask-image/issues/24#issuecomment-706165593

m-albert avatar May 05 '21 09:05 m-albert

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: https://github.com/dask/dask-image/pull/213

martinschorb avatar May 06 '21 10:05 martinschorb

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

martinschorb avatar May 06 '21 10:05 martinschorb

Wrote a response in the PR https://github.com/dask/dask-image/pull/213!

m-albert avatar May 07 '21 10:05 m-albert