CS-SI / SIRIUS

Sirius - Fast and simple to plug-in C++ resampling library that is taking advantage of the Fourier Transform
https://cs-si.github.io/SIRIUS/html/Sirius.html
GNU General Public License v3.0
6 stars 5 forks source link

Manage NODATA #30

Open savmickael opened 6 years ago

dumasl commented 6 years ago

Well this is a wide open issue...

Most of the resampling tools can deal with no data locally. Indeed, most of the resampling tools are working locally in spatial domain... If we were to briefly resume most common methods we should cite those:

When it comes to Sirius and spectral domain it becomes more complicated. If we are to provide only correct output, we cannot try to reproduce what we would do in spatial domain. We are not working locally so we cannot easily avoid the computation of some output pixels for which the computation would have required using no data input values. Moreover, we cannot use an input binary mask to try to figure out to what extent the input no data are spreading away and then tagged to no data all these corrupted pixels in the output data. I mean we can, but because we are using a rather global approach, a no data value will impact much further away from where it originates. And this does not depend on the filter support but on the discontinuity created by the value assigned to no data pixels and the filter use to resample. I'm afraid this method will not leave us with sparse correct outputs but with dense no data values :s

The only way I can think of right now would be to divide the block to resample in recursive manner if it contains no data values. Then, up to a minimal block size the resulting blocks are divided again until they posses no no data value. This way we would only resample blocks without a single no data value. The output would be correct but will be composed of no data "tiles" (the ones we did not process). Note that the minimal block size will be constrained by the filter size here