Commit 3c0e2a2c authored by Antoine Regimbeau's avatar Antoine Regimbeau

MRG: Merge branch 'develop' into metadata_pixeltype

parents 2cdbc0ea 35219b52
......@@ -4,7 +4,7 @@
\label{chapter:Installation}
\index{Installation}
There are two ways to install OTB library on your system: installing from a binary distribution or compiling from sources.
There are two ways to install OTB library on your system: installing from a binary distribution or compiling from sources.
You can find information about the installation of binary packages for OTB and Monteverdi in the OTB-Cookbook.
This chapter covers compilation of OTB library from source. Note that it covers
......@@ -20,7 +20,7 @@ It is known to work with the following compilers in 32/64 bit:
\item AppleClang on Mac~OS~X (10.8 or higher)
\end{itemize}
Since release version 6.2.0, OTB is compiled using the C++14 standard by default.
Since release version 6.2.0, OTB is compiled using the C++14 standard by default.
\index{CMake}
The challenge of supporting OTB across platforms has been solved through the use of CMake, a cross-platform, open-source
......@@ -44,7 +44,7 @@ options specified by the user.
There are (at least) two ways to use CMake :
\begin{itemize}
\item Using the command \texttt{ccmake} (on Unix) or \texttt{cmake-gui} (on Windows):
\item Using the command \texttt{ccmake} (on Unix) or \texttt{cmake-gui} (on Windows):
it provides an interactive mode in which you iteratively select
options and configure according to these options. The iteration
proceeds until no more options remain to be selected. At this point, a
......@@ -207,7 +207,7 @@ If you do not know which method to use and just want to compile OTB with all its
\texttt{OTB\_WRAP\_JAVA} & Enable Java wrapper \\
\hline
\multicolumn{2}{l}{\small \textbf{SuperBuild only}} \\
\multicolumn{2}{l}{\small \textbf{SuperBuild only}} \\
\texttt{DOWNLOAD\_LOCATION} & Location to download dependencies \\
\texttt{USE\_SYSTEM\_\textit{XXX}} & Use the system's \textit{XXX} library \\
......@@ -300,7 +300,8 @@ On a GNU/Linux you must have Qt X11 dependencies installed.
See Qt 5 documentation for list of packages that needs to be installed
before starting superbuild. https://doc.qt.io/qt-5/linux-requirements.html.
For a Debian 8.1 system, I installed all Qt5 dependencies with below 'apt-get install'
\texttt{apt-get install libx11-dev libxext-dev libxt-dev libxi-dev libxrandr-dev libgl-dev libglu-dev}
\texttt{apt-get install libx11-dev libxext-dev libxt-dev libxi-dev libxrandr-dev
libgl-dev libglu-dev libxinerama-dev libxcursor-dev}
You can also deactivate QT5 and skip this by passing \texttt{-DOTB\_USE\_QT=OFF} to cmake.
This will give you OTB install without monteverdi, mapla and gui application launchers.
......@@ -454,17 +455,17 @@ Everything that is needed for OTB development on Windows, including compiling fr
\label{sec:knownissues}
\begin{itemize}
\item openjpeg/ITK
\item openjpeg/ITK
\end{itemize}
It is important to know that the OpenJpeg library doesn't support name mangling since version 2.0.
As a consequence, if other libraries linked by your project already contain OpenJpeg, there may be a symbol conflict at run-time.
For instance, this was observed with OTB build on a recent ITK version (ver. 4).
It is important to know that the OpenJpeg library doesn't support name mangling since version 2.0.
As a consequence, if other libraries linked by your project already contain OpenJpeg, there may be a symbol conflict at run-time.
For instance, this was observed with OTB build on a recent ITK version (ver. 4).
The ITK library already had a version of OpenJpeg in libitkopenjpeg-*.so, which contained the OpenJpeg symbols un-wrapped.
These symbols were also loaded by the GDAL driver but only the first ones were used, which caused a crash.
These symbols were also loaded by the GDAL driver but only the first ones were used, which caused a crash.
Hopefully, thanks to the modular architecture of ITK, the library libitkopenjpeg-*.so is not imported anymore inside OTB.
However the OpenJPEG headers may be present in ITK include directory. As the current architecture doesn't allow to tune
However the OpenJPEG headers may be present in ITK include directory. As the current architecture doesn't allow to tune
include order between modules, the OpenJPEG header from ITK can be included before your own OpenJPEG install. There are
two ways to avoid this situation :
\begin{itemize}
......@@ -475,9 +476,8 @@ two ways to avoid this situation :
More information can be found here : \url{http://wiki.orfeo-toolbox.org/index.php/JPEG2000_with_GDAL_OpenJpeg_plugin}
\begin{itemize}
\item libkml / Ubuntu 12.04
\item libkml / Ubuntu 12.04
\end{itemize}
Another issue is related to the official package of libkml under Ubuntu 12.4.
Until this problem is addressed, users of this plateform should disable the option OTB\_USE\_KML, so that OTB won't be built with this third-party.
Another issue is related to the official package of libkml under Ubuntu 12.04.
Users of this plateform should disable the option OTB\_USE\_KML, so that OTB won't be built with this third-party.
......@@ -158,20 +158,28 @@ OTB, through the use of the OSSIM library --
sensors either through a physical or an analytical approach. This is
transparent for the user, since the geometrical model for a given
image is instantiated using the information stored in its meta-data. The
search for a sensor model is not straightforward. It is done in 3 steps :
search for a sensor model is not straightforward. It is done in several steps :
\begin{enumerate}
\item Load an external \code{.geom} file specified through extended filenames
(if present)
\item Load the \code{.geom} file attached with the input image (if present).
They share the same name, without extension.
\item Search in the OSSIM plugin factory for a suitable model
(\code{ossimplugins::ossimPluginProjectionFactory}). For instance, this
factory contains Pl\'eiades and TerraSar sensor models.
\item If no model was found, search in the OSSIM projection factory
(\code{ossimProjectionFactoryRegistry}). For instance this factory contains
Spot5, Landsat and Quickbird sensor models.
\item If still no model was found, search for a valid sensor model defined
in an external \code{.geom} file. If no model is found, check if there are
any RPC tags embedded within the image (GDAL is used to detect those RPC
tags). When the tags are present, an \code{ossimRpcModel} is created.
\item If no model was found, search any RPC tags in the input image. When the
tags are present, an \code{ossimRpcModel} is created.
\item If still no model was found, search for a valid sensor model in other
files attached to the current dataset. For instance, with a Sentinel-1 SAFE XML
product, it will inspect underlying \code{.tiff} files. With a VRT dataset, it
will inspect the files referenced by the VRT.
\end{enumerate}
Note that the \code{.geom} metadata file can store any sensor model recognized
by OSSIM.
\subsection{Using Sensor Models}
\label{sec:UsingSensorModels}
......
......@@ -424,7 +424,7 @@ private:
"initialize cleanup parameter.\n"
"For more information on shark KMeans algorithm [1].");
SetDocLimitations("None");
SetDocLimitations("The application doesn't support NaN in the input image");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("ImageEnveloppe PolygonClassStatistics SampleSelection SamplesExtraction "
"PolygonClassStatistics TrainVectorClassifier ImageClassifier\n"
......
......@@ -429,6 +429,9 @@ public:
* conversion)*/
void DoMapBuffer(void* buffer, size_t numberOfPixels, std::vector<unsigned int>& bandList);
/** Returns a const ref to the list of attached files*/
itkGetConstReferenceMacro(AttachedFileNames, std::vector<std::string> );
protected:
ImageIOBase();
~ImageIOBase() override;
......@@ -550,6 +553,9 @@ protected:
unsigned int numberOfActualSplits,
const itk::ImageIORegion &pasteRegion) const;
/** List of files part of the same dataset as the input filename */
std::vector<std::string> m_AttachedFileNames;
private:
ImageIOBase(const Self&) = delete;
void operator=(const Self&) = delete;
......
......@@ -435,7 +435,7 @@ void GDALImageIO::InternalReadImageInformation()
// supported gdal format using the m_DatasetNumber value
// HDF4_SDS:UNKNOWN:"myfile.hdf":2
// and make m_Dataset point to it.
if (m_Dataset->GetDataSet()->GetRasterCount() == 0)
if (m_Dataset->GetDataSet()->GetRasterCount() == 0 || m_DatasetNumber > 0)
{
// this happen in the case of a hdf file with SUBDATASETS
// Note: we assume that the datasets are in order
......@@ -659,6 +659,24 @@ void GDALImageIO::InternalReadImageInformation()
}
}
// get list of other files part of the same dataset
char** datasetFileList = dataset->GetFileList();
m_AttachedFileNames.clear();
if (datasetFileList != nullptr)
{
char** currentFile = datasetFileList;
while (*currentFile != nullptr)
{
if (m_FileName.compare(*currentFile) != 0)
{
m_AttachedFileNames.emplace_back(*currentFile);
otbLogMacro(Debug,<<"Found attached file : "<< *currentFile);
}
currentFile++;
}
CSLDestroy(datasetFileList);
}
/*----------------------------------------------------------------------*/
/*-------------------------- METADATA ----------------------------------*/
/*----------------------------------------------------------------------*/
......
......@@ -433,7 +433,20 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
}
else
{
otbLogMacro(Info,<< "No kwl metadata found in file "<<lFileNameOssimKeywordlist);
// Try attached files
for (const std::string& path : m_ImageIO->GetAttachedFileNames())
{
otb_kwl = ReadGeometryFromImage(path,!m_FilenameHelper->GetSkipRpcTag());
if(!otb_kwl.Empty())
{
otbLogMacro(Info,<< "Loading kwl metadata in attached file "<<path);
break;
}
}
if (otb_kwl.Empty())
{
otbLogMacro(Info,<< "No kwl metadata found in file "<<lFileNameOssimKeywordlist);
}
}
}
......
......@@ -75,6 +75,7 @@ otbCompareWritingComplexImage.cxx
otbImageFileReaderOptBandTest.cxx
otbImageFileWriterOptBandTest.cxx
otbMultiImageFileWriterTest.cxx
otbWriteGeomFile.cxx
)
add_executable(otbImageIOTestDriver ${OTBImageIOTests})
......@@ -1357,3 +1358,12 @@ otb_add_test(NAME ioTvMultiImageFileWriter_DiffSize
${TEMP}/ioTvMultiImageFileWriter_DiffSize1.tif
${TEMP}/ioTvMultiImageFileWriter_DiffSize2.tif
25)
otb_add_test(NAME ioTvCompoundMetadataReaderTest
COMMAND otbImageIOTestDriver
--compare-ascii ${EPSILON_9}
${INPUTDATA}/QB_Toulouse_SensorModel_labelImage.geom
${TEMP}/ioTvCompoundMetadataReaderTest.geom
otbWriteGeomFile
${INPUTDATA}/QB_Toulouse_combo.vrt
${TEMP}/ioTvCompoundMetadataReaderTest.tif)
......@@ -152,4 +152,5 @@ void RegisterTests()
REGISTER_TEST(otbImageFileReaderOptBandTest);
REGISTER_TEST(otbImageFileWriterOptBandTest);
REGISTER_TEST(otbMultiImageFileWriterTest);
REGISTER_TEST(otbWriteGeomFile);
}
/*
* Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "otbVectorImage.h"
#include "itkMacro.h"
#include <iostream>
#include "otbImageFileReader.h"
int otbWriteGeomFile(int itkNotUsed(argc), char* argv[])
{
// Verify the number of parameters in the command line
std::string inputFilename(argv[1]);
std::string outputFilename(argv[2]);
typedef double InputPixelType;
const unsigned int Dimension = 2;
typedef otb::VectorImage<InputPixelType, Dimension> InputImageType;
typedef otb::ImageFileReader<InputImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFilename);
reader->UpdateOutputInformation();
otb::ImageKeywordlist otb_kwl;
itk::MetaDataDictionary &dict = reader->GetOutput()->GetMetaDataDictionary();
itk::ExposeMetaData<otb::ImageKeywordlist>(dict, otb::MetaDataKey::OSSIMKeywordlistKey, otb_kwl);
if (otb_kwl.Empty())
{
return EXIT_FAILURE;
}
otb::WriteGeometry(otb_kwl, outputFilename);
return EXIT_SUCCESS;
}
......@@ -30,6 +30,11 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wheader-guard"
#pragma clang diagnostic ignored "-Wdivision-by-zero"
#endif
#endif
#include "otb_shark.h"
#include <shark/Algorithms/StoppingCriteria/AbstractStoppingCriterion.h>
......
......@@ -29,6 +29,10 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wheader-guard"
#endif
#endif
#include "otb_shark.h"
#include <shark/Algorithms/Trainers/PCA.h>
......
......@@ -34,6 +34,7 @@
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wheader-guard"
#endif
......
......@@ -33,6 +33,10 @@
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wheader-guard"
#endif
#endif
#include "otb_shark.h"
......
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