diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..399e250 --- /dev/null +++ b/.clang-format @@ -0,0 +1,151 @@ +## This config file is only relevant for clang-format version 8.0.0 +## +## Examples of each format style can be found on the in the clang-format documentation +## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option +## +## The clang-format binaries can be downloaded as part of the clang binary distributions +## from http://releases.llvm.org/download.html +## +## Use the script Utilities/Maintenance/clang-format.bash to faciliate +## maintaining a consistent code style. +## +## EXAMPLE apply code style enforcement before commit: +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --modified +## EXAMPLE apply code style enforcement after commit: +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --last +--- +# This configuration requires clang-format version 8.0.0 exactly. +BasedOnStyle: Mozilla +Language: Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Right +AlignOperands: true +AlignTrailingComments: true +# clang 9.0 AllowAllArgumentsOnNextLine: true +# clang 9.0 AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +# clang 9.0 AllowShortLambdasOnASingleLine: All +# clang 9.0 features AllowShortIfStatementsOnASingleLine: Never +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: All +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBraces: Custom +BraceWrapping: + # clang 9.0 feature AfterCaseLabel: false + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true +## This is the big change from historical ITK formatting! +# Historically ITK used a style similar to https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style +# with indented braces, and not indented code. This style is very difficult to automatically +# maintain with code beautification tools. Not indenting braces is more common among +# formatting tools. + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakBeforeBinaryOperators: None +#clang 6.0 BreakBeforeInheritanceComma: true +BreakInheritanceList: BeforeComma +BreakBeforeTernaryOperators: true +#clang 6.0 BreakConstructorInitializersBeforeComma: true +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +## The following line allows larger lines in non-documentation code +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: true +IndentPPDirectives: AfterHash +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +## The following line allows larger lines in non-documentation code +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Middle +ReflowComments: true +# We may want to sort the includes as a separate pass +SortIncludes: false +# We may want to revisit this later +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +# SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 2 +UseTab: Never +... diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c598f42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Custom attribute to mark sources as using our C++/C code style. +[attr]our-c-style whitespace=tab-in-indent,no-lf-at-eof hooks.style=KWStyle,clangformat + +*.c our-c-style +*.h our-c-style +*.cxx our-c-style +*.hxx our-c-style +*.txx our-c-style +*.txt whitespace=tab-in-indent,no-lf-at-eof +*.cmake whitespace=tab-in-indent,no-lf-at-eof + +# ExternalData content links must have LF newlines +*.md5 crlf=input +*.sha512 crlf=input diff --git a/include/itkAdditiveGaussianNoiseMeshFilter.h b/include/itkAdditiveGaussianNoiseMeshFilter.h index 7b9a707..4225def 100644 --- a/include/itkAdditiveGaussianNoiseMeshFilter.h +++ b/include/itkAdditiveGaussianNoiseMeshFilter.h @@ -37,9 +37,8 @@ namespace itk * * \ingroup MeshNoise */ -template< typename TInput, typename TOutput = TInput > -class AdditiveGaussianNoiseMeshFilter: -public MeshToMeshFilter< TInput, TOutput > +template +class AdditiveGaussianNoiseMeshFilter : public MeshToMeshFilter { public: @@ -47,9 +46,9 @@ public MeshToMeshFilter< TInput, TOutput > /** Standard class type alias. */ using Self = AdditiveGaussianNoiseMeshFilter; - using Superclass = MeshToMeshFilter< TInput, TOutput >; - using Pointer = SmartPointer< Self >; - using ConstPointer = SmartPointer< const Self >; + using Superclass = MeshToMeshFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; using InputMeshType = TInput; using OutputMeshType = TOutput; @@ -78,24 +77,25 @@ public MeshToMeshFilter< TInput, TOutput > itkSetMacro(Seed, int); protected: - AdditiveGaussianNoiseMeshFilter(); - ~AdditiveGaussianNoiseMeshFilter() override{} + ~AdditiveGaussianNoiseMeshFilter() override {} - void PrintSelf(std::ostream & os, Indent indent) const override; + void + PrintSelf(std::ostream & os, Indent indent) const override; /** Generate Requested Data */ - void GenerateData() override; + void + GenerateData() override; CoordRepType m_Mean; CoordRepType m_Sigma; int m_Seed; }; -} +} // namespace itk #ifndef ITK_MANUAL_INSTANTIATION -#include "itkAdditiveGaussianNoiseMeshFilter.hxx" +# include "itkAdditiveGaussianNoiseMeshFilter.hxx" #endif #endif diff --git a/include/itkAdditiveGaussianNoiseMeshFilter.hxx b/include/itkAdditiveGaussianNoiseMeshFilter.hxx index 989feb8..eb11c0d 100644 --- a/include/itkAdditiveGaussianNoiseMeshFilter.hxx +++ b/include/itkAdditiveGaussianNoiseMeshFilter.hxx @@ -24,29 +24,26 @@ namespace itk { -template< typename TInputMesh, typename TOutputMesh > -AdditiveGaussianNoiseMeshFilter< TInputMesh, TOutputMesh > -::AdditiveGaussianNoiseMeshFilter() +template +AdditiveGaussianNoiseMeshFilter::AdditiveGaussianNoiseMeshFilter() { this->m_Mean = 0.0; this->m_Sigma = 1.0; this->m_Seed = 0; } -template< typename TInputMesh, typename TOutputMesh > +template void -AdditiveGaussianNoiseMeshFilter< TInputMesh, TOutputMesh > -::PrintSelf(std::ostream & os, Indent indent) const +AdditiveGaussianNoiseMeshFilter::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Mean: " << this->m_Mean << std::endl; os << indent << "Sigma: " << this->m_Sigma << std::endl; } -template< typename TInputMesh, typename TOutputMesh > +template void -AdditiveGaussianNoiseMeshFilter< TInputMesh, TOutputMesh > -::GenerateData(void) +AdditiveGaussianNoiseMeshFilter::GenerateData(void) { using InputPointsContainer = typename TInputMesh::PointsContainer; using OutputPointsContainer = typename TOutputMesh::PointsContainer; @@ -54,48 +51,45 @@ AdditiveGaussianNoiseMeshFilter< TInputMesh, TOutputMesh > using InputPointsContainerConstPointer = typename TInputMesh::PointsContainerConstPointer; using OutputPointsContainerPointer = typename TOutputMesh::PointsContainerPointer; - const InputMeshType *inputMesh = this->GetInput(); - OutputMeshPointer outputMesh = this->GetOutput(); + const InputMeshType * inputMesh = this->GetInput(); + OutputMeshPointer outputMesh = this->GetOutput(); - if ( !inputMesh ) - { + if (!inputMesh) + { itkExceptionMacro(<< "Missing Input Mesh"); - } + } - if ( !outputMesh ) - { + if (!outputMesh) + { itkExceptionMacro(<< "Missing Output Mesh"); - } + } - outputMesh->SetBufferedRegion( outputMesh->GetRequestedRegion() ); + outputMesh->SetBufferedRegion(outputMesh->GetRequestedRegion()); - InputPointsContainerConstPointer inPoints = inputMesh->GetPoints(); + InputPointsContainerConstPointer inPoints = inputMesh->GetPoints(); OutputPointsContainerPointer outPoints = outputMesh->GetPoints(); - outPoints->Reserve( inputMesh->GetNumberOfPoints() ); + outPoints->Reserve(inputMesh->GetNumberOfPoints()); outPoints->Squeeze(); - typename InputPointsContainer::ConstIterator inputPoint - = inPoints->Begin(); - typename OutputPointsContainer::Iterator outputPoint - = outPoints->Begin(); + typename InputPointsContainer::ConstIterator inputPoint = inPoints->Begin(); + typename OutputPointsContainer::Iterator outputPoint = outPoints->Begin(); unsigned int maxDimension = TInputMesh::MaxTopologicalDimension; using GeneratorType = itk::Statistics::NormalVariateGenerator; GeneratorType::Pointer generator = GeneratorType::New(); - generator->Initialize( this->m_Seed ); + generator->Initialize(this->m_Seed); - while ( inputPoint != inPoints->End() ) + while (inputPoint != inPoints->End()) + { + for (unsigned int dim = 0; dim < maxDimension; ++dim) { - for ( unsigned int dim = 0; dim < maxDimension; ++dim ) - { - outputPoint.Value()[dim] - = inputPoint.Value()[dim] + generator->GetVariate()*this->m_Sigma + this->m_Mean; - } + outputPoint.Value()[dim] = inputPoint.Value()[dim] + generator->GetVariate() * this->m_Sigma + this->m_Mean; + } ++inputPoint; ++outputPoint; - } + } // Create duplicate references to the rest of data on the mesh this->CopyInputMeshToOutputMeshPointData(); @@ -103,14 +97,12 @@ AdditiveGaussianNoiseMeshFilter< TInputMesh, TOutputMesh > this->CopyInputMeshToOutputMeshCells(); this->CopyInputMeshToOutputMeshCellData(); - for ( unsigned int dim = 0; dim < maxDimension; ++dim ) - { - outputMesh->SetBoundaryAssignments( dim, - inputMesh->GetBoundaryAssignments(dim) ); - } - + for (unsigned int dim = 0; dim < maxDimension; ++dim) + { + outputMesh->SetBoundaryAssignments(dim, inputMesh->GetBoundaryAssignments(dim)); + } } -} +} // namespace itk #endif diff --git a/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.h b/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.h index e62d96a..27df6c8 100644 --- a/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.h +++ b/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.h @@ -37,18 +37,17 @@ namespace itk * * \ingroup MeshNoise */ -template< typename TInputMesh, typename TOutputMesh = TInputMesh > -class AdditiveGaussianNoiseQuadEdgeMeshFilter: - public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh > +template +class AdditiveGaussianNoiseQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdgeMeshFilter { public: ITK_DISALLOW_COPY_AND_ASSIGN(AdditiveGaussianNoiseQuadEdgeMeshFilter); /** Standard class type alias. */ using Self = AdditiveGaussianNoiseQuadEdgeMeshFilter; - using Superclass = QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >; - using Pointer = SmartPointer< Self >; - using ConstPointer = SmartPointer< const Self >; + using Superclass = QuadEdgeMeshToQuadEdgeMeshFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Type for representing coordinates. */ using CoordRepType = typename TInputMesh::CoordRepType; @@ -72,14 +71,15 @@ class AdditiveGaussianNoiseQuadEdgeMeshFilter: itkSetMacro(Seed, int); protected: - AdditiveGaussianNoiseQuadEdgeMeshFilter(); - ~AdditiveGaussianNoiseQuadEdgeMeshFilter() override{} + ~AdditiveGaussianNoiseQuadEdgeMeshFilter() override {} - void PrintSelf(std::ostream & os, Indent indent) const override; + void + PrintSelf(std::ostream & os, Indent indent) const override; /** Generate Requested Data */ - void GenerateData(void) override; + void + GenerateData(void) override; CoordRepType m_Mean; CoordRepType m_Sigma; @@ -89,7 +89,7 @@ class AdditiveGaussianNoiseQuadEdgeMeshFilter: } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION -#include "itkAdditiveGaussianNoiseQuadEdgeMeshFilter.hxx" +# include "itkAdditiveGaussianNoiseQuadEdgeMeshFilter.hxx" #endif #endif diff --git a/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.hxx b/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.hxx index f72a164..2485a87 100644 --- a/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.hxx +++ b/include/itkAdditiveGaussianNoiseQuadEdgeMeshFilter.hxx @@ -24,51 +24,46 @@ namespace itk { -template< typename TInputMesh, typename TOutputMesh > -AdditiveGaussianNoiseQuadEdgeMeshFilter< TInputMesh, TOutputMesh > -::AdditiveGaussianNoiseQuadEdgeMeshFilter() +template +AdditiveGaussianNoiseQuadEdgeMeshFilter::AdditiveGaussianNoiseQuadEdgeMeshFilter() { this->m_Mean = 0.0; this->m_Sigma = 1.0; this->m_Seed = 0; } -template< typename TInputMesh, typename TOutputMesh > +template void -AdditiveGaussianNoiseQuadEdgeMeshFilter< TInputMesh, TOutputMesh > -::PrintSelf(std::ostream & os, Indent indent) const +AdditiveGaussianNoiseQuadEdgeMeshFilter::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Mean: " << this->m_Mean << std::endl; os << indent << "Sigma: " << this->m_Sigma << std::endl; } -template< typename TInputMesh, typename TOutputMesh > +template void -AdditiveGaussianNoiseQuadEdgeMeshFilter< TInputMesh, TOutputMesh > -::GenerateData(void) +AdditiveGaussianNoiseQuadEdgeMeshFilter::GenerateData(void) { - typename TInputMesh::ConstPointer inputMesh = this->GetInput(); + typename TInputMesh::ConstPointer inputMesh = this->GetInput(); typename TOutputMesh::Pointer outputMesh = this->GetOutput(); this->CopyInputMeshToOutputMesh(); - typename TOutputMesh::PointsContainer::Iterator it = - outputMesh->GetPoints()->Begin(); + typename TOutputMesh::PointsContainer::Iterator it = outputMesh->GetPoints()->Begin(); using GeneratorType = itk::Statistics::NormalVariateGenerator; GeneratorType::Pointer generator = GeneratorType::New(); - generator->Initialize( this->m_Seed ); + generator->Initialize(this->m_Seed); - while ( it != outputMesh->GetPoints()->End() ) - { + while (it != outputMesh->GetPoints()->End()) + { for (unsigned int d = 0; d < TOutputMesh::MeshTraits::PointDimension; ++d) - { - it.Value()[d] += (generator->GetVariate()*this->m_Sigma + this->m_Mean); - } - ++it; + { + it.Value()[d] += (generator->GetVariate() * this->m_Sigma + this->m_Mean); } - + ++it; + } } } // end namespace itk diff --git a/test/itkAdditiveGaussianNoiseMeshFilterTest.cxx b/test/itkAdditiveGaussianNoiseMeshFilterTest.cxx index 0caede1..22d84de 100644 --- a/test/itkAdditiveGaussianNoiseMeshFilterTest.cxx +++ b/test/itkAdditiveGaussianNoiseMeshFilterTest.cxx @@ -21,7 +21,7 @@ #include "itkTestingMacros.h" int -itkAdditiveGaussianNoiseMeshFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) +itkAdditiveGaussianNoiseMeshFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using TPixel = double; @@ -31,20 +31,20 @@ itkAdditiveGaussianNoiseMeshFilterTest(int itkNotUsed(argc), char * itkNotUsed(a // Typedefs // ////////////// - using TMesh = itk::Mesh< TPixel, Dimension >; - using TSphere = itk::RegularSphereMeshSource< TMesh >; - using TNoise = itk::AdditiveGaussianNoiseMeshFilter< TMesh >; + using TMesh = itk::Mesh; + using TSphere = itk::RegularSphereMeshSource; + using TNoise = itk::AdditiveGaussianNoiseMeshFilter; //////////////// // Parameters // //////////////// - constexpr int SPHERE_RESOLUTION = 5; + constexpr int SPHERE_RESOLUTION = 5; constexpr double SPHERE_SCALE = 10.0; - constexpr int NOISE_SEED = 100; - const TMesh::CoordRepType NOISE_SIGMA = SPHERE_SCALE * 0.01; - constexpr TMesh::CoordRepType NOISE_MEAN = 1.0; + constexpr int NOISE_SEED = 100; + const TMesh::CoordRepType NOISE_SIGMA = SPHERE_SCALE * 0.01; + constexpr TMesh::CoordRepType NOISE_MEAN = 1.0; /////////// // Logic // @@ -52,25 +52,22 @@ itkAdditiveGaussianNoiseMeshFilterTest(int itkNotUsed(argc), char * itkNotUsed(a TSphere::Pointer sphere = TSphere::New(); - sphere->SetResolution( SPHERE_RESOLUTION ); - sphere->SetScale( SPHERE_SCALE ); + sphere->SetResolution(SPHERE_RESOLUTION); + sphere->SetScale(SPHERE_SCALE); TNoise::Pointer noise = TNoise::New(); - EXERCISE_BASIC_OBJECT_METHODS( noise, - AdditiveGaussianNoiseMeshFilter, - MeshToMeshFilter ); + EXERCISE_BASIC_OBJECT_METHODS(noise, AdditiveGaussianNoiseMeshFilter, MeshToMeshFilter); - noise->SetInput( sphere->GetOutput() ); - noise->SetSeed( NOISE_SEED ); - TEST_SET_GET_VALUE( NOISE_SEED, noise->GetSeed() ); - noise->SetSigma( NOISE_SIGMA ); - TEST_SET_GET_VALUE( NOISE_SIGMA, noise->GetSigma() ); - noise->SetMean( NOISE_MEAN ); - TEST_SET_GET_VALUE( NOISE_MEAN, noise->GetMean() ); + noise->SetInput(sphere->GetOutput()); + noise->SetSeed(NOISE_SEED); + TEST_SET_GET_VALUE(NOISE_SEED, noise->GetSeed()); + noise->SetSigma(NOISE_SIGMA); + TEST_SET_GET_VALUE(NOISE_SIGMA, noise->GetSigma()); + noise->SetMean(NOISE_MEAN); + TEST_SET_GET_VALUE(NOISE_MEAN, noise->GetMean()); noise->Update(); return EXIT_SUCCESS; - } diff --git a/test/itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest.cxx b/test/itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest.cxx index 0e08f27..a80664b 100644 --- a/test/itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest.cxx +++ b/test/itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest.cxx @@ -21,7 +21,7 @@ #include "itkTestingMacros.h" int -itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) +itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using TPixel = double; @@ -31,20 +31,20 @@ itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest(int itkNotUsed(argc), char * itkN // Typedefs // ////////////// - using TMesh = itk::QuadEdgeMesh< TPixel, Dimension >; - using TSphere = itk::RegularSphereMeshSource< TMesh >; - using TNoise = itk::AdditiveGaussianNoiseQuadEdgeMeshFilter< TMesh >; + using TMesh = itk::QuadEdgeMesh; + using TSphere = itk::RegularSphereMeshSource; + using TNoise = itk::AdditiveGaussianNoiseQuadEdgeMeshFilter; //////////////// // Parameters // //////////////// - constexpr int SPHERE_RESOLUTION = 5; + constexpr int SPHERE_RESOLUTION = 5; constexpr double SPHERE_SCALE = 10.0; - constexpr int NOISE_SEED = 100; - const TMesh::CoordRepType NOISE_SIGMA = SPHERE_SCALE * 0.01; - constexpr TMesh::CoordRepType NOISE_MEAN = 1.0; + constexpr int NOISE_SEED = 100; + const TMesh::CoordRepType NOISE_SIGMA = SPHERE_SCALE * 0.01; + constexpr TMesh::CoordRepType NOISE_MEAN = 1.0; /////////// // Logic // @@ -52,25 +52,22 @@ itkAdditiveGaussianNoiseQuadEdgeMeshFilterTest(int itkNotUsed(argc), char * itkN TSphere::Pointer sphere = TSphere::New(); - sphere->SetResolution( SPHERE_RESOLUTION ); - sphere->SetScale( SPHERE_SCALE ); + sphere->SetResolution(SPHERE_RESOLUTION); + sphere->SetScale(SPHERE_SCALE); TNoise::Pointer noise = TNoise::New(); - EXERCISE_BASIC_OBJECT_METHODS( noise, - AdditiveGaussianNoiseQuadEdgeMeshFilter, - QuadEdgeMeshToQuadEdgeMeshFilter ); + EXERCISE_BASIC_OBJECT_METHODS(noise, AdditiveGaussianNoiseQuadEdgeMeshFilter, QuadEdgeMeshToQuadEdgeMeshFilter); - noise->SetInput( sphere->GetOutput() ); - noise->SetSeed( NOISE_SEED ); - TEST_SET_GET_VALUE( NOISE_SEED, noise->GetSeed() ); - noise->SetSigma( NOISE_SIGMA ); - TEST_SET_GET_VALUE( NOISE_SIGMA, noise->GetSigma() ); - noise->SetMean( NOISE_MEAN ); - TEST_SET_GET_VALUE( NOISE_MEAN, noise->GetMean() ); + noise->SetInput(sphere->GetOutput()); + noise->SetSeed(NOISE_SEED); + TEST_SET_GET_VALUE(NOISE_SEED, noise->GetSeed()); + noise->SetSigma(NOISE_SIGMA); + TEST_SET_GET_VALUE(NOISE_SIGMA, noise->GetSigma()); + noise->SetMean(NOISE_MEAN); + TEST_SET_GET_VALUE(NOISE_MEAN, noise->GetMean()); noise->Update(); return EXIT_SUCCESS; - }