diff --git a/.clang-format b/.clang-format index 411b009..45b9502 100644 --- a/.clang-format +++ b/.clang-format @@ -1,4 +1,4 @@ -## This config file is only relevant for clang-format version 8.0.0 +## This config file is only relevant for clang-format version 19.1.4 ## ## 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 @@ -10,142 +10,309 @@ ## 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 +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --modified ## EXAMPLE apply code style enforcement after commit: -# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --last +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_19.1.4} --last --- -# This configuration requires clang-format version 8.0.0 exactly. -BasedOnStyle: Mozilla +# This configuration requires clang-format version 19.1.4 exactly. 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 +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: true + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignEscapedNewlines: Left +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false +AllowBreakBeforeNoexceptSpecifier: Never +AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline -# clang 9.0 AllowShortLambdasOnASingleLine: All -# clang 9.0 features AllowShortIfStatementsOnASingleLine: Never -AllowShortIfStatementsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true +#AllowShortFunctionsOnASingleLine: Inline Only merge functions defined inside a class. Implies empty. +#AllowShortFunctionsOnASingleLine: None (in configuration: None) Never merge functions into a single line. +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: All AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: + - __capability BinPackArguments: false BinPackParameters: false -BreakBeforeBraces: Custom +BitFieldColonSpacing: Both BraceWrapping: - # clang 9.0 feature AfterCaseLabel: false + AfterCaseLabel: true AfterClass: true - AfterControlStatement: true + AfterControlStatement: Always AfterEnum: true + AfterExternBlock: 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. + BeforeLambdaBody: false + BeforeWhile: false IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: false +BreakAfterReturnType: All +BreakArrays: true BreakBeforeBinaryOperators: None -#clang 6.0 BreakBeforeInheritanceComma: true -BreakInheritanceList: BeforeComma +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Custom +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -#clang 6.0 BreakConstructorInitializersBeforeComma: true BreakConstructorInitializers: BeforeComma -BreakAfterJavaFieldAnnotations: false +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeComma BreakStringLiterals: true +BreakTemplateDeclarations: Yes ## 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 +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Preserve IncludeCategories: - Regex: '^"(llvm|llvm-c|clang|clang-c)/' Priority: 2 + SortPriority: 0 + CaseSensitive: false - Regex: '^(<|"(gtest|gmock|isl|json)/)' Priority: 3 + SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 1 + SortPriority: 0 + CaseSensitive: false IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false IndentCaseLabels: true +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true IndentPPDirectives: AfterHash +IndentRequiresClause: true IndentWidth: 2 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: true +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: true + AtStartOfFile: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' +MainIncludeChar: Quote MaxEmptyLinesToKeep: 2 NamespaceIndentation: None ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: false +PackConstructorInitializers: BinPack PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 ## The following line allows larger lines in non-documentation code PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Middle +PPIndentWidth: -1 +QualifierAlignment: Custom +QualifierOrder: + - friend + - static + - inline + - constexpr + - const + - type +ReferenceAlignment: Pointer ReflowComments: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false # We may want to sort the includes as a separate pass -SortIncludes: false +SortIncludes: Never +SortJavaStaticImport: Before # We may want to revisit this later -SortUsingDeclarations: false +SortUsingDeclarations: Never SpaceAfterCStyleCast: false -# SpaceAfterLogicalNot: false +SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyParentheses: false +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false SpacesBeforeTrailingComments: 1 -SpacesInAngles: false +SpacesInAngles: Never SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + ExceptDoubleParentheses: false + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false -Standard: Cpp11 +Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION + - ITK_GCC_PRAGMA_PUSH + - ITK_GCC_PRAGMA_POP + - ITK_GCC_SUPPRESS_Wfloat_equal + - ITK_GCC_SUPPRESS_Wformat_nonliteral + - ITK_GCC_SUPPRESS_Warray_bounds + - ITK_CLANG_PRAGMA_PUSH + - ITK_CLANG_PRAGMA_POP + - ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant + - CLANG_PRAGMA_PUSH + - CLANG_PRAGMA_POP + - CLANG_SUPPRESS_Wfloat_equal + - INTEL_PRAGMA_WARN_PUSH + - INTEL_PRAGMA_WARN_POP + - INTEL_SUPPRESS_warning_1292 + - itkTemplateFloatingToIntegerMacro + - itkLegacyMacro +TableGenBreakInsideDAGArg: DontBreak TabWidth: 2 UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 443791f..9045192 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -4,13 +4,13 @@ on: [push,pull_request] jobs: cxx-build-workflow: - uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@30c37d7e056c9bf450738fde055d04111f0f8b1a + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@fed6f13d145960999e479784df8794df6acb7421 with: - itk-module-deps: 'MeshToPolyData@v0.10.0' + itk-module-deps: 'MeshToPolyData@v0.11.1' python-build-workflow: - uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@30c37d7e056c9bf450738fde055d04111f0f8b1a + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@fed6f13d145960999e479784df8794df6acb7421 with: - itk-module-deps: 'InsightSoftwareConsortium/ITKMeshToPolyData@v0.10.0' + itk-module-deps: 'InsightSoftwareConsortium/ITKMeshToPolyData@v0.11.1' secrets: pypi_password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml index 69166d9..c8e1681 100644 --- a/.github/workflows/clang-format-linter.yml +++ b/.github/workflows/clang-format-linter.yml @@ -7,7 +7,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 with: fetch-depth: 1 - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master + with: + itk-branch: master diff --git a/include/itkBSplineApproximationGradientImageFilter.h b/include/itkBSplineApproximationGradientImageFilter.h index 60f41e9..f2849fb 100644 --- a/include/itkBSplineApproximationGradientImageFilter.h +++ b/include/itkBSplineApproximationGradientImageFilter.h @@ -52,7 +52,7 @@ class ITK_TEMPLATE_EXPORT BSplineApproximationGradientImageFilter public: ITK_DISALLOW_COPY_AND_MOVE(BSplineApproximationGradientImageFilter); - itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); + static constexpr unsigned int ImageDimension = TInputImage::ImageDimension; using Self = BSplineApproximationGradientImageFilter; @@ -66,13 +66,13 @@ class ITK_TEMPLATE_EXPORT BSplineApproximationGradientImageFilter itkNewMacro(Self); - itkTypeMacro(BSplineApproximationGradientImageFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(BSplineApproximationGradientImageFilter); using OutputValueType = TOutputValueType; using InputPixelType = typename InputImageType::PixelType; - using PointSetType = PointSet; + using PointSetType = PointSet; - itkStaticConstMacro(InputVectorDimension, unsigned int, InputPixelType::Dimension); + static constexpr unsigned int InputVectorDimension = InputPixelType::Dimension; /** Internal filter type */ /** Internal filter type */ @@ -83,7 +83,7 @@ class ITK_TEMPLATE_EXPORT BSplineApproximationGradientImageFilter using ImageToPointSetFilterType = ImageToPointSetFilter; using ImageToPointSetFilterPointerType = typename ImageToPointSetFilterType::Pointer; - using ControlPointSpacingRatioType = FixedArray; + using ControlPointSpacingRatioType = FixedArray; /** Set/Get number of levels. This is the number of levels used in the * BSplineScatteredDataPointSetToImageFilter for calculating the BSpline grid. diff --git a/include/itkBSplineGradientImageFilter.h b/include/itkBSplineGradientImageFilter.h index a39f055..e8fb0aa 100644 --- a/include/itkBSplineGradientImageFilter.h +++ b/include/itkBSplineGradientImageFilter.h @@ -47,7 +47,7 @@ class ITK_TEMPLATE_EXPORT BSplineGradientImageFilter ITK_DISALLOW_COPY_AND_MOVE(BSplineGradientImageFilter); /** Extract dimension from input image. */ - itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); + static constexpr unsigned int ImageDimension = TInputImage::ImageDimension; /** Standard class type alias. */ using Self = BSplineGradientImageFilter; @@ -66,12 +66,12 @@ class ITK_TEMPLATE_EXPORT BSplineGradientImageFilter itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(BSplineGradientImageFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(BSplineGradientImageFilter); /** Image type alias support. */ using InputPixelType = typename InputImageType::PixelType; using OutputValueType = TOutputValueType; - using OutputPixelType = CovariantVector; + using OutputPixelType = CovariantVector; using OutputImageRegionType = typename OutputImageType::RegionType; #ifdef ITK_USE_CONCEPT_CHECKING @@ -82,9 +82,9 @@ class ITK_TEMPLATE_EXPORT BSplineGradientImageFilter #endif /** Typedefs for the interpolator. */ - using CoordRepType = TCoordRep; + using CoordinateType = TCoordRep; using CoefficientType = TCoefficientType; - using InterpolatorType = itk::BSplineInterpolateImageFunction; + using InterpolatorType = itk::BSplineInterpolateImageFunction; using InterpolatorPointerType = typename InterpolatorType::Pointer; protected: diff --git a/include/itkBSplineGradientImageFilter.hxx b/include/itkBSplineGradientImageFilter.hxx index e12badb..5ec04fb 100644 --- a/include/itkBSplineGradientImageFilter.hxx +++ b/include/itkBSplineGradientImageFilter.hxx @@ -91,7 +91,7 @@ BSplineGradientImageFilter(index[i]); + contIndex[i] = static_cast(index[i]); } it.Set(interpolator->EvaluateDerivativeAtContinuousIndex(contIndex)); } diff --git a/include/itkBSplineScatteredDataPointSetToGradientImageFilter.h b/include/itkBSplineScatteredDataPointSetToGradientImageFilter.h index 5b68af2..6d6406a 100644 --- a/include/itkBSplineScatteredDataPointSetToGradientImageFilter.h +++ b/include/itkBSplineScatteredDataPointSetToGradientImageFilter.h @@ -59,8 +59,8 @@ class BSplineScatteredDataPointSetToGradientImageFilter ITK_DISALLOW_COPY_AND_MOVE(BSplineScatteredDataPointSetToGradientImageFilter); /** Extract dimension from input image. */ - itkStaticConstMacro(PointSetDimension, unsigned int, TInputPointSet::PointDimension); - itkStaticConstMacro(ImageDimension, unsigned int, TInputPointSet::PointDimension); + static constexpr unsigned int PointSetDimension = TInputPointSet::PointDimension; + static constexpr unsigned int ImageDimension = TInputPointSet::PointDimension; /** Standard class type alias. */ using Self = BSplineScatteredDataPointSetToGradientImageFilter; @@ -68,8 +68,7 @@ class BSplineScatteredDataPointSetToGradientImageFilter /** Convenient type alias for simplifying declarations. */ using InputPointSetType = TInputPointSet; using InputPointSetPointer = typename InputPointSetType::Pointer; - using OutputImageType = Image, - itkGetStaticConstMacro(ImageDimension)>; + using OutputImageType = Image, Self::ImageDimension>; using OutputImagePointer = typename OutputImageType::Pointer; /** Standard class type alias. */ @@ -81,11 +80,11 @@ class BSplineScatteredDataPointSetToGradientImageFilter itkNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(BSplineScatteredDataPointSetToGradientImageFilter, PointSetToImageFilter); + itkOverrideGetNameOfClassMacro(BSplineScatteredDataPointSetToGradientImageFilter); /** Image type alias support. */ using InputPixelType = typename InputPointSetType::PixelType; - itkStaticConstMacro(InputVectorDimension, unsigned int, InputPixelType::Dimension); + static constexpr unsigned int InputVectorDimension = InputPixelType::Dimension; using InputPointType = typename InputPointSetType::PointType; using OutputValueType = TOutputValueType; diff --git a/include/itkImageToImageOfVectorsFilter.h b/include/itkImageToImageOfVectorsFilter.h index 872d67f..fd18bb1 100644 --- a/include/itkImageToImageOfVectorsFilter.h +++ b/include/itkImageToImageOfVectorsFilter.h @@ -64,10 +64,10 @@ class ITK_TEMPLATE_EXPORT ImageToImageOfVectorsFilter using Pointer = SmartPointer; using ConstPointer = SmartPointer; itkNewMacro(Self); - itkTypeMacro(ImageToImageOfVectorsFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(ImageToImageOfVectorsFilter); using InputImageType = TInputImage; - itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); + static constexpr unsigned int ImageDimension = TInputImage::ImageDimension; using InputPixelType = typename InputImageType::InternalPixelType; diff --git a/pyproject.toml b/pyproject.toml index ee0de17..e88eb59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "itk-bsplinegradient" -version = "1.0.0" +version = "1.0.1" description = "Approximate an image's gradient from a B-spline fit to its intensity." readme = "README.rst" license = {file = "LICENSE"} @@ -36,7 +36,7 @@ classifiers = [ "Topic :: Scientific/Engineering :: Medical Science Apps.", "Topic :: Software Development :: Libraries", ] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "itk == 5.4.*", "itk-meshtopolydata == 0.12.*",