saalfeldlab / n5-spark

Spark-driven processing utilities for N5 datasets.
BSD 2-Clause "Simplified" License
3 stars 7 forks source link

Add ability to specify multiple (different) downsampling factors #3

Closed nthistle closed 6 years ago

nthistle commented 6 years ago

This adds the ability to specify multiple different downsampling factors with raw data (N5Downsampler.java), for ease of use in creating scale pyramids for anisotropic data in scenarios where specific factors are required. To use different downsampling factors, simply specify multiple output datasets and multiple factors like so:

... --outputDatasetPath downscaled/s1 downscaled/s2 downscaled/s3 --factors 2,2,1 2,2,2 2,2,1 ...

The factors each build upon the previous one, and downscale in the order specified (the first factor is applied first, and written to the first output dataset, etc.)

If desired, I can implement this functionality in a similar way for N5LabelDownsamplerSpark as well.

cc @axtimwalde @igorpisarev

igorpisarev commented 6 years ago

Thanks @nthistle! I agree that it's a useful feature. N5LabelDownsamplerSpark has not been used much, so I think it's safe to keep this functionality only in the basic downsampler for now.

igorpisarev commented 6 years ago

Looking at the code, I saw that the downsamplingFactors attribute is not set by N5DownsamplerSpark so you may have problems opening the resulting scale pyramid in a viewer. I opened the issue #4 and am going to resolve it by moving the appropriate code from N5ScalePyramidSpark and such.

nthistle commented 6 years ago

In paintera-conversion-helper, I just manually set the downsamplingFactors attribute to fix this, but it would be useful to have this in N5DownsamplerSpark as well. Thanks @igorpisarev!