RasterFilter Enumeration
Specifies a filter for raster processing, which can be used for visualization or data lookup.
NuGet/Assembly: Carmenta.Engine.5.16.2.nupkg (in the CECore assembly)
Syntax
public enum RasterFilter
Values
Value name | Value | Description |
---|---|---|
Bilinear | 0 | Indicates that bilinear filtering should be used. A little slower than NearestNeighbor, but improves the results. |
Bicubic | 1 | Indicates that bicubic filtering should be used. This is usually the slowest option, but gives the best result. |
NearestNeighbor | 2 | Indicates that no filtering should be used. This is the fastest option, but can give poor image quality or less accurate data lookup. |
Remarks
A raster filter can be used in two different contexts: it can be used during visualization to smooth the image, or it can be used during data lookup to interpolate values for positions between the raster cell centers. This distinction is not relevant for rasters that are just images, but it is relevant for raster data where the cell values are numbers that represent a continuous quantity like temperature or a discrete enumeration like terrain types. For discrete rasters, it makes no sense to interpolate between, say, a 6 meaning WATER and an 8 meaning FOREST, since 7 could mean DESERT, but smoothing the colors would still make sense.
Visualization
A raster filter can be attached to a Visualizer or a DataSet, to remove aliasing artifacts when rasters are scaled or resampled from the original resolution. When attached to a dataset, the filter will be used by the visualizer that is automatically generated for the dataset.
With NearestNeighbor, the raster is drawn fast but has aliasing artifacts. Bilinear and Bicubic remove aliasing but are slower.
![]() |
![]() |
Data lookup
There are methods on RasterGeometry and DataSet that look up the value of a raster at a given position, which does not have to be at a raster cell center. You can specify the interpolation method, if any, in two ways.
Implicitly. There is a boolean property continuous on raster datasets and on the basic Raster class, which says whether the raster cell values represent a continuous quantity. Since interpolation makes sense only for continuous raster data, the basic lookup methods will automatically use nearest-neighbor lookup on discrete raster data and bilinear interpolation on continuous raster data.
Explicitly. The lookup methods also have overloaded variants that take an explicit RasterFilter parameter. This is the only way to use bicubic interpolation for lookup. It can also make sense to force nearest-neighbor lookup of continuous data, if performance is more important than accuracy.
Platforms
Windows, Linux, Android