From 444ddb9e3c140ff6f566c9264b558d62d8bda20a Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Tue, 6 Oct 2020 13:05:47 -0400 Subject: [PATCH 01/20] Update version to 0.2 and add package dependency on itk v5.1.1 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 28cc2c1..fc18343 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='itk-simpleitkfilters', - version='0.1.0', + version='0.2.0', author='SimpleITK', author_email='itk+community@discourse.itk.org', packages=['itk'], @@ -44,6 +44,6 @@ keywords='ITK InsightToolkit', url=r'https://itk.org/', install_requires=[ - r'itk>=5.1.0.post2' + r'itk>=5.1.1'' ] ) From 9a5cfa0a39129ca696b1e9f6dffad04fc06d8d1a Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Tue, 6 Oct 2020 13:22:06 -0400 Subject: [PATCH 02/20] Fix setup.py syntax error --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fc18343..8bf21b2 100644 --- a/setup.py +++ b/setup.py @@ -44,6 +44,6 @@ keywords='ITK InsightToolkit', url=r'https://itk.org/', install_requires=[ - r'itk>=5.1.1'' + r'itk>=5.1.1' ] ) From 930289f7d55d7d4f649bd3a0ddb8dfcbd629bb92 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 19 Nov 2020 16:09:42 -0500 Subject: [PATCH 03/20] Add intial check in of maksed assign image filter --- include/itkMaskedAssignImageFilter.h | 106 ++++++++++ include/itkMaskedAssignImageFilter.hxx | 45 ++++ test/CMakeLists.txt | 3 +- test/itkMaskedAssignImageFilterGTest.cxx | 250 +++++++++++++++++++++++ 4 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 include/itkMaskedAssignImageFilter.h create mode 100644 include/itkMaskedAssignImageFilter.hxx create mode 100644 test/itkMaskedAssignImageFilterGTest.cxx diff --git a/include/itkMaskedAssignImageFilter.h b/include/itkMaskedAssignImageFilter.h new file mode 100644 index 0000000..7cf2f5a --- /dev/null +++ b/include/itkMaskedAssignImageFilter.h @@ -0,0 +1,106 @@ +/*========================================================================= + * + * Copyright NumFOCUS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkMaskedAssignImageFilter_h +#define itkMaskedAssignImageFilter_h + +#include "itkTernaryGeneratorImageFilter.h" +#include "itkNumericTraits.h" + +namespace itk +{ + +/** + *\class MaskedAssignImageFilter + * \brief Assign values to a masked set of pixels. + * + * This class is templated over the types of the + * input image, the mask image and the type of the output image. + * Numeric conversions (castings) are done by the C++ defaults. + * + * The first input is the "input image", the second is the "mask image", + * the third is the "assign image". Any of the images can be set as constants, + * with third input can be set as constant with the `SetAssignConstant` method. + * + * For the "masked input" non-zero values are considered the mask, and assigned values + * from the "assign input". + * + * The following is the logic applied per pixel (pixel value or constant value) : + * + \code + if pixel_from_mask_image != 0 + pixel_output_image = pixel_assign_image + else + pixel_output_image = pixel_input_image + \endcode + * + * The pixel from the "input image" is cast to the pixel type of the output image. + * + * Note all images must be geometrically congruent. + * + * \sa MaskImageFilter + * \ingroup SimpleITKFilters + * + */ + template + class MaskedAssignImageFilter : public TernaryGeneratorImageFilter + + { + public: + ITK_DISALLOW_COPY_AND_MOVE(MaskedAssignImageFilter); + + /** Standard class type aliases. */ + using Self = MaskedAssignImageFilter; + using Superclass = TernaryGeneratorImageFilter; + + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(MaskedAssignImageFilter, TernaryGeneratorImageFilter); + + /** Typedefs **/ + using InputImageType = TInputImage; + using MaskImageType = TMaskImage; + using AssignImageType = TOutputImage; + using OutputImageType = TOutputImage; + + using OutputPixelType = typename OutputImageType::PixelType; + + itkSetInputMacro(MaskImage, MaskImageType); + itkGetInputMacro(MaskImage, MaskImageType); + + itkSetInputMacro(AssignImage, AssignImageType); + itkGetInputMacro(AssignImage, AssignImageType); + + virtual void SetAssignConstant( const OutputPixelType &v) { this->SetConstant3(v); } + virtual OutputPixelType GetAssignConstant( ) const {return this->GetConstant3(); } + + protected: + MaskedAssignImageFilter(); + ~MaskedAssignImageFilter() override = default; + }; +} // end namespace itk + +#endif + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkMaskedAssignImageFilter.hxx" +#endif \ No newline at end of file diff --git a/include/itkMaskedAssignImageFilter.hxx b/include/itkMaskedAssignImageFilter.hxx new file mode 100644 index 0000000..13bd032 --- /dev/null +++ b/include/itkMaskedAssignImageFilter.hxx @@ -0,0 +1,45 @@ +/*========================================================================= + * + * Copyright NumFOCUS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkMaskedAssignImageFilter_hxx +#define itkMaskedAssignImageFilter_hxx + +#include "itkMaskedAssignImageFilter.h" + +namespace itk { + template + MaskedAssignImageFilter::MaskedAssignImageFilter() { + this->SetPrimaryInputName("InputImage"); + this->AddRequiredInputName("MaskImage", 1); + this->AddRequiredInputName("AssignImage", 2); + + auto func = [](const typename InputImageType::PixelType &input, + const typename MaskImageType::PixelType &mask, + const typename AssignImageType::PixelType &assign) -> + OutputPixelType { + if (mask != NumericTraits::Zero) { + return assign; + } else { + return static_cast(input); + } + }; + this->SetFunctor(func); + } + +} // end namespace itk + +#endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f42350a..49b08f0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -61,6 +61,7 @@ add_test(NAME itkHessianImageFilterTest set(SimpleITKFiltersGTest itkHessianImageFilterGTest.cxx - itkDICOMOrientImageFilterGTest.cxx) + itkDICOMOrientImageFilterGTest.cxx + itkMaskedAssignImageFilterGTest.cxx) CreateGoogleTestDriver(SimpleITKFilters "${SimpleITKFilters-Test_LIBRARIES}" "${SimpleITKFiltersGTest}") diff --git a/test/itkMaskedAssignImageFilterGTest.cxx b/test/itkMaskedAssignImageFilterGTest.cxx new file mode 100644 index 0000000..367a145 --- /dev/null +++ b/test/itkMaskedAssignImageFilterGTest.cxx @@ -0,0 +1,250 @@ +/*========================================================================= + * + * Copyright NumFOCUS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include "itkGTest.h" + +#include "itkMaskedAssignImageFilter.h" +#include "itkVectorImage.h" + +#include "itkTestDriverIncludeRequiredIOFactories.h" +#include "itkTestingHashImageFilter.h" + +namespace +{ + class MaskedAssignFixture : public ::testing::Test + { + public: + MaskedAssignFixture() = default; + ~MaskedAssignFixture() override = default; + + protected: + void + SetUp() override + { + RegisterRequiredFactories(); + } + + template + static std::string + MD5Hash(const TImageType * image) + { + + using HashFilter = itk::Testing::HashImageFilter; + typename HashFilter::Pointer hasher = HashFilter::New(); + hasher->SetInput(image); + hasher->InPlaceOff(); + hasher->Update(); + return hasher->GetHash(); + } + + template + struct FixtureUtilities + { + static const unsigned int Dimension = TInputImage::ImageDimension; + + using PixelType = typename TInputImage::PixelType; + using OutputPixelType = PixelType; + using InputImageType = TInputImage; + using OutputImageType = TInputImage; + using RegionType = typename InputImageType::RegionType; + using SizeType = typename TInputImage::SizeType; + using IndexType = typename TInputImage::IndexType; + + + using MaskImageType = TMaskImage; + using MaskRegionType = typename MaskImageType::RegionType; + using MaskSizeType = typename MaskImageType::SizeType; + using MaskIndexType = typename MaskImageType::IndexType; + + using FilterType = itk::MaskedAssignImageFilter; + + // Create a black image or empty + template + static typename TImage::Pointer + CreateImageT(unsigned int size = 100) + { + typename TImage::Pointer image = TImage::New(); + + typename TImage::SizeType imageSize; + imageSize.Fill(size); + image->SetRegions(typename TImage::RegionType(imageSize)); + InitializeImage(image.GetPointer()); + + return image; + } + + template + static void InitializeImage(itk::Image *image) + { + image->Allocate(); + image->FillBuffer(itk::NumericTraits::ZeroValue()); + } + + + template + static void InitializeImage(itk::VectorImage *image) + { + constexpr unsigned int sz = 3; + image->SetNumberOfComponentsPerPixel(sz); + image->Allocate(); + itk::VariableLengthVector p{sz}; + p.Fill(itk::NumericTraits::ZeroValue()); + image->FillBuffer(p); + } + + static constexpr auto CreateImage = CreateImageT; + static constexpr auto CreateMaskImage = CreateImageT; + }; + }; +} // namespace + + +TEST_F(MaskedAssignFixture, SetGetPrint) { + using Utils = FixtureUtilities>; + + auto filter = Utils::FilterType::New(); + + auto image = Utils::CreateImage(100); + + EXPECT_STREQ("MaskedAssignImageFilter", filter->GetNameOfClass()); + + EXPECT_NO_THROW(filter->SetInput(image)); + EXPECT_EQ(image, filter->GetInput()); + EXPECT_ANY_THROW(filter->GetConstant1()); + + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetInput1(image)); + EXPECT_EQ(image, filter->GetInput()); + EXPECT_ANY_THROW(filter->GetConstant1()); + + EXPECT_NO_THROW(filter->SetConstant1(1)); + EXPECT_ANY_THROW(filter->GetInput()); + EXPECT_EQ(1, filter->GetConstant1()); + + + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetInput2(image)); + EXPECT_EQ(image, filter->GetMaskImage()); + EXPECT_ANY_THROW(filter->GetConstant2()); + + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetMaskImage(image)); + EXPECT_EQ(image, filter->GetMaskImage()); + EXPECT_ANY_THROW(filter->GetConstant2()); + + EXPECT_NO_THROW(filter->SetConstant2(2)); + EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_EQ(2, filter->GetConstant2()); + + + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetInput3(image)); + EXPECT_EQ(image, filter->GetAssignImage()); + EXPECT_ANY_THROW(filter->GetConstant3()); + EXPECT_ANY_THROW(filter->GetAssignConstant()); + + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetAssignImage(image)); + EXPECT_EQ(image, filter->GetAssignImage()); + EXPECT_ANY_THROW(filter->GetConstant3()); + EXPECT_ANY_THROW(filter->GetAssignConstant()); + + EXPECT_NO_THROW(filter->SetConstant3(3)); + EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_EQ(3, filter->GetConstant3()); + + + EXPECT_NO_THROW(filter->SetAssignConstant(4)); + EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_EQ(4, filter->GetConstant3()); + EXPECT_EQ(4, filter->GetAssignConstant()); +} + +TEST_F(MaskedAssignFixture, Test1) { + + using Utils = FixtureUtilities, itk::Image>; + + + auto image = Utils::CreateImage(100); + image->FillBuffer(99); + + auto mask = Utils::CreateMaskImage(100); + mask->FillBuffer(0); + + auto filter = Utils::FilterType::New(); + + EXPECT_NO_THROW(filter->SetAssignConstant(5)); + EXPECT_EQ(5, filter->GetAssignConstant()); + + mask->SetPixel({ {0,0}}, 1); + + mask->SetPixel({{20,21}}, 1); + + filter->SetInput(image); + filter->SetMaskImage(mask); + + filter->Update(); + auto output = filter->GetOutput(); + + EXPECT_EQ(5, output->GetPixel({{0,0}})); + EXPECT_EQ(99, output->GetPixel({{0,1}})); + + EXPECT_EQ(99, output->GetPixel({{1,1}})); + + EXPECT_EQ(5, output->GetPixel({{20,21}})); + + EXPECT_EQ("b28618b5cccaa828028a29b44d88c728", MD5Hash(output)); +} + + +TEST_F(MaskedAssignFixture, VectorTest2) { + + using Utils = FixtureUtilities, itk::Image>; + + auto image = Utils::CreateImage(21); + Utils::PixelType p{image->GetNumberOfComponentsPerPixel()}; + p.Fill( 12 ); + image->FillBuffer( p ); + + auto filter = Utils::FilterType::New(); + + Utils::PixelType c{3}; + c.Fill( 0 ); + EXPECT_NO_THROW(filter->SetAssignConstant(c)); + EXPECT_EQ(c, filter->GetAssignConstant()); + + + auto mask = Utils::CreateMaskImage(21); + mask->FillBuffer(0); + mask->SetPixel({ {2,2}}, 1); + + mask->SetPixel({{3,19}}, 1); + + filter->SetInput(image); + filter->SetMaskImage(mask); + + filter->Update(); + auto output = filter->GetOutput(); + + EXPECT_EQ(p, output->GetPixel({{0,0}})); + EXPECT_EQ(c, output->GetPixel({{2,2}})); + EXPECT_EQ(c, output->GetPixel({{3,19}})); + + + EXPECT_EQ("f089464fcbec9429f409ee779788cca3", MD5Hash(output)); +} From 7f969cbce3bd22c6c4c6efa177990b29bfd3b5dd Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Mon, 19 Oct 2020 09:22:04 -0500 Subject: [PATCH 04/20] STYLE: Rename ITK_DISALLOW_COPY_AND_ASSIGN to ITK_DISALLOW_COPY_AND_MOVE Fixes changes made in #2053. ITK_DISALLOW_COPY_AND_ASSIGN will be used if ITK_FUTURE_LEGACY_REMOVE=OFF. --- include/itkDICOMOrientImageFilter.h | 2 +- include/itkHessianImageFilter.h | 2 +- include/itkNPasteImageFilter.h | 2 +- include/itkObjectnessMeasureImageFilter.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/itkDICOMOrientImageFilter.h b/include/itkDICOMOrientImageFilter.h index 328fe98..32354c8 100644 --- a/include/itkDICOMOrientImageFilter.h +++ b/include/itkDICOMOrientImageFilter.h @@ -66,7 +66,7 @@ class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter : public ImageToImageFilter { public: - ITK_DISALLOW_COPY_AND_ASSIGN(DICOMOrientImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(DICOMOrientImageFilter); /** Standard class type aliases. */ using Self = DICOMOrientImageFilter; diff --git a/include/itkHessianImageFilter.h b/include/itkHessianImageFilter.h index 7f0f1f3..fa82ce9 100644 --- a/include/itkHessianImageFilter.h +++ b/include/itkHessianImageFilter.h @@ -46,7 +46,7 @@ template { public: - ITK_DISALLOW_COPY_AND_ASSIGN(HessianImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(HessianImageFilter); /** Standard type alias */ using Self = HessianImageFilter; diff --git a/include/itkNPasteImageFilter.h b/include/itkNPasteImageFilter.h index c595069..8df72ad 100644 --- a/include/itkNPasteImageFilter.h +++ b/include/itkNPasteImageFilter.h @@ -60,7 +60,7 @@ template { public: - ITK_DISALLOW_COPY_AND_ASSIGN(NPasteImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(NPasteImageFilter); /** Standard class type aliases. */ using Self = NPasteImageFilter; diff --git a/include/itkObjectnessMeasureImageFilter.h b/include/itkObjectnessMeasureImageFilter.h index fde6665..1edb209 100644 --- a/include/itkObjectnessMeasureImageFilter.h +++ b/include/itkObjectnessMeasureImageFilter.h @@ -74,7 +74,7 @@ template class ObjectnessMeasureImageFilter : public ImageToImageFilter { public: - ITK_DISALLOW_COPY_AND_ASSIGN(ObjectnessMeasureImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(ObjectnessMeasureImageFilter); /** Standard class type alias. */ using Self = ObjectnessMeasureImageFilter; From 49bb41d158902ce3ccf1fe9980b26dc42bd2f233 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 28 Dec 2020 07:46:54 -0600 Subject: [PATCH 05/20] ENH: Adding missing macro end of line semi-colon --- src/itkDICOMOrientation.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/itkDICOMOrientation.cxx b/src/itkDICOMOrientation.cxx index 4f2f760..bb95fba 100644 --- a/src/itkDICOMOrientation.cxx +++ b/src/itkDICOMOrientation.cxx @@ -194,7 +194,7 @@ DICOMOrientation::DirectionCosinesToOrientation(const DirectionType & dir) break; } default: - itkGenericExceptionMacro("Unexpected Axis") + itkGenericExceptionMacro("Unexpected Axis"); } } From 7dadf89a8e426efda9cd93fc7961aebf65982c95 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 28 Dec 2020 08:29:37 -0600 Subject: [PATCH 06/20] STYLE: Match clang-format style for ITK When adding missing macro end-of-line semi-colons, the clang-format corrections make the code more consistent to read. --- include/itkDICOMOrientImageFilter.h | 7 +- include/itkDICOMOrientImageFilter.hxx | 6 +- include/itkDICOMOrientation.h | 2 +- include/itkMaskedAssignImageFilter.h | 90 +++--- include/itkMaskedAssignImageFilter.hxx | 38 +-- include/itkNPasteImageFilter.h | 4 +- include/itkNPasteImageFilter.hxx | 4 +- src/itkDICOMOrientation.cxx | 8 +- test/itkMaskedAssignImageFilterGTest.cxx | 345 ++++++++++++----------- 9 files changed, 260 insertions(+), 244 deletions(-) diff --git a/include/itkDICOMOrientImageFilter.h b/include/itkDICOMOrientImageFilter.h index 32354c8..c26d53f 100644 --- a/include/itkDICOMOrientImageFilter.h +++ b/include/itkDICOMOrientImageFilter.h @@ -62,8 +62,7 @@ namespace itk * \ingroup SimpleITKFilters */ template -class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter - : public ImageToImageFilter +class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter : public ImageToImageFilter { public: ITK_DISALLOW_COPY_AND_MOVE(DICOMOrientImageFilter); @@ -140,7 +139,7 @@ class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter void GenerateOutputInformation() override; - static_assert(ImageDimension == 3, "Only 3 dimensional images are support!" ); + static_assert(ImageDimension == 3, "Only 3 dimensional images are support!"); protected: DICOMOrientImageFilter(); @@ -154,7 +153,7 @@ class ITK_TEMPLATE_EXPORT DICOMOrientImageFilter /*** Member functions used by GenerateData: */ void - DeterminePermutationsAndFlips(DICOMOrientation desired, DICOMOrientation given); + DeterminePermutationsAndFlips(DICOMOrientation desired, DICOMOrientation given); /** Returns true if a permute is required. Returns false otherwise. */ bool diff --git a/include/itkDICOMOrientImageFilter.hxx b/include/itkDICOMOrientImageFilter.hxx index 9468ba2..5b23662 100644 --- a/include/itkDICOMOrientImageFilter.hxx +++ b/include/itkDICOMOrientImageFilter.hxx @@ -29,7 +29,7 @@ namespace itk template DICOMOrientImageFilter::DICOMOrientImageFilter() - : m_FlipAxes{false} + : m_FlipAxes{ false } { for (unsigned int dimension = 0; dimension < ImageDimension; ++dimension) { @@ -159,7 +159,7 @@ DICOMOrientImageFilter::SetDesiredCoordinateOrientation(const std:: { DICOMOrientation o(desired); - if ( OrientationEnum(o) == OrientationEnum::INVALID) + if (OrientationEnum(o) == OrientationEnum::INVALID) { itkWarningMacro("Invalid desired coordinate direction string: \"" << desired << "\"!"); } @@ -301,7 +301,7 @@ DICOMOrientImageFilter::VerifyPreconditions() ITKv5_CONST if (this->m_DesiredCoordinateOrientation == OrientationEnum::INVALID) { - itkExceptionMacro(<<"DesiredCoordinateOrientation is 'INVALID'.") + itkExceptionMacro(<< "DesiredCoordinateOrientation is 'INVALID'."); } } diff --git a/include/itkDICOMOrientation.h b/include/itkDICOMOrientation.h index 8034df2..d6e8ef1 100644 --- a/include/itkDICOMOrientation.h +++ b/include/itkDICOMOrientation.h @@ -216,7 +216,7 @@ class SimpleITKFilters_EXPORT DICOMOrientation friend SimpleITKFilters_EXPORT std::ostream & - operator<<(std::ostream & out, OrientationEnum value); + operator<<(std::ostream & out, OrientationEnum value); private: diff --git a/include/itkMaskedAssignImageFilter.h b/include/itkMaskedAssignImageFilter.h index 7cf2f5a..6d86b3d 100644 --- a/include/itkMaskedAssignImageFilter.h +++ b/include/itkMaskedAssignImageFilter.h @@ -56,51 +56,59 @@ namespace itk * \ingroup SimpleITKFilters * */ - template - class MaskedAssignImageFilter : public TernaryGeneratorImageFilter +template +class MaskedAssignImageFilter : public TernaryGeneratorImageFilter - { - public: - ITK_DISALLOW_COPY_AND_MOVE(MaskedAssignImageFilter); - - /** Standard class type aliases. */ - using Self = MaskedAssignImageFilter; - using Superclass = TernaryGeneratorImageFilter; - - using Pointer = SmartPointer; - using ConstPointer = SmartPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(MaskedAssignImageFilter, TernaryGeneratorImageFilter); - - /** Typedefs **/ - using InputImageType = TInputImage; - using MaskImageType = TMaskImage; - using AssignImageType = TOutputImage; - using OutputImageType = TOutputImage; - - using OutputPixelType = typename OutputImageType::PixelType; - - itkSetInputMacro(MaskImage, MaskImageType); - itkGetInputMacro(MaskImage, MaskImageType); - - itkSetInputMacro(AssignImage, AssignImageType); - itkGetInputMacro(AssignImage, AssignImageType); - - virtual void SetAssignConstant( const OutputPixelType &v) { this->SetConstant3(v); } - virtual OutputPixelType GetAssignConstant( ) const {return this->GetConstant3(); } - - protected: - MaskedAssignImageFilter(); - ~MaskedAssignImageFilter() override = default; - }; +{ +public: + ITK_DISALLOW_COPY_AND_MOVE(MaskedAssignImageFilter); + + /** Standard class type aliases. */ + using Self = MaskedAssignImageFilter; + using Superclass = TernaryGeneratorImageFilter; + + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(MaskedAssignImageFilter, TernaryGeneratorImageFilter); + + /** Typedefs **/ + using InputImageType = TInputImage; + using MaskImageType = TMaskImage; + using AssignImageType = TOutputImage; + using OutputImageType = TOutputImage; + + using OutputPixelType = typename OutputImageType::PixelType; + + itkSetInputMacro(MaskImage, MaskImageType); + itkGetInputMacro(MaskImage, MaskImageType); + + itkSetInputMacro(AssignImage, AssignImageType); + itkGetInputMacro(AssignImage, AssignImageType); + + virtual void + SetAssignConstant(const OutputPixelType & v) + { + this->SetConstant3(v); + } + virtual OutputPixelType + GetAssignConstant() const + { + return this->GetConstant3(); + } + +protected: + MaskedAssignImageFilter(); + ~MaskedAssignImageFilter() override = default; +}; } // end namespace itk #endif #ifndef ITK_MANUAL_INSTANTIATION #include "itkMaskedAssignImageFilter.hxx" -#endif \ No newline at end of file +#endif diff --git a/include/itkMaskedAssignImageFilter.hxx b/include/itkMaskedAssignImageFilter.hxx index 13bd032..0880ea2 100644 --- a/include/itkMaskedAssignImageFilter.hxx +++ b/include/itkMaskedAssignImageFilter.hxx @@ -20,25 +20,29 @@ #include "itkMaskedAssignImageFilter.h" -namespace itk { - template - MaskedAssignImageFilter::MaskedAssignImageFilter() { - this->SetPrimaryInputName("InputImage"); - this->AddRequiredInputName("MaskImage", 1); - this->AddRequiredInputName("AssignImage", 2); +namespace itk +{ +template +MaskedAssignImageFilter::MaskedAssignImageFilter() +{ + this->SetPrimaryInputName("InputImage"); + this->AddRequiredInputName("MaskImage", 1); + this->AddRequiredInputName("AssignImage", 2); - auto func = [](const typename InputImageType::PixelType &input, - const typename MaskImageType::PixelType &mask, - const typename AssignImageType::PixelType &assign) -> - OutputPixelType { - if (mask != NumericTraits::Zero) { - return assign; - } else { - return static_cast(input); - } - }; - this->SetFunctor(func); + auto func = [](const typename InputImageType::PixelType & input, + const typename MaskImageType::PixelType & mask, + const typename AssignImageType::PixelType & assign) -> OutputPixelType { + if (mask != NumericTraits::Zero) + { + return assign; } + else + { + return static_cast(input); + } + }; + this->SetFunctor(func); +} } // end namespace itk diff --git a/include/itkNPasteImageFilter.h b/include/itkNPasteImageFilter.h index 8df72ad..1427bd4 100644 --- a/include/itkNPasteImageFilter.h +++ b/include/itkNPasteImageFilter.h @@ -40,8 +40,8 @@ namespace itk * repositioned to DestinationIndex, then the output will just be * a copy of the input. * - * This filter supports running "InPlace" to efficiently reuses the destination image buffer for the output, removing the - * need to copy the destination pixels to the output. + * This filter supports running "InPlace" to efficiently reuses the destination image buffer for the output, removing + * the need to copy the destination pixels to the output. * * When the source image is a lower dimension than the destination image then the DestinationSkipAxes parameter * specifies which axes in the destination image are set to 1 when copying the region or filling with a constant. diff --git a/include/itkNPasteImageFilter.hxx b/include/itkNPasteImageFilter.hxx index f60406a..50e5087 100644 --- a/include/itkNPasteImageFilter.hxx +++ b/include/itkNPasteImageFilter.hxx @@ -89,7 +89,7 @@ NPasteImageFilter::VerifyPreconditions( if (sourceInput == nullptr && constantInput == nullptr) { - itkExceptionMacro("The Source or the Constant input are required.") + itkExceptionMacro("The Source or the Constant input are required."); } @@ -285,7 +285,7 @@ NPasteImageFilter::GetPresumedDestinati if (numberSkippedAxis != (InputImageDimension - SourceImageDimension)) { - itkExceptionMacro("Number of skipped axis " << m_DestinationSkipAxes) + itkExceptionMacro("Number of skipped axis " << m_DestinationSkipAxes); } InputImageSizeType ret; diff --git a/src/itkDICOMOrientation.cxx b/src/itkDICOMOrientation.cxx index bb95fba..3279c49 100644 --- a/src/itkDICOMOrientation.cxx +++ b/src/itkDICOMOrientation.cxx @@ -55,12 +55,12 @@ const std::string & DICOMOrientation::GetAsString() const { const auto & codeToString = GetCodeToString(); - auto iter = codeToString.find(m_Value); + auto iter = codeToString.find(m_Value); if (iter != codeToString.end()) - { + { return iter->second; - } - assert( codeToString.find(OrientationEnum::INVALID) != codeToString.end()); + } + assert(codeToString.find(OrientationEnum::INVALID) != codeToString.end()); return codeToString.find(OrientationEnum::INVALID)->second; } diff --git a/test/itkMaskedAssignImageFilterGTest.cxx b/test/itkMaskedAssignImageFilterGTest.cxx index 367a145..6e72c73 100644 --- a/test/itkMaskedAssignImageFilterGTest.cxx +++ b/test/itkMaskedAssignImageFilterGTest.cxx @@ -26,225 +26,230 @@ namespace { - class MaskedAssignFixture : public ::testing::Test +class MaskedAssignFixture : public ::testing::Test +{ +public: + MaskedAssignFixture() = default; + ~MaskedAssignFixture() override = default; + +protected: + void + SetUp() override + { + RegisterRequiredFactories(); + } + + template + static std::string + MD5Hash(const TImageType * image) + { + + using HashFilter = itk::Testing::HashImageFilter; + typename HashFilter::Pointer hasher = HashFilter::New(); + hasher->SetInput(image); + hasher->InPlaceOff(); + hasher->Update(); + return hasher->GetHash(); + } + + template + struct FixtureUtilities + { + static const unsigned int Dimension = TInputImage::ImageDimension; + + using PixelType = typename TInputImage::PixelType; + using OutputPixelType = PixelType; + using InputImageType = TInputImage; + using OutputImageType = TInputImage; + using RegionType = typename InputImageType::RegionType; + using SizeType = typename TInputImage::SizeType; + using IndexType = typename TInputImage::IndexType; + + + using MaskImageType = TMaskImage; + using MaskRegionType = typename MaskImageType::RegionType; + using MaskSizeType = typename MaskImageType::SizeType; + using MaskIndexType = typename MaskImageType::IndexType; + + using FilterType = itk::MaskedAssignImageFilter; + + // Create a black image or empty + template + static typename TImage::Pointer + CreateImageT(unsigned int size = 100) + { + typename TImage::Pointer image = TImage::New(); + + typename TImage::SizeType imageSize; + imageSize.Fill(size); + image->SetRegions(typename TImage::RegionType(imageSize)); + InitializeImage(image.GetPointer()); + + return image; + } + + template + static void + InitializeImage(itk::Image * image) { - public: - MaskedAssignFixture() = default; - ~MaskedAssignFixture() override = default; - - protected: - void - SetUp() override - { - RegisterRequiredFactories(); - } - - template - static std::string - MD5Hash(const TImageType * image) - { - - using HashFilter = itk::Testing::HashImageFilter; - typename HashFilter::Pointer hasher = HashFilter::New(); - hasher->SetInput(image); - hasher->InPlaceOff(); - hasher->Update(); - return hasher->GetHash(); - } - - template - struct FixtureUtilities - { - static const unsigned int Dimension = TInputImage::ImageDimension; - - using PixelType = typename TInputImage::PixelType; - using OutputPixelType = PixelType; - using InputImageType = TInputImage; - using OutputImageType = TInputImage; - using RegionType = typename InputImageType::RegionType; - using SizeType = typename TInputImage::SizeType; - using IndexType = typename TInputImage::IndexType; - - - using MaskImageType = TMaskImage; - using MaskRegionType = typename MaskImageType::RegionType; - using MaskSizeType = typename MaskImageType::SizeType; - using MaskIndexType = typename MaskImageType::IndexType; - - using FilterType = itk::MaskedAssignImageFilter; - - // Create a black image or empty - template - static typename TImage::Pointer - CreateImageT(unsigned int size = 100) - { - typename TImage::Pointer image = TImage::New(); - - typename TImage::SizeType imageSize; - imageSize.Fill(size); - image->SetRegions(typename TImage::RegionType(imageSize)); - InitializeImage(image.GetPointer()); - - return image; - } - - template - static void InitializeImage(itk::Image *image) - { - image->Allocate(); - image->FillBuffer(itk::NumericTraits::ZeroValue()); - } - - - template - static void InitializeImage(itk::VectorImage *image) - { - constexpr unsigned int sz = 3; - image->SetNumberOfComponentsPerPixel(sz); - image->Allocate(); - itk::VariableLengthVector p{sz}; - p.Fill(itk::NumericTraits::ZeroValue()); - image->FillBuffer(p); - } - - static constexpr auto CreateImage = CreateImageT; - static constexpr auto CreateMaskImage = CreateImageT; - }; - }; + image->Allocate(); + image->FillBuffer(itk::NumericTraits::ZeroValue()); + } + + + template + static void + InitializeImage(itk::VectorImage * image) + { + constexpr unsigned int sz = 3; + image->SetNumberOfComponentsPerPixel(sz); + image->Allocate(); + itk::VariableLengthVector p{ sz }; + p.Fill(itk::NumericTraits::ZeroValue()); + image->FillBuffer(p); + } + + static constexpr auto CreateImage = CreateImageT; + static constexpr auto CreateMaskImage = CreateImageT; + }; +}; } // namespace -TEST_F(MaskedAssignFixture, SetGetPrint) { - using Utils = FixtureUtilities>; +TEST_F(MaskedAssignFixture, SetGetPrint) +{ + using Utils = FixtureUtilities>; - auto filter = Utils::FilterType::New(); + auto filter = Utils::FilterType::New(); - auto image = Utils::CreateImage(100); + auto image = Utils::CreateImage(100); - EXPECT_STREQ("MaskedAssignImageFilter", filter->GetNameOfClass()); + EXPECT_STREQ("MaskedAssignImageFilter", filter->GetNameOfClass()); - EXPECT_NO_THROW(filter->SetInput(image)); - EXPECT_EQ(image, filter->GetInput()); - EXPECT_ANY_THROW(filter->GetConstant1()); + EXPECT_NO_THROW(filter->SetInput(image)); + EXPECT_EQ(image, filter->GetInput()); + EXPECT_ANY_THROW(filter->GetConstant1()); - image = Utils::CreateImage(100); - EXPECT_NO_THROW(filter->SetInput1(image)); - EXPECT_EQ(image, filter->GetInput()); - EXPECT_ANY_THROW(filter->GetConstant1()); + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetInput1(image)); + EXPECT_EQ(image, filter->GetInput()); + EXPECT_ANY_THROW(filter->GetConstant1()); - EXPECT_NO_THROW(filter->SetConstant1(1)); - EXPECT_ANY_THROW(filter->GetInput()); - EXPECT_EQ(1, filter->GetConstant1()); + EXPECT_NO_THROW(filter->SetConstant1(1)); + EXPECT_ANY_THROW(filter->GetInput()); + EXPECT_EQ(1, filter->GetConstant1()); - image = Utils::CreateImage(100); - EXPECT_NO_THROW(filter->SetInput2(image)); - EXPECT_EQ(image, filter->GetMaskImage()); - EXPECT_ANY_THROW(filter->GetConstant2()); + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetInput2(image)); + EXPECT_EQ(image, filter->GetMaskImage()); + EXPECT_ANY_THROW(filter->GetConstant2()); - image = Utils::CreateImage(100); - EXPECT_NO_THROW(filter->SetMaskImage(image)); - EXPECT_EQ(image, filter->GetMaskImage()); - EXPECT_ANY_THROW(filter->GetConstant2()); + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetMaskImage(image)); + EXPECT_EQ(image, filter->GetMaskImage()); + EXPECT_ANY_THROW(filter->GetConstant2()); - EXPECT_NO_THROW(filter->SetConstant2(2)); - EXPECT_ANY_THROW(filter->GetMaskImage()); - EXPECT_EQ(2, filter->GetConstant2()); + EXPECT_NO_THROW(filter->SetConstant2(2)); + EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_EQ(2, filter->GetConstant2()); - image = Utils::CreateImage(100); - EXPECT_NO_THROW(filter->SetInput3(image)); - EXPECT_EQ(image, filter->GetAssignImage()); - EXPECT_ANY_THROW(filter->GetConstant3()); - EXPECT_ANY_THROW(filter->GetAssignConstant()); + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetInput3(image)); + EXPECT_EQ(image, filter->GetAssignImage()); + EXPECT_ANY_THROW(filter->GetConstant3()); + EXPECT_ANY_THROW(filter->GetAssignConstant()); - image = Utils::CreateImage(100); - EXPECT_NO_THROW(filter->SetAssignImage(image)); - EXPECT_EQ(image, filter->GetAssignImage()); - EXPECT_ANY_THROW(filter->GetConstant3()); - EXPECT_ANY_THROW(filter->GetAssignConstant()); + image = Utils::CreateImage(100); + EXPECT_NO_THROW(filter->SetAssignImage(image)); + EXPECT_EQ(image, filter->GetAssignImage()); + EXPECT_ANY_THROW(filter->GetConstant3()); + EXPECT_ANY_THROW(filter->GetAssignConstant()); - EXPECT_NO_THROW(filter->SetConstant3(3)); - EXPECT_ANY_THROW(filter->GetMaskImage()); - EXPECT_EQ(3, filter->GetConstant3()); + EXPECT_NO_THROW(filter->SetConstant3(3)); + EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_EQ(3, filter->GetConstant3()); - EXPECT_NO_THROW(filter->SetAssignConstant(4)); - EXPECT_ANY_THROW(filter->GetMaskImage()); - EXPECT_EQ(4, filter->GetConstant3()); - EXPECT_EQ(4, filter->GetAssignConstant()); + EXPECT_NO_THROW(filter->SetAssignConstant(4)); + EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_EQ(4, filter->GetConstant3()); + EXPECT_EQ(4, filter->GetAssignConstant()); } -TEST_F(MaskedAssignFixture, Test1) { +TEST_F(MaskedAssignFixture, Test1) +{ - using Utils = FixtureUtilities, itk::Image>; + using Utils = FixtureUtilities, itk::Image>; - auto image = Utils::CreateImage(100); - image->FillBuffer(99); + auto image = Utils::CreateImage(100); + image->FillBuffer(99); - auto mask = Utils::CreateMaskImage(100); - mask->FillBuffer(0); + auto mask = Utils::CreateMaskImage(100); + mask->FillBuffer(0); - auto filter = Utils::FilterType::New(); + auto filter = Utils::FilterType::New(); - EXPECT_NO_THROW(filter->SetAssignConstant(5)); - EXPECT_EQ(5, filter->GetAssignConstant()); + EXPECT_NO_THROW(filter->SetAssignConstant(5)); + EXPECT_EQ(5, filter->GetAssignConstant()); - mask->SetPixel({ {0,0}}, 1); + mask->SetPixel({ { 0, 0 } }, 1); - mask->SetPixel({{20,21}}, 1); + mask->SetPixel({ { 20, 21 } }, 1); - filter->SetInput(image); - filter->SetMaskImage(mask); + filter->SetInput(image); + filter->SetMaskImage(mask); - filter->Update(); - auto output = filter->GetOutput(); + filter->Update(); + auto output = filter->GetOutput(); - EXPECT_EQ(5, output->GetPixel({{0,0}})); - EXPECT_EQ(99, output->GetPixel({{0,1}})); + EXPECT_EQ(5, output->GetPixel({ { 0, 0 } })); + EXPECT_EQ(99, output->GetPixel({ { 0, 1 } })); - EXPECT_EQ(99, output->GetPixel({{1,1}})); + EXPECT_EQ(99, output->GetPixel({ { 1, 1 } })); - EXPECT_EQ(5, output->GetPixel({{20,21}})); + EXPECT_EQ(5, output->GetPixel({ { 20, 21 } })); - EXPECT_EQ("b28618b5cccaa828028a29b44d88c728", MD5Hash(output)); + EXPECT_EQ("b28618b5cccaa828028a29b44d88c728", MD5Hash(output)); } -TEST_F(MaskedAssignFixture, VectorTest2) { +TEST_F(MaskedAssignFixture, VectorTest2) +{ - using Utils = FixtureUtilities, itk::Image>; + using Utils = FixtureUtilities, itk::Image>; - auto image = Utils::CreateImage(21); - Utils::PixelType p{image->GetNumberOfComponentsPerPixel()}; - p.Fill( 12 ); - image->FillBuffer( p ); + auto image = Utils::CreateImage(21); + Utils::PixelType p{ image->GetNumberOfComponentsPerPixel() }; + p.Fill(12); + image->FillBuffer(p); - auto filter = Utils::FilterType::New(); + auto filter = Utils::FilterType::New(); - Utils::PixelType c{3}; - c.Fill( 0 ); - EXPECT_NO_THROW(filter->SetAssignConstant(c)); - EXPECT_EQ(c, filter->GetAssignConstant()); + Utils::PixelType c{ 3 }; + c.Fill(0); + EXPECT_NO_THROW(filter->SetAssignConstant(c)); + EXPECT_EQ(c, filter->GetAssignConstant()); - auto mask = Utils::CreateMaskImage(21); - mask->FillBuffer(0); - mask->SetPixel({ {2,2}}, 1); + auto mask = Utils::CreateMaskImage(21); + mask->FillBuffer(0); + mask->SetPixel({ { 2, 2 } }, 1); - mask->SetPixel({{3,19}}, 1); + mask->SetPixel({ { 3, 19 } }, 1); - filter->SetInput(image); - filter->SetMaskImage(mask); + filter->SetInput(image); + filter->SetMaskImage(mask); - filter->Update(); - auto output = filter->GetOutput(); + filter->Update(); + auto output = filter->GetOutput(); - EXPECT_EQ(p, output->GetPixel({{0,0}})); - EXPECT_EQ(c, output->GetPixel({{2,2}})); - EXPECT_EQ(c, output->GetPixel({{3,19}})); + EXPECT_EQ(p, output->GetPixel({ { 0, 0 } })); + EXPECT_EQ(c, output->GetPixel({ { 2, 2 } })); + EXPECT_EQ(c, output->GetPixel({ { 3, 19 } })); - EXPECT_EQ("f089464fcbec9429f409ee779788cca3", MD5Hash(output)); + EXPECT_EQ("f089464fcbec9429f409ee779788cca3", MD5Hash(output)); } From 69174157fe2347e0c7e449c39c54b667bb07e471 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Mon, 11 Jan 2021 13:43:34 -0600 Subject: [PATCH 07/20] COMP: Update GitHub Actions from ITKModuleTemplate --- .github/workflows/build-test-package.yml | 36 +++++++++++++++++------- setup.py | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index d13527c..4bf7c5f 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -13,17 +13,17 @@ jobs: - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" - itk-git-tag: "v5.1.1" + itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "v5.1.1" + itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "v5.1.1" + itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" cmake-build-type: "MinSizeRel" steps: @@ -39,6 +39,9 @@ jobs: python -m pip install --upgrade pip python -m pip install ninja + - name: Get specific version of CMake, Ninja + uses: lukka/get-cmake@v3.18.3 + - name: Download ITK run: | cd .. @@ -100,6 +103,9 @@ jobs: set(dashboard_no_clean 1) set(ENV{CC} ${{ matrix.c-compiler }}) set(ENV{CXX} ${{ matrix.cxx-compiler }}) + if(WIN32) + set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\$ENV{PATH}") + endif() set(dashboard_cache " ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build BUILD_TESTING:BOOL=ON @@ -128,9 +134,9 @@ jobs: strategy: max-parallel: 2 matrix: - python-version: [35, 36, 37, 38] + python-version: [36, 37, 38, 39] include: - - itk-python-git-tag: "v5.1.1" + - itk-python-git-tag: "v5.2rc01" steps: - uses: actions/checkout@v2 @@ -166,11 +172,18 @@ jobs: max-parallel: 2 matrix: include: - - itk-python-git-tag: "v5.1.1" + - itk-python-git-tag: "v5.2rc01" steps: - uses: actions/checkout@v2 + - name: 'Specific XCode version' + run: | + sudo xcode-select -s "/Applications/Xcode_11.7.app" + + - name: Get specific version of CMake, Ninja + uses: lukka/get-cmake@v3.18.3 + - name: 'Fetch build script' run: | curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O @@ -193,11 +206,14 @@ jobs: strategy: max-parallel: 2 matrix: - python-version-minor: [5, 6, 7, 8] + python-version-minor: [6, 7, 8, 9] include: - - itk-python-git-tag: "v5.1.1" + - itk-python-git-tag: "v5.2rc01" steps: + - name: Get specific version of CMake, Ninja + uses: lukka/get-cmake@v3.18.3 + - uses: actions/checkout@v2 with: path: "im" @@ -212,7 +228,7 @@ jobs: shell: bash run: | mv im ../../ - cd ../../ + cd ../../im curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ matrix.itk-python-git-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip" 7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip" @@ -233,7 +249,7 @@ jobs: - name: Publish Python package as GitHub Artifact uses: actions/upload-artifact@v1 with: - name: WindowWheel3.${{ matrix.python-version-minor }} + name: WindowsWheel3.${{ matrix.python-version-minor }} path: ../../im/dist publish-python-packages-to-pypi: diff --git a/setup.py b/setup.py index 8bf21b2..aaad919 100644 --- a/setup.py +++ b/setup.py @@ -44,6 +44,6 @@ keywords='ITK InsightToolkit', url=r'https://itk.org/', install_requires=[ - r'itk>=5.1.1' + r'itk>=5.2rc1' ] ) From be2102454e61aba74b4f3657398420b32550f856 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Tue, 26 Jan 2021 10:50:01 -0600 Subject: [PATCH 08/20] BUG: Incorrect expectations for tests The test expects an exception to be thrown, when in actuality, it does not. This makes the test verify no exception is thrown. --- test/itkMaskedAssignImageFilterGTest.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/itkMaskedAssignImageFilterGTest.cxx b/test/itkMaskedAssignImageFilterGTest.cxx index 6e72c73..0104f27 100644 --- a/test/itkMaskedAssignImageFilterGTest.cxx +++ b/test/itkMaskedAssignImageFilterGTest.cxx @@ -136,7 +136,7 @@ TEST_F(MaskedAssignFixture, SetGetPrint) EXPECT_ANY_THROW(filter->GetConstant1()); EXPECT_NO_THROW(filter->SetConstant1(1)); - EXPECT_ANY_THROW(filter->GetInput()); + EXPECT_NO_THROW(filter->GetInput()); EXPECT_EQ(1, filter->GetConstant1()); @@ -151,7 +151,7 @@ TEST_F(MaskedAssignFixture, SetGetPrint) EXPECT_ANY_THROW(filter->GetConstant2()); EXPECT_NO_THROW(filter->SetConstant2(2)); - EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_NO_THROW(filter->GetMaskImage()); EXPECT_EQ(2, filter->GetConstant2()); @@ -168,12 +168,12 @@ TEST_F(MaskedAssignFixture, SetGetPrint) EXPECT_ANY_THROW(filter->GetAssignConstant()); EXPECT_NO_THROW(filter->SetConstant3(3)); - EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_NO_THROW(filter->GetMaskImage()); EXPECT_EQ(3, filter->GetConstant3()); EXPECT_NO_THROW(filter->SetAssignConstant(4)); - EXPECT_ANY_THROW(filter->GetMaskImage()); + EXPECT_NO_THROW(filter->GetMaskImage()); EXPECT_EQ(4, filter->GetConstant3()); EXPECT_EQ(4, filter->GetAssignConstant()); } From 83cc86df23b4d42129363bc59b90f26c2d058f84 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 23 Apr 2021 13:01:53 +0000 Subject: [PATCH 09/20] Update checkout version 2 --- .github/workflows/build-test-package.yml | 2 +- .github/workflows/clang-format-linter.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 4bf7c5f..5f38395 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -27,7 +27,7 @@ jobs: cmake-build-type: "MinSizeRel" steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up Python 3.7 uses: actions/setup-python@v1 diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml index 69166d9..35a9103 100644 --- a/.github/workflows/clang-format-linter.yml +++ b/.github/workflows/clang-format-linter.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: fetch-depth: 1 - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master From 9450615302b55221b78347c6694caf2b3859958e Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 23 Apr 2021 13:02:15 +0000 Subject: [PATCH 10/20] Update to ITK tag v5.20 --- .github/workflows/build-test-package.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 5f38395..b75ef9d 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -13,17 +13,17 @@ jobs: - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" - itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" + itk-git-tag: "v5.2.0" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" + itk-git-tag: "v5.2.0" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" + itk-git-tag: "v5.2.0" cmake-build-type: "MinSizeRel" steps: @@ -136,7 +136,7 @@ jobs: matrix: python-version: [36, 37, 38, 39] include: - - itk-python-git-tag: "v5.2rc01" + - itk-python-git-tag: "v5.2.0" steps: - uses: actions/checkout@v2 @@ -172,7 +172,7 @@ jobs: max-parallel: 2 matrix: include: - - itk-python-git-tag: "v5.2rc01" + - itk-python-git-tag: "v5.2.0" steps: - uses: actions/checkout@v2 @@ -208,7 +208,7 @@ jobs: matrix: python-version-minor: [6, 7, 8, 9] include: - - itk-python-git-tag: "v5.2rc01" + - itk-python-git-tag: "v5.2.0" steps: - name: Get specific version of CMake, Ninja From 4cd0a630f433c16b491a9e2ce028e2655965b5d7 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 23 Apr 2021 13:11:55 +0000 Subject: [PATCH 11/20] Update Ubuntu 20.04 --- .github/workflows/build-test-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index b75ef9d..6ef10e7 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -8,9 +8,9 @@ jobs: strategy: max-parallel: 3 matrix: - os: [ubuntu-18.04, windows-2019, macos-10.15] + os: [ubuntu-20.04, windows-2019, macos-10.15] include: - - os: ubuntu-18.04 + - os: ubuntu-20.04 c-compiler: "gcc" cxx-compiler: "g++" itk-git-tag: "v5.2.0" @@ -130,7 +130,7 @@ jobs: shell: cmd build-linux-python-packages: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: max-parallel: 2 matrix: @@ -257,7 +257,7 @@ jobs: - build-linux-python-packages - build-macos-python-packages - build-windows-python-packages - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Download Python Packages From 8a7586cf1370468d89abbebb22c437649d73f586 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 23 Apr 2021 13:20:06 +0000 Subject: [PATCH 12/20] Update used python version in setup --- .github/workflows/build-test-package.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 6ef10e7..e639420 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -29,10 +29,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.8 - name: Install build dependencies run: | From 2ff7b0774a9d99001edbb44026a7ba4c1c23983e Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 23 Apr 2021 13:20:24 +0000 Subject: [PATCH 13/20] Update setup.py version --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index aaad919..fa0a4f4 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='itk-simpleitkfilters', - version='0.2.0', + version='0.3.0', author='SimpleITK', author_email='itk+community@discourse.itk.org', packages=['itk'], @@ -44,6 +44,6 @@ keywords='ITK InsightToolkit', url=r'https://itk.org/', install_requires=[ - r'itk>=5.2rc1' + r'itk>=5.2.0' ] ) From 0a6d1bf0817d71fb1ee98faef046334fedaef1a0 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Apr 2021 20:24:01 +0000 Subject: [PATCH 14/20] Add test case for report matrix with an INVALID orientation --- test/itkDICOMOrientImageFilterGTest.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/itkDICOMOrientImageFilterGTest.cxx b/test/itkDICOMOrientImageFilterGTest.cxx index a0b7ffa..9791b9d 100644 --- a/test/itkDICOMOrientImageFilterGTest.cxx +++ b/test/itkDICOMOrientImageFilterGTest.cxx @@ -450,8 +450,15 @@ TEST(DICOMOrientation, DirectionCosinesToOrientation) d(1, 1) = 1; d(0, 2) = 1; EXPECT_EQ(OE::SPL, DICOMOrientation::DirectionCosinesToOrientation(d)); -} + const double data[] = {0.5986634407395047, 0.22716302314740483, -0.768113953548866, + 0.5627936241740271, 0.563067040943212, 0.6051601804419384, + 0.5699696670095713, -0.794576911518317, 0.20924175102261847}; + ImageType::DirectionType::InternalMatrixType m{data}; + d.GetVnlMatrix() = m; + EXPECT_EQ(OE::PIR, DICOMOrientation::DirectionCosinesToOrientation(d)); + +} TEST(DICOMOrientation, OrientationToDirectionCosines) { From a728f6d9c610f997e3111cb9eeb1b90cec3b7d8e Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Apr 2021 20:25:31 +0000 Subject: [PATCH 15/20] Update to greedy algorithm for determining closes orientation The new method resolved the cases where there are no dominant direction in one or more axis. This method chooses the high value in the matrix first, then removes the invalid remaining values to select from. --- src/itkDICOMOrientation.cxx | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/itkDICOMOrientation.cxx b/src/itkDICOMOrientation.cxx index 3279c49..c914ec8 100644 --- a/src/itkDICOMOrientation.cxx +++ b/src/itkDICOMOrientation.cxx @@ -170,27 +170,50 @@ DICOMOrientation::DirectionCosinesToOrientation(const DirectionType & dir) // but it is DIFFERENT in the meaning of direction in terms of sign-ness. CoordinateEnum terms[3] = { CoordinateEnum::UNKNOWN, CoordinateEnum::UNKNOWN, CoordinateEnum::UNKNOWN }; - for (unsigned i = 0; i < 3; i++) - { + std::multimap< double, std::pair > value_to_idx; + for (unsigned int c = 0; c < 3; ++c ) + { + for (unsigned int r = 0; r < 3; ++r ) + { + value_to_idx.emplace(std::abs(dir[c][r]), std::make_pair(c,r)); + } + } + + for (unsigned i = 0; i < 3; ++i) + { - const unsigned dominant_axis = Function::Max3(dir[0][i], dir[1][i], dir[2][i]); + auto max_idx = value_to_idx.rbegin()->second; + const unsigned int max_c = max_idx.first; + const unsigned int max_r = max_idx.second; - const int dominate_sgn = Math::sgn(dir[dominant_axis][i]); + const int max_sgn = Math::sgn(dir[max_c][max_r]); + + for (auto it = value_to_idx.begin(); it != value_to_idx.end();) + { + if (it->second.first == max_c || it->second.second == max_r) + { + value_to_idx.erase(it++); + } + else + { + ++it; + } + } - switch (dominant_axis) + switch (max_c) { case 0: { - // When the dominate axis sign is positive, assign the coordinate for the direction we are increasing towards. + // When the dominant axis sign is positive, assign the coordinate for the direction we are increasing towards. // ITK is in LPS, so that is the positive direction - terms[i] = (dominate_sgn == 1) ? CoordinateEnum::Left : CoordinateEnum::Right; + terms[max_r] = (max_sgn == 1) ? CoordinateEnum::Left : CoordinateEnum::Right; break; } case 1: { - terms[i] = (dominate_sgn == 1) ? CoordinateEnum::Posterior : CoordinateEnum::Anterior; + terms[max_r] = (max_sgn == 1) ? CoordinateEnum::Posterior : CoordinateEnum::Anterior; break; } case 2: { - terms[i] = (dominate_sgn == 1) ? CoordinateEnum::Superior : CoordinateEnum::Inferior; + terms[max_r] = (max_sgn == 1) ? CoordinateEnum::Superior : CoordinateEnum::Inferior; break; } default: From 432d4578ca578d5ae052a7b6cb2ef31e567ed7dc Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 23 Apr 2021 17:43:10 +0000 Subject: [PATCH 16/20] Fix CI to use Ubuntu 18.04 --- .github/workflows/build-test-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index e639420..16cea04 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -8,9 +8,9 @@ jobs: strategy: max-parallel: 3 matrix: - os: [ubuntu-20.04, windows-2019, macos-10.15] + os: [ubuntu-18.04, windows-2019, macos-10.15] include: - - os: ubuntu-20.04 + - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" itk-git-tag: "v5.2.0" From c1ab5847530c75dd13369cd64dd29f5c580e606f Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Tue, 2 Nov 2021 18:17:59 +0000 Subject: [PATCH 17/20] Update to ITK 5.3rc2 The MakeIndex and MakeVector methods are now in the itk namespace. --- .github/workflows/build-test-package.yml | 6 +++--- test/itkHessianImageFilterGTest.cxx | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 16cea04..4e15e78 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -13,17 +13,17 @@ jobs: - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" - itk-git-tag: "v5.2.0" + itk-git-tag: "v5.3rc02" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "v5.2.0" + itk-git-tag: "v5.3rc02" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "v5.2.0" + itk-git-tag: "v5.3rc02" cmake-build-type: "MinSizeRel" steps: diff --git a/test/itkHessianImageFilterGTest.cxx b/test/itkHessianImageFilterGTest.cxx index 07f06c8..4c2853b 100644 --- a/test/itkHessianImageFilterGTest.cxx +++ b/test/itkHessianImageFilterGTest.cxx @@ -154,16 +154,16 @@ TEST_F(HessianImageFilterFixture, ValueTest_3D) Utils::HessianImageType::Pointer output = filter->GetOutput(); - std::cout << "Value: " << image->GetPixel(MakeIndex(11, 12, 12)) << std::endl; - std::cout << "Value: " << image->GetPixel(MakeIndex(12, 12, 12)) << std::endl; - std::cout << "Value: " << image->GetPixel(MakeIndex(13, 12, 12)) << std::endl; - std::cout << "Value: " << image->GetPixel(MakeIndex(14, 12, 12)) << std::endl; + std::cout << "Value: " << image->GetPixel(itk::MakeIndex(11, 12, 12)) << std::endl; + std::cout << "Value: " << image->GetPixel(itk::MakeIndex(12, 12, 12)) << std::endl; + std::cout << "Value: " << image->GetPixel(itk::MakeIndex(13, 12, 12)) << std::endl; + std::cout << "Value: " << image->GetPixel(itk::MakeIndex(14, 12, 12)) << std::endl; ITK_EXPECT_VECTOR_NEAR( - MakeFixedArray(-0.0001615, 0.0, 0.0, -0.0001615, 0.0, -0.0001615), output->GetPixel(MakeIndex(12, 12, 12)), 1e-6); + MakeFixedArray(-0.0001615, 0.0, 0.0, -0.0001615, 0.0, -0.0001615), output->GetPixel(itk::MakeIndex(12, 12, 12)), 1e-6); ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-0.00014602, 0.0, 0.0, -0.00014602, 0.0, -0.00014602), - output->GetPixel(MakeIndex(10, 10, 10)), + output->GetPixel(itk::MakeIndex(10, 10, 10)), 1e-5); } @@ -179,7 +179,7 @@ TEST_F(HessianImageFilterFixture, ValueTest_2D) for (unsigned int i = 0; i < Utils::imageSize; ++i) { - image->SetPixel(MakeIndex(10, i), 1); + image->SetPixel(itk::MakeIndex(10, i), 1); } using Utils = FixtureUtilities<2>; @@ -190,16 +190,16 @@ TEST_F(HessianImageFilterFixture, ValueTest_2D) Utils::HessianImageType::Pointer output = filter->GetOutput(); - ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-2.0, 0.0, 0.0), output->GetPixel(MakeIndex(10, 10)), 1e-6); + ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-2.0, 0.0, 0.0), output->GetPixel(itk::MakeIndex(10, 10)), 1e-6); - ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-2.0, 0.0, 0.0), output->GetPixel(MakeIndex(10, 0)), 1e-6); + ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-2.0, 0.0, 0.0), output->GetPixel(itk::MakeIndex(10, 0)), 1e-6); - image->SetSpacing(MakeVector(10.0, 2.0)); + image->SetSpacing(itk::MakeVector(10.0, 2.0)); image->Modified(); filter->Update(); - ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-.02, 0.0, 0.0), output->GetPixel(MakeIndex(10, 10)), 1e-6); + ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-.02, 0.0, 0.0), output->GetPixel(itk::MakeIndex(10, 10)), 1e-6); - ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-.02, 0.0, 0.0), output->GetPixel(MakeIndex(10, 0)), 1e-6); + ITK_EXPECT_VECTOR_NEAR(MakeFixedArray(-.02, 0.0, 0.0), output->GetPixel(itk::MakeIndex(10, 0)), 1e-6); } From ad919053dcf7fdfec827497954afed2c83330d1a Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 4 Nov 2021 15:30:39 +0000 Subject: [PATCH 18/20] Change testing data to sha512 uploaded to data.kitware --- test/Baseline/ObjectnessMeasureImageFilterTest1.nii.md5 | 1 - test/Baseline/ObjectnessMeasureImageFilterTest1.nii.sha512 | 1 + test/Baseline/ObjectnessMeasureImageFilterTest2.nii.md5 | 1 - test/Baseline/ObjectnessMeasureImageFilterTest2.nii.sha512 | 1 + .../itkHessianToObjectnessMeasureImageFilterTest2.mha.md5 | 1 - .../itkHessianToObjectnessMeasureImageFilterTest2.mha.sha512 | 1 + test/Input/DSA.png.md5 | 1 - test/Input/DSA.png.sha512 | 1 + test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.md5 | 1 - .../itkHessianToObjectnessMeasureImageFilterTest.mha.sha512 | 1 + 10 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 test/Baseline/ObjectnessMeasureImageFilterTest1.nii.md5 create mode 100644 test/Baseline/ObjectnessMeasureImageFilterTest1.nii.sha512 delete mode 100644 test/Baseline/ObjectnessMeasureImageFilterTest2.nii.md5 create mode 100644 test/Baseline/ObjectnessMeasureImageFilterTest2.nii.sha512 delete mode 100644 test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.md5 create mode 100644 test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.sha512 delete mode 100644 test/Input/DSA.png.md5 create mode 100644 test/Input/DSA.png.sha512 delete mode 100644 test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.md5 create mode 100644 test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.sha512 diff --git a/test/Baseline/ObjectnessMeasureImageFilterTest1.nii.md5 b/test/Baseline/ObjectnessMeasureImageFilterTest1.nii.md5 deleted file mode 100644 index ae9d581..0000000 --- a/test/Baseline/ObjectnessMeasureImageFilterTest1.nii.md5 +++ /dev/null @@ -1 +0,0 @@ -1fdb74a9029cf33147ace42e2d6c8f15 diff --git a/test/Baseline/ObjectnessMeasureImageFilterTest1.nii.sha512 b/test/Baseline/ObjectnessMeasureImageFilterTest1.nii.sha512 new file mode 100644 index 0000000..83f4b48 --- /dev/null +++ b/test/Baseline/ObjectnessMeasureImageFilterTest1.nii.sha512 @@ -0,0 +1 @@ +c6509e0f113026360dd0c2c4375f7442a693638912015eaaad2173896c1dfe3895aa0bef49e2809891ada7f1b2e9e1553f80898a3dd6754216c4b1f9ed5f5537 diff --git a/test/Baseline/ObjectnessMeasureImageFilterTest2.nii.md5 b/test/Baseline/ObjectnessMeasureImageFilterTest2.nii.md5 deleted file mode 100644 index 3eefacf..0000000 --- a/test/Baseline/ObjectnessMeasureImageFilterTest2.nii.md5 +++ /dev/null @@ -1 +0,0 @@ -68046dd24c7824ef346d5a219e271d47 diff --git a/test/Baseline/ObjectnessMeasureImageFilterTest2.nii.sha512 b/test/Baseline/ObjectnessMeasureImageFilterTest2.nii.sha512 new file mode 100644 index 0000000..9f9c18a --- /dev/null +++ b/test/Baseline/ObjectnessMeasureImageFilterTest2.nii.sha512 @@ -0,0 +1 @@ +9266a2fc5216696f978ebc8437f242972a5300139f527f94034a3409a642c22b67e96c1b844c200b33038bdea35232841297238e4627598efb4108722d132eb2 diff --git a/test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.md5 b/test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.md5 deleted file mode 100644 index ce92a61..0000000 --- a/test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.md5 +++ /dev/null @@ -1 +0,0 @@ -8cc0bc4f769074e53bd1379a730b8df5 diff --git a/test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.sha512 b/test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.sha512 new file mode 100644 index 0000000..1d353e1 --- /dev/null +++ b/test/Baseline/itkHessianToObjectnessMeasureImageFilterTest2.mha.sha512 @@ -0,0 +1 @@ +a411c8fa380caf20d0fb3ebe70cb11595267477b0e3837d086a41ee4f94be879a60e491ec532d6f83779e8d8ab6d904bcce5290952d73d9dd95edd2d63fb9fc1 diff --git a/test/Input/DSA.png.md5 b/test/Input/DSA.png.md5 deleted file mode 100644 index 0223a95..0000000 --- a/test/Input/DSA.png.md5 +++ /dev/null @@ -1 +0,0 @@ -02e576585b1d28ad4d016129be2aa224 diff --git a/test/Input/DSA.png.sha512 b/test/Input/DSA.png.sha512 new file mode 100644 index 0000000..25cb160 --- /dev/null +++ b/test/Input/DSA.png.sha512 @@ -0,0 +1 @@ +9338a27235ef1b4fd41066c1c1d5cad4f88da444db58229b90cb4e72bac25cab47b574673e078b302b3ce5071bdb0a6d714b7c8144b7501dc0857380238b5b4d diff --git a/test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.md5 b/test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.md5 deleted file mode 100644 index 5c35811..0000000 --- a/test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.md5 +++ /dev/null @@ -1 +0,0 @@ -40c95795843d6a036769786b154329e3 diff --git a/test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.sha512 b/test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.sha512 new file mode 100644 index 0000000..eb761c6 --- /dev/null +++ b/test/Input/itkHessianToObjectnessMeasureImageFilterTest.mha.sha512 @@ -0,0 +1 @@ +afe4a473bba3fd2e2672b7e0360b488136dab2d745c078a1025275a2dfe15d373ab0dc750f8597ff0d6925dbf4dfad43ec245c0c96a56aff25a616efd5a8ccdf From 877b9be442e36b9dee9d9e251bb1107acc6eed56 Mon Sep 17 00:00:00 2001 From: Tom Birdsong Date: Tue, 31 May 2022 13:24:46 -0400 Subject: [PATCH 19/20] ENH: Bump ITK and change http to https --- .github/workflows/build-test-package.yml | 18 +++++++++--------- LICENSE | 4 ++-- include/itkDICOMOrientImageFilter.h | 2 +- include/itkDICOMOrientImageFilter.hxx | 2 +- include/itkDICOMOrientation.h | 2 +- include/itkHessianImageFilter.h | 2 +- include/itkHessianImageFilter.hxx | 2 +- include/itkMaskedAssignImageFilter.h | 2 +- include/itkMaskedAssignImageFilter.hxx | 2 +- include/itkNPasteImageFilter.h | 2 +- include/itkNPasteImageFilter.hxx | 2 +- include/itkObjectnessMeasureImageFilter.h | 2 +- include/itkObjectnessMeasureImageFilter.hxx | 2 +- src/itkDICOMOrientation.cxx | 2 +- test/itkDICOMOrientImageFilterGTest.cxx | 2 +- test/itkHessianImageFilterGTest.cxx | 2 +- test/itkHessianImageFilterTest.cxx | 2 +- test/itkMaskedAssignImageFilterGTest.cxx | 2 +- test/itkNPasteImageFilterGTest.cxx | 2 +- test/itkObjectnessMeasureImageFilterTest.cxx | 2 +- 20 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 4e15e78..dcf5147 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -13,17 +13,17 @@ jobs: - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" - itk-git-tag: "v5.3rc02" + itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "v5.3rc02" + itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "v5.3rc02" + itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" cmake-build-type: "MinSizeRel" steps: @@ -134,9 +134,9 @@ jobs: strategy: max-parallel: 2 matrix: - python-version: [36, 37, 38, 39] + python-version: [37, 38, 39, 310] include: - - itk-python-git-tag: "v5.2.0" + - itk-python-git-tag: "v5.3rc04" steps: - uses: actions/checkout@v2 @@ -172,7 +172,7 @@ jobs: max-parallel: 2 matrix: include: - - itk-python-git-tag: "v5.2.0" + - itk-python-git-tag: "v5.3rc04" steps: - uses: actions/checkout@v2 @@ -206,9 +206,9 @@ jobs: strategy: max-parallel: 2 matrix: - python-version-minor: [6, 7, 8, 9] + python-version-minor: [7, 8, 9, 10] include: - - itk-python-git-tag: "v5.2.0" + - itk-python-git-tag: "v5.3rc04" steps: - name: Get specific version of CMake, Ninja @@ -241,7 +241,7 @@ jobs: run: | cd ../../im call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - set PATH="C:\P\grep;%PATH%" + set PATH=C:\P\grep;%PATH% set CC=cl.exe set CXX=cl.exe C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" diff --git a/LICENSE b/LICENSE index d645695..62589ed 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ Apache License Version 2.0, January 2004 - http://www.apache.org/licenses/ + https://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -193,7 +193,7 @@ you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkDICOMOrientImageFilter.h b/include/itkDICOMOrientImageFilter.h index c26d53f..d2ecb3d 100644 --- a/include/itkDICOMOrientImageFilter.h +++ b/include/itkDICOMOrientImageFilter.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkDICOMOrientImageFilter.hxx b/include/itkDICOMOrientImageFilter.hxx index 5b23662..b8e2ed8 100644 --- a/include/itkDICOMOrientImageFilter.hxx +++ b/include/itkDICOMOrientImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkDICOMOrientation.h b/include/itkDICOMOrientation.h index d6e8ef1..9e03b5f 100644 --- a/include/itkDICOMOrientation.h +++ b/include/itkDICOMOrientation.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkHessianImageFilter.h b/include/itkHessianImageFilter.h index fa82ce9..fd8953f 100644 --- a/include/itkHessianImageFilter.h +++ b/include/itkHessianImageFilter.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkHessianImageFilter.hxx b/include/itkHessianImageFilter.hxx index 0d514b2..9a7e464 100644 --- a/include/itkHessianImageFilter.hxx +++ b/include/itkHessianImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkMaskedAssignImageFilter.h b/include/itkMaskedAssignImageFilter.h index 6d86b3d..e6c5668 100644 --- a/include/itkMaskedAssignImageFilter.h +++ b/include/itkMaskedAssignImageFilter.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkMaskedAssignImageFilter.hxx b/include/itkMaskedAssignImageFilter.hxx index 0880ea2..76b54b7 100644 --- a/include/itkMaskedAssignImageFilter.hxx +++ b/include/itkMaskedAssignImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkNPasteImageFilter.h b/include/itkNPasteImageFilter.h index 1427bd4..2ef324c 100644 --- a/include/itkNPasteImageFilter.h +++ b/include/itkNPasteImageFilter.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkNPasteImageFilter.hxx b/include/itkNPasteImageFilter.hxx index 50e5087..56f0c85 100644 --- a/include/itkNPasteImageFilter.hxx +++ b/include/itkNPasteImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkObjectnessMeasureImageFilter.h b/include/itkObjectnessMeasureImageFilter.h index 1edb209..0c635d7 100644 --- a/include/itkObjectnessMeasureImageFilter.h +++ b/include/itkObjectnessMeasureImageFilter.h @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/include/itkObjectnessMeasureImageFilter.hxx b/include/itkObjectnessMeasureImageFilter.hxx index 59f9bf3..db0e302 100644 --- a/include/itkObjectnessMeasureImageFilter.hxx +++ b/include/itkObjectnessMeasureImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/src/itkDICOMOrientation.cxx b/src/itkDICOMOrientation.cxx index c914ec8..5d9edff 100644 --- a/src/itkDICOMOrientation.cxx +++ b/src/itkDICOMOrientation.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/itkDICOMOrientImageFilterGTest.cxx b/test/itkDICOMOrientImageFilterGTest.cxx index 9791b9d..002cae0 100644 --- a/test/itkDICOMOrientImageFilterGTest.cxx +++ b/test/itkDICOMOrientImageFilterGTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/itkHessianImageFilterGTest.cxx b/test/itkHessianImageFilterGTest.cxx index 4c2853b..fca69d5 100644 --- a/test/itkHessianImageFilterGTest.cxx +++ b/test/itkHessianImageFilterGTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/itkHessianImageFilterTest.cxx b/test/itkHessianImageFilterTest.cxx index 61d84f8..ef89402 100644 --- a/test/itkHessianImageFilterTest.cxx +++ b/test/itkHessianImageFilterTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/itkMaskedAssignImageFilterGTest.cxx b/test/itkMaskedAssignImageFilterGTest.cxx index 0104f27..51ee74a 100644 --- a/test/itkMaskedAssignImageFilterGTest.cxx +++ b/test/itkMaskedAssignImageFilterGTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/itkNPasteImageFilterGTest.cxx b/test/itkNPasteImageFilterGTest.cxx index e2f2ce6..85be9c2 100644 --- a/test/itkNPasteImageFilterGTest.cxx +++ b/test/itkNPasteImageFilterGTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/test/itkObjectnessMeasureImageFilterTest.cxx b/test/itkObjectnessMeasureImageFilterTest.cxx index f582f71..6925b48 100644 --- a/test/itkObjectnessMeasureImageFilterTest.cxx +++ b/test/itkObjectnessMeasureImageFilterTest.cxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, From 04c3f48a3748e573f14d812c527eea507e11ac73 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Wed, 7 Dec 2022 12:58:34 -0500 Subject: [PATCH 20/20] Update GHA from template for ITK 5.3.0 --- .github/workflows/build-test-package.yml | 282 +--------------------- .github/workflows/clang-format-linter.yml | 5 +- 2 files changed, 8 insertions(+), 279 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index dcf5147..efac9f6 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -3,279 +3,9 @@ name: Build, test, package on: [push,pull_request] jobs: - build-test-cxx: - runs-on: ${{ matrix.os }} - strategy: - max-parallel: 3 - matrix: - os: [ubuntu-18.04, windows-2019, macos-10.15] - include: - - os: ubuntu-18.04 - c-compiler: "gcc" - cxx-compiler: "g++" - itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" - cmake-build-type: "MinSizeRel" - - os: windows-2019 - c-compiler: "cl.exe" - cxx-compiler: "cl.exe" - itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" - cmake-build-type: "Release" - - os: macos-10.15 - c-compiler: "clang" - cxx-compiler: "clang++" - itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" - cmake-build-type: "MinSizeRel" - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install build dependencies - run: | - python -m pip install --upgrade pip - python -m pip install ninja - - - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.18.3 - - - name: Download ITK - run: | - cd .. - git clone https://github.com/InsightSoftwareConsortium/ITK.git - cd ITK - git checkout ${{ matrix.itk-git-tag }} - - - name: Build ITK - if: matrix.os != 'windows-2019' - run: | - cd .. - mkdir ITK-build - cd ITK-build - cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK - ninja - - - name: Build ITK - if: matrix.os == 'windows-2019' - run: | - cd .. - mkdir ITK-build - cd ITK-build - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - cmake -DCMAKE_C_COMPILER:FILEPATH="${{ matrix.c-compiler }}" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="${{ matrix.cxx-compiler }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake-build-type }} -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK - ninja - shell: cmd - - - name: Fetch CTest driver script - run: | - curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O - - - name: Configure CTest script - shell: bash - run: | - operating_system="${{ matrix.os }}" - cat > dashboard.cmake << EOF - set(CTEST_SITE "GitHubActions") - file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/.." CTEST_DASHBOARD_ROOT) - file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/" CTEST_SOURCE_DIRECTORY) - file(TO_CMAKE_PATH "\$ENV{GITHUB_WORKSPACE}/../build" CTEST_BINARY_DIRECTORY) - set(dashboard_source_name "${GITHUB_REPOSITORY}") - if(ENV{GITHUB_REF} MATCHES "master") - set(branch "-master") - set(dashboard_model "Continuous") - else() - set(branch "-${GITHUB_REF}") - set(dashboard_model "Experimental") - endif() - set(CTEST_BUILD_NAME "${GITHUB_REPOSITORY}-${operating_system}-\${branch}") - set(CTEST_UPDATE_VERSION_ONLY 1) - set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL}) - set(CTEST_BUILD_CONFIGURATION "Release") - set(CTEST_CMAKE_GENERATOR "Ninja") - set(CTEST_CUSTOM_WARNING_EXCEPTION - \${CTEST_CUSTOM_WARNING_EXCEPTION} - # macOS Azure VM Warning - "ld: warning: text-based stub file" - ) - set(dashboard_no_clean 1) - set(ENV{CC} ${{ matrix.c-compiler }}) - set(ENV{CXX} ${{ matrix.cxx-compiler }}) - if(WIN32) - set(ENV{PATH} "\${CTEST_DASHBOARD_ROOT}/ITK-build/bin;\$ENV{PATH}") - endif() - set(dashboard_cache " - ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build - BUILD_TESTING:BOOL=ON - ") - string(TIMESTAMP build_date "%Y-%m-%d") - message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}") - message("CTEST_SITE = \${CTEST_SITE}") - include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake) - EOF - cat dashboard.cmake - - - name: Build and test - if: matrix.os != 'windows-2019' - run: | - ctest --output-on-failure -j 2 -V -S dashboard.cmake - - - name: Build and test - if: matrix.os == 'windows-2019' - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - ctest --output-on-failure -j 2 -V -S dashboard.cmake - shell: cmd - - build-linux-python-packages: - runs-on: ubuntu-20.04 - strategy: - max-parallel: 2 - matrix: - python-version: [37, 38, 39, 310] - include: - - itk-python-git-tag: "v5.3rc04" - - steps: - - uses: actions/checkout@v2 - - - name: 'Free up disk space' - run: | - # Workaround for https://github.com/actions/virtual-environments/issues/709 - df -h - sudo apt-get clean - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - df -h - - - name: 'Fetch build script' - run: | - curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O - chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh - - - name: 'Build 🐍 Python 📦 package' - run: | - export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }} - ./dockcross-manylinux-download-cache-and-build-module-wheels.sh cp${{ matrix.python-version }} - - - name: Publish Python package as GitHub Artifact - uses: actions/upload-artifact@v1 - with: - name: LinuxWheel${{ matrix.python-version }} - path: dist - - build-macos-python-packages: - runs-on: macos-10.15 - strategy: - max-parallel: 2 - matrix: - include: - - itk-python-git-tag: "v5.3rc04" - - steps: - - uses: actions/checkout@v2 - - - name: 'Specific XCode version' - run: | - sudo xcode-select -s "/Applications/Xcode_11.7.app" - - - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.18.3 - - - name: 'Fetch build script' - run: | - curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O - chmod u+x macpython-download-cache-and-build-module-wheels.sh - - - name: 'Build 🐍 Python 📦 package' - run: | - export ITK_PACKAGE_VERSION=${{ matrix.itk-python-git-tag }} - export MACOSX_DEPLOYMENT_TARGET=10.9 - ./macpython-download-cache-and-build-module-wheels.sh - - - name: Publish Python package as GitHub Artifact - uses: actions/upload-artifact@v1 - with: - name: MacOSWheels - path: dist - - build-windows-python-packages: - runs-on: windows-2019 - strategy: - max-parallel: 2 - matrix: - python-version-minor: [7, 8, 9, 10] - include: - - itk-python-git-tag: "v5.3rc04" - - steps: - - name: Get specific version of CMake, Ninja - uses: lukka/get-cmake@v3.18.3 - - - uses: actions/checkout@v2 - with: - path: "im" - - - name: 'Install Python' - run: | - $pythonArch = "64" - $pythonVersion = "3.${{ matrix.python-version-minor }}" - iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/scikit-build/scikit-ci-addons/master/windows/install-python.ps1')) - - - name: 'Fetch build dependencies' - shell: bash - run: | - mv im ../../ - cd ../../im - curl -L "https://github.com/InsightSoftwareConsortium/ITKPythonBuilds/releases/download/${{ matrix.itk-python-git-tag }}/ITKPythonBuilds-windows.zip" -o "ITKPythonBuilds-windows.zip" - 7z x ITKPythonBuilds-windows.zip -o/c/P -aoa -r - curl -L "https://data.kitware.com/api/v1/file/5c0ad59d8d777f2179dd3e9c/download" -o "doxygen-1.8.11.windows.bin.zip" - 7z x doxygen-1.8.11.windows.bin.zip -o/c/P/doxygen -aoa -r - curl -L "https://data.kitware.com/api/v1/file/5bbf87ba8d777f06b91f27d6/download/grep-win.zip" -o "grep-win.zip" - 7z x grep-win.zip -o/c/P/grep -aoa -r - - - name: 'Build 🐍 Python 📦 package' - shell: cmd - run: | - cd ../../im - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - set PATH=C:\P\grep;%PATH% - set CC=cl.exe - set CXX=cl.exe - C:\Python3${{ matrix.python-version-minor }}-x64\python.exe C:\P\IPP\scripts\windows_build_module_wheels.py --py-envs "3${{ matrix.python-version-minor }}-x64" - - - name: Publish Python package as GitHub Artifact - uses: actions/upload-artifact@v1 - with: - name: WindowsWheel3.${{ matrix.python-version-minor }} - path: ../../im/dist - - publish-python-packages-to-pypi: - needs: - - build-linux-python-packages - - build-macos-python-packages - - build-windows-python-packages - runs-on: ubuntu-20.04 - - steps: - - name: Download Python Packages - uses: actions/download-artifact@v2 - - - name: Prepare packages for upload - run: | - ls -R - for d in */; do - mv ${d}/*.whl . - done - mkdir dist - mv *.whl dist/ - ls dist - - - name: Publish 🐍 Python 📦 package to PyPI - if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.pypi_password }} + cxx-build-workflow: + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@5083da2740617b78423ebf6083489e1e70ee8ca0 + python-build-workflow: + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@5083da2740617b78423ebf6083489e1e70ee8ca0 + secrets: + pypi_password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml index 35a9103..899d579 100644 --- a/.github/workflows/clang-format-linter.yml +++ b/.github/workflows/clang-format-linter.yml @@ -7,7 +7,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 + - uses: actions/checkout@v3 + - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master