Commit 2d3343e3 authored by Christophe Palmann's avatar Christophe Palmann

ENH: bandmathx, better naming conventions

parent 1d3c968d
......@@ -20,7 +20,7 @@
#include "otbObjectList.h"
#include "otbBandMathImageFilterX.h"
#include "otbBandMathXImageFilter.h"
namespace otb
{
......@@ -44,7 +44,7 @@ public:
itkTypeMacro(BandMathX, otb::Application);
typedef otb::BandMathImageFilterX<FloatVectorImageType> BandMathImageFilterType;
typedef otb::BandMathXImageFilter<FloatVectorImageType> BandMathImageFilterType;
private:
......
......@@ -19,8 +19,8 @@
=========================================================================*/
#ifndef __otbBandMathImageFilterX_h
#define __otbBandMathImageFilterX_h
#ifndef __otbBandMathXImageFilter_h
#define __otbBandMathXImageFilter_h
#include "itkImageToImageFilter.h"
#include "itkArray.h"
......@@ -33,7 +33,7 @@
namespace otb
{
/** \class BandMathImageFilterX
/** \class BandMathXImageFilter
* \brief Performs mathematical operations on the input images
* according to the formula specified by the user.
*
......@@ -57,12 +57,12 @@ namespace otb
*/
template< class TImage >
class ITK_EXPORT BandMathImageFilterX
class ITK_EXPORT BandMathXImageFilter
: public itk::ImageToImageFilter< TImage , TImage >
{
public:
/** Standard class typedefs. */
typedef BandMathImageFilterX< TImage > Self;
typedef BandMathXImageFilter< TImage > Self;
typedef itk::ImageToImageFilter< TImage , TImage> Superclass;
typedef itk::SmartPointer< Self > Pointer;
typedef itk::SmartPointer< const Self > ConstPointer;
......@@ -71,7 +71,7 @@ public:
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(BandMathImageFilterX, ImageToImageFilter);
itkTypeMacro(BandMathXImageFilter, ImageToImageFilter);
/** Some convenient typedefs. */
typedef TImage ImageType;
......@@ -121,8 +121,8 @@ public:
protected :
BandMathImageFilterX();
virtual ~BandMathImageFilterX();
BandMathXImageFilter();
virtual ~BandMathXImageFilter();
virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
void GenerateOutputInformation();
......@@ -147,7 +147,7 @@ private :
} adhocStruct;
BandMathImageFilterX(const Self&); //purposely not implemented
BandMathXImageFilter(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
void AddVariable(adhocStruct&);
......@@ -178,7 +178,7 @@ private :
}//end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
#include "otbBandMathImageFilterX.txx"
#include "otbBandMathXImageFilter.txx"
#endif
#endif
......@@ -18,9 +18,9 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbBandMathImageFilterX_txx
#define __otbBandMathImageFilterX_txx
#include "otbBandMathImageFilterX.h"
#ifndef __otbBandMathXImageFilter_txx
#define __otbBandMathXImageFilter_txx
#include "otbBandMathXImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"
......@@ -38,8 +38,8 @@ namespace otb
/** Constructor */
template <class TImage>
BandMathImageFilterX<TImage>
::BandMathImageFilterX()
BandMathXImageFilter<TImage>
::BandMathXImageFilter()
{
//This number will be incremented each time an image
//is added over the one minimumrequired
......@@ -68,8 +68,8 @@ BandMathImageFilterX<TImage>
/** Destructor */
template <class TImage>
BandMathImageFilterX<TImage>
::~BandMathImageFilterX()
BandMathXImageFilter<TImage>
::~BandMathXImageFilter()
{
m_Expression.clear();
m_VParser.clear();
......@@ -90,7 +90,7 @@ BandMathImageFilterX<TImage>
template <class TImage>
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
......@@ -108,7 +108,7 @@ void BandMathImageFilterX<TImage>
}
template <class TImage>
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::SetNthInput(unsigned int idx, const ImageType * image)
{
......@@ -118,7 +118,7 @@ void BandMathImageFilterX<TImage>
}
template <class TImage>
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::SetNthInput(unsigned int idx, const ImageType * image, const std::string& varName)
{
......@@ -211,7 +211,7 @@ void BandMathImageFilterX<TImage>
}
template <typename TImage>
TImage * BandMathImageFilterX<TImage>
TImage * BandMathXImageFilter<TImage>
::GetNthInput(unsigned int idx)
{
return const_cast<TImage *>(this->GetInput(idx));
......@@ -219,7 +219,7 @@ TImage * BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::SetExpression(const std::string& expression)
{
......@@ -248,7 +248,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::SetMatrix(const std::string& name, const std::string& definition)
{
......@@ -308,7 +308,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::SetConstant(const std::string& name, double value)
{
for(int i=0; i<m_VAllowedVarNameAddedByUser.size(); i++)
......@@ -326,7 +326,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::ExportContext(const std::string& filename)
{
......@@ -398,7 +398,7 @@ void BandMathImageFilterX<TImage>
}
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::ImportContext(const std::string& filename)
{
std::ifstream importFile(filename.c_str(), std::ios::in);
......@@ -501,7 +501,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
std::string BandMathImageFilterX<TImage>
std::string BandMathXImageFilter<TImage>
::GetExpression(int IDExpression) const
{
return m_Expression.at(IDExpression);
......@@ -509,7 +509,7 @@ std::string BandMathImageFilterX<TImage>
template< typename TImage >
std::vector<std::string> BandMathImageFilterX<TImage>
std::vector<std::string> BandMathXImageFilter<TImage>
::GetVarNames() const
{
std::vector<std::string> res;
......@@ -521,7 +521,7 @@ std::vector<std::string> BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::AddVariable(adhocStruct &ahc)
{
bool found=false;
......@@ -536,7 +536,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::PrepareParsers()
{
......@@ -705,7 +705,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX< TImage >
void BandMathXImageFilter< TImage >
::OutputsDimensions()
{
......@@ -749,7 +749,7 @@ void BandMathImageFilterX< TImage >
template< typename TImage >
void BandMathImageFilterX< TImage >
void BandMathXImageFilter< TImage >
::GenerateOutputInformation(void)
{
Superclass::GenerateOutputInformation();
......@@ -778,7 +778,7 @@ void BandMathImageFilterX< TImage >
template< typename TImage >
void BandMathImageFilterX< TImage >
void BandMathXImageFilter< TImage >
::GenerateInputRequestedRegion()
{
// call the superclass' implementation of this method
......@@ -799,7 +799,7 @@ void BandMathImageFilterX< TImage >
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::BeforeThreadedGenerateData()
{
// Some useful variables
......@@ -905,7 +905,7 @@ void BandMathImageFilterX<TImage>
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::AfterThreadedGenerateData()
{
unsigned int nbThreads = this->GetNumberOfThreads();
......@@ -938,7 +938,7 @@ void BandMathImageFilterX<TImage>
}
template< typename TImage >
void BandMathImageFilterX<TImage>
void BandMathXImageFilter<TImage>
::ThreadedGenerateData(const ImageRegionType& outputRegionForThread,
itk::ThreadIdType threadId)
{
......
......@@ -56,7 +56,7 @@
#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbBandMathImageFilterX.h"
#include "otbBandMathXImageFilter.h"
// Software Guide : EndCodeSnippet
int main( int argc, char* argv[])
......@@ -74,7 +74,7 @@ int main( int argc, char* argv[])
// Software Guide : BeginLatex
//
// Then, we set the classical \code{typedef}s needed for reading and
// writing the images. The \doxygen{otb}{BandMathImageFilterX} class
// writing the images. The \doxygen{otb}{BandMathXImageFilter} class
// works with \doxygen{otb}{VectorImage}.
//
// Software Guide : EndLatex
......@@ -94,7 +94,7 @@ int main( int argc, char* argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef otb::BandMathImageFilterX<ImageType> FilterType;
typedef otb::BandMathXImageFilter<ImageType> FilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -167,14 +167,14 @@ int main( int argc, char* argv[])
// Software Guide : BeginLatex
//
// Figure~\ref{fig:BandMathImageFilterX} shows the result of our high-pass filter.
// Figure~\ref{fig:BandMathXImageFilter} shows the result of our high-pass filter.
// \begin{figure}
// \center
// \includegraphics[width=0.45\textwidth]{qb_ExtractRoad.eps}
// \includegraphics[width=0.45\textwidth]{qb_BandMath-res1.eps}
// \itkcaption[Band Math X]{From left to right:
// Original image, high-pass filter output.}
// \label{fig:BandMathImageFilterX}
// \label{fig:BandMathXImageFilter}
// \end{figure}
//
// Software Guide : EndLatex
......@@ -256,14 +256,14 @@ int main( int argc, char* argv[])
// Software Guide : BeginLatex
//
// Figure~\ref{fig:BandMathImageFilterX2} shows the result of the second filter.
// Figure~\ref{fig:BandMathXImageFilter2} shows the result of the second filter.
// \begin{figure}
// \center
// \includegraphics[width=0.45\textwidth]{qb_ExtractRoad.eps}
// \includegraphics[width=0.45\textwidth]{qb_BandMath-res2.eps}
// \itkcaption[Band Math X]{From left to right:
// Original image, second filter output.}
// \label{fig:BandMathImageFilterX2}
// \label{fig:BandMathXImageFilter2}
// \end{figure}
//
// Software Guide : EndLatex
......
......@@ -28,8 +28,8 @@ target_link_libraries(HillShadingExample OTBCommon OTBIO OTBBasicFilters)
add_executable(BandMathFilterExample BandMathFilterExample.cxx )
target_link_libraries(BandMathFilterExample OTBCommon OTBIO OTBBasicFilters)
add_executable(BandMathFilterXExample BandMathFilterXExample.cxx )
target_link_libraries(BandMathFilterXExample OTBCommon OTBIO OTBBasicFilters)
add_executable(BandMathXImageFilterExample BandMathXImageFilterExample.cxx )
target_link_libraries(BandMathXImageFilterExample OTBCommon OTBIO OTBBasicFilters)
if( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
......
......@@ -2126,29 +2126,29 @@ add_test(bfTvBandMathImageFilterWithIdx ${BASICFILTERS_TESTS13}
${TEMP}/bfTvBandMathImageFilterWithIdx2.tif
)
add_test(bfTuBandMathImageFilterXNew ${BASICFILTERS_TESTS13}
otbBandMathImageFilterXNew)
add_test(bfTuBandMathXImageFilterNew ${BASICFILTERS_TESTS13}
otbBandMathXImageFilterNew)
add_test(bfTvBandMathImageFilterX ${BASICFILTERS_TESTS13}
otbBandMathImageFilterX)
add_test(bfTvBandMathXImageFilter ${BASICFILTERS_TESTS13}
otbBandMathXImageFilter)
add_test(bfTvotbBandMathImageFilterXConv ${BASICFILTERS_TESTS13}
otbBandMathImageFilterXConv
add_test(bfTvBandMathXImageFilterConv ${BASICFILTERS_TESTS13}
otbBandMathXImageFilterConv
${BASELINE_FILES}/bfTvExportBandMathX.txt
${TEMP}/bfTvExportBandMathXOut.txt
)
add_test(bfTvotbBandMathImageFilterXTxt ${BASICFILTERS_TESTS13}
add_test(bfTvBandMathXImageFilterTxt ${BASICFILTERS_TESTS13}
--compare-ascii ${NOTOL}
${BASELINE_FILES}/bfTvExportBandMathX.txt
${TEMP}/bfTvExportBandMathXOut.txt
otbBandMathImageFilterXTxt
otbBandMathXImageFilterTxt
${BASELINE_FILES}/bfTvExportBandMathX.txt
${TEMP}/bfTvExportBandMathXOut.txt
)
add_test(bfTvBandMathImageFilterXWithIdx ${BASICFILTERS_TESTS13}
otbBandMathImageFilterXWithIdx
add_test(bfTvBandMathXImageFilterWithIdx ${BASICFILTERS_TESTS13}
otbBandMathXImageFilterWithIdx
${TEMP}/bfTvBandMathImageFilterWithIdx1.tif
${TEMP}/bfTvBandMathImageFilterWithIdx2.tif
)
......@@ -3173,7 +3173,7 @@ otbImageAndVectorImageOperationFilterTest.cxx
set(BasicFilters_SRCS13
otbBasicFiltersTests13.cxx
otbBandMathImageFilter.cxx
otbBandMathImageFilterX.cxx
otbBandMathXImageFilter.cxx
otbComplexToIntensityFilterTest.cxx
otbRealAndImaginaryImageToComplexImageFilterTest.cxx
otbRealImageToComplexImageFilterTest.cxx
......
......@@ -23,16 +23,16 @@
#include "otbMath.h"
#include "otbVectorImage.h"
#include "otbBandMathImageFilterX.h"
#include "otbBandMathXImageFilter.h"
#include "otbImageFileWriter.h"
#include "itkImageRegionIteratorWithIndex.h"
int otbBandMathImageFilterXNew( int itkNotUsed(argc), char* itkNotUsed(argv) [])
int otbBandMathXImageFilterNew( int itkNotUsed(argc), char* itkNotUsed(argv) [])
{
typedef double PixelType;
typedef otb::VectorImage<PixelType, 2> ImageType;
typedef otb::BandMathImageFilterX<ImageType> FilterType;
typedef otb::BandMathXImageFilter<ImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
......@@ -40,12 +40,12 @@ int otbBandMathImageFilterXNew( int itkNotUsed(argc), char* itkNotUsed(argv) [])
}
int otbBandMathImageFilterX( int itkNotUsed(argc), char* itkNotUsed(argv) [])
int otbBandMathXImageFilter( int itkNotUsed(argc), char* itkNotUsed(argv) [])
{
typedef otb::VectorImage<double, 2> ImageType;
typedef ImageType::PixelType PixelType;
typedef otb::BandMathImageFilterX<ImageType> FilterType;
typedef otb::BandMathXImageFilter<ImageType> FilterType;
unsigned int i;
const unsigned int N = 100, D1=3, D2=1, D3=1;
......@@ -199,13 +199,13 @@ int otbBandMathImageFilterX( int itkNotUsed(argc), char* itkNotUsed(argv) [])
}
int otbBandMathImageFilterXConv( int itkNotUsed(argc), char* argv [])
int otbBandMathXImageFilterConv( int itkNotUsed(argc), char* argv [])
{
const char * inputFilename = argv[1];
typedef otb::VectorImage<double, 2> ImageType;
typedef ImageType::PixelType PixelType;
typedef otb::BandMathImageFilterX<ImageType> FilterType;
typedef otb::BandMathXImageFilter<ImageType> FilterType;
unsigned int i;
const unsigned int N = 100, D1=3, D2=1, D3=1;
......@@ -434,14 +434,14 @@ int otbBandMathImageFilterXConv( int itkNotUsed(argc), char* argv [])
}
int otbBandMathImageFilterXTxt( int itkNotUsed(argc), char* argv [])
int otbBandMathXImageFilterTxt( int itkNotUsed(argc), char* argv [])
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
typedef otb::VectorImage<double, 2> ImageType;
typedef ImageType::PixelType PixelType;
typedef otb::BandMathImageFilterX<ImageType> FilterType;
typedef otb::BandMathXImageFilter<ImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
......@@ -452,7 +452,7 @@ int otbBandMathImageFilterXTxt( int itkNotUsed(argc), char* argv [])
}
int otbBandMathImageFilterXWithIdx( int itkNotUsed(argc), char* argv[])
int otbBandMathXImageFilterWithIdx( int itkNotUsed(argc), char* argv[])
{
const char * outfname1 = argv[1];
const char * outfname2 = argv[2];
......@@ -460,7 +460,7 @@ int otbBandMathImageFilterXWithIdx( int itkNotUsed(argc), char* argv[])
typedef otb::VectorImage<double, 2> ImageType;
typedef ImageType::PixelType PixelType;
typedef otb::BandMathImageFilterX<ImageType> FilterType;
typedef otb::BandMathXImageFilter<ImageType> FilterType;
typedef otb::ImageFileWriter<ImageType> WriterType;
const unsigned int N = 100, D1=1, D2=1, D3=1;
......
......@@ -26,12 +26,12 @@ void RegisterTests()
{
REGISTER_TEST(otbBandMathImageFilterNew);
REGISTER_TEST(otbBandMathImageFilter);
REGISTER_TEST(otbBandMathImageFilterXNew);
REGISTER_TEST(otbBandMathImageFilterX);
REGISTER_TEST(otbBandMathImageFilterXConv);
REGISTER_TEST(otbBandMathImageFilterXTxt);
REGISTER_TEST(otbBandMathXImageFilterNew);
REGISTER_TEST(otbBandMathXImageFilter);
REGISTER_TEST(otbBandMathXImageFilterConv);
REGISTER_TEST(otbBandMathXImageFilterTxt);
REGISTER_TEST(otbBandMathImageFilterWithIdx);
REGISTER_TEST(otbBandMathImageFilterXWithIdx);
REGISTER_TEST(otbBandMathXImageFilterWithIdx);
REGISTER_TEST(otbComplexToIntensityFilterTest);
REGISTER_TEST(otbRealAndImaginaryImageToComplexImageFilterTest);
REGISTER_TEST(otbRealImageToComplexImageFilterTest);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment