Skip to content
Snippets Groups Projects
Commit af9b7922 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

TEST: add test for the lidar file reader (3D points and intensity)

parent 612df047
No related branches found
No related tags found
No related merge requests found
......@@ -1886,6 +1886,14 @@ ADD_TEST(ioTvPointSetFileReader ${IO_TESTS17}
otbPointSetFileReader
${INPUTDATA}/srs.las
${TEMP}/ioPointSetFileReader.txt)
ADD_TEST(ioTvPointSetFileReader2 ${IO_TESTS17}
--compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioPointSetFileReader2.txt
${TEMP}/ioPointSetFileReader2.txt
otbPointSetFileReader2
${INPUTDATA}/srs.las
${TEMP}/ioPointSetFileReader2.txt)
ENDIF(OTB_USE_LIBLAS)
......@@ -2076,6 +2084,7 @@ otbImageSeriesFileReader.cxx
SET(BasicIO_SRCS17
otbPointSetFileReaderNew.cxx
otbPointSetFileReader.cxx
otbPointSetFileReader2.cxx
otbImageMetadataInterfaceNew.cxx
otbImageMetadataInterfaceTest.cxx
otbImageMetadataInterfaceTest2.cxx
......
......@@ -30,6 +30,7 @@ void RegisterTests()
{
REGISTER_TEST(otbPointSetFileReaderNew);
REGISTER_TEST(otbPointSetFileReader);
REGISTER_TEST(otbPointSetFileReader2);
REGISTER_TEST(otbImageMetadataInterfaceNew);
REGISTER_TEST(otbImageMetadataInterfaceTest);
REGISTER_TEST(otbImageMetadataInterfaceTest2);
......
/*=========================================================================
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 "otbPointSetFileReader.h"
#include "itkPointSet.h"
#include "itkNumericTraits.h"
#include <fstream>
int otbPointSetFileReader2(int argc, char * argv[])
{
typedef itk::PointSet <double, 3> PointSetType;
typedef otb::PointSetFileReader<PointSetType> PointSetFileReaderType;
PointSetFileReaderType::Pointer reader = PointSetFileReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
PointSetType::Pointer data = reader->GetOutput();
std::ofstream fout (argv[2]);
unsigned long nPoints = data->GetNumberOfPoints();
fout << std::setprecision(15) << "Number of points: " << nPoints << std::endl;
for (unsigned long i=0; i < nPoints; ++i)
{
PointSetType::PointType point;
data->GetPoint(i,&point);
fout << point << " : ";
PointSetType::PixelType value(itk::NumericTraits<PointSetType::PixelType>::Zero);
data->GetPointData(i,&value);
fout << value << std::endl;
}
fout << std::endl;
fout.close();
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment