You are here: Appendix A - Technical Notes > Overrides

## Overrides

The SDK uses a system of “mixins” to simplify the overriding of LTIImageStage properties. Specifically, LTIImageStage defines an abstract interface that needs to be implemented by derived class of LTIImageFilter; LTIImageFilter implements the LTIImageStage interface by forwarding the method call to the next LTIImageStage in the pipeline. Derived classes of LTIImageFilter that change image properties will need to override the accessor functions.

A cropping filter would change the width and height of the image at that stage in the pipeline, and so would need to override getWidth() and getHeight().

For example:

#include "lti_imageFilter.h"

#include "lti_imageStageOverrides.h"

class MyCropFilter : public LTIOverrideDimensions< LTIImageFilter >

{

...

LT_STATUS initialize(... lt_uint32 newWidth, lt_uint32 newHeight, ...)

{

...

sts = setDimensions(newWidth, newHeight);

...

}

...

};

LTIOverrideDimensions<> adds getWidth() and getHeight(), a protected setDimensions() function, and the needed data members.

The SDK uses templates to implement the mixins over virtual inheritance. To override many sets of properties you use the following code:

class MyFilter : public LTIOverrideXXX < LTIOverrideYYY < LTIOverideZZZ < LTIImageFilter > > >

{ ... };

The list of override mixin templates and the LTIImageStage functions they override is as follows:

- LTIOverrideMetadata
  - getMetadata()
- LTIOverrideDimensions
  - getWidth(), getHeight()
- LTIOverridePixelProps
  - getPixelProps()
  - getMinDynamicRange()
  - getMaxDynamicRange()
- LTIOverrideNoDataPixels
  - getNoDataPixel()
  - getBackgroundPixel()
- LTIOverrideGeoCoord
  - getGeoCoord()
  - isGeoCoordImplicit()
- LTIOverrideMagnification
  - getMinMagnification()
  - getMaxMagnification()
- LTIOverrideIsSelectiveData
  - isSelective()
- LTIOverrideStripHeight
  - getStripHeight()
  - setStripHeight()
- LTIOverrideDelegates
  - setProgressDelegate()
  - getProgressDelegate()
  - setInterruptDelegate()
  - getInterruptDelegate()
- LTIOverridePixelLookupTables:
  - getPixelLookupTable()