Commit d07c97a7 authored by Antoine Regimbeau's avatar Antoine Regimbeau

MRG: Merge branch 'develop' into deprecate-mapnik

parents a7cb4257 f89f4007
......@@ -37,9 +37,11 @@ List or link documentation modifications that were made (doxygen, example, Softw
The copyright owner is *COPYRIGHT OWNER (OR OWNER'S AGENT)* and has signed the ORFEO ToolBox Contributor License Agreement.
<hr>
***Check before merging:***
- All discussions are resolved
- At least 2 :thumbsup: votes from core developers, no :thumbsdown: vote.
- The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
\ No newline at end of file
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
......@@ -3,8 +3,8 @@ Advanced Use
This section describes advanced configuration options and tricks.
Environment variables that affects Orfeo ToolBox
------------------------------------------------
Environment variables that affect Orfeo ToolBox
-----------------------------------------------
The following environment variables are parsed by Orfeo ToolBox. Note
that they only affect default values, and that settings in extended
......
......@@ -52,8 +52,9 @@ public:
"validation sets per class and per image.\n Several classifier parameters can be set depending on the chosen classifier. In the "
"validation process, the confusion matrix is organized the following way: rows = reference labels, columns = produced labels. "
"In the header of the optional confusion matrix output file, the validation (reference) and predicted (produced) class labels"
" are ordered according to the rows/columns of the confusion matrix.\n This application is based on LibSVM and OpenCV Machine Learning "
"(2.3.1 and later)." );
" are ordered according to the rows/columns of the confusion matrix.\n This application is based on LibSVM, OpenCV Machine Learning "
"(2.3.1 and later), and Shark ML. The output of this application is a text model file, whose format corresponds to the "
"ML model type chosen. There is no image nor vector data output." );
SetDocLimitations( "None" );
SetDocAuthors( "OTB-Team" );
SetDocSeeAlso( "OpenCV documentation for machine learning http://docs.opencv.org/modules/ml/doc/ml.html " );
......
......@@ -63,7 +63,10 @@ protected:
SetDocName( "Train Vector Classifier" );
SetDocLongDescription( "This application trains a classifier based on "
"labeled geometries and a list of features to consider for "
"classification." );
"classification.\nThis application is based on LibSVM, OpenCV Machine "
"Learning (2.3.1 and later), and Shark ML The output of this application "
"is a text model file, whose format corresponds to the ML model type "
"chosen. There is no image nor vector data output.");
SetDocLimitations( " " );
SetDocAuthors( "OTB Team" );
SetDocSeeAlso( " " );
......
......@@ -138,7 +138,7 @@ LearningApplicationBase<TInputValue,TOutputValue>
RGBAPixelConverter<int,int>::Pointer dummyFilter =
RGBAPixelConverter<int,int>::New();
dummyFilter->SetProgress(0.0f);
this->AddProcess(dummyFilter,"Classify...");
this->AddProcess(dummyFilter,"Validation...");
dummyFilter->InvokeEvent(itk::StartEvent());
// load a machine learning model from file and predict the input sample list
......@@ -169,6 +169,7 @@ LearningApplicationBase<TInputValue,TOutputValue>
typename TargetListSampleType::Pointer trainingLabeledListSample,
std::string modelPath)
{
otbAppLogINFO("Computing model file : "<<modelPath);
// Setup fake reporter
RGBAPixelConverter<int,int>::Pointer dummyFilter =
RGBAPixelConverter<int,int>::New();
......
......@@ -208,7 +208,7 @@ public:
/** Convenience method returns the IOPixelType as a string. This can be
* used for writing output files. */
std::string GetPixelTypeAsString(IOPixelType) const;
static std::string GetPixelTypeAsString(IOPixelType);
/** Enums used to specify write style: whether binary or ASCII. Some
* subclasses use this, some ignore it. */
......@@ -255,11 +255,11 @@ public:
/** Convenience method returns the FileType as a string. This can be
* used for writing output files. */
std::string GetFileTypeAsString(FileType) const;
static std::string GetFileTypeAsString(FileType);
/** Convenience method returns the ByteOrder as a string. This can be
* used for writing output files. */
std::string GetByteOrderAsString(ByteOrder) const;
static std::string GetByteOrderAsString(ByteOrder);
/** Type for representing size of bytes, and or positions along a file */
typedef std::streamoff SizeType;
......
......@@ -709,7 +709,7 @@ unsigned int ImageIOBase::GetComponentSize() const
return 0;
}
std::string ImageIOBase::GetFileTypeAsString(FileType t) const
std::string ImageIOBase::GetFileTypeAsString(FileType t)
{
std::string s;
switch(t)
......@@ -724,7 +724,7 @@ std::string ImageIOBase::GetFileTypeAsString(FileType t) const
}
}
std::string ImageIOBase::GetByteOrderAsString(ByteOrder t) const
std::string ImageIOBase::GetByteOrderAsString(ByteOrder t)
{
std::string s;
switch(t)
......@@ -778,7 +778,7 @@ std::string ImageIOBase::GetComponentTypeAsString(IOComponentType t)
}
}
std::string ImageIOBase::GetPixelTypeAsString(IOPixelType t) const
std::string ImageIOBase::GetPixelTypeAsString(IOPixelType t)
{
std::string s;
switch(t)
......@@ -805,7 +805,7 @@ std::string ImageIOBase::GetPixelTypeAsString(IOPixelType t) const
return (s = "complex");
case UNKNOWNPIXELTYPE:
default:
itkExceptionMacro ("Unknown pixel type: " << t);
return (s = "unknown");
}
}
......@@ -1325,13 +1325,13 @@ void ImageIOBase::PrintSelf(std::ostream& os, itk::Indent indent) const
Superclass::PrintSelf(os, indent);
os << indent << "FileName: " << m_FileName << std::endl;
os << indent << "FileType: " << this->GetFileTypeAsString(m_FileType) << std::endl;
os << indent << "ByteOrder: " << this->GetByteOrderAsString(m_ByteOrder) << std::endl;
os << indent << "FileType: " << ImageIOBase::GetFileTypeAsString(m_FileType) << std::endl;
os << indent << "ByteOrder: " << ImageIOBase::GetByteOrderAsString(m_ByteOrder) << std::endl;
os << indent << "IORegion: " << std::endl;
m_IORegion.Print(os, indent.GetNextIndent());
os << indent << "Number of Components/Pixel: " << m_NumberOfComponents << "\n";
os << indent << "Pixel Type: " << this->GetPixelTypeAsString(m_PixelType) << std::endl;
os << indent << "Component Type: " << this->GetComponentTypeAsString(m_ComponentType)
os << indent << "Pixel Type: " << ImageIOBase::GetPixelTypeAsString(m_PixelType) << std::endl;
os << indent << "Component Type: " << ImageIOBase::GetComponentTypeAsString(m_ComponentType)
<< std::endl;
os << indent << "Dimensions: ( ";
for (unsigned int i=0; i < m_NumberOfDimensions; i++)
......
......@@ -183,7 +183,6 @@ private:
bool IsInsideWithNeighborhoodRadius(const RegionType& region, const ContinuousIndexType &index) const
{
typedef typename RegionType::IndexType IndexType;
typedef typename IndexType::IndexValueType IndexValueType;
typedef typename ContinuousIndexType::ValueType ContinuousIndexValueType;
......
......@@ -194,7 +194,6 @@ private:
bool
IsInsideWithNeighborhoodRadius(const RegionType& region, const ContinuousIndexType &index) const
{
typedef typename RegionType::IndexType IndexType;
typedef typename IndexType::IndexValueType IndexValueType;
for(unsigned int i=0; i<ImageDimension; ++i)
......
......@@ -58,7 +58,7 @@ ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet>
m_GradientMagnitudeThreshold = 0.2;
m_ExpandFilter = ExpandFilterType::New();
const double HistogramGaussianWeights[73] = {
2.3771112282795414e-07, 3.8860734758633732e-07, 6.2655544995978937e-07, 9.9631120821413786e-07,
1.5624909838697011e-06, 2.4167238265599128e-06, 3.6865788528530121e-06,
......@@ -82,9 +82,9 @@ ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet>
2.4167238265599128e-06, 1.5624909838697011e-06, 9.9631120821413786e-07,
6.2655544995978937e-07, 3.8860734758633732e-07, 2.3771112282795414e-07
};
m_HistogramGaussianWeights = std::vector<double>(HistogramGaussianWeights,HistogramGaussianWeights+73);
m_Offsets[0][0]=-1;
m_Offsets[0][1]=-1;
m_Offsets[1][0]=-1;
......@@ -896,9 +896,7 @@ void
ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
typedef itk::ProcessObject ProcessObjectType;
const OutputPointSetType* output = dynamic_cast<const OutputPointSetType*>(this->ProcessObjectType::GetOutput(0));
const OutputPointSetType* output = dynamic_cast<const OutputPointSetType*>(this->Superclass::ProcessObjectType::GetOutput(0));
Superclass::PrintSelf(os, indent);
os << indent << "Number of octaves: " << m_OctavesNumber << std::endl;
......
......@@ -57,12 +57,6 @@ KullbackLeiblerSupervizedDistance<TInput1, TInput2, TInputROIImage, TOutput>
const typename TInput2::ImageType * img2,
const TInputROIImage * imgROI)
{
typedef ROIdataConversion<typename TInput1::ImageType, TInputROIImage>
ROIConversionType1;
typedef itk::ConstNeighborhoodIterator<
typename ROIConversionType1::OutputImageType> ROIInputType1;
typename ROIConversionType1::Pointer conversion1 = ROIConversionType1::New();
conversion1->SetInputImage(img1);
conversion1->SetROIImage(imgROI);
......
......@@ -43,8 +43,6 @@ typename CompacityPathFunction<TInputPath,
CompacityPathFunction<TInputPath, TOutput>
::Evaluate(const PathType& path) const
{
typedef double RealType;
VertexListPointer vertexList;
VertexType cindex;
VertexType IndexOut;
......
......@@ -44,8 +44,6 @@ typename OrientationPathFunction<TInputPath,
OrientationPathFunction<TInputPath, TOutput>
::Evaluate(const PathType& path) const
{
typedef double RealType;
VertexListPointer vertexList;
VertexType cindex;
VertexType IndexOut;
......
......@@ -1313,7 +1313,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
}
else
{
itkExceptionMacro(<< "This complex type is not defined :" << this->GetPixelTypeAsString(this->GetPixelType()) );
itkExceptionMacro(<< "This complex type is not defined :" << ImageIOBase::GetPixelTypeAsString(this->GetPixelType()) );
}
}
else
......
......@@ -384,13 +384,13 @@ void ONERAImageIO::InternalReadImageInformation()
otbMsgDebugMacro(<< "Driver to read: ONERA");
otbMsgDebugMacro(<< " Read file : " << m_FileName);
otbMsgDebugMacro(<< " Size : " << m_Dimensions[0] << "," << m_Dimensions[1]);
otbMsgDebugMacro(<< " PixelType : " << this->GetPixelTypeAsString(this->GetPixelType()));
otbMsgDebugMacro(<< " ComponentType : " << this->GetComponentTypeAsString(this->GetComponentType()));
otbMsgDebugMacro(<< " PixelType : " << ImageIOBase::GetPixelTypeAsString(this->GetPixelType()));
otbMsgDebugMacro(<< " ComponentType : " << ImageIOBase::GetComponentTypeAsString(this->GetComponentType()));
otbMsgDebugMacro(<< " ComponentSize : " << this->GetComponentSize());
otbMsgDebugMacro(<< " NumberOfComponents : " << this->GetNumberOfComponents());
otbMsgDebugMacro(<< " BytePerPixel : " << m_BytePerPixel);
otbMsgDebugMacro(<< " Host byte order : " << this->GetByteOrderAsString(m_ByteOrder));
otbMsgDebugMacro(<< " File byte order : " << this->GetByteOrderAsString(m_FileByteOrder));
otbMsgDebugMacro(<< " Host byte order : " << ImageIOBase::GetByteOrderAsString(m_ByteOrder));
otbMsgDebugMacro(<< " File byte order : " << ImageIOBase::GetByteOrderAsString(m_FileByteOrder));
delete [] sHeader;
}
......@@ -595,7 +595,7 @@ void ONERAImageIO::InternalWriteImageInformation()
otbMsgDebugMacro(<< " ComponentType : " << this->GetComponentType());
otbMsgDebugMacro(<< " NumberOfComponents : " << this->GetNumberOfComponents());
otbMsgDebugMacro(<< " BytePerPixel : " << m_BytePerPixel);
otbMsgDebugMacro(<< " Host byte order : " << this->GetByteOrderAsString(m_ByteOrder));
otbMsgDebugMacro(<< " Host byte order : " << ImageIOBase::GetByteOrderAsString(m_ByteOrder));
}
} // end namespace otb
......@@ -618,8 +618,8 @@ void RADImageIO::WriteImageInformation()
m_HeaderFile << "TYPECODAGE ";
std::string lExtension;
std::string lStringPixelType = itksys::SystemTools::UpperCase(this->GetPixelTypeAsString(m_PixelType));
std::string lStringComponentType = itksys::SystemTools::UpperCase(this->GetComponentTypeAsString(this->GetComponentType()));
std::string lStringPixelType = itksys::SystemTools::UpperCase(ImageIOBase::GetPixelTypeAsString(m_PixelType));
std::string lStringComponentType = itksys::SystemTools::UpperCase(ImageIOBase::GetComponentTypeAsString(this->GetComponentType()));
if (lStringPixelType == "SCALAR")
{
......
......@@ -889,7 +889,7 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
std::ostringstream msg;
msg <<"Couldn't convert component type: "
<< std::endl << " "
<< m_ImageIO->GetComponentTypeAsString(m_ImageIO->GetComponentType())
<< ImageIOBase::GetComponentTypeAsString(m_ImageIO->GetComponentType())
<< std::endl << "to one of: "
<< std::endl << " " << typeid(unsigned char).name()
<< std::endl << " " << typeid(char).name()
......
......@@ -88,12 +88,13 @@ public:
typedef typename InputGraphType::VertexDescriptorType VertexDescriptorType;
typedef typename InputGraphType::RCC8ValueType RCC8ValueType;
typedef typename VertexType::AttributesMapType AttributesMapType;
typedef typename AttributesMapType::iterator IteratorType;
/** Set the filename */
itkSetStringMacro(FileName);
/** Get the filename */
itkGetStringMacro(FileName);
using Superclass::SetInput;
/**
* Set the input graph.
......
......@@ -203,7 +203,6 @@ RCC8GraphFileWriter<TInputGraph>
::WriteVertex(std::ofstream& of, VertexDescriptorType index,
VertexPointerType vertex)
{
typedef typename VertexType::AttributesMapType AttributesMapType;
typedef typename AttributesMapType::iterator IteratorType;
AttributesMapType attr = vertex->GetAttributesMap();
otbMsgDevMacro(<< "RCC8GraphFileWriter: WriteVertex call: " << index);
......
......@@ -137,6 +137,11 @@ public:
itkGetConstReferenceMacro(BurnAttributeMode,bool);
itkBooleanMacro(BurnAttributeMode);
/** Set/Get the AllTouchedMode flag */
itkSetMacro(AllTouchedMode,bool);
itkGetConstReferenceMacro(AllTouchedMode,bool);
itkBooleanMacro(AllTouchedMode);
/** Useful to set the output parameters from an existing image*/
void SetOutputParametersFromImage(const ImageBaseType * image);
......@@ -169,6 +174,7 @@ private:
OutputImageInternalPixelType m_BackgroundValue;
OutputImageInternalPixelType m_ForegroundValue;
bool m_BurnAttributeMode;
bool m_AllTouchedMode;
}; // end of class VectorDataToLabelImageFilter
} // end of namespace otb
......
......@@ -39,7 +39,8 @@ OGRDataSourceToLabelImageFilter<TOutputImage>
::OGRDataSourceToLabelImageFilter() : m_BurnAttribute("DN"),
m_BackgroundValue(0),
m_ForegroundValue(255),
m_BurnAttributeMode(true)
m_BurnAttributeMode(true),
m_AllTouchedMode(false)
{
this->SetNumberOfRequiredInputs(1);
......@@ -129,7 +130,7 @@ OGRDataSourceToLabelImageFilter<TOutputImage>
this->SetOutputOrigin ( image->GetOrigin() );
this->SetOutputSpacing ( internal::GetSignedSpacing( image ) );
this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() );
ImageMetadataInterfaceBase::Pointer imi = ImageMetadataInterfaceFactory::CreateIMI(image->GetMetaDataDictionary());
this->SetOutputProjectionRef(imi->GetProjectionRef());
......@@ -251,6 +252,10 @@ OGRDataSourceToLabelImageFilter<TOutputImage>::GenerateData()
{
options.push_back("ATTRIBUTE="+m_BurnAttribute);
}
if(m_AllTouchedMode)
{
options.push_back("ALL_TOUCHED=TRUE");
}
GDALRasterizeLayers( dataset, nbBands,
&m_BandsToBurn[0],
......
......@@ -99,6 +99,11 @@ public:
typedef itk::DataObject DataObjectType;
/** Set/Get the AllTouchedMode flag */
itkSetMacro(AllTouchedMode,bool);
itkGetConstReferenceMacro(AllTouchedMode,bool);
itkBooleanMacro(AllTouchedMode);
const InputImageType * GetInput();
const DataObjectType* GetInput(unsigned int idx);
......@@ -163,6 +168,7 @@ private:
std::vector<double> m_BurnValues;
std::vector<double> m_FullBurnValues;
std::vector<int> m_BandsToBurn;
bool m_AllTouchedMode;
}; // end of class RasterizeVectorDataFilter
......
......@@ -30,7 +30,8 @@ namespace otb
template<class TVectorData, class TInputImage, class TOutputImage>
RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>
::RasterizeVectorDataFilter()
: m_OGRDataSourcePointer(nullptr)
: m_OGRDataSourcePointer(nullptr),
m_AllTouchedMode(false)
{
this->SetNumberOfRequiredInputs(1);
}
......@@ -188,6 +189,12 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData(
geoTransform[4] = 0.;
GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer()));
char **options = nullptr;
if (m_AllTouchedMode)
{
options = CSLSetNameValue(options, "ALL_TOUCHED", "TRUE");
}
// Burn the geometries into the dataset
if (dataset != nullptr)
{
......@@ -196,9 +203,11 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData(
m_SrcDataSetLayers.size(),
&(m_SrcDataSetLayers[0]),
nullptr, nullptr, &(m_FullBurnValues[0]),
nullptr,
options,
GDALDummyProgress, nullptr );
CSLDestroy(options);
// release the dataset
GDALClose( dataset );
}
......
......@@ -129,6 +129,11 @@ public:
itkSetMacro(DefaultBurnValue, OutputImageInternalPixelType);
itkGetMacro(DefaultBurnValue, OutputImageInternalPixelType);
/** Set/Get the AllTouchedMode flag */
itkSetMacro(AllTouchedMode,bool);
itkGetConstReferenceMacro(AllTouchedMode,bool);
itkBooleanMacro(AllTouchedMode);
/** Useful to set the output parameters from an existing image*/
void SetOutputParametersFromImage(const ImageBaseType * image);
......@@ -176,6 +181,9 @@ private:
// Background value
OutputImageInternalPixelType m_BackgroundValue;
// All touched mode
bool m_AllTouchedMode;
// Output params
std::string m_OutputProjectionRef;
OutputSpacingType m_OutputSpacing;
......
......@@ -40,7 +40,8 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>
m_BandsToBurn(1, 1),
m_BurnAttribute("FID"),
m_DefaultBurnValue(1.),
m_BackgroundValue(0.)
m_BackgroundValue(0.),
m_AllTouchedMode(false)
{
this->SetNumberOfRequiredInputs(1);
......@@ -262,7 +263,7 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData()
// Fill the buffer with the background value
this->GetOutput()->FillBuffer(m_BackgroundValue);
// nb bands
unsigned int nbBands = this->GetOutput()->GetNumberOfComponentsPerPixel();
......@@ -303,6 +304,12 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData()
geoTransform[4] = 0.;
GDALSetGeoTransform(dataset,const_cast<double*>(geoTransform.GetDataPointer()));
char **options = nullptr;
if (m_AllTouchedMode)
{
options = CSLSetNameValue(options, "ALL_TOUCHED", "TRUE");
}
// Burn the geometries into the dataset
if (dataset != nullptr)
{
......@@ -311,9 +318,11 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData()
m_SrcDataSetGeometries.size(),
&(m_SrcDataSetGeometries[0]),
nullptr, nullptr, &(m_FullBurnValues[0]),
nullptr,
options,
GDALDummyProgress, nullptr );
CSLDestroy(options);
// release the dataset
GDALClose( dataset );
}
......
......@@ -295,7 +295,6 @@ VectorDataToLabelMapFilter<TVectorData, TLabelMap>
CorrectFunctorType correct;
PolygonPointerType correctPolygonExtRing = correct(dataNode->GetPolygonExteriorRing());
typedef typename DataNodeType::PolygonType PolygonType;
typedef typename PolygonType::RegionType RegionType;
typedef typename PolygonType::VertexType VertexType;
typedef typename IndexType::IndexValueType IndexValueType;
......
......@@ -298,7 +298,7 @@ VectorImageModel
// Get build-context settings.
VectorImageSettings * const settings =
static_cast< VectorImageSettings * const >( buildContext->m_Settings );
static_cast< VectorImageSettings * >( buildContext->m_Settings );
// Fetch the no data flags if any
......
......@@ -378,7 +378,7 @@ TreeWidget
}
/*******************************************************************************/
void
void
TreeWidget
::dragMoveEvent( QDragMoveEvent* e )
{
......@@ -435,7 +435,7 @@ TreeWidget
}
/*******************************************************************************/
void
void
TreeWidget
::dropEvent( QDropEvent* e )
{
......@@ -443,8 +443,6 @@ TreeWidget
// qDebug() << this << "::dropEvent(" << e << ")";
typedef QList< QTreeWidgetItem* > QTreeWidgetItemList;
QTreeWidgetItemList itemList;
DecodeMimeData( itemList, e->mimeData() );
......@@ -467,7 +465,7 @@ TreeWidget
while( !item->flags().testFlag( Qt::ItemIsDropEnabled ) )
{
item = item->parent();
assert( item!=NULL );
assert( item!=NULL );
#if 1
qDebug()
......@@ -533,7 +531,7 @@ operator << ( QDataStream& out, QTreeWidgetItem const * item )
"QDataStream& operator << ( QDataStream&, QTreeWidgetItem const * & );";
*/
#if 0 // operator >> is used in QT5 this lead to wrong call, fix: comment or
#if 0 // operator >> is used in QT5 this lead to wrong call, fix: comment or
// put operator >> def and decl in a specific namespace.
return operator << < QTreeWidgetItem >( out, item );
......@@ -554,7 +552,7 @@ operator >>( QDataStream& in, QTreeWidgetItem * & item )
"QDataStream& operator >> ( QDataStream&, QTreeWidgetItem * & );";
*/
#if 0
#if 0
return operator >> < QTreeWidgetItem >( in, item );
#else // DATA_STREAM_USE_TEMPLATE_OPERATORS
......
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