Commit 10c64654 authored by remi cresson's avatar remi cresson
Browse files

ENH: create output no-data

No related merge requests found
Showing with 19 additions and 2 deletions
+19 -2
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
// Projection // Projection
#include "otbGenericRSTransform.h" #include "otbGenericRSTransform.h"
// No-data
#include "otbChangeInformationImageFilter.h"
using namespace std; using namespace std;
namespace otb namespace otb
...@@ -74,6 +77,9 @@ public: ...@@ -74,6 +77,9 @@ public:
typedef otb::GenericMapProjection<otb::TransformDirection::FORWARD> MapProjectionType; typedef otb::GenericMapProjection<otb::TransformDirection::FORWARD> MapProjectionType;
typedef RSTransformType::InputPointType Point3DType; typedef RSTransformType::InputPointType Point3DType;
/** no-data */
typedef otb::ChangeInformationImageFilter<FloatVectorImageType> ChangeInfoFilterType;
void DoInit() void DoInit()
{ {
SetName("ExtractGeom"); SetName("ExtractGeom");
...@@ -211,7 +217,18 @@ public: ...@@ -211,7 +217,18 @@ public:
m_ExtractFilter->SetInput(m_MaskFilter->GetOutput()); m_ExtractFilter->SetInput(m_MaskFilter->GetOutput());
m_ExtractFilter->SetExtractionRegion(roi); m_ExtractFilter->SetExtractionRegion(roi);
SetParameterOutputImage("out", m_ExtractFilter->GetOutput()); /* Change no-data value */
std::vector<bool> flags;
std::vector<double> values;
unsigned int nbBands = xs->GetNumberOfComponentsPerPixel();
flags.resize(nbBands, true);
values.resize(nbBands, 0.0);
m_MetaDataChanger = ChangeInfoFilterType::New();
m_MetaDataChanger->SetInput(m_ExtractFilter->GetOutput());
m_MetaDataChanger->SetOutputMetaData<std::vector<bool> >(otb::MetaDataKey::NoDataValueAvailable,&flags);
m_MetaDataChanger->SetOutputMetaData<std::vector<double> >(otb::MetaDataKey::NoDataValue,&values);
SetParameterOutputImage("out", m_MetaDataChanger->GetOutput());
} }
...@@ -219,7 +236,7 @@ public: ...@@ -219,7 +236,7 @@ public:
VectorDataReprojFilterType::Pointer m_VectorDataReprojectionFilter; VectorDataReprojFilterType::Pointer m_VectorDataReprojectionFilter;
RasteriseFilterType::Pointer m_RasterizeFilter; RasteriseFilterType::Pointer m_RasterizeFilter;
MaskFilterType::Pointer m_MaskFilter; MaskFilterType::Pointer m_MaskFilter;
ChangeInfoFilterType::Pointer m_MetaDataChanger;
}; };
} }
} }
......
Supports Markdown
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