OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimFilterTable Class Reference

#include <ossimFilterTable.h>

Public Member Functions

 ossimFilterTable ()
 default constructor More...
 
 ~ossimFilterTable ()
 destructor More...
 
void buildTable (ossim_uint32 filterSteps, const ossimFilter &filter)
 Builds a table with filter being used in both x and y direction. More...
 
void buildTable (ossim_uint32 filterSteps, const ossimFilter &xFilter, const ossimFilter &yFilter)
 Builds a table. More...
 
ossim_uint32 getWidthByHeight () const
 
ossim_uint32 getXSupport () const
 
ossim_uint32 getYSupport () const
 
ossim_uint32 getWidth () const
 
ossim_uint32 getHeight () const
 
const double * getClosestWeights (const double &x, const double &y) const
 Inlined below. More...
 

Protected Member Functions

void allocateWeights ()
 Creates the weight array "theWeights". More...
 

Protected Attributes

double * theWeights
 
ossim_uint32 theWidth
 
ossim_uint32 theHeight
 
ossim_uint32 theWidthHeight
 
ossim_uint32 theXSupport
 
ossim_uint32 theYSupport
 
ossim_uint32 theFilterSteps
 

Detailed Description

Definition at line 19 of file ossimFilterTable.h.

Constructor & Destructor Documentation

◆ ossimFilterTable()

ossimFilterTable::ossimFilterTable ( )

default constructor

Definition at line 15 of file ossimFilterTable.cpp.

16  :theWeights(0),
17  theWidth(0),
18  theHeight(0),
19  theWidthHeight(0),
20  theXSupport(0),
21  theYSupport(0),
23 {
24 
25 }
ossim_uint32 theYSupport
ossim_uint32 theWidthHeight
ossim_uint32 theHeight
ossim_uint32 theWidth
ossim_uint32 theXSupport
ossim_uint32 theFilterSteps

◆ ~ossimFilterTable()

ossimFilterTable::~ossimFilterTable ( )

destructor

Definition at line 27 of file ossimFilterTable.cpp.

References theWeights.

28 {
29  if(theWeights)
30  {
31  delete [] theWeights;
32  theWeights = 0;
33  }
34 }

Member Function Documentation

◆ allocateWeights()

void ossimFilterTable::allocateWeights ( )
protected

Creates the weight array "theWeights".

Will delete if previously allocated.

Definition at line 134 of file ossimFilterTable.cpp.

References size, theFilterSteps, theWeights, and theWidthHeight.

Referenced by buildTable().

135 {
136  if(theWeights)
137  {
138  delete [] theWeights;
139  theWeights = 0;
140  }
141 
143 
144  if(size)
145  {
146  theWeights = new double[size];
147  }
148 }
ossim_uint32 theWidthHeight
yy_size_t size
unsigned int ossim_uint32
ossim_uint32 theFilterSteps

◆ buildTable() [1/2]

void ossimFilterTable::buildTable ( ossim_uint32  filterSteps,
const ossimFilter filter 
)

Builds a table with filter being used in both x and y direction.

Definition at line 36 of file ossimFilterTable.cpp.

Referenced by ossimFilterResampler::computeTable().

38 {
39  buildTable(filterSteps, filter, filter);
40 }
void buildTable(ossim_uint32 filterSteps, const ossimFilter &filter)
Builds a table with filter being used in both x and y direction.

◆ buildTable() [2/2]

void ossimFilterTable::buildTable ( ossim_uint32  filterSteps,
const ossimFilter xFilter,
const ossimFilter yFilter 
)

Builds a table.

Definition at line 42 of file ossimFilterTable.cpp.

References allocateWeights(), ossimFilter::filter(), ossimFilter::getSupport(), theFilterSteps, theHeight, theWeights, theWidth, theWidthHeight, theXSupport, theYSupport, x, and y.

45 {
46  ossim_int32 subpixelSample=0;
47  ossim_int32 subpixelLine=0;
48  double dx = 0.0;
49  double dy = 0.0;
50  double kernelH = 0.0;
51  double kernelV = 0.0;
52  double x = 0;
53  double y = 0;
54 
55  double xsupport = ceil(xFilter.getSupport());
56  double ysupport = ceil(yFilter.getSupport());
57  double left = 0;
58  double right = 0;
59  double top = 0;
60  double bottom = 0;
61 
62  theXSupport = (ossim_uint32)xsupport;
63  theYSupport = (ossim_uint32)ysupport;
64  theFilterSteps = filterSteps;
65  theWidth = (2*theXSupport);
66  theHeight = (2*theYSupport);
68 
70  left = -(xsupport-1);
71  right = xsupport;
72  top = -(ysupport-1);
73  bottom = ysupport;
74  ossim_uint32 idx = 0;
75 
76  for (subpixelLine = 0; subpixelLine < (int)filterSteps;
77  subpixelLine++)
78  {
79 
80  // Calculate subpixel sample step.
81  // ----------------------------------
82  dy = subpixelLine / (double)(filterSteps);
83  for (subpixelSample = 0; subpixelSample < (int)filterSteps; subpixelSample++)
84  {
85 
86  // Calculate subpixel sample step.
87  // ----------------------------------
88  dx = subpixelSample / (double)(filterSteps);
89 
90  for (kernelV=top; kernelV<=bottom;
91  kernelV++)
92  {
93  y = kernelV - dy;
94  double tempWeight = yFilter.filter(y, yFilter.getSupport());
95  for(kernelH=left; kernelH<=right;++kernelH)
96  {
97  x = kernelH - dx;
98 
99  // Get the weight for the current pixel.
100  // ----------------------------------------
101  theWeights[idx] = tempWeight*xFilter.filter(x, xFilter.getSupport());
102  ++idx;
103  }
104  }
105  }
106  }
107 }
ossim_uint32 theYSupport
ossim_uint32 x
ossim_uint32 theWidthHeight
virtual double getSupport() const =0
void allocateWeights()
Creates the weight array "theWeights".
ossim_uint32 theHeight
ossim_uint32 y
ossim_uint32 theWidth
ossim_uint32 theXSupport
unsigned int ossim_uint32
ossim_uint32 theFilterSteps
virtual double filter(double x, double support) const =0
int ossim_int32

◆ getClosestWeights()

const double * ossimFilterTable::getClosestWeights ( const double &  x,
const double &  y 
) const
inline

Inlined below.

Method inlined for speed as it is used in the inner pixel loop of ossimFilterResampler::resampleBilinearTile method.

Returns
const double* to the closest weight of x and y.

Definition at line 80 of file ossimFilterTable.h.

References theFilterSteps, theWeights, theWidthHeight, x, and y.

Referenced by ossimFilterResampler::resampleBilinearTile().

82 {
83  // Extract the decimal part of x and y.
84  double intPartDummy;
85  double decimalPrecisionX = fabs(modf(x, &intPartDummy));
86  double decimalPrecisionY = fabs(modf(y, &intPartDummy));
87 
88  ossim_int32 kernelLine =
89  (ossim_int32)(theFilterSteps*decimalPrecisionY);
90  ossim_int32 kernelSamp =
91  (ossim_int32)(theFilterSteps*decimalPrecisionX);
92 
93  return &theWeights[(kernelLine*theFilterSteps +
94  kernelSamp)*theWidthHeight];
95 }
ossim_uint32 x
ossim_uint32 theWidthHeight
ossim_uint32 y
ossim_uint32 theFilterSteps
int ossim_int32

◆ getHeight()

ossim_uint32 ossimFilterTable::getHeight ( ) const
Returns
theHeight

Definition at line 129 of file ossimFilterTable.cpp.

References theHeight.

Referenced by ossimFilterResampler::resampleBilinearTile().

130 {
131  return theHeight;
132 }
ossim_uint32 theHeight

◆ getWidth()

ossim_uint32 ossimFilterTable::getWidth ( ) const
Returns
theWidth

Definition at line 124 of file ossimFilterTable.cpp.

References theWidth.

Referenced by ossimFilterResampler::resampleBilinearTile().

125 {
126  return theWidth;
127 }
ossim_uint32 theWidth

◆ getWidthByHeight()

ossim_uint32 ossimFilterTable::getWidthByHeight ( ) const
Returns
theWidth*theHeight

Definition at line 109 of file ossimFilterTable.cpp.

References theWidthHeight.

110 {
111  return theWidthHeight;
112 }
ossim_uint32 theWidthHeight

◆ getXSupport()

ossim_uint32 ossimFilterTable::getXSupport ( ) const
Returns
theXSupport

Definition at line 114 of file ossimFilterTable.cpp.

References theXSupport.

Referenced by ossimFilterResampler::resampleBilinearTile().

115 {
116  return theXSupport;
117 }
ossim_uint32 theXSupport

◆ getYSupport()

ossim_uint32 ossimFilterTable::getYSupport ( ) const
Returns
theYSupport

Definition at line 119 of file ossimFilterTable.cpp.

References theYSupport.

Referenced by ossimFilterResampler::resampleBilinearTile().

120 {
121  return theYSupport;
122 }
ossim_uint32 theYSupport

Member Data Documentation

◆ theFilterSteps

ossim_uint32 ossimFilterTable::theFilterSteps
protected

Definition at line 73 of file ossimFilterTable.h.

Referenced by allocateWeights(), buildTable(), and getClosestWeights().

◆ theHeight

ossim_uint32 ossimFilterTable::theHeight
protected

Definition at line 69 of file ossimFilterTable.h.

Referenced by buildTable(), and getHeight().

◆ theWeights

double* ossimFilterTable::theWeights
protected

◆ theWidth

ossim_uint32 ossimFilterTable::theWidth
protected

Definition at line 68 of file ossimFilterTable.h.

Referenced by buildTable(), and getWidth().

◆ theWidthHeight

ossim_uint32 ossimFilterTable::theWidthHeight
protected

◆ theXSupport

ossim_uint32 ossimFilterTable::theXSupport
protected

Definition at line 71 of file ossimFilterTable.h.

Referenced by buildTable(), and getXSupport().

◆ theYSupport

ossim_uint32 ossimFilterTable::theYSupport
protected

Definition at line 72 of file ossimFilterTable.h.

Referenced by buildTable(), and getYSupport().


The documentation for this class was generated from the following files: