Skip to content
Commits on Source (7)
......@@ -38,8 +38,8 @@ git shortlog -es HEAD | cut -f 2- \
curl -s ${GITLAB_PROJECT_URL}/raw/master/CI/contributors/known-contributors.txt \
| sort -u > ${KNOWN_CONTRIBUTORS}
diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} > ${UNKNOWN_CONTRIBUTORS}
if [ "$?" -ne "0" ] ; then
diff ${KNOWN_CONTRIBUTORS} ${GIT_CONTRIBUTORS} | grep '^>' > ${UNKNOWN_CONTRIBUTORS}
if [ -s "${UNKNOWN_CONTRIBUTORS}" ] ; then
echo ""
echo "WARNING: ***************************************************************"
echo "WARNING: Unknown contributors found:"
......
......@@ -5,7 +5,7 @@
<platform>Linux</platform>
<application>
<name>OrthoRectification</name>
<descr>This application allows to ortho-rectify optical images from supported sensors.&#x0A;</descr>
<descr>This application allows ortho-rectifying optical images from supported sensors.&#x0A;</descr>
<doc>
<name>Ortho-rectification</name>
<longdescr>An inverse sensor model is built from the input image metadata to convert geographical to raw geometry coordinates. This inverse sensor model is then combined with the chosen map projection to build a global coordinate mapping grid. Last, this grid is used to resample using the chosen interpolation algorithm. A Digital Elevation Model can be specified to account for terrain deformations. &#x0A;In case of SPOT5 images, the sensor model can be approximated by an RPC model in order to speed-up computation.</longdescr>
......
......@@ -452,15 +452,30 @@ public:
RemoveNoDataEntry();
// Generate output
if (GetParameterAsString("out") == "xml")
{
DisableParameter("out.vector.filename");
DisableParameter("out.raster.filename");
EnableParameter("out.xml.filename");
WriteXMLStatsFile();
}
else // vector or raster
{
if (m_FromLabelImage)
GenerateVectorDataFromLabelImage();
if (GetParameterAsString("out") == "vector")
{
EnableParameter("out.vector.filename");
DisableParameter("out.raster.filename");
DisableParameter("out.xml.filename");
WriteVectorData();
}
else if (GetParameterAsString("out") == "raster")
{
DisableParameter("out.vector.filename");
EnableParameter("out.raster.filename");
DisableParameter("out.xml.filename");
WriteRasterData();
}
else
otbAppLogFATAL("Unknown output mode");
}
......
......@@ -315,7 +315,7 @@ private:
// Interpolators
AddParameter(ParameterType_Choice, "interpolator", "Interpolation");
SetParameterDescription("interpolator", "This group of parameters allows to define how the input image will be interpolated during resampling.");
SetParameterDescription("interpolator", "This group of parameters allows defining how the input image will be interpolated during resampling.");
MandatoryOff("interpolator");
// NN
......
......@@ -302,7 +302,7 @@ private:
}
catch (...)
{
SetParameterDescription("exp", "Other exception catched");
SetParameterDescription("exp", "Other exception caught");
}
}
......
......@@ -488,7 +488,7 @@ private:
// in this case, the pipeline cannot be resolved : the output image (wo)
// won't be computed and a segfault can occur.
otbAppLogFATAL(
"w option has not been set : the ouput image cannot be produced."
"w option has not been set : the output image cannot be produced."
"Stop execution because the pipeline cannot be resolved");
}
......
......@@ -440,7 +440,7 @@ auto NewFunctorFilter(Functor f, itk::Size<2> radius)
/**
* \struct NumberOfOutputBandsDecorator
* \brief This struct allows to forward the operator of template
* \brief This struct allows forwarding the operator of template
* parameter, while adding number of ouptut components service.
*
* Its purpose is to enable the use of lambda or functor with
......
......@@ -67,7 +67,7 @@ struct tuple_index<Arg, std::tuple<NotMatching, Args...>>
* used as a tag to set/get the corresponding input and thus should be
* unique in tuple.
*
* This allows to add semantic to inputs and remove the need for the
* This allows adding semantic to inputs and remove the need for the
* user to know input orders and set them by their index.
*
* Example of use:
......
......@@ -424,7 +424,7 @@ int otbFunctorImageFilter(int itkNotUsed(argc), char* itkNotUsed(argv)[])
return out;
};
// In this case, we use the helper function which allows to specify
// In this case, we use the helper function which allows specifying
// the number of outputs
auto filterLambda2 = NewFunctorFilter(Lambda2, vimage->GetNumberOfComponentsPerPixel(), {{3, 3}});
filterLambda2->SetInputs(image);
......
......@@ -41,7 +41,7 @@ namespace otb
* regions of input images. There is a shift-scale mode which allows
* to shift-scale input images, which can be useful e.g. color or
* radiometric harmonization of input set of images. The output
* spacing (SetOuputSpacing()), the start index (SetOutputIndex()) and
* spacing (SetOutputSpacing()), the start index (SetOutputIndex()) and
* the interpolator (SetInterpolator()) and the origin (SetOrigin())
* can be set using the method between brackets.
*
......
......@@ -38,7 +38,7 @@ namespace otb
* Two parameters can be set:
* -Distance image interpolator: explicit
* -Distance image offset: this value is added to the interpolated distance image
* value, which allows to create a margin around the edges
* value, which allows creating a margin around the edges
* of the image (i.e. around the 0-value distance image contour)
*
* Support streaming
......
......@@ -97,10 +97,13 @@ public:
const RealValueType value = pixel[band];
const RealValueType sqValue = value * value;
UpdateValues(!m_UseNoDataValue || value != m_NoDataValue, value, sqValue, value, value, m_BandCount[band], m_Sum[band], m_SqSum[band], m_Min[band],
if(!m_UseNoDataValue || value != m_NoDataValue)
{
UpdateValues(1, value, sqValue, value, value, m_BandCount[band], m_Sum[band], m_SqSum[band], m_Min[band],
m_Max[band]);
}
}
}
// Function update (self)
void Update(const StatisticsAccumulator& other)
......
......@@ -24,6 +24,7 @@
#include <itkObject.h>
#include "otbViewSettings.h"
#include "otbShader.h"
#include "OTBIceExport.h"
#include <string>
......@@ -58,6 +59,9 @@ public:
itkGetMacro( Overlay, bool );
itkBooleanMacro( Overlay );
itkGetObjectMacro( Shader, Shader );
itkSetObjectMacro( Shader, Shader );
// Retrieve the full extent of the actor
virtual void GetExtent(double & ulx, double & uly, double & lrx, double & lry) const = 0;
......@@ -70,15 +74,20 @@ public:
// Gl rendering of current state
virtual void Render() = 0;
/** create the shader (no shader created by default) */
virtual void CreateShader();
protected:
GlActor();
~GlActor() override;
Shader::Pointer m_Shader;
private:
// prevent implementation
GlActor(const Self&);
void operator=(const Self&);
GlActor( const Self & ) = delete;
void operator=( const Self & ) = delete;
ViewSettings::Pointer m_Settings;
......
/*
* Copyright (C) 2005-2019 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.
*/
#ifndef otb_GlBufferObject_h
#define otb_GlBufferObject_h
#include "OTBIceExport.h"
#include "otbGlHandle.h"
#include "otbGlTypeTraits.h"
namespace otb { namespace gl {
/** OpenGL element-type of buffer-object.
*/
enum class element : GLenum
{
vertex = GL_ARRAY_BUFFER,
index = GL_ELEMENT_ARRAY_BUFFER,
};
/**
*/
template< element E >
struct BufferObjectPolicy
{
static
void
Generate( Id_t & id )
{
glGenBuffers( 1, &id );
}
static
void
Bind( Id_t id )
{
glBindBuffer( static_cast< GLenum >( E ), id );
}
static
void
Release( Id_t & id )
{
glDeleteBuffers( 1, &id );
}
};
/**
* @class OpenGL object.
*/
template< element E >
struct BufferObject
{
/** Buffer identifier type. */
using Id_t = otb::gl::Id_t;
/** @return element type. */
static constexpr
element
Element() noexcept
{
return E;
}
/** Default constructor. */
BufferObject() = default;
/** Construct and fill. */
template< typename T >
BufferObject( std::initializer_list< T > data,
std::size_t components = 1 ) :
m_Id(),
m_Count( data.size() ),
m_Size( sizeof( T ) ),
m_Components( components ),
m_GlType( TypeTraits< T >::value() )
{
assert( data.size() );
assert( components );
glBufferData(
static_cast< GLenum >( E ),
data.size() * sizeof( T ),
data.begin(),
GL_STATIC_DRAW
);
CheckError();
}
~BufferObject() = default;
BufferObject( BufferObject && ) = default;
BufferObject & operator = ( BufferObject && ) = default;
/** Cast operator. */
operator Id_t() const noexcept
{
return m_Id;
}
void
Bind( bool isEnabled = true ) const
{
m_Id.Bind( isEnabled );
}
GLenum
GlType() const noexcept
{
return m_GlType;
}
std::size_t
Size() const noexcept
{
return m_Size;
}
std::size_t
Stride( std::size_t components ) const noexcept
{
assert( m_Size>0 );
assert( m_Components>0 );
assert( components<=m_Components );
return m_Size * ( m_Components - components );
}
private:
Handle< BufferObjectPolicy< E > > m_Id;
std::size_t m_Count = 0;
std::size_t m_Size = 0;
std::size_t m_Components = 0;
GLenum m_GlType = GL_ZERO;
};
using VertexBufferObject = BufferObject< element::vertex >;
using IndexBufferObject = BufferObject< element::index >;
} // end namespace gl.
} // end namespace otb.
#endif // otb_GlBufferObject_h
/*
* Copyright (C) 2005-2019 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.
*/
#ifndef otb_GlError_h
#define otb_GlError_h
#include "OTBIceExport.h"
#ifdef _WIN32
# include <windows.h>
#endif
#include <GL/glew.h>
#include <cassert>
#include <iostream>
#include <stdexcept>
namespace otb { namespace gl {
/**
* @class OpenGL-specific exception.
*/
struct OTBIce_EXPORT Error : public std::runtime_error
{
/** Construct an OpenGL exception related to the OpenGL error code.
*/
Error( GLenum code );
}; // End class GlError
enum class error : int
{
clear = 0,
trace,
assertion,
exception,
};
template< error E = error::exception >
GLenum
CheckError()
{
GLenum glError = glGetError();
if( E>=error::trace )
if( glError!=GL_NO_ERROR )
std::cerr
<< "OPenGL error #" << glError << ": '" << gluErrorString( glError ) << "'"
<< std::endl;
if( E>=error::assertion )
assert( glError==GL_NO_ERROR );
// When assert is removed (NDEBUG) and Throw is false, this function
// body is emtpy and the C++ compiler should optimize the call by
// removing it.
//
// N.B.: equivalent of a scoped (and breakpoint-friendly) macro.
// Condition is splitted because first is determined at compile time
// and may be removed (see above) and second is determined at
// runtime.
if( E>=error::exception )
if( glError!=GL_NO_ERROR )
throw Error( glError );
return glError;
}
} // End of namespace gl.
} // End namespace otb.
#endif // otb_GlError_h
/*
* Copyright (C) 2005-2019 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.
*/
#ifndef otb_GlHandle_h
#define otb_GlHandle_h
#include "OTBIceExport.h"
#ifdef _WIN32
# include <windows.h>
#endif
#include <GL/glew.h>
#include "otbGlError.h"
#include <cassert>
#include <utility>
namespace otb { namespace gl {
using Id_t = GLuint;
/**
* @class OpenGL handle.
*/
template< typename Policy >
class OTBIce_EXPORT Handle
{
using Policy_t = Policy;
public:
/** OpenGL handle identifier type */
using Id_t = otb::gl::Id_t;
/** Default constructor */
Handle()
{
Policy::Generate( m_Id );
assert( m_Id );
CheckError();
Policy::Bind( m_Id );
CheckError();
}
/** Destructor */
~Handle()
{
Release();
}
/** Copy constructor (disabled). */
Handle( Handle const & ) = delete;
/** Assignement operator (disabled). */
Handle & operator = ( Handle const & ) = delete;
/** Move constructor. */
Handle( Handle && rhs ) noexcept :
m_Id( std::exchange( rhs.m_Id, 0 ) ) {}
/** Move assignment operator. */
Handle &
operator = ( Handle && rhs )
{
Release();
m_Id = std::exchange( rhs.m_Id, GL_ZERO );
return *this;
}
/** Cast operator. */
operator Id_t() const noexcept
{
return m_Id;
}
/** OpenGL handle binding */
void
Bind( bool isEnabled = true ) const
{
assert( m_Id );
Policy::Bind( isEnabled ? m_Id : GL_ZERO );
CheckError();
}
protected:
/** OpenGL handle identifier (handler) */
Id_t m_Id = GL_ZERO;
private:
void
Release()
{
CheckError< error::clear >();
Policy::Release( m_Id );
m_Id = GL_ZERO;
CheckError();
}
};
} // end namespace gl.
} // end namespace otb.
#endif // otb_GlHandle_h
......@@ -26,7 +26,6 @@
#include "itkCenteredRigid2DTransform.h"
#include "otbFragmentShader.h"
#include "otbGenericRSTransform.h"
#include "otbGeoInterface.h"
#include "otbGlActor.h"
......@@ -35,12 +34,19 @@
#include "otbMultiChannelExtractROI.h"
#include "otbVectorRescaleIntensityImageFilter.h"
#include "otbVectorImage.h"
#include <string>
namespace otb
{
namespace gl
{
struct Mesh;
}
class OTBIce_EXPORT GlImageActor
: public GlActor, public GeoInterface
{
......@@ -125,11 +131,7 @@ public:
itkSetMacro(TileSize,unsigned int);
itkGetMacro(TileSize,unsigned int);
itkBooleanMacro(SoftwareRendering );
itkSetMacro(SoftwareRendering, bool );
itkGetMacro(SoftwareRendering, bool );
void CreateShader();
void CreateShader() override;
void SetResolutionAlgorithm(ResolutionAlgorithm::type alg)
{
......@@ -181,9 +183,6 @@ public:
bool GetPixel( const PointType & physical, PixelType & pixel, IndexType & index ) const;
itkGetObjectMacro(Shader,FragmentShader);
itkSetObjectMacro(Shader,FragmentShader);
itkGetObjectMacro( ImageSettings, ImageSettings );
//
......@@ -216,33 +215,23 @@ protected:
class Tile
{
public:
Tile()
: m_Loaded(false),
m_TextureId(0),
m_ImageRegion(),
m_TileSize(0),
m_Image(),
m_UL(),
m_UR(),
m_LL(),
m_LR(),
m_Resolution(1),
m_RedIdx(1),
m_GreenIdx(2),
m_BlueIdx(3),
m_RescaleFilter(nullptr)
{
m_UL.Fill(0);
m_UR.Fill(0);
m_LL.Fill(0);
m_LR.Fill(0);
}
Tile();
~Tile();
void Link( ReaderType::OutputImageType * );
ReaderType::OutputImageType::Pointer const &
Image() const noexcept
{ return m_Image; }
void Acquire() noexcept;
void Release();
bool m_Loaded;
unsigned int m_TextureId;
RegionType m_ImageRegion;
unsigned int m_TileSize;
VectorImageType::Pointer m_Image;
PointType m_UL;
PointType m_UR;
PointType m_LL;
......@@ -252,9 +241,13 @@ protected:
unsigned int m_GreenIdx;
unsigned int m_BlueIdx;
RescaleFilterType::Pointer m_RescaleFilter;
private:
VectorImageType::Pointer m_Image;
};
typedef std::vector<Tile> TileVectorType;
typedef std::list< Tile > TileVectorType;
private:
// prevent implementation
......@@ -308,7 +301,6 @@ private:
unsigned int m_NumberOfComponents;
ImageSettings::Pointer m_ImageSettings;
FragmentShader::Pointer m_Shader;
RSTransformType::Pointer m_ViewportToImageTransform;
RSTransformType::Pointer m_ImageToViewportTransform;
......@@ -318,7 +310,8 @@ private:
ResolutionAlgorithm::type m_ResolutionAlgorithm;
bool m_SoftwareRendering;
/** OpenGL quad. */
std::unique_ptr< gl::Mesh > m_Mesh;
}; // End class GlImageActor
......
/*
* Copyright (C) 2005-2019 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.
*/
#ifndef otb_GlMesh_h
#define otb_GlMesh_h
#include "OTBIceExport.h"
#include "otbGlVertexArrayObject.h"
#include "otbGlBufferObject.h"
namespace otb { namespace gl {
/**
* @class OpenGL mesh.
*/
struct Mesh
{
Mesh() = default;
template< typename VT,
typename IT = GLuint >
Mesh( std::initializer_list< VT > vertices,
std::size_t components,
std::initializer_list< IT > indices ) :
m_VBO( vertices, components ),
m_IBO( indices, 3 )
{}
Mesh( Mesh && ) = default;
// Mesh & operator = ( Mesh && ) = default;
// Mesh( Mesh && m ) :
// m_VAO( std::move( m.m_VAO ) ),
// m_VBO( std::move( m.m_VBO ) ),
// m_IBO( std::move( m.m_IBO ) )
// {}
void
Bind( bool isEnabled = true )
{
assert( glIsBuffer( m_VBO ) );
assert( glIsBuffer( m_IBO ) );
assert( glIsVertexArray( m_VAO ) );
m_VAO.Bind( isEnabled );
m_VBO.Bind( isEnabled );
m_IBO.Bind( isEnabled );
}
void
VertexAttribPointer( VertexBufferObject::Id_t id,
std::size_t components,
std::ptrdiff_t first = 0 ) const;
VertexBufferObject const &
VBO() const noexcept
{
return m_VBO;
}
IndexBufferObject const &
IBO() const
{
return m_IBO;
}
private:
VertexArrayObject m_VAO;
VertexBufferObject m_VBO;
IndexBufferObject m_IBO;
};
Mesh MakeTexturedQuad( Id_t xy, Id_t uv );
Mesh MakeInterleavedTexturedQuad( Id_t xy, Id_t uv );
Mesh MakeQuad( Id_t xy);
} // end namespace gl.
} // end namespace otb.
#endif // otb_GlMesh_h
......@@ -24,7 +24,6 @@
#include "otbGlActor.h"
#include "otbGenericRSTransform.h"
#include "otbFragmentShader.h"
#include "otbImageKeywordlist.h"
#include "itkImageRegion.h"
#include "itkVector.h"
......@@ -33,6 +32,11 @@
namespace otb
{
namespace gl
{
struct Mesh;
}
class OTBIce_EXPORT GlROIActor
: public GlActor
{
......@@ -61,6 +65,8 @@ public:
// Gl rendering of current state
void Render() override;
void CreateShader() override;
void SetUL( const PointType & );
itkGetConstReferenceMacro(UL,PointType);
......@@ -105,6 +111,7 @@ private:
ColorType m_Color;
double m_Alpha;
double m_CurrentAlpha;
bool m_Fill;
RSTransformType::Pointer m_ViewportToImageTransform;
......@@ -115,6 +122,9 @@ private:
PointType m_VpLL;
PointType m_VpLR;
/** OpenGL quad. */
std::unique_ptr< gl::Mesh > m_Mesh;
}; // End class GlROIActor
} // End namespace otb
......
/*
* Copyright (C) 2005-2019 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.
*/
#ifndef otb_GlTypeTraits_h
#define otb_GlTypeTraits_h
#include "OTBIceExport.h"
#ifdef _WIN32
# include <windows.h>
#endif
#include <GL/glew.h>
namespace otb { namespace gl {
using Id_t = GLuint;
/**
* @class traits to associate (OpenGL) type to its GLenum value.
*/
template< typename T >
struct TypeTraits
{
/** OpenGL type */
using Type = T;
/** OpenGL type enum */
static constexpr GLenum value() noexcept;
static char const * name() noexcept;
};
/** Define OpenGL type to its GLenum value */
#define OTB_GL_TYPE_TRAITS( type, glenum, glname ) \
/** OpenGL type to GLenum association. */ \
template<> \
struct TypeTraits< type > \
{ \
static constexpr GLenum value() noexcept { return glenum; } \
\
static constexpr char const * name() noexcept { return glname; } \
}
OTB_GL_TYPE_TRAITS( GLfloat, GL_FLOAT, "GLfloat" );
OTB_GL_TYPE_TRAITS( GLdouble, GL_DOUBLE, "GLdouble" );
OTB_GL_TYPE_TRAITS( GLint, GL_INT, "GLint" );
OTB_GL_TYPE_TRAITS( GLuint, GL_UNSIGNED_INT, "GLuint" );
} // end namespace gl.
} // end namespace otb.
#endif // otb_TypeTraits_h