Skip to content
Snippets Groups Projects
Commit e0271529 authored by Victor Poughon's avatar Victor Poughon
Browse files

Merge branch 'update_clang_format' into 'develop'

Update .clang-format

See merge request orfeotoolbox/otb!273
parents bb8be1c6 06fdb343
Branches
Tags
No related merge requests found
---
Language: Cpp
BasedOnStyle: Mozilla
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: GNU
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 200
# ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
BreakBeforeBraces: Allman
ColumnLimit: 160
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
Language: Cpp
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 0
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: true
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: Cpp03
SortIncludes: false
Standard: Cpp11
TabWidth: 2
UseTab: Never
...
......@@ -19,7 +19,6 @@
*/
// Software Guide : BeginCommandLineArgs
// INPUTS: {QB_Suburb.png}
// INPUTS: {QB_Suburb13x17y.png}
......@@ -68,52 +67,51 @@
class CommandIterationUpdate : public itk::Command
{
public:
typedef CommandIterationUpdate Self;
typedef itk::Command Superclass;
typedef CommandIterationUpdate Self;
typedef itk::Command Superclass;
typedef itk::SmartPointer<Self> Pointer;
itkNewMacro(Self);
protected:
CommandIterationUpdate() {}
CommandIterationUpdate()
{
}
public:
typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
typedef const OptimizerType * OptimizerPointer;
typedef const OptimizerType* OptimizerPointer;
void Execute(itk::Object *caller, const itk::EventObject& event) override
void Execute(itk::Object* caller, const itk::EventObject& event) override
{
Execute((const itk::Object *) caller, event);
Execute((const itk::Object*)caller, event);
}
void Execute(const itk::Object * object, const itk::EventObject& event) override
void Execute(const itk::Object* object, const itk::EventObject& event) override
{
OptimizerPointer optimizer =
dynamic_cast<OptimizerPointer>(object);
OptimizerPointer optimizer = dynamic_cast<OptimizerPointer>(object);
if (!itk::IterationEvent().CheckEvent(&event))
{
{
return;
}
}
std::cout << optimizer->GetCurrentIteration() << " = ";
std::cout << optimizer->GetValue() << " : ";
std::cout << optimizer->GetCurrentPosition() << std::endl;
}
};
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
if (argc < 4)
{
{
std::cerr << "Missing Parameters " << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " fixedImageFile movingImageFile ";
std::cerr << "outputImagefile [differenceImageAfter]";
std::cerr << "[differenceImageBefore]" << std::endl;
return 1;
}
}
// Software Guide : BeginLatex
//
......@@ -125,7 +123,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
const unsigned int Dimension = 2;
typedef float PixelType;
typedef float PixelType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -170,9 +168,7 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::MeanSquaresImageToImageMetric<
FixedImageType,
MovingImageType> MetricType;
typedef itk::MeanSquaresImageToImageMetric<FixedImageType, MovingImageType> MetricType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -183,9 +179,7 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::LinearInterpolateImageFunction<
MovingImageType,
double> InterpolatorType;
typedef itk::LinearInterpolateImageFunction<MovingImageType, double> InterpolatorType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -197,9 +191,7 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::ImageRegistrationMethod<
FixedImageType,
MovingImageType> RegistrationType;
typedef itk::ImageRegistrationMethod<FixedImageType, MovingImageType> RegistrationType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -211,11 +203,11 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
MetricType::Pointer metric = MetricType::New();
TransformType::Pointer transform = TransformType::New();
OptimizerType::Pointer optimizer = OptimizerType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
RegistrationType::Pointer registration = RegistrationType::New();
MetricType::Pointer metric = MetricType::New();
TransformType::Pointer transform = TransformType::New();
OptimizerType::Pointer optimizer = OptimizerType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
RegistrationType::Pointer registration = RegistrationType::New();
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -239,8 +231,8 @@ int main(int argc, char *argv[])
typedef otb::ImageFileReader<FixedImageType> FixedImageReaderType;
typedef otb::ImageFileReader<MovingImageType> MovingImageReaderType;
FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();
MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();
FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New();
MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New();
fixedImageReader->SetFileName(argv[1]);
movingImageReader->SetFileName(argv[2]);
......@@ -255,11 +247,9 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::MeanImageFilter<
FixedImageType, FixedImageType> FixedFilterType;
typedef itk::MeanImageFilter<FixedImageType, FixedImageType> FixedFilterType;
typedef itk::MeanImageFilter<
MovingImageType, MovingImageType> MovingFilterType;
typedef itk::MeanImageFilter<MovingImageType, MovingImageType> MovingFilterType;
FixedFilterType::Pointer fixedFilter = FixedFilterType::New();
MovingFilterType::Pointer movingFilter = MovingFilterType::New();
......@@ -313,8 +303,7 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
fixedFilter->Update();
registration->SetFixedImageRegion(
fixedFilter->GetOutput()->GetBufferedRegion());
registration->SetFixedImageRegion(fixedFilter->GetOutput()->GetBufferedRegion());
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -336,10 +325,10 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
typedef RegistrationType::ParametersType ParametersType;
ParametersType initialParameters(transform->GetNumberOfParameters());
ParametersType initialParameters(transform->GetNumberOfParameters());
initialParameters[0] = 0.0; // Initial offset in mm along X
initialParameters[1] = 0.0; // Initial offset in mm along Y
initialParameters[0] = 0.0; // Initial offset in mm along X
initialParameters[1] = 0.0; // Initial offset in mm along Y
registration->SetInitialTransformParameters(initialParameters);
// Software Guide : EndCodeSnippet
......@@ -412,15 +401,15 @@ int main(int argc, char *argv[])
// Software Guide : BeginCodeSnippet
try
{
{
registration->Update();
}
}
catch (itk::ExceptionObject& err)
{
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
return -1;
}
}
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -488,10 +477,10 @@ int main(int argc, char *argv[])
// Print out results
//
std::cout << "Result = " << std::endl;
std::cout << " Translation X = " << TranslationAlongX << std::endl;
std::cout << " Translation Y = " << TranslationAlongY << std::endl;
std::cout << " Translation X = " << TranslationAlongX << std::endl;
std::cout << " Translation Y = " << TranslationAlongY << std::endl;
std::cout << " Iterations = " << numberOfIterations << std::endl;
std::cout << " Metric value = " << bestValue << std::endl;
std::cout << " Metric value = " << bestValue << std::endl;
// Software Guide : BeginLatex
//
......@@ -542,9 +531,7 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::ResampleImageFilter<
MovingImageType,
FixedImageType> ResampleFilterType;
typedef itk::ResampleImageFilter<MovingImageType, FixedImageType> ResampleFilterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -624,11 +611,10 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef unsigned char OutputPixelType;
typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
typedef itk::CastImageFilter<FixedImageType,
OutputImageType> CastFilterType;
typedef otb::ImageFileWriter<OutputImageType> WriterType;
typedef unsigned char OutputPixelType;
typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
typedef itk::CastImageFilter<FixedImageType, OutputImageType> CastFilterType;
typedef otb::ImageFileWriter<OutputImageType> WriterType;
// Software Guide : EndCodeSnippet
// Software Guide : BeginLatex
......@@ -639,8 +625,8 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
WriterType::Pointer writer = WriterType::New();
CastFilterType::Pointer caster = CastFilterType::New();
WriterType::Pointer writer = WriterType::New();
CastFilterType::Pointer caster = CastFilterType::New();
// Software Guide : EndCodeSnippet
writer->SetFileName(argv[3]);
......@@ -680,10 +666,7 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::SubtractImageFilter<
FixedImageType,
FixedImageType,
FixedImageType> DifferenceFilterType;
typedef itk::SubtractImageFilter<FixedImageType, FixedImageType, FixedImageType> DifferenceFilterType;
DifferenceFilterType::Pointer difference = DifferenceFilterType::New();
......@@ -715,9 +698,7 @@ int main(int argc, char *argv[])
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::RescaleIntensityImageFilter<
FixedImageType,
OutputImageType> RescalerType;
typedef itk::RescaleIntensityImageFilter<FixedImageType, OutputImageType> RescalerType;
RescalerType::Pointer intensityRescaler = RescalerType::New();
......@@ -740,10 +721,10 @@ int main(int argc, char *argv[])
// Software Guide : EndCodeSnippet
if (argc > 4)
{
{
writer2->SetFileName(argv[4]);
writer2->Update();
}
}
// Software Guide : BeginLatex
//
......@@ -765,10 +746,10 @@ int main(int argc, char *argv[])
// Software Guide : EndCodeSnippet
if (argc > 5)
{
{
writer2->SetFileName(argv[5]);
writer2->Update();
}
}
// Software Guide : BeginLatex
//
......
......@@ -37,187 +37,179 @@ namespace Wrapper
class EdgeExtraction : public Application
{
public:
/** Standard class typedefs. */
typedef EdgeExtraction Self;
typedef Application Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType,FloatImageType::InternalPixelType>
ExtractorFilterType;
typedef itk::GradientMagnitudeImageFilter<FloatImageType, FloatImageType>
GradientFilterType;
typedef itk::SobelEdgeDetectionImageFilter<FloatImageType, FloatImageType>
SobelFilterType;
//typedef itk::CannyEdgeDetectionImageFilter<FloatImageType, FloatImageType>
// CannyFilterType;
typedef TouziEdgeDetectorImageFilter<FloatImageType, FloatImageType>
TouziFilterType;
/** Standard macro */
itkNewMacro(Self);
itkTypeMacro(EdgeExtraction, otb::Application);
/** Standard class typedefs. */
typedef EdgeExtraction Self;
typedef Application Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
private:
typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType, FloatImageType::InternalPixelType> ExtractorFilterType;
typedef itk::GradientMagnitudeImageFilter<FloatImageType, FloatImageType> GradientFilterType;
typedef itk::SobelEdgeDetectionImageFilter<FloatImageType, FloatImageType> SobelFilterType;
// typedef itk::CannyEdgeDetectionImageFilter<FloatImageType, FloatImageType>
// CannyFilterType;
typedef TouziEdgeDetectorImageFilter<FloatImageType, FloatImageType> TouziFilterType;
void DoInit() override
{
SetName("EdgeExtraction");
SetDescription(
"This application computes edge features on every pixel of the input image "
"selected channel");
// Documentation
SetDocName("Edge Feature Extraction");
SetDocLongDescription(
"This application computes edge features on a selected channel of the input."
"It uses different filter such as gradient, Sobel and Touzi");
SetDocLimitations("None");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("otb class");
AddDocTag(Tags::FeatureExtraction);
AddDocTag("Edge");
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in", "The input image on which the features are computed.");
AddParameter(ParameterType_Int, "channel", "Selected Channel");
SetParameterDescription("channel", "The selected channel index");
SetDefaultParameterInt("channel", 1);
SetMinimumParameterIntValue("channel", 1);
AddRAMParameter();
AddParameter(ParameterType_Choice, "filter", "Edge feature");
SetParameterDescription("filter", "Choice of edge feature");
//Gradient Section
AddChoice("filter.gradient", "Gradient");
SetParameterDescription("filter.gradient",
"This filter computes the gradient magnitude of the image at each pixel.");
//Sobel Section
AddChoice("filter.sobel", "Sobel");
SetParameterDescription("filter.sobel",
"This filter uses the Sobel operator to calculate the image gradient and "
"then finds the magnitude of this gradient vector.");
//Touzi Section
AddChoice("filter.touzi", "Touzi");
SetParameterDescription("filter.touzi",
"This filter is more suited for radar images. It has a spatial parameter "
"to avoid speckle noise perturbations. The larger the radius is, "
"less sensible to the speckle noise the filter is, but micro edge will be missed.");
AddParameter(ParameterType_Int, "filter.touzi.xradius",
"The X radius of the neighborhood.");
SetDefaultParameterInt("filter.touzi.xradius", 1);
AddParameter(ParameterType_Int, "filter.touzi.yradius",
"The Y radius of the neighborhood.");
SetDefaultParameterInt("filter.touzi.yradius", 1);
//Canny Section
/*
AddChoice("filter.canny", "Canny");
AddParameter(ParameterType_Float, "filter.canny.variance", "");
SetDefaultParameterFloat("filter.canny.variance", 1.0);
AddParameter(ParameterType_Float, "filter.canny.maximumerror", "");
SetDefaultParameterFloat("filter.canny.maximumerror", 0.01);
AddParameter(ParameterType_Float, "filter.canny.upperthreshold", "");
SetDefaultParameterFloat("filter.canny.upperthreshold", 15.0);
AddParameter(ParameterType_Float, "filter.canny.lowerthreshold", "");
SetDefaultParameterFloat("filter.canny.lowerthreshold", 3.0);
*/
AddParameter(ParameterType_OutputImage, "out", "Feature Output Image");
SetParameterDescription("out", "Output image containing the edge features.");
// Doc example parameter settings
SetDocExampleParameterValue("in", "qb_RoadExtract.tif");
SetDocExampleParameterValue("channel", "1");
SetDocExampleParameterValue("out", "Edges.tif");
SetOfficialDocLink();
}
void DoUpdateParameters() override
{
// Nothing to do here : all parameters are independent
}
/** Standard macro */
itkNewMacro(Self);
void DoExecute() override
{
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
inImage->UpdateOutputInformation();
int nbChan = inImage->GetNumberOfComponentsPerPixel();
itkTypeMacro(EdgeExtraction, otb::Application);
if( GetParameterInt("channel") > nbChan )
private:
void DoInit() override
{
SetName("EdgeExtraction");
SetDescription(
"This application computes edge features on every pixel of the input image "
"selected channel");
// Documentation
SetDocName("Edge Feature Extraction");
SetDocLongDescription(
"This application computes edge features on a selected channel of the input."
"It uses different filter such as gradient, Sobel and Touzi");
SetDocLimitations("None");
SetDocAuthors("OTB-Team");
SetDocSeeAlso("otb class");
AddDocTag(Tags::FeatureExtraction);
AddDocTag("Edge");
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription("in", "The input image on which the features are computed.");
AddParameter(ParameterType_Int, "channel", "Selected Channel");
SetParameterDescription("channel", "The selected channel index");
SetDefaultParameterInt("channel", 1);
SetMinimumParameterIntValue("channel", 1);
AddRAMParameter();
AddParameter(ParameterType_Choice, "filter", "Edge feature");
SetParameterDescription("filter", "Choice of edge feature");
// Gradient Section
AddChoice("filter.gradient", "Gradient");
SetParameterDescription("filter.gradient", "This filter computes the gradient magnitude of the image at each pixel.");
// Sobel Section
AddChoice("filter.sobel", "Sobel");
SetParameterDescription("filter.sobel",
"This filter uses the Sobel operator to calculate the image gradient and "
"then finds the magnitude of this gradient vector.");
// Touzi Section
AddChoice("filter.touzi", "Touzi");
SetParameterDescription("filter.touzi",
"This filter is more suited for radar images. It has a spatial parameter "
"to avoid speckle noise perturbations. The larger the radius is, "
"less sensible to the speckle noise the filter is, but micro edge will be missed.");
AddParameter(ParameterType_Int, "filter.touzi.xradius", "The X radius of the neighborhood.");
SetDefaultParameterInt("filter.touzi.xradius", 1);
AddParameter(ParameterType_Int, "filter.touzi.yradius", "The Y radius of the neighborhood.");
SetDefaultParameterInt("filter.touzi.yradius", 1);
// Canny Section
/*
AddChoice("filter.canny", "Canny");
AddParameter(ParameterType_Float, "filter.canny.variance", "");
SetDefaultParameterFloat("filter.canny.variance", 1.0);
AddParameter(ParameterType_Float, "filter.canny.maximumerror", "");
SetDefaultParameterFloat("filter.canny.maximumerror", 0.01);
AddParameter(ParameterType_Float, "filter.canny.upperthreshold", "");
SetDefaultParameterFloat("filter.canny.upperthreshold", 15.0);
AddParameter(ParameterType_Float, "filter.canny.lowerthreshold", "");
SetDefaultParameterFloat("filter.canny.lowerthreshold", 3.0);
*/
AddParameter(ParameterType_OutputImage, "out", "Feature Output Image");
SetParameterDescription("out", "Output image containing the edge features.");
// Doc example parameter settings
SetDocExampleParameterValue("in", "qb_RoadExtract.tif");
SetDocExampleParameterValue("channel", "1");
SetDocExampleParameterValue("out", "Edges.tif");
SetOfficialDocLink();
}
void DoUpdateParameters() override
{
// Nothing to do here : all parameters are independent
}
void DoExecute() override
{
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
inImage->UpdateOutputInformation();
int nbChan = inImage->GetNumberOfComponentsPerPixel();
if (GetParameterInt("channel") > nbChan)
{
otbAppLogCRITICAL("Selected band is not available...");
return;
otbAppLogCRITICAL("Selected band is not available...");
return;
}
const std::string edgeType = GetParameterString("filter");
const std::string edgeType = GetParameterString("filter");
m_ExtractorFilter = ExtractorFilterType::New();
m_ExtractorFilter->SetInput(inImage);
m_ExtractorFilter->SetStartX(inImage->GetLargestPossibleRegion().GetIndex(0));
m_ExtractorFilter->SetStartY(inImage->GetLargestPossibleRegion().GetIndex(1));
m_ExtractorFilter->SetSizeX(inImage->GetLargestPossibleRegion().GetSize(0));
m_ExtractorFilter->SetSizeY(inImage->GetLargestPossibleRegion().GetSize(1));
m_ExtractorFilter->SetChannel(GetParameterInt("channel"));
m_ExtractorFilter->UpdateOutputInformation();
m_ExtractorFilter = ExtractorFilterType::New();
m_ExtractorFilter->SetInput(inImage);
m_ExtractorFilter->SetStartX(inImage->GetLargestPossibleRegion().GetIndex(0));
m_ExtractorFilter->SetStartY(inImage->GetLargestPossibleRegion().GetIndex(1));
m_ExtractorFilter->SetSizeX(inImage->GetLargestPossibleRegion().GetSize(0));
m_ExtractorFilter->SetSizeY(inImage->GetLargestPossibleRegion().GetSize(1));
m_ExtractorFilter->SetChannel(GetParameterInt("channel"));
m_ExtractorFilter->UpdateOutputInformation();
m_GradientFilter = GradientFilterType::New();
m_SobelFilter = SobelFilterType::New();
m_TouziFilter = TouziFilterType::New();
//m_CannyFilter = CannyFilterType::New();
m_GradientFilter = GradientFilterType::New();
m_SobelFilter = SobelFilterType::New();
m_TouziFilter = TouziFilterType::New();
// m_CannyFilter = CannyFilterType::New();
if( edgeType == "gradient" )
if (edgeType == "gradient")
{
m_GradientFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
SetParameterOutputImage("out", m_GradientFilter->GetOutput());
m_GradientFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
SetParameterOutputImage("out", m_GradientFilter->GetOutput());
}
if( edgeType == "sobel" )
if (edgeType == "sobel")
{
m_SobelFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
SetParameterOutputImage("out", m_SobelFilter->GetOutput());
m_SobelFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
SetParameterOutputImage("out", m_SobelFilter->GetOutput());
}
if( edgeType == "touzi" )
if (edgeType == "touzi")
{
m_TouziFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
TouziFilterType::SizeType rad;
rad[0] = this->GetParameterInt("filter.touzi.xradius");
rad[1] = this->GetParameterInt("filter.touzi.yradius");
m_TouziFilter->SetRadius(rad);
SetParameterOutputImage("out", m_TouziFilter->GetOutput());
}
/*
if( edgeType == "canny" )
{
m_CannyFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
m_CannyFilter->SetVariance(GetParameterFloat("filter.canny.variance"));
m_CannyFilter->SetMaximumError(GetParameterFloat("filter.canny.maximumerror"));
m_CannyFilter->SetUpperThreshold(GetParameterFloat("filter.canny.upperthreshold"));
m_CannyFilter->SetLowerThreshold(GetParameterFloat("filter.canny.lowerthreshold"));
SetParameterOutputImage("out", m_CannyFilter->GetOutput());
m_TouziFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
TouziFilterType::SizeType rad;
rad[0] = this->GetParameterInt("filter.touzi.xradius");
rad[1] = this->GetParameterInt("filter.touzi.yradius");
m_TouziFilter->SetRadius(rad);
SetParameterOutputImage("out", m_TouziFilter->GetOutput());
}
*/
}
ExtractorFilterType::Pointer m_ExtractorFilter;
GradientFilterType::Pointer m_GradientFilter;
SobelFilterType::Pointer m_SobelFilter;
TouziFilterType::Pointer m_TouziFilter;
//CannyFilterType::Pointer m_CannyFilter;
/*
if( edgeType == "canny" )
{
m_CannyFilter->SetInput(const_cast<FloatImageType*>(m_ExtractorFilter->GetOutput()));
m_CannyFilter->SetVariance(GetParameterFloat("filter.canny.variance"));
m_CannyFilter->SetMaximumError(GetParameterFloat("filter.canny.maximumerror"));
m_CannyFilter->SetUpperThreshold(GetParameterFloat("filter.canny.upperthreshold"));
m_CannyFilter->SetLowerThreshold(GetParameterFloat("filter.canny.lowerthreshold"));
SetParameterOutputImage("out", m_CannyFilter->GetOutput());
}
*/
}
ExtractorFilterType::Pointer m_ExtractorFilter;
GradientFilterType::Pointer m_GradientFilter;
SobelFilterType::Pointer m_SobelFilter;
TouziFilterType::Pointer m_TouziFilter;
// CannyFilterType::Pointer m_CannyFilter;
};
}
}
} // namespace Wrapper
} // namespace otb
OTB_APPLICATION_EXPORT(otb::Wrapper::EdgeExtraction)
......@@ -42,10 +42,9 @@ std::string VectorImage<TPixel, VImageDimension>::GetProjectionRef(void) const
}
template <class TPixel, unsigned int VImageDimension>
void
VectorImage<TPixel, VImageDimension>::SetProjectionRef(const std::string& kwl)
{
itk::EncapsulateMetaData<std::string>(this->GetMetaDataDictionary(),MetaDataKey::ProjectionRefKey,kwl);
void VectorImage<TPixel, VImageDimension>::SetProjectionRef(const std::string& kwl)
{
itk::EncapsulateMetaData<std::string>(this->GetMetaDataDictionary(), MetaDataKey::ProjectionRefKey, kwl);
}
......@@ -116,130 +115,111 @@ double VectorImage<TPixel, VImageDimension>::GetGCPZ(unsigned int GCPnum) const
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::VectorType
VectorImage<TPixel, VImageDimension>::GetGeoTransform(void) const
typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetGeoTransform(void) const
{
return (this->GetMetaDataInterface()->GetGeoTransform());
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::VectorType
VectorImage<TPixel, VImageDimension>::GetUpperLeftCorner(void) const
typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetUpperLeftCorner(void) const
{
return (this->GetMetaDataInterface()->GetUpperLeftCorner());
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::VectorType
VectorImage<TPixel, VImageDimension>::GetUpperRightCorner(void) const
typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetUpperRightCorner(void) const
{
return (this->GetMetaDataInterface()->GetUpperRightCorner());
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::VectorType
VectorImage<TPixel, VImageDimension>::GetLowerLeftCorner(void) const
typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetLowerLeftCorner(void) const
{
return (this->GetMetaDataInterface()->GetLowerLeftCorner());
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::VectorType
VectorImage<TPixel, VImageDimension>::GetLowerRightCorner(void) const
typename VectorImage<TPixel, VImageDimension>::VectorType VectorImage<TPixel, VImageDimension>::GetLowerRightCorner(void) const
{
return (this->GetMetaDataInterface()->GetLowerRightCorner());
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::SpacingType
VectorImage<TPixel, VImageDimension>::GetSignedSpacing() const
typename VectorImage<TPixel, VImageDimension>::SpacingType VectorImage<TPixel, VImageDimension>::GetSignedSpacing() const
{
auto spacing = this->GetSpacing();
for ( unsigned int i = 0; i < VImageDimension; ++i )
{
if (this->m_Direction[i][i] < 0 )
spacing[i] = - spacing[i];
}
for (unsigned int i = 0; i < VImageDimension; ++i)
{
if (this->m_Direction[i][i] < 0)
spacing[i] = -spacing[i];
}
return spacing;
}
template <class TPixel, unsigned int VImageDimension>
void VectorImage<TPixel, VImageDimension>
::SetSignedSpacing( SpacingType spacing)
void VectorImage<TPixel, VImageDimension>::SetSignedSpacing(SpacingType spacing)
{
for ( unsigned int i = 0; i < VImageDimension; i++ )
for (unsigned int i = 0; i < VImageDimension; i++)
{
if (spacing[i] < 0.0)
{
if ( spacing[i] < 0.0 )
if (this->m_Direction[i][i] > 0)
{
if ( this->m_Direction[i][i] > 0 )
for (unsigned j = 0; j < VImageDimension; ++j)
{
for ( unsigned j = 0; j < VImageDimension; ++j )
{
this->m_Direction[j][i] = - this->m_Direction[j][i];
}
this->m_Direction[j][i] = -this->m_Direction[j][i];
}
spacing[i] = - spacing[i];
}
spacing[i] = -spacing[i];
}
}
this->SetSpacing(spacing);
this->ComputeIndexToPhysicalPointMatrices();
this->Modified();
}
template <class TPixel, unsigned int VImageDimension>
void VectorImage<TPixel, VImageDimension>
::SetSignedSpacing( double spacing[ VImageDimension ])
void VectorImage<TPixel, VImageDimension>::SetSignedSpacing(double spacing[VImageDimension])
{
SpacingType s(spacing);
this->SetSignedSpacing(s);
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType
VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void)
typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void)
{
ImageKeywordlist kwl;
itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(),
MetaDataKey::OSSIMKeywordlistKey,
kwl);
return kwl;
itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(), MetaDataKey::OSSIMKeywordlistKey, kwl);
return kwl;
}
template <class TPixel, unsigned int VImageDimension>
const typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType
VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void) const
const typename VectorImage<TPixel, VImageDimension>::ImageKeywordlistType VectorImage<TPixel, VImageDimension>::GetImageKeywordlist(void) const
{
ImageKeywordlist kwl;
itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(),
MetaDataKey::OSSIMKeywordlistKey,
kwl);
return kwl;
itk::ExposeMetaData<ImageKeywordlist>(this->GetMetaDataDictionary(), MetaDataKey::OSSIMKeywordlistKey, kwl);
return kwl;
}
template <class TPixel, unsigned int VImageDimension>
void
VectorImage<TPixel,VImageDimension>::SetImageKeywordList(const ImageKeywordlistType& kwl)
void VectorImage<TPixel, VImageDimension>::SetImageKeywordList(const ImageKeywordlistType& kwl)
{
itk::EncapsulateMetaData<ImageKeywordlistType>(this->GetMetaDataDictionary(),MetaDataKey::OSSIMKeywordlistKey,kwl);
itk::EncapsulateMetaData<ImageKeywordlistType>(this->GetMetaDataDictionary(), MetaDataKey::OSSIMKeywordlistKey, kwl);
}
template <class TPixel, unsigned int VImageDimension>
void
VectorImage<TPixel, VImageDimension>
::CopyInformation(const itk::DataObject * data)
void VectorImage<TPixel, VImageDimension>::CopyInformation(const itk::DataObject* data)
{
Superclass::CopyInformation(data);
this->itk::Object::SetMetaDataDictionary(data->GetMetaDataDictionary());
}
template <class TPixel, unsigned int VImageDimension>
typename VectorImage<TPixel, VImageDimension>::ImageMetadataInterfacePointerType
VectorImage<TPixel, VImageDimension>
::GetMetaDataInterface() const
typename VectorImage<TPixel, VImageDimension>::ImageMetadataInterfacePointerType VectorImage<TPixel, VImageDimension>::GetMetaDataInterface() const
{
if (m_ImageMetadataInterface.IsNull())
m_ImageMetadataInterface = ImageMetadataInterfaceFactory::CreateIMI(this->GetMetaDataDictionary());
......@@ -247,8 +227,7 @@ VectorImage<TPixel, VImageDimension>
}
template <class TPixel, unsigned int VImageDimension>
void
VectorImage<TPixel, VImageDimension>::PrintSelf(std::ostream& os, itk::Indent indent) const
void VectorImage<TPixel, VImageDimension>::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os, indent);
this->GetMetaDataInterface()->PrintMetadata(os, indent, this->GetMetaDataDictionary());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment