Commit 1052e74f authored by Thomas Feuvrier's avatar Thomas Feuvrier

ENH: Add testing for ImageRegionTileMapSplitter class

parent acc12c05
......@@ -22,6 +22,7 @@ PURPOSE. See the above copyright notices for more information.
#include "itkObject.h"
#include "itkRegion.h"
#include "itkImageRegion.h"
#include "itkImageRegionSplitter.h"
#include "itkObjectFactory.h"
#include "itkIndex.h"
#include "itkSize.h"
......@@ -130,16 +131,7 @@ private:
};
} // end namespace itk
// Define instantiation macro for this template.
// #define ITK_TEMPLATE_ImageRegionTileMapSplitter(_, EXPORT, x, y) namespace itk { \
// _(1(class EXPORT ImageRegionTileMapSplitter< ITK_TEMPLATE_1 x >)) \
// namespace Templates { typedef ImageRegionTileMapSplitter< ITK_TEMPLATE_1 x > ImageRegionTileMapSplitter##y; } \
// }
} // end namespace otb
#ifndef OTB_MANUAL_INSTANTIATION
# include "otbImageRegionTileMapSplitter.txx"
......
......@@ -616,17 +616,17 @@ ADD_TEST(ioTvRemoteSensingRegion ${COMMON_TESTS7}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ------------- otb::QuickLookImageGenerator ----------------------------
ADD_TEST(coTvQuickLookImageGeneratorNew ${COMMON_TESTS8}
ADD_TEST(coTuQuickLookImageGeneratorNew ${COMMON_TESTS8}
otbQuickLookImageGeneratorNew
)
ADD_TEST(coTuQuickLookImageGenerator ${COMMON_TESTS8}
ADD_TEST(coTvQuickLookImageGenerator ${COMMON_TESTS8}
--compare-image ${TOL}
${BASELINE}/coTuQuickLookImageGenerator.tif
${TEMP}/coTuQuickLookImageGenerator.tif
${BASELINE}/coQuickLookImageGenerator.tif
${TEMP}/coQuickLookImageGenerator.tif
otbQuickLookImageGenerator
${INPUTDATA}/qb_RoadExtract.img.hdr
${TEMP}/coTuQuickLookImageGenerator.tif
${TEMP}/coQuickLookImageGenerator.tif
10 # sr
2 # variance
0.5 # max error
......@@ -634,6 +634,23 @@ ADD_TEST(coTuQuickLookImageGenerator ${COMMON_TESTS8}
1 # usespacing
)
# ------------- otb::ImageRegionTileMapSplitter ----------------------------
ADD_TEST(coTuImageRegionTileMapSplitterNew ${COMMON_TESTS8}
otbImageRegionTileMapSplitterNew
)
ADD_TEST(coTvImageRegionTileMapSplitter ${COMMON_TESTS8}
--compare-ascii ${TOL}
${BASELINE_FILES}/coImageRegionTileMapSplitter.txt
${TEMP}/coImageRegionTileMapSplitter.txt
otbImageRegionTileMapSplitter
45 45 # Index
1000 1500 # Size
10 # Nb split
2 # Number of slipt
${TEMP}/coImageRegionTileMapSplitter.txt
)
# ------- Fichiers sources CXX -----------------------------------
......@@ -730,6 +747,8 @@ otbRemoteSensingRegion.cxx
SET(BasicCommon_SRCS8
otbQuickLookImageGeneratorNew.cxx
otbQuickLookImageGenerator.cxx
otbImageRegionTileMapSplitterNew.cxx
otbImageRegionTileMapSplitter.cxx
)
INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}")
......
......@@ -28,4 +28,6 @@ void RegisterTests()
{
REGISTER_TEST(otbQuickLookImageGeneratorNew);
REGISTER_TEST(otbQuickLookImageGenerator);
REGISTER_TEST(otbImageRegionTileMapSplitterNew);
REGISTER_TEST(otbImageRegionTileMapSplitter);
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbImageRegionTileMapSplitter.h"
#include <fstream>
int otbImageRegionTileMapSplitter( int argc, char * argv[] )
{
const int Dimension = 2;
typedef otb::ImageRegionTileMapSplitter< Dimension > FilterType;
typedef FilterType::IndexType IndexType;
typedef FilterType::SizeType SizeType;
typedef FilterType::RegionType RegionType;
IndexType index;
index[0] = atoi(argv[1]);
index[1] = atoi(argv[2]);
SizeType size;
size[0] = atoi(argv[3]);
size[1] = atoi(argv[4]);
unsigned int nbSplitTheoric(atoi(argv[5]));
unsigned int nbAsked(atoi(argv[6]));
const char * outfname(argv[7]);
RegionType region;
region.SetSize(size);
region.SetIndex(index);
FilterType::Pointer filter = FilterType::New();
unsigned int nb = filter->GetNumberOfSplits(region,nbSplitTheoric);
RegionType region2 = filter->GetSplit(nbAsked,nb,region);
std::ofstream outfile(outfname);
outfile << "Input region: "<<region<<std::endl;
outfile << "Input NumberOfSplits: "<<nbSplitTheoric<<std::endl;
outfile << "Output GetNumberOfSplits: "<<nb<<std::endl;
outfile << "Output GetSplit("<<nbAsked<<","<<nb<<",input region): "<<std::endl;
outfile << " "<<region2<<std::endl;
outfile.close();
return EXIT_SUCCESS;
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbImageRegionTileMapSplitter.h"
int otbImageRegionTileMapSplitterNew( int argc, char * argv[] )
{
const int Dimension = 2;
typedef otb::ImageRegionTileMapSplitter< Dimension > FilterType;
FilterType::Pointer filter = FilterType::New();
return EXIT_SUCCESS;
}
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