Algorithms
ElementThe Algorithms
element is used to configure the various algorithms used by Express Server in order to satisfy requests for images.
Express Server can be configured to use one of three algorithms when scaling a scene to the requested output dimensions (scale resampling) and when scaling pixels during reprojection (warp resampling). The scaleResample and warpResample attributes of the Algorithms element determine which algorithm will be used for each process. The default in both cases is bilinear. If image quality is insufficient with the bilinear algorithm we recommend using the bicubic algorithm if possible, especially for multicatalogs.
The Algorithms
element contains the following configurable attributes:
scaleResample
This specifies the algorithm used for scaling from source image dimensions to output dimensions.
Possible scaleResample
values:
NN
Specifies that the "nearest neighbor" algorithm be used. This is the fastest algorithm but yields the poorest quality.
BL
Specifies that "bilinear interpolation" be used. This algorithm is more expensive than nearest neighbor, but yields better quality.
BC
Specifies that "bicubic interpolation" be used. This is the most CPU-intensive algorithm, but produces the best result for reprojection.
warpResample
This specifies the algorithm used for scaling pixels during reprojection (warping).
Possible warpResample
values:
NN
Specifies that the "nearest neighbor" algorithm be used. This is the fastest algorithm but yields the poorest quality.
BL
Specifies that "bilinear interpolation" be used. This algorithm is more expensive than nearest neighbor, but yields better quality.
BC
Specifies that "bicubic interpolation" be used. This is the most CPU-intensive algorithm, but produces the best result for reprojection.
This specifies the maximum error allowed when choosing a faster reprojection algorithm. In order to reproject pixels from one coordinate reference system (CRS, sometimes called spatial reference system or SRS) to another, a complex mathematical formula must be applied to each point in the source image. In some cases, this formula may be roughly equivalent to a linear transform, a simple function that is much faster than the reprojection function. Express Server's reprojection engine can compare the results of a linear transform with that of the reprojection, and if the results are close, then it will choose the faster linear transform.
The value of this attribute is a decimal number greater than or equal to 0. The default and recommended value is .333.
Example warpErrorThreshold
values:
0
Specifies that the linear transform is never used .
0.25
Specifies that the linear transform is used when it yields an error of 1/4 pixel or less.
2.0
Specifies that the linear transform is used when it yields an error of 2 pixels or less.
In a MrSID or JPEG 2000 image, Zoom Level 0 (Zero) is full scale and has the highest resolution, and higher-numbered zoom levels represent lower resolution, on up to the tiny thumbnail or icon level. The scaleMagThreshold attribute is a bias toward the next-higher-numbered (lower-resolution) zoom level in determining which zoom level to scale pixel data from.
Express Server assigns a decimal value to the resolution level of a requested scene that corresponds to the numbering of the image's zoom levels, then adds the bias, and finally truncates the number after the decimal to arrive at a zoom level.
For example, let's say a requested scene has a resolution level of 1.6, which falls between Zoom Level 1 and Zoom Level 2. Express Server adds the default scaleMagThreshold value of 0.5, which brings the requested scene's resolution level to 2.1. Express Server drops the ".1" to arrive at Zoom Level 2. It then pulls the lower resolution pixel data from Zoom Level 2 and scales it up to satisfy the scene request. This scaled-up pixel data is not as sharp as that from Zoom Level 1, but it takes less time to retrieve.
For another example, let's say a requested scene has a resolution level of 2.4. The default scaleMagThreshold value of 0.5 brings the total number to 2.9, which is not enough to bump this scene's value "over the threshold" to Zoom Level 3. Express Server uses the higher resolution pixel data of Zoom Level 2 and scales it down to the requested dimensions.
Increasing the scaleMagThreshold value strengthens the bias toward higher numbered (lower resolution) zoom levels, which results in generally quicker decodes but also in lower image quality. Lowering its value favors higher image quality over performance.
Accepted values for scaleMagThreshold are decimals between 0 (zero) and 1, inclusive. By default the value is 0.5.