GUI Mockup
In order to implement this we would need three new registries. One for the resampling presets and two for the up- and down-samplers.
The following image shows a brief hand drafted diagram of the classes.
Drafted code example
Code Block | ||||
---|---|---|---|---|
| ||||
package org.esa.snap.core.gpf.ui.resample;
import org.esa.snap.core.datamodel.Product;
import org.esa.snap.core.datamodel.RasterDataNode;
public interface ResamplingProvider {
String getName();
boolean isCompatible(Product p);
ResampleMethodology getResampleMethod(RasterDataNode raster);
} |
I'm not yet sure about the upsampling
and downsampling in ResamplingMethodology.
Maybe we should define a common interface for both. Additionally it would be good to make use of the implementations of org.esa.snap.core.dataop.resamp.Resampling
. And the interpolation and aggregation operations also need to be extended by a SPI or at least should be retrieved by ResamplingProvider
. Here a bit more of thinking is probably needed.
...
language | java |
---|---|
title | Resampling method |
...
The ResamplingPresets define for a band name the resampling name. They might be handled similar to the RGBProfiles as they can be described in a plain text file. All presets are added to a ResamplingPresetRegistry. The two other registries are for the up- and down-samplers. They should be provided be provided by the means of META-INF/services SPI. The DownSampling and the UpSampling can have a common ResamplingMethod interface. The Interpolator and the Aggregator interfaces need to be extended. The init(...)
method needs to have the RasterDataNode as Parameter. It might be necessary for the Resampler to access the raster or the product. To have the data in access is not enough. Also a dispose()
method should be added to the interfaces in order to release the resources.
This is how the parameter xml file could look like.
Code Block | ||||
---|---|---|---|---|
| ||||
<parameters> <referenceBand>B1</referenceBand> <!-- Still supported but deprecated <upsampling>Nearest</upsampling> <downsampling>First</downsampling> <flagDownsampling>First</flagDownsampling> --> <!-- if empty the the default is used --> <resamplingPreset>S2_MSI_RESAMPLER</resamplingPreset> <!-- over rules the settings by the resampling preset--> <bandResamplings>B2:First,B3:First,B4:First,B5:Median</bandResamplings> <resampleOnPyramidLevels>true</resampleOnPyramidLevels> </parameters> |
...