Skip to content
Snippets Groups Projects
Commit ccd63b77 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: add ReadImageInfo application, outputs info through the ITK log system

parent 91179f7e
Branches
Tags
No related merge requests found
include(WrapperMacros)
OTB_CREATE_APPLICATION(NAME ExtractROI SOURCES otbExtractROI.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
OTB_CREATE_APPLICATION(NAME Rescale SOURCES otbRescale.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
OTB_CREATE_APPLICATION(NAME Smoothing SOURCES otbSmoothing.cxx LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
OTB_CREATE_APPLICATION(NAME ExtractROI
SOURCES otbExtractROI.cxx
LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
OTB_CREATE_APPLICATION(NAME Rescale
SOURCES otbRescale.cxx
LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
OTB_CREATE_APPLICATION(NAME Smoothing
SOURCES otbSmoothing.cxx
LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
OTB_CREATE_APPLICATION(NAME ReadImageInfo
SOURCES otbReadImageInfo.cxx
LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters)
/*=========================================================================
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 "otbWrapperApplication.h"
#include "otbWrapperApplicationFactory.h"
namespace otb
{
namespace Wrapper
{
class ReadImageInfo : public Application
{
public:
/** Standard class typedefs. */
typedef ReadImageInfo Self;
typedef Application Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Standard macro */
itkNewMacro(Self);
itkTypeMacro(ReadImageInfo, otb::Application);
private:
ReadImageInfo()
{
SetName("ReadImageInfo");
SetDescription("Get information about the image");
}
virtual ~ReadImageInfo()
{
}
void DoCreateParameters()
{
AddParameter(ParameterType_InputImage, "in", "Input Image");
}
void DoUpdateParameters()
{
// Nothing to do here : all parameters are independent
}
void DoExecute()
{
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
std::ostringstream oss;
oss << std::setprecision(15);
oss << inImage;
oss << std::endl;
this->GetLogger()->Info( oss.str() );
}
};
}
}
OTB_APPLICATION_EXPORT(otb::Wrapper::ReadImageInfo)
......@@ -26,5 +26,16 @@ add_test(NAME exTvSmoothingTest
${INPUTDATA}/poupees.tif
${TEMP}/owTvSmoothingTest2.tif )
add_executable(otbWrapperExampleTests otbWrapperExampleTests.cxx otbRescaleTest.cxx otbSmoothingTest.cxx )
add_test(NAME exTvReadImageInfoTest
COMMAND otbWrapperExampleTests
otbReadImageInfoTest
$<TARGET_FILE_DIR:otbapp_ReadImageInfo>
${INPUTDATA}/poupees.tif )
add_executable(otbWrapperExampleTests
otbWrapperExampleTests.cxx
otbRescaleTest.cxx
otbSmoothingTest.cxx
otbReadImageInfoTest.cxx )
target_link_libraries(otbWrapperExampleTests OTBApplicationEngine OTBTesting)
/*=========================================================================
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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbWrapperApplication.h"
#include "otbWrapperApplicationRegistry.h"
#include "itkStdStreamLogOutput.h"
using otb::Wrapper::Application;
using otb::Wrapper::ApplicationRegistry;
int otbReadImageInfoTest(int argc, char* argv[])
{
ApplicationRegistry::SetApplicationPath(argv[1]);
const char* in = argv[2];
Application::Pointer app = ApplicationRegistry::CreateApplication("ReadImageInfo");
itk::StdStreamLogOutput::Pointer coutput = itk::StdStreamLogOutput::New();
coutput->SetStream(std::cout);
app->GetLogger()->AddLogOutput(coutput);
app->GetLogger()->SetPriorityLevel(itk::LoggerBase::DEBUG);
app->SetParameterString("in", in );
app->ExecuteAndWriteOutput();
return EXIT_SUCCESS;
}
......@@ -28,5 +28,6 @@ void RegisterTests()
{
REGISTER_TEST(otbSmoothingTest);
REGISTER_TEST(otbRescaleTest);
REGISTER_TEST(otbReadImageInfoTest);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment