Skip to content
Snippets Groups Projects
Commit 704d879b authored by Patrick Imbo's avatar Patrick Imbo
Browse files

ENH: template ElevDatabaseHeightAboveMSLFunction class with OutputPixelType...

ENH: template ElevDatabaseHeightAboveMSLFunction class with OutputPixelType instead of OutputImageType
parent 255e86fb
Branches
Tags
No related merge requests found
......@@ -78,7 +78,8 @@ public:
typedef itk::FunctionBase< PointType, PixelType> DEMFunctionBaseType;
typedef typename DEMFunctionBaseType::Pointer DEMFunctionBasePointer;
typedef otb::ElevDatabaseHeightAboveMSLFunction<DEMImageType,typename PointType::ValueType> SRTMFunctionType;
typedef otb::ElevDatabaseHeightAboveMSLFunction<PixelType,
typename PointType::ValueType> SRTMFunctionType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......@@ -193,7 +194,7 @@ protected:
SizeType m_OutputSize;
PixelType m_DefaultUnknownValue;
typename DEMFunctionBaseType::Pointer m_DEMFunction;
DEMFunctionBasePointer m_DEMFunction;
private:
DEMToImageGenerator(const Self &); //purposely not implemented
......
......@@ -39,25 +39,22 @@ namespace otb
* \ingroup ImageFunctions
*/
template <
class TOutput,
class TCoordRep = float
class TOutputPixel,
class TCoordRep = float,
unsigned int NPointDimension=2
>
class ElevDatabaseHeightAboveMSLFunction :
public itk::FunctionBase< itk::Point<TCoordRep,
::itk::GetImageDimension<TOutput>::ImageDimension>,
typename TOutput::PixelType >
public itk::FunctionBase< itk::Point<TCoordRep, NPointDimension>,
TOutputPixel >
{
public:
/** Dimension underlying input image. */
itkStaticConstMacro(ImageDimension, unsigned int,
TOutput::ImageDimension);
/** Dimension of the Space */
itkStaticConstMacro(PointDimension, unsigned int, NPointDimension);
/** Standard class typedefs. */
typedef ElevDatabaseHeightAboveMSLFunction Self;
typedef ElevDatabaseHeightAboveMSLFunction Self;
typedef itk::FunctionBase<
itk::Point<TCoordRep, itkGetStaticConstMacro(ImageDimension)>,
TOutput > Superclass;
itk::Point<TCoordRep, NPointDimension>, TOutputPixel > Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
......@@ -67,24 +64,19 @@ public:
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** OutputType typedef support. */
typedef TOutput OutputImageType;
/** InputPixel typedef support */
typedef typename OutputImageType::PixelType PixelType;
/** InputImagePointer typedef support */
typedef typename OutputImageType::ConstPointer ImageConstPointer;
/** Output Pixel typedef support */
typedef TOutputPixel PixelType;
/** CoordRepType typedef support. */
typedef TCoordRep CoordRepType;
/** Index Type. */
typedef typename OutputImageType::IndexType IndexType;
typedef typename OutputImageType::IndexValueType IndexValueType;
/** Point Type. */
typedef itk::Point<TCoordRep,itkGetStaticConstMacro(ImageDimension)> PointType;
typedef itk::Point<TCoordRep,NPointDimension> PointType;
/** Get the dimension (size) of the point. */
static unsigned int GetPointDimension()
{ return NPointDimension; }
/** Set the Elev Manager to the function. */
virtual void SetElevManager(ossimElevManager * ptr )
......
......@@ -37,8 +37,8 @@ namespace otb
/**
* Constructor
*/
template <class TOutput, class TCoordRep>
ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
template <class TOutputPixel, class TCoordRep, unsigned int NPointDimension>
ElevDatabaseHeightAboveMSLFunction<TOutputPixel, TCoordRep, NPointDimension>
::ElevDatabaseHeightAboveMSLFunction() :
m_ElevManager(ossimElevManager::instance())
{
......@@ -51,9 +51,9 @@ ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
/**
* Standard "PrintSelf" method
*/
template <class TOutput, class TCoordRep>
template <class TOutputPixel, class TCoordRep, unsigned int NPointDimension>
void
ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
ElevDatabaseHeightAboveMSLFunction<TOutputPixel, TCoordRep, NPointDimension>
::PrintSelf(
std::ostream& os,
itk::Indent indent) const
......@@ -65,9 +65,9 @@ ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
/**
*
*/
template <class TOutput, class TCoordRep>
typename ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>::PixelType
ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
template <class TOutputPixel, class TCoordRep, unsigned int NPointDimension>
typename ElevDatabaseHeightAboveMSLFunction<TOutputPixel, TCoordRep, NPointDimension>::PixelType
ElevDatabaseHeightAboveMSLFunction<TOutputPixel, TCoordRep, NPointDimension>
::Evaluate(const PointType& point) const
{
double height;
......@@ -88,9 +88,9 @@ ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
}
template <class TOutput, class TCoordRep>
template <class TOutputPixel, class TCoordRep, unsigned int NPointDimension>
void
ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
ElevDatabaseHeightAboveMSLFunction<TOutputPixel, TCoordRep, NPointDimension>
::OpenDEMDirectory(const char* DEMDirectory)
{
ossimFilename ossimDEMDir;
......@@ -102,9 +102,9 @@ ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
}
}
template <class TOutput, class TCoordRep>
template <class TOutputPixel, class TCoordRep, unsigned int NPointDimension>
void
ElevDatabaseHeightAboveMSLFunction<TOutput, TCoordRep>
ElevDatabaseHeightAboveMSLFunction<TOutputPixel, TCoordRep, NPointDimension>
::SetDefaultHeightAboveEllipsoid(double h)
{
m_ElevManager->setDefaultHeightAboveEllipsoid(h);
......
......@@ -22,8 +22,7 @@
int otbElevDatabaseHeightAboveMSLFunction(int argc, char* argv[])
{
typedef otb::Image<float,2> ImageType;
typedef otb::ElevDatabaseHeightAboveMSLFunction<ImageType> SrtmFunctionType;
typedef otb::ElevDatabaseHeightAboveMSLFunction<float> SrtmFunctionType;
SrtmFunctionType::Pointer srtmDem;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment