From c7d84d80708ac977135aede09e90011328debf57 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 7 Jun 2015 23:38:38 -0400 Subject: [PATCH 01/43] ENH: Update the license header to the ISC copyright. Assign copyright to the Insight Software Consortium and use the Apache 2 license, ITK's current license. This will be merged pending approval by Glenn Pierce. --- ITKKWStyleOverwrite.txt | 3 --- include/itkFDFCommonImageIO.h | 28 ++++++++++++++-------------- include/itkFDFImageIO.h | 27 ++++++++++++++------------- include/itkFDFImageIOFactory.h | 27 ++++++++++++++------------- src/itkFDFCommonImageIO.cxx | 27 ++++++++++++++------------- src/itkFDFImageIO.cxx | 27 ++++++++++++++------------- src/itkFDFImageIOFactory.cxx | 27 ++++++++++++++------------- 7 files changed, 84 insertions(+), 82 deletions(-) diff --git a/ITKKWStyleOverwrite.txt b/ITKKWStyleOverwrite.txt index 3334495..e69de29 100644 --- a/ITKKWStyleOverwrite.txt +++ b/ITKKWStyleOverwrite.txt @@ -1,3 +0,0 @@ -test/.*\.cxx Namespace Disable -/.*\.cxx Header Disable -/.*\.h Header Disable diff --git a/include/itkFDFCommonImageIO.h b/include/itkFDFCommonImageIO.h index 34226ab..04a90a5 100644 --- a/include/itkFDFCommonImageIO.h +++ b/include/itkFDFCommonImageIO.h @@ -1,20 +1,20 @@ -/* Copyright (C) 2004 Glenn Pierce. +/*========================================================================= * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright Insight Software Consortium * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * 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 * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - + * 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 itkFDFCommonImageIO_h #define itkFDFCommonImageIO_h diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 3238bbf..98ceaa8 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -1,19 +1,20 @@ -/* Copyright (C) 2004 Glenn Pierce. +/*========================================================================= * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright Insight Software Consortium * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * 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 * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + * 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 itkFDFImageIO_h #define itkFDFImageIO_h diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index b0c7250..0c9a21a 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -1,19 +1,20 @@ -/* Copyright (C) 2004 Glenn Pierce. +/*========================================================================= * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright Insight Software Consortium * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * 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 * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + * 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 itkFDFImageIOFactory_h #define itkFDFImageIOFactory_h #include "IOFDFExport.h" diff --git a/src/itkFDFCommonImageIO.cxx b/src/itkFDFCommonImageIO.cxx index 5fafc2b..ff17e2c 100644 --- a/src/itkFDFCommonImageIO.cxx +++ b/src/itkFDFCommonImageIO.cxx @@ -1,19 +1,20 @@ -/* Copyright (C) 2004 Glenn Pierce. +/*========================================================================= * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright Insight Software Consortium * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * 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 * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + * 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 "itkFDFCommonImageIO.h" diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index e77e5b1..606c143 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -1,19 +1,20 @@ -/* Copyright (C) 2004 Glenn Pierce. +/*========================================================================= * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright Insight Software Consortium * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * 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 * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + * 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 "itkFDFImageIO.h" #include "itkFDFCommonImageIO.h" diff --git a/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index 69b46d4..e83d36b 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.cxx @@ -1,19 +1,20 @@ -/* Copyright (C) 2004 Glenn Pierce. +/*========================================================================= * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright Insight Software Consortium * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. + * 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 * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ + * 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 "itkFDFImageIOFactory.h" #include "itkCreateObjectFunction.h" From 9be213a6363b4053d3e671fa5b0e3198c5911e92 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Fri, 4 Dec 2015 03:46:43 -0500 Subject: [PATCH 02/43] BUG: Ensure factory is registered once. This commit updates CMakeLists.txt to ensure built library is shared. It also uses "RegisterFactoryInternal" to make sure the factory is registered once into the ImageIOFactory. See InsightSoftwareConsortium/ITK@39b4ab3 (BUG: Internal factory must use RegisterFactoryInternal method) for more details. See ITK issue #3393 https://issues.itk.org/jira/browse/ITK-3393 --- include/itkFDFImageIOFactory.h | 2 +- src/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index 0c9a21a..f0bd502 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -50,7 +50,7 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase static void RegisterOneFactory(void) { FDFImageIOFactory::Pointer FdfFactory = FDFImageIOFactory::New(); - ObjectFactoryBase::RegisterFactory(FdfFactory); + ObjectFactoryBase::RegisterFactoryInternal(FdfFactory); } protected: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0903c68..e05f33c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,7 @@ set(IOFDF_SRC itkFDFCommonImageIO.cxx itkFDFImageIOFactory.cxx) -add_library(IOFDF ${IOFDF_SRC}) +add_library(IOFDF ${ITK_LIBRARY_BUILD_TYPE} ${IOFDF_SRC}) target_link_libraries(IOFDF ${ITKIOImageBase_LIBRARIES} ${ITKTransform_LIBRARIES}) itk_module_target(IOFDF) From 179b3689d06e856512f279967a4d8c3fc64b0d8d Mon Sep 17 00:00:00 2001 From: Zach Williamson Date: Wed, 29 Jun 2016 09:20:42 -0500 Subject: [PATCH 03/43] STYLE: Use Macro for Function Deletion --- include/itkFDFImageIO.h | 3 +-- include/itkFDFImageIOFactory.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 98ceaa8..4023b26 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -105,8 +105,7 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase int ReadHeader(const char *FileNameToRead); private: - FDFImageIO(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIO); void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels); diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index f0bd502..fdc5192 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -58,8 +58,7 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase ~FDFImageIOFactory(); private: - FDFImageIOFactory(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented + ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIOFactory); }; From bbfe27f8f83368c92b2d9f0fb76b53c962473238 Mon Sep 17 00:00:00 2001 From: Francois Budin Date: Thu, 26 Oct 2017 16:49:50 -0400 Subject: [PATCH 04/43] ENH: Add FACTORY_NAMES parameter to itk_module() declaration This new parameter allows ITK to be aware any object that needs to be registered to the ITK factory. Remote modules that offer IO capabilities can be more easily integrated in ITK. --- CMakeLists.txt | 11 ++++++++++- itk-module.cmake | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8ac7c2..5f8cdde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,12 @@ +cmake_minimum_required(VERSION 2.8.12) project(IOFDF) set(IOFDF_LIBRARIES IOFDF) -itk_module_impl() + +if(NOT ITK_SOURCE_DIR) + find_package(ITK REQUIRED) + list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) + include(ITKModuleExternal) +else() + itk_module_impl() +endif() + diff --git a/itk-module.cmake b/itk-module.cmake index a0d7b1f..8bc9339 100644 --- a/itk-module.cmake +++ b/itk-module.cmake @@ -9,6 +9,8 @@ itk_module(IOFDF TEST_DEPENDS ITKTestKernel ITKTransform + FACTORY_NAMES + ImageIO::FDF DESCRIPTION "${DOCUMENTATION}" EXCLUDE_FROM_DEFAULT From f30300d01ce8323c15cd901ceab5693ddfa5705c Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Wed, 17 Jan 2018 17:52:19 +0100 Subject: [PATCH 05/43] ENH: Require cmake minimum version to be 3.9.5. Require CMake minimum version to be 3.9.5 following ITKv5 requiring C++11: https://discourse.itk.org/t/minimum-cmake-version-update/585 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f8cdde..119381a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.9.5) project(IOFDF) set(IOFDF_LIBRARIES IOFDF) From fa9b2dc5d4a0445306001a61d1549a6b0d8fef2a Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 19:16:59 -0600 Subject: [PATCH 06/43] ENH: ITKv5 override consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide remove virtual and override Use clang-tidy to add ITK_OVERRIDE, and to remove redundant virtual on functions. cd ../ITK; clang-tidy -p ITK-clangtidy $find Modules/[A-J]* -name *.cxx |fgrep -v ThirdParty) -checks=-*,modernize-use-override -header-filter=.* -fix clang-tidy -p ITK-clangtidy $(find Modules/[K-Z]* -name *.cxx |fgrep -v ThirdParty) -checks=-*,modernize-use-override -header-filter=.* -fix https://stackoverflow.com/questions/39932391/virtual-override-or-both-c When you override a function you don't technically need to write either virtual or override. The original base class declaration needs the keyword virtual to mark it as virtual. In the derived class the function is virtual by way of having the ΒΉsame type as the base class function. However, an override can help avoid bugs by producing a compilation error when the intended override isn't technically an override. E.g. that the function type isn't exactly like the base class function. Or that a maintenance of the base class changes that function's type, e.g. adding a defaulted argument. In the same way, a virtual keyword in the derived class can make such a bug more subtle, by ensuring that the function is still is virtual in further derived classes. So the general advice is, virtual for the base class function declaration. This is technically necessary. Use override (only) for a derived class' override. This helps with maintenance. --- include/itkFDFImageIO.h | 16 ++++++++-------- include/itkFDFImageIOFactory.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 4023b26..a135b72 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -45,7 +45,7 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Run-time type information (and related methods). */ itkTypeMacro(FDFImageIO, ImageIOBase); - virtual bool SupportsDimension( unsigned long dim ) ITK_OVERRIDE + bool SupportsDimension( unsigned long dim ) ITK_OVERRIDE { if( dim == 2 || dim == 3 ) { @@ -62,16 +62,16 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) ITK_OVERRIDE; /** Set the spacing and diemention information for the set filename. */ - virtual void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() ITK_OVERRIDE; /** Get the type of the pixel. */ // virtual const std::type_info& GetPixelType() const; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) ITK_OVERRIDE; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -85,19 +85,19 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) ITK_OVERRIDE; /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) ITK_OVERRIDE; protected: FDFImageIO(); - ~FDFImageIO(); + ~FDFImageIO() ITK_OVERRIDE; void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; void WriteSlice(std::string& fileName, const void* buffer); diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index fdc5192..188d8b8 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -37,8 +37,8 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase typedef SmartPointer ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - virtual const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const ITK_OVERRIDE; + const char* GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -55,7 +55,7 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase protected: FDFImageIOFactory(); - ~FDFImageIOFactory(); + ~FDFImageIOFactory() ITK_OVERRIDE; private: ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIOFactory); From 21a2915b5bb71b562397505464197a0e84fae51e Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 19:36:25 -0600 Subject: [PATCH 07/43] COMP: Use C++11 override directly git grep -l "ITK_OVERRIDE" | fgrep -v itk_compiler_detection.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | xargs sed -i '' -e "s/ITK_OVERRIDE/override/g" --- include/itkFDFImageIO.h | 18 +++++++++--------- include/itkFDFImageIOFactory.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index a135b72..13e484e 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -45,7 +45,7 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Run-time type information (and related methods). */ itkTypeMacro(FDFImageIO, ImageIOBase); - bool SupportsDimension( unsigned long dim ) ITK_OVERRIDE + bool SupportsDimension( unsigned long dim ) override { if( dim == 2 || dim == 3 ) { @@ -62,16 +62,16 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; + bool CanReadFile(const char*) override; /** Set the spacing and diemention information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; + void ReadImageInformation() override; /** Get the type of the pixel. */ // virtual const std::type_info& GetPixelType() const; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; + void Read(void* buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ virtual void ReadVolume(void* buffer); @@ -85,20 +85,20 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; + bool CanWriteFile(const char*) override; /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; + void WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; + void Write(const void* buffer) override; protected: FDFImageIO(); - ~FDFImageIO() ITK_OVERRIDE; - void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; + ~FDFImageIO() override; + void PrintSelf(std::ostream& os, Indent indent) const override; void WriteSlice(std::string& fileName, const void* buffer); diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index 188d8b8..bc59b18 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -37,8 +37,8 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase typedef SmartPointer ConstPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; + const char* GetITKSourceVersion(void) const override; + const char* GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -55,7 +55,7 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase protected: FDFImageIOFactory(); - ~FDFImageIOFactory() ITK_OVERRIDE; + ~FDFImageIOFactory() override; private: ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIOFactory); From 161b1e4cc627d984f5c17b5388461ea6769aed51 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 14 Jan 2018 10:51:03 -0700 Subject: [PATCH 08/43] COMP: Use C++ headers over C header Some headers from C library were deprecated in C++ and are no longer welcome in C++ codebases. Some have no effect in C++. For more details refer to the C++ 14 Standard [depr.c.headers] section. This patch replaces C standard library headers with their C++ alternatives and removes redundant ones. --- src/itkFDFImageIO.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index 606c143..293be1f 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -22,7 +22,7 @@ #include "itkRGBPixel.h" #include "itkRGBAPixel.h" #include "vnl/vnl_matrix.h" -#include +#include #include namespace itk From 547d2860f902f98d3b91cb7bcbbe4f9e8b58bde6 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 15:21:00 -0600 Subject: [PATCH 09/43] STYLE: Modernize to C++11 conventions STYLE: Use auto for variable creation This check is responsible for using the auto type specifier for variable declarations to improve code readability and maintainability. The auto type specifier will only be introduced in situations where the variable type matches the type of the initializer expression. In other words auto should deduce the same type that was originally spelled in the source cd /Users/johnsonhj/Dashboard/src/ITK-clangtidy/ run-clang-tidy.py -checks=-*,modernize-use-auto -header-filter=.* -fix use auto when declaring iterators use auto when initializing with a cast to avoid duplicating the type name use auto when initializing with a template cast to avoid duplicating the type name use auto when initializing with new to avoid duplicating the type name SRCDIR=/Users/johnsonhj/Dashboard/src/ITK #My local SRC BLDDIR=/Users/johnsonhj/Dashboard/src/ITK-clangtidy/ #My local BLD PERF: Replace explicit return calls of constructor Replaces explicit calls to the constructor in a return with a braced initializer list. This way the return type is not needlessly duplicated in the function definition and the return statement. SRCDIR=/Users/johnsonhj/Dashboard/src/ITK #My local SRC BLDDIR=/Users/johnsonhj/Dashboard/src/ITK-clangtidy/ #My local BLD cd /Users/johnsonhj/Dashboard/src/ITK-clangtidy/ run-clang-tidy.py -checks=-*,modernize-return-braced-init-list -header-filter=.* -fix PERF: Allow compiler to choose best way to construct a copy With move semantics added to the language and the standard library updated with move constructors added for many types it is now interesting to take an argument directly by value, instead of by const-reference, and then copy. This check allows the compiler to take care of choosing the best way to construct the copy. The transformation is usually beneficial when the calling code passes an rvalue and assumes the move construction is a cheap operation. This short example illustrates how the construction of the value happens: class Foo { public: - Foo(const std::string &Copied, const std::string &ReadOnly) - : Copied(Copied), ReadOnly(ReadOnly) {} + Foo(std::string Moved, const std::string &ReadOnly) + : Copied(std::move(Moved)), ReadOnly(ReadOnly) {} private: private: std::string Copied; const std::string &ReadOnly; }; SRCDIR=/Users/johnsonhj/Dashboard/src/ITK #My local SRC BLDDIR=/Users/johnsonhj/Dashboard/src/ITK-clangtidy/ #My local BLD cd /Users/johnsonhj/Dashboard/src/ITK-clangtidy/ run-clang-tidy.py -checks=-*,modernize-pass-by-value -header-filter=.* -fix STYLE: Use range-based loops from C++11 Used as a more readable equivalent to the traditional for loop operating over a range of values, such as all elements in a container, in the forward direction. ==== Range based loopes are more explicit for only computing the end location once for containers. for ( ImageIORegion::IndexType::const_iterator i = this->GetIndex().begin(); i != this->GetIndex().end(); //<- NOTE: Compute end every loop iteration ++i ) for (long i : this->GetIndex()) //<- NOTE: Implicitly only compute end once ==== Explicitly reduce the amount of index computations: (The compiler probably does this too) for(int i = 0; i < 11; i++) { pos[0] = testPoints[i][0]; pos[1] = testPoints[i][1]; ^^^^ for(auto & testPoint : testPoints) { pos[0] = testPoint[0]; pos[1] = testPoint[1]; ==== SRCDIR=/Users/johnsonhj/Dashboard/src/ITK #My local SRC BLDDIR=/Users/johnsonhj/Dashboard/src/ITK-clangtidy/ #My local BLD cd /Users/johnsonhj/Dashboard/src/ITK-clangtidy/ run-clang-tidy.py -checks=-*,modernize-loop-convert -header-filter=.* -fix --- include/itkFDFCommonImageIO.h | 4 ++-- src/itkFDFImageIO.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/itkFDFCommonImageIO.h b/include/itkFDFCommonImageIO.h index 04a90a5..932bac4 100644 --- a/include/itkFDFCommonImageIO.h +++ b/include/itkFDFCommonImageIO.h @@ -63,8 +63,8 @@ void StringToVector (std::string value, std::vector& values) T element; - for(unsigned int i=0; i(buffer); + auto * p = static_cast(buffer); inFile.read( p, this->GetImageSizeInBytes() ); From de73fb9af05d02bf95b12bb2c24f2f71f7610ba7 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 23:29:53 -0600 Subject: [PATCH 10/43] STYLE: Prefer C++11 type alias over typedef == http://en.cppreference.com/w/cpp/language/type_alias == Type alias is a name that refers to a previously defined type (similar to typedef). A type alias declaration introduces a name which can be used as a synonym for the type denoted by type-id. It does not introduce a new type and it cannot change the meaning of an existing type name. There is no difference between a type alias declaration and typedef declaration. This declaration may appear in block scope, class scope, or namespace scope. == https://www.quora.com/Is-using-typedef-in-C++-considered-a-bad-practice == While typedef is still available for backward compatibility, the new Type Alias syntax 'using Alias = ExistingLongName;' is more consistent with the flow of C++ than the old typedef syntax 'typedef ExistingLongName Alias;', and it also works for templates (Type alias, alias template (since C++11)), so leftover 'typedef' aliases will differ in style from any alias templates. --- include/itkFDFImageIO.h | 8 ++++---- include/itkFDFImageIOFactory.h | 10 +++++----- src/ImageReadWrite.cxx | 12 ++++++------ test/itkFDFImageIOTest.cxx | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 13e484e..b681523 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -34,10 +34,10 @@ namespace itk class IOFDF_EXPORT FDFImageIO : public ImageIOBase { public: - /** Standard class typedefs. */ - typedef FDFImageIO Self; - typedef ImageIOBase Superclass; - typedef SmartPointer Pointer; + /** Standard class type alias. */ + using Self = FDFImageIO; + using Superclass = ImageIOBase; + using Pointer = SmartPointer; /** Method for creation through the object factory. */ itkNewMacro(Self); diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index bc59b18..e2dca08 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -30,11 +30,11 @@ namespace itk class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase { public: - /** Standard class typedefs. */ - typedef FDFImageIOFactory Self; - typedef ObjectFactoryBase Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + /** Standard class type alias. */ + using Self = FDFImageIOFactory; + using Superclass = ObjectFactoryBase; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Class methods used to interface with the registered factories. */ const char* GetITKSourceVersion(void) const override; diff --git a/src/ImageReadWrite.cxx b/src/ImageReadWrite.cxx index 6612eb5..2d5bc18 100644 --- a/src/ImageReadWrite.cxx +++ b/src/ImageReadWrite.cxx @@ -30,14 +30,14 @@ int main( int argc, char ** argv ) { - typedef float PixelType; + using PixelType = float; const unsigned int Dimension = 2; - typedef itk::Image< PixelType, Dimension > ImageType; - typedef itk::ImageFileReader< ImageType > ReaderType; - typedef itk::ImageToVTKImageFilter< ImageType > ImageToVTKType; - typedef itk::NormalizeImageFilter< ImageType, ImageType> NormalizeFilter; - typedef itk::ChangeInformationImageFilter< ImageType > ChangeInformationFilter; + using ImageType = itk::Image< PixelType, Dimension >; + using ReaderType = itk::ImageFileReader< ImageType >; + using ImageToVTKType = itk::ImageToVTKImageFilter< ImageType >; + using NormalizeFilter = itk::NormalizeImageFilter< ImageType, ImageType>; + using ChangeInformationFilter = itk::ChangeInformationImageFilter< ImageType >; // Register FDF Factory itk::FDFImageIOFactory::RegisterOneFactory(); diff --git a/test/itkFDFImageIOTest.cxx b/test/itkFDFImageIOTest.cxx index 8f9447a..d838cda 100644 --- a/test/itkFDFImageIOTest.cxx +++ b/test/itkFDFImageIOTest.cxx @@ -29,11 +29,11 @@ int itkFDFImageIOTest( int argc, char * argv[] ) std::cerr << "Usage: itkFDFImageIO ImageType; - typedef itk::ImageFileReader< ImageType > ReaderType; + using ImageType = itk::Image< PixelType, Dimension >; + using ReaderType = itk::ImageFileReader< ImageType >; // Register FDF Factory itk::FDFImageIOFactory::RegisterOneFactory(); From 2a457ccbd211543875d664af7b8c64ef9e2d39fc Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 13 Feb 2018 08:24:20 -0600 Subject: [PATCH 11/43] STYLE: Prefer constexpr for const numeric literals Use constexpr for constant numeric literals. --- src/ImageReadWrite.cxx | 2 +- test/itkFDFImageIOTest.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageReadWrite.cxx b/src/ImageReadWrite.cxx index 2d5bc18..d5a4341 100644 --- a/src/ImageReadWrite.cxx +++ b/src/ImageReadWrite.cxx @@ -31,7 +31,7 @@ int main( int argc, char ** argv ) { using PixelType = float; - const unsigned int Dimension = 2; + constexpr unsigned int Dimension = 2; using ImageType = itk::Image< PixelType, Dimension >; using ReaderType = itk::ImageFileReader< ImageType >; diff --git a/test/itkFDFImageIOTest.cxx b/test/itkFDFImageIOTest.cxx index d838cda..fd962fa 100644 --- a/test/itkFDFImageIOTest.cxx +++ b/test/itkFDFImageIOTest.cxx @@ -30,7 +30,7 @@ int itkFDFImageIOTest( int argc, char * argv[] ) return EXIT_FAILURE; } using PixelType = float; - const unsigned int Dimension = 2; + constexpr unsigned int Dimension = 2; using ImageType = itk::Image< PixelType, Dimension >; using ReaderType = itk::ImageFileReader< ImageType >; From df6afc93e7a273bc0bfb45aedea30abb78af5678 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 14 Apr 2018 19:07:58 +0200 Subject: [PATCH 12/43] COMP: Move ITK_DISALLOW_COPY_AND_ASSIGN calls to public section. Move `ITK_DISALLOW_COPY_AND_ASSIGN` calls to public section following the discussion in https://discourse.itk.org/t/noncopyable If legacy (pre-macro) copy and assing methods existed, subsitute them for the `ITK_DISALLOW_COPY_AND_ASSIGN` macro. --- include/itkFDFImageIO.h | 4 ++-- include/itkFDFImageIOFactory.h | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index b681523..955c9cb 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -34,6 +34,8 @@ namespace itk class IOFDF_EXPORT FDFImageIO : public ImageIOBase { public: + ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIO); + /** Standard class type alias. */ using Self = FDFImageIO; using Superclass = ImageIOBase; @@ -105,8 +107,6 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase int ReadHeader(const char *FileNameToRead); private: - ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIO); - void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels); // Position after ReadImageInformation. diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index e2dca08..c338da6 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -30,6 +30,8 @@ namespace itk class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase { public: + ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIOFactory); + /** Standard class type alias. */ using Self = FDFImageIOFactory; using Superclass = ObjectFactoryBase; @@ -56,10 +58,6 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase protected: FDFImageIOFactory(); ~FDFImageIOFactory() override; - -private: - ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIOFactory); - }; From 0aee453643c9507635ae67e7e37ce2004d5babff Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 5 May 2018 12:21:45 +0200 Subject: [PATCH 13/43] COMP: Set the minimum required CMake version to 3.10.2. As agreed in: https://discourse.itk.org/t/cmake-update/870/ Set the `cmake_minimum_required` to version **3.10.2**. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 119381a..367910c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.9.5) +cmake_minimum_required(VERSION 3.10.2) project(IOFDF) set(IOFDF_LIBRARIES IOFDF) From 0fae569dbb0c4051233c08b02cc4f50de9145cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Mon, 22 Oct 2018 20:46:26 -0400 Subject: [PATCH 14/43] STYLE: Use "typename" for template parameters. As discussed in: http://review.source.kitware.com/#/c/12655/ the use of the template keyword "class" was substituted by "typename" in the toolkit for the reasons stated in that topic. --- include/itkFDFCommonImageIO.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/itkFDFCommonImageIO.h b/include/itkFDFCommonImageIO.h index 932bac4..e71e025 100644 --- a/include/itkFDFCommonImageIO.h +++ b/include/itkFDFCommonImageIO.h @@ -37,7 +37,7 @@ void Tokenize(const std::string& str, std::vector& tokens, const st std::string ParseLine(std::string line); -template +template void ConvertFromString (std::string s, T &value) { std::stringstream str; @@ -45,7 +45,7 @@ void ConvertFromString (std::string s, T &value) str >> value; } -template +template void StringToVector (std::string value, std::vector& values) { std::vector tokens; @@ -69,7 +69,7 @@ void StringToVector (std::string value, std::vector& values) } } -template +template void PrintVector (std::ostream& os, std::string name, const std::vector& vect) { int size = vect.size(); From f3116e176cc31b1027871ca218ef4ae7ac5cbce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 10 Nov 2018 14:52:04 -0500 Subject: [PATCH 15/43] ENH: Clean unnecessary files. Clean the temporary, accidentally comitted KW style file `ITKKWStyleOverwrite.txt` file. --- ITKKWStyleOverwrite.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ITKKWStyleOverwrite.txt diff --git a/ITKKWStyleOverwrite.txt b/ITKKWStyleOverwrite.txt deleted file mode 100644 index e69de29..0000000 From 228414d8a53639010e0223773ee07e082940e7a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 10 Nov 2018 15:47:16 -0500 Subject: [PATCH 16/43] ENH: Add CI. Add CI for the module: - Add Circle, Travis and AppVeyor CI configuration `*.yml` files. - Add the `CTestConfig.cmake` file to submit builds to the **Inisght** project in the **open.cdash.org** dashboard. - Add the Python setup `setup.py` file. - Re-use the `README` file documentation in the `itk-module.cmake` file. --- .circleci/config.yml | 65 ++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 15 ++++++++++ CTestConfig.cmake | 7 +++++ appveyor.yml | 21 ++++++++++++++ itk-module.cmake | 12 ++++++-- setup.py | 50 ++++++++++++++++++++++++++++++++++ 6 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 .travis.yml create mode 100644 CTestConfig.cmake create mode 100644 appveyor.yml create mode 100644 setup.py diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9c04d72 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,65 @@ +version: 2 +jobs: + build-and-test: + working_directory: /ITKFDFImageIO-build + docker: + - image: insighttoolkit/module-ci:latest + steps: + - checkout: + path: /ITKFDFImageIO + - run: + name: Fetch CTest driver script + command: | + curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O + - run: + name: Configure CTest script + command: | + SHASNIP=$(echo $CIRCLE_SHA1 | cut -c1-7) + cat > dashboard.cmake << EOF + set(CTEST_SITE "CircleCI") + set(CTEST_BUILD_NAME "External-ITKFDFImageIO-${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}-${SHASNIP}") + set(CTEST_BUILD_CONFIGURATION "MinSizeRel") + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") + set(CTEST_BUILD_FLAGS: "-j5") + set(CTEST_SOURCE_DIRECTORY /ITKFDFImageIO) + set(CTEST_BINARY_DIRECTORY /ITKFDFImageIO-build) + set(dashboard_model Experimental) + set(dashboard_no_clean 1) + set(dashboard_cache " + ITK_DIR:PATH=/ITK-build + BUILD_TESTING:BOOL=ON + ") + include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake) + EOF + - run: + name: Build and Test + no_output_timeout: 1.0h + command: | + ctest -j 2 -VV -S dashboard.cmake + package: + working_directory: ~/ + machine: true + steps: + - checkout: + path: ~/ITKFDFImageIO + - run: + name: Fetch build script + command: | + 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 + - run: + name: Build Python packages + no_output_timeout: 1.0h + command: | + cd ~/ITKFDFImageIO + ./dockcross-manylinux-download-cache-and-build-module-wheels.sh + - store_artifacts: + path: dist + destination: dist + +workflows: + version: 2 + build-test-package: + jobs: + - build-and-test + - package diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c0a5d09 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +sudo: true +language: cpp +os: +- osx +compiler: +- gcc +cache: + directories: + - "$HOME/Library/Caches/Homebrew" +script: +- 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 +- ./macpython-download-cache-and-build-module-wheels.sh +- tar -zcvf dist.tar.gz dist/ +- curl --upload-file dist.tar.gz https://transfer.sh/dist.tar.gz diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 0000000..62f68ac --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "ITK") +set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=Insight") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..99c62fc --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,21 @@ +branches: + only: + - master + +version: "0.0.1.{build}" + +install: + + - curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O + - ps: .\windows-download-cache-and-build-module-wheels.ps1 + +build: off + +test: off + +artifacts: + + # pushing entire folder as a zip archive + - path: dist\* + +deploy: off diff --git a/itk-module.cmake b/itk-module.cmake index 8bc9339..0196b31 100644 --- a/itk-module.cmake +++ b/itk-module.cmake @@ -1,6 +1,14 @@ -set(DOCUMENTATION "This modules contains an ImageIO class to read or write the -FDF image format.") +# the top-level README is used for describing this module, just +# re-used it for documentation here +get_filename_component(MY_CURENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(READ "${MY_CURENT_DIR}/README.rst" DOCUMENTATION) +# itk_module() defines the module dependencies in IOFDF +# The testing module in IOFDF depends on ITKTestKernel +# By convention those modules outside of ITK are not prefixed with +# ITK + +# define the dependencies of the include module and the tests itk_module(IOFDF ENABLE_SHARED DEPENDS diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f73d31a --- /dev/null +++ b/setup.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function +from os import sys + +try: + from skbuild import setup +except ImportError: + print('scikit-build is required to build from source.', file=sys.stderr) + print('Please run:', file=sys.stderr) + print('', file=sys.stderr) + print(' python -m pip install scikit-build') + sys.exit(1) + +setup( + name='itk-fdfimageio', + version='1.0.0', + author='Glenn Pierce', + author_email='glennpierce@gmail.com', + packages=['itk'], + package_dir={'itk': 'itk'}, + download_url=r'https://github.com/InsightSoftwareConsortium/ITKFDFImageIO', + description=r'ITK `ImageIO` class to read or write the FDF image format', + long_description='itkFDFImageIO provides an `ImageIO` class to read or' + 'write the FDF image format.', + classifiers=[ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: C++", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Healthcare Industry", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Medical Science Apps.", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Software Development :: Libraries", + "Operating System :: Android", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: Unix", + "Operating System :: MacOS" + ], + license='Apache', + keywords='ITK InsightToolkit FDF', + url=r'https://github.com/InsightSoftwareConsortium/ITKFDFImageIO', + install_requires=[ + r'itk' + ] + ) From 91f5e487a4a29b060ee7f6f5c256fb8efa4d3400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 10 Nov 2018 15:36:09 -0500 Subject: [PATCH 17/43] DOC: Add license file. Add the `LICENSE` license file, in conformance to the license notice in the header of the source files. --- LICENSE | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + 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. From 577762458585a06cceeb073cacda4ff60da1e230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 10 Nov 2018 16:05:32 -0500 Subject: [PATCH 18/43] DOC: Improve `README` file. Improve the `README` file: - Use resTructuredText syntax to conform to `ITKModuleTemplate` guidelines. - Improve its contents. - Add the CI status badges. --- README.md | 5 ----- README.rst | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) delete mode 100644 README.md create mode 100644 README.rst diff --git a/README.md b/README.md deleted file mode 100644 index dd85738..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -This is an ITK remote module that can be requested during an ITK build by setting Module_FDFImageIO to ON when configuring ITK. - -Initial work was done by Glenn Pierce (glennpierce@gmail.com) -Code brought up to current ITK standards by Nicholas Tustison (mtustison@gmail.com) -Converted to an ITK Remote module by Kent Williams (norman-k-williams@uiowa.edu) diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..3042b0b --- /dev/null +++ b/README.rst @@ -0,0 +1,48 @@ +ITKFDFImageIO +============= + +.. |CircleCI| image:: https://circleci.com/gh/InsightSoftwareConsortium/ITKFDFImageIO.svg?style=shield + :target: https://circleci.com/gh/InsightSoftwareConsortium/ITKFDFImageIO + +.. |TravisCI| image:: https://travis-ci.org/InsightSoftwareConsortium/ITKFDFImageIO.svg?branch=master + :target: https://travis-ci.org/InsightSoftwareConsortium/ITKFDFImageIO + +.. |AppVeyor| image:: https://img.shields.io/appveyor/ci/itkrobot/itkfdfimageio.svg + :target: https://ci.appveyor.com/project/itkrobot/itkfdfimageio + +=========== =========== =========== + Linux macOS Windows +=========== =========== =========== +|CircleCI| |TravisCI| |AppVeyor| +=========== =========== =========== + + +Overview +-------- + +This is a module for the `Insight Toolkit (ITK) `_ to read or +write the FDF image format. + +It contains an `ImageIO` class to read or write the FDF image format. + +This module is available in the ITK source tree as a Remote module. To enable +it, set:: + + Module_IOFDF:BOOL=ON + +in ITK's CMake build configuration. + + +License +------- + +This software is distributed under the Apache 2.0 license. Please see +the *LICENSE* file for details. + + +Acknowledgements +---------------- + +Initial work was done by `Glenn Pierce `_; the +code was brought up to current ITK standards by `Nicholas Tustison `_; +and it was converted to an ITK Remote module by `Kent Williams `_. From e76a58339dbdfb2e64e19155b56189433fdba3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 20 Dec 2018 23:14:07 -0500 Subject: [PATCH 19/43] DOC: Improve Python package information. Improve Python package information: - Make the reference in the long description match the package name and not the ITK project name. - Use white spaces to avoid words in two consecutive lines being concatenated. Partially addresses: https://github.com/InsightSoftwareConsortium/ITK/issues/326 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f73d31a..8617926 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ package_dir={'itk': 'itk'}, download_url=r'https://github.com/InsightSoftwareConsortium/ITKFDFImageIO', description=r'ITK `ImageIO` class to read or write the FDF image format', - long_description='itkFDFImageIO provides an `ImageIO` class to read or' + long_description='itk-fdfimageio provides an `ImageIO` class to read or ' 'write the FDF image format.', classifiers=[ "License :: OSI Approved :: Apache Software License", From bb94cd7f9e84c40306b84ebafaa91578a7cfb528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Wed, 30 Jan 2019 16:02:23 -0500 Subject: [PATCH 20/43] BUG: Fix CMake configuration warning. Fix CMake configuration warning. Fixes: ``` Make Warning (dev) at C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:102 (message): Unknown argument [ the code was brought up to current ITK standards by `Nicholas Tustison `_] Call Stack (most recent call first): itk-module.cmake:12 (itk_module) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleExternal.cmake:92 (include) CMakeLists.txt:8 (include) This warning is for project developers.Use -Wno-dev to suppress it. CMake Warning (dev) at C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:102 (message): Unknown argument [ and it was converted to an ITK Remote module by `Kent Williams `_. ] Call Stack (most recent call first): itk-module.cmake:12 (itk_module) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleExternal.cmake:92 (include) CMakeLists.txt:8 (include) This warning is for project developers.Use -Wno-dev to suppress it. CMake Warning (dev) at C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:102 (message): Unknown argument [ the code was brought up to current ITK standards by `Nicholas Tustison `_] Call Stack (most recent call first): itk-module.cmake:12 (itk_module) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:134 (include) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleExternal.cmake:102 (itk_module_impl) CMakeLists.txt:8 (include) This warning is for project developers.Use -Wno-dev to suppress it. CMake Warning (dev) at C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:102 (message): Unknown argument [ and it was converted to an ITK Remote module by `Kent Williams `_. ] Call Stack (most recent call first): itk-module.cmake:12 (itk_module) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:134 (include) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleExternal.cmake:102 (itk_module_impl) CMakeLists.txt:8 (include) This warning is for project developers.Use -Wno-dev to suppress it. CMake Warning (dev) at C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:102 (message): Unknown argument [ the code was brought up to current ITK standards by `Nicholas Tustison `_] Call Stack (most recent call first): itk-module.cmake:12 (itk_module) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:325 (include) test/CMakeLists.txt:1 (itk_module_test) This warning is for project developers.Use -Wno-dev to suppress it. CMake Warning (dev) at C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:102 (message): Unknown argument [ and it was converted to an ITK Remote module by `Kent Williams `_. ] Call Stack (most recent call first): itk-module.cmake:12 (itk_module) C:/SDKs/ITK/itk-head/ITK/CMake/ITKModuleMacros.cmake:325 (include) test/CMakeLists.txt:1 (itk_module_test) This warning is for project developers.Use -Wno-dev to suppress it. ``` Take advantage of the commit to fix Nick's email address. --- README.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 3042b0b..79c058c 100644 --- a/README.rst +++ b/README.rst @@ -43,6 +43,7 @@ the *LICENSE* file for details. Acknowledgements ---------------- -Initial work was done by `Glenn Pierce `_; the -code was brought up to current ITK standards by `Nicholas Tustison `_; -and it was converted to an ITK Remote module by `Kent Williams `_. +Initial work was done by `Glenn Pierce `_\; the +code was brought up to current ITK standards by +`Nicholas Tustison `_\; and it was converted to an +ITK Remote module by `Kent Williams `_. From 2f4d77695f178acda1a297b36b6727b8ab8adc33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Wed, 30 Jan 2019 16:04:41 -0500 Subject: [PATCH 21/43] STYLE: Fix `itk-module.cmake` local variable typo. Fix `itk-module.cmake` local variable typo: change `MY_CURENT_DIR` to `MY_CURRENT_DIR`. --- itk-module.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itk-module.cmake b/itk-module.cmake index 0196b31..f5dafbb 100644 --- a/itk-module.cmake +++ b/itk-module.cmake @@ -1,7 +1,7 @@ # the top-level README is used for describing this module, just # re-used it for documentation here -get_filename_component(MY_CURENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -file(READ "${MY_CURENT_DIR}/README.rst" DOCUMENTATION) +get_filename_component(MY_CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(READ "${MY_CURRENT_DIR}/README.rst" DOCUMENTATION) # itk_module() defines the module dependencies in IOFDF # The testing module in IOFDF depends on ITKTestKernel From 23bb47ba949f0a38306714f46d5e908e7747cac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 26 Jan 2019 19:12:26 -0500 Subject: [PATCH 22/43] STYLE: Conform to ITK IO module naming convention. Conform to ITK module naming convetion: change module name from `ITKFDFImageIO` to `ITKIOFDF`. Closes #24. --- .circleci/config.yml | 16 +++++++--------- README.rst | 16 ++++++++-------- setup.py | 8 ++++---- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9c04d72..770cd7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,12 +1,12 @@ version: 2 jobs: build-and-test: - working_directory: /ITKFDFImageIO-build + working_directory: /ITKIOFDF-build docker: - image: insighttoolkit/module-ci:latest steps: - checkout: - path: /ITKFDFImageIO + path: /ITKIOFDF - run: name: Fetch CTest driver script command: | @@ -17,12 +17,12 @@ jobs: SHASNIP=$(echo $CIRCLE_SHA1 | cut -c1-7) cat > dashboard.cmake << EOF set(CTEST_SITE "CircleCI") - set(CTEST_BUILD_NAME "External-ITKFDFImageIO-${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}-${SHASNIP}") + set(CTEST_BUILD_NAME "External-ITKIOFDF-${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}-${SHASNIP}") set(CTEST_BUILD_CONFIGURATION "MinSizeRel") set(CTEST_CMAKE_GENERATOR "Unix Makefiles") set(CTEST_BUILD_FLAGS: "-j5") - set(CTEST_SOURCE_DIRECTORY /ITKFDFImageIO) - set(CTEST_BINARY_DIRECTORY /ITKFDFImageIO-build) + set(CTEST_SOURCE_DIRECTORY /ITKIOFDF) + set(CTEST_BINARY_DIRECTORY /ITKIOFDF-build) set(dashboard_model Experimental) set(dashboard_no_clean 1) set(dashboard_cache " @@ -37,11 +37,10 @@ jobs: command: | ctest -j 2 -VV -S dashboard.cmake package: - working_directory: ~/ + working_directory: ~/ITKIOFDF machine: true steps: - - checkout: - path: ~/ITKFDFImageIO + - checkout - run: name: Fetch build script command: | @@ -51,7 +50,6 @@ jobs: name: Build Python packages no_output_timeout: 1.0h command: | - cd ~/ITKFDFImageIO ./dockcross-manylinux-download-cache-and-build-module-wheels.sh - store_artifacts: path: dist diff --git a/README.rst b/README.rst index 79c058c..c00ce9a 100644 --- a/README.rst +++ b/README.rst @@ -1,14 +1,14 @@ -ITKFDFImageIO -============= +ITKIOFDF +======== -.. |CircleCI| image:: https://circleci.com/gh/InsightSoftwareConsortium/ITKFDFImageIO.svg?style=shield - :target: https://circleci.com/gh/InsightSoftwareConsortium/ITKFDFImageIO +.. |CircleCI| image:: https://circleci.com/gh/InsightSoftwareConsortium/ITKIOFDF.svg?style=shield + :target: https://circleci.com/gh/InsightSoftwareConsortium/ITKIOFDF -.. |TravisCI| image:: https://travis-ci.org/InsightSoftwareConsortium/ITKFDFImageIO.svg?branch=master - :target: https://travis-ci.org/InsightSoftwareConsortium/ITKFDFImageIO +.. |TravisCI| image:: https://travis-ci.org/InsightSoftwareConsortium/ITKIOFDF.svg?branch=master + :target: https://travis-ci.org/InsightSoftwareConsortium/ITKIOFDF -.. |AppVeyor| image:: https://img.shields.io/appveyor/ci/itkrobot/itkfdfimageio.svg - :target: https://ci.appveyor.com/project/itkrobot/itkfdfimageio +.. |AppVeyor| image:: https://img.shields.io/appveyor/ci/itkrobot/itkiofdf.svg + :target: https://ci.appveyor.com/project/itkrobot/itkiofdf =========== =========== =========== Linux macOS Windows diff --git a/setup.py b/setup.py index 8617926..2830ebf 100644 --- a/setup.py +++ b/setup.py @@ -12,15 +12,15 @@ sys.exit(1) setup( - name='itk-fdfimageio', + name='itk-iofdf', version='1.0.0', author='Glenn Pierce', author_email='glennpierce@gmail.com', packages=['itk'], package_dir={'itk': 'itk'}, - download_url=r'https://github.com/InsightSoftwareConsortium/ITKFDFImageIO', + download_url=r'https://github.com/InsightSoftwareConsortium/ITKIOFDF', description=r'ITK `ImageIO` class to read or write the FDF image format', - long_description='itk-fdfimageio provides an `ImageIO` class to read or ' + long_description='itk-iofdf provides an `ImageIO` class to read or ' 'write the FDF image format.', classifiers=[ "License :: OSI Approved :: Apache Software License", @@ -43,7 +43,7 @@ ], license='Apache', keywords='ITK InsightToolkit FDF', - url=r'https://github.com/InsightSoftwareConsortium/ITKFDFImageIO', + url=r'https://github.com/InsightSoftwareConsortium/ITKIOFDF', install_requires=[ r'itk' ] From 5b2fc1e9201ed2fe01f7c27ebe9ae1dd968c1852 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Wed, 19 Feb 2020 15:45:24 -0600 Subject: [PATCH 23/43] ENH: Add .gitattributes to allow running ITK clang-formatting scripts ``` git filter-branch -f \ --tree-filter "~/ITK/Utilities/Maintenance/clang-format.bash --clang-format ~/Dashboard/src/ITK-clang11/clang-format-Linux --tracked" \ master.. ``` --- .clang-format | 151 +++++++++ .gitattributes | 14 + include/itkFDFCommonImageIO.h | 63 ++-- include/itkFDFImageIO.h | 74 ++-- include/itkFDFImageIOFactory.h | 9 +- src/ImageReadWrite.cxx | 48 +-- src/itkFDFCommonImageIO.cxx | 76 +++-- src/itkFDFImageIO.cxx | 599 ++++++++++++++++----------------- src/itkFDFImageIOFactory.cxx | 23 +- test/itkFDFImageIOTest.cxx | 29 +- 10 files changed, 631 insertions(+), 455 deletions(-) create mode 100644 .clang-format create mode 100644 .gitattributes diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..399e250 --- /dev/null +++ b/.clang-format @@ -0,0 +1,151 @@ +## This config file is only relevant for clang-format version 8.0.0 +## +## Examples of each format style can be found on the in the clang-format documentation +## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option +## +## The clang-format binaries can be downloaded as part of the clang binary distributions +## from http://releases.llvm.org/download.html +## +## Use the script Utilities/Maintenance/clang-format.bash to faciliate +## maintaining a consistent code style. +## +## EXAMPLE apply code style enforcement before commit: +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --modified +## EXAMPLE apply code style enforcement after commit: +# Utilities/Maintenance/clang-format.bash --clang ${PATH_TO_CLANG_FORMAT_8.0.0} --last +--- +# This configuration requires clang-format version 8.0.0 exactly. +BasedOnStyle: Mozilla +Language: Cpp +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Right +AlignOperands: true +AlignTrailingComments: true +# clang 9.0 AllowAllArgumentsOnNextLine: true +# clang 9.0 AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +# clang 9.0 AllowShortLambdasOnASingleLine: All +# clang 9.0 features AllowShortIfStatementsOnASingleLine: Never +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: All +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BreakBeforeBraces: Custom +BraceWrapping: + # clang 9.0 feature AfterCaseLabel: false + AfterClass: true + AfterControlStatement: true + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true +## This is the big change from historical ITK formatting! +# Historically ITK used a style similar to https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style +# with indented braces, and not indented code. This style is very difficult to automatically +# maintain with code beautification tools. Not indenting braces is more common among +# formatting tools. + IndentBraces: false + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakBeforeBinaryOperators: None +#clang 6.0 BreakBeforeInheritanceComma: true +BreakInheritanceList: BeforeComma +BreakBeforeTernaryOperators: true +#clang 6.0 BreakConstructorInitializersBeforeComma: true +BreakConstructorInitializers: BeforeComma +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +## The following line allows larger lines in non-documentation code +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +Cpp11BracedListStyle: false +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(Test)?$' +IndentCaseLabels: true +IndentPPDirectives: AfterHash +IndentWidth: 2 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: false +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +## The following line allows larger lines in non-documentation code +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Middle +ReflowComments: true +# We may want to sort the includes as a separate pass +SortIncludes: false +# We may want to revisit this later +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +# SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 2 +UseTab: Never +... diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c598f42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Custom attribute to mark sources as using our C++/C code style. +[attr]our-c-style whitespace=tab-in-indent,no-lf-at-eof hooks.style=KWStyle,clangformat + +*.c our-c-style +*.h our-c-style +*.cxx our-c-style +*.hxx our-c-style +*.txx our-c-style +*.txt whitespace=tab-in-indent,no-lf-at-eof +*.cmake whitespace=tab-in-indent,no-lf-at-eof + +# ExternalData content links must have LF newlines +*.md5 crlf=input +*.sha512 crlf=input diff --git a/include/itkFDFCommonImageIO.h b/include/itkFDFCommonImageIO.h index e71e025..407abd2 100644 --- a/include/itkFDFCommonImageIO.h +++ b/include/itkFDFCommonImageIO.h @@ -31,61 +31,70 @@ namespace itk { -std::string RemoveCharacters( std::string, char ); +std::string +RemoveCharacters(std::string, char); -void Tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters = " "); +void +Tokenize(const std::string & str, std::vector & tokens, const std::string & delimiters = " "); -std::string ParseLine(std::string line); +std::string +ParseLine(std::string line); template -void ConvertFromString (std::string s, T &value) +void +ConvertFromString(std::string s, T & value) { - std::stringstream str; - str << s; - str >> value; + std::stringstream str; + str << s; + str >> value; } template -void StringToVector (std::string value, std::vector& values) +void +StringToVector(std::string value, std::vector & values) { - std::vector tokens; + std::vector tokens; - // value consists of something like {256,256} - std::string::size_type startBracketPosition = value.find_first_of("{", 0); - std::string::size_type endBracketPosition = value.find_first_of("}", startBracketPosition); + // value consists of something like {256,256} + std::string::size_type startBracketPosition = value.find_first_of("{", 0); + std::string::size_type endBracketPosition = value.find_first_of("}", startBracketPosition); - if ( startBracketPosition != std::string::npos && endBracketPosition != std::string::npos) { - std::string elements = value.substr(startBracketPosition + 1, endBracketPosition - startBracketPosition - 1); + if (startBracketPosition != std::string::npos && endBracketPosition != std::string::npos) + { + std::string elements = value.substr(startBracketPosition + 1, endBracketPosition - startBracketPosition - 1); - Tokenize(elements, tokens, ","); - } + Tokenize(elements, tokens, ","); + } - T element; + T element; - for(auto & token : tokens) { - ConvertFromString(token, element); - values.push_back(element); - } + for (auto & token : tokens) + { + ConvertFromString(token, element); + values.push_back(element); + } } template -void PrintVector (std::ostream& os, std::string name, const std::vector& vect) +void +PrintVector(std::ostream & os, std::string name, const std::vector & vect) { int size = vect.size(); os << name << " {"; - for(int i=0; i < size; i++) { - os << vect[i]; + for (int i = 0; i < size; i++) + { + os << vect[i]; - if (i < size - 1) - os << ", "; + if (i < size - 1) + os << ", "; } os << "}" << std::endl; } -} +} // namespace itk #endif diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 955c9cb..45497b5 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -47,86 +47,100 @@ class IOFDF_EXPORT FDFImageIO : public ImageIOBase /** Run-time type information (and related methods). */ itkTypeMacro(FDFImageIO, ImageIOBase); - bool SupportsDimension( unsigned long dim ) override + bool + SupportsDimension(unsigned long dim) override + { + if (dim == 2 || dim == 3) { - if( dim == 2 || dim == 3 ) - { return true; - } + } else - { + { return false; - } } + } /*-------- This part of the interface deals with reading data. ------ */ /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanReadFile(const char*) override; + bool + CanReadFile(const char *) override; /** Set the spacing and diemention information for the set filename. */ - void ReadImageInformation() override; + void + ReadImageInformation() override; /** Get the type of the pixel. */ -// virtual const std::type_info& GetPixelType() const; + // virtual const std::type_info& GetPixelType() const; /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) override; + void + Read(void * buffer) override; /** Reads 3D data from multiple files assuming one slice per file. */ - virtual void ReadVolume(void* buffer); + virtual void + ReadVolume(void * buffer); /** Compute the size (in bytes) of the components of a pixel. For * example, and RGB pixel of unsigned char would have a * component size of 1 byte. */ -// virtual unsigned int GetComponentSize() const; + // virtual unsigned int GetComponentSize() const; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - bool CanWriteFile(const char*) override; + bool + CanWriteFile(const char *) override; /** Writes the spacing and dimentions of the image. * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() override; + void + WriteImageInformation() override; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - void Write(const void* buffer) override; + void + Write(const void * buffer) override; protected: FDFImageIO(); ~FDFImageIO() override; - void PrintSelf(std::ostream& os, Indent indent) const override; + void + PrintSelf(std::ostream & os, Indent indent) const override; - void WriteSlice(std::string& fileName, const void* buffer); + void + WriteSlice(std::string & fileName, const void * buffer); - int ReadHeader(const char *FileNameToRead); + int + ReadHeader(const char * FileNameToRead); private: - void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels); + void + SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels); // Position after ReadImageInformation. size_t m_InputPosition; - std::string m_SpatialRank; - std::string m_Checksum; - std::string m_Bits; - std::vector m_Size; - std::vector m_Location; - std::vector m_Span; - std::vector m_Roi; + std::string m_SpatialRank; + std::string m_Checksum; + std::string m_Bits; + std::vector m_Size; + std::vector m_Location; + std::vector m_Span; + std::vector m_Roi; }; } // end namespace itk -#define RAISE_EXCEPTION() \ - { ExceptionObject exception(__FILE__, __LINE__); \ - exception.SetDescription("File cannot be read"); \ - throw exception; } +#define RAISE_EXCEPTION() \ + { \ + ExceptionObject exception(__FILE__, __LINE__); \ + exception.SetDescription("File cannot be read"); \ + throw exception; \ + } #endif diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index c338da6..190d075 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -39,8 +39,10 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase using ConstPointer = SmartPointer; /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const override; - const char* GetDescription(void) const override; + const char * + GetITKSourceVersion(void) const override; + const char * + GetDescription(void) const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -49,7 +51,8 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase itkTypeMacro(FDFImageIOFactory, ObjectFactoryBase); /** Register one factory of this type */ - static void RegisterOneFactory(void) + static void + RegisterOneFactory(void) { FDFImageIOFactory::Pointer FdfFactory = FDFImageIOFactory::New(); ObjectFactoryBase::RegisterFactoryInternal(FdfFactory); diff --git a/src/ImageReadWrite.cxx b/src/ImageReadWrite.cxx index d5a4341..c6413a3 100644 --- a/src/ImageReadWrite.cxx +++ b/src/ImageReadWrite.cxx @@ -28,59 +28,61 @@ #include "itkImage.h" -int main( int argc, char ** argv ) +int +main(int argc, char ** argv) { using PixelType = float; constexpr unsigned int Dimension = 2; - using ImageType = itk::Image< PixelType, Dimension >; - using ReaderType = itk::ImageFileReader< ImageType >; - using ImageToVTKType = itk::ImageToVTKImageFilter< ImageType >; - using NormalizeFilter = itk::NormalizeImageFilter< ImageType, ImageType>; - using ChangeInformationFilter = itk::ChangeInformationImageFilter< ImageType >; + using ImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using ImageToVTKType = itk::ImageToVTKImageFilter; + using NormalizeFilter = itk::NormalizeImageFilter; + using ChangeInformationFilter = itk::ChangeInformationImageFilter; // Register FDF Factory itk::FDFImageIOFactory::RegisterOneFactory(); - ReaderType::Pointer reader = ReaderType::New(); - NormalizeFilter::Pointer normalizer = NormalizeFilter::New(); + ReaderType::Pointer reader = ReaderType::New(); + NormalizeFilter::Pointer normalizer = NormalizeFilter::New(); ChangeInformationFilter::Pointer movingChange = ChangeInformationFilter::New(); - reader->SetFileName( "/home/glenn/development/reader/test.fdf" ); + reader->SetFileName("/home/glenn/development/reader/test.fdf"); - try { - reader->Update(); + try + { + reader->Update(); } - catch( itk::ExceptionObject & exp ) + catch (itk::ExceptionObject & exp) { - std::cerr << "Exception caught" << std::endl; - std::cerr << exp << std::endl; + std::cerr << "Exception caught" << std::endl; + std::cerr << exp << std::endl; } std::cout << reader << std::endl; - normalizer->SetInput( reader->GetOutput() ); + normalizer->SetInput(reader->GetOutput()); movingChange->SetInput(normalizer->GetOutput()); movingChange->CenterImageOn(); - vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New(); + vtkRenderWindowInteractor * iren = vtkRenderWindowInteractor::New(); ImageToVTKType::Pointer bridge = ImageToVTKType::New(); - bridge->SetInput( movingChange->GetOutput() ); + bridge->SetInput(movingChange->GetOutput()); - vtkImageViewer *viewer = vtkImageViewer::New(); - viewer->SetInput( bridge->GetOutput() ); + vtkImageViewer * viewer = vtkImageViewer::New(); + viewer->SetInput(bridge->GetOutput()); viewer->SetColorWindow(1); viewer->SetColorLevel(0.1); - //viewer->SetupInteractor(iren); + // viewer->SetupInteractor(iren); - while(1) - viewer->Render(); + while (1) + viewer->Render(); viewer->Delete(); - //iren->Delete(); + // iren->Delete(); return 0; } diff --git a/src/itkFDFCommonImageIO.cxx b/src/itkFDFCommonImageIO.cxx index ff17e2c..f597a1f 100644 --- a/src/itkFDFCommonImageIO.cxx +++ b/src/itkFDFCommonImageIO.cxx @@ -22,55 +22,59 @@ namespace itk { // Remove a particular type of character from a string -std::string RemoveCharacters( std::string line, char character ) +std::string +RemoveCharacters(std::string line, char character) { - line.erase( std::remove( line.begin(), line.end(), character ), line.end() ); + line.erase(std::remove(line.begin(), line.end(), character), line.end()); return line; } -void Tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters) +void +Tokenize(const std::string & str, std::vector & tokens, const std::string & delimiters) { - // Skip delimiters at beginning. - std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); - // Find first "non-delimiter". - std::string::size_type pos = str.find_first_of(delimiters, lastPos); + // Skip delimiters at beginning. + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + // Find first "non-delimiter". + std::string::size_type pos = str.find_first_of(delimiters, lastPos); - while (std::string::npos != pos || std::string::npos != lastPos) - { - // Found a token, add it to the vector. - tokens.push_back(str.substr(lastPos, pos - lastPos)); - // Skip delimiters. Note the "not_of" - lastPos = str.find_first_not_of(delimiters, pos); - // Find next "non-delimiter" - pos = str.find_first_of(delimiters, lastPos); - } + while (std::string::npos != pos || std::string::npos != lastPos) + { + // Found a token, add it to the vector. + tokens.push_back(str.substr(lastPos, pos - lastPos)); + // Skip delimiters. Note the "not_of" + lastPos = str.find_first_not_of(delimiters, pos); + // Find next "non-delimiter" + pos = str.find_first_of(delimiters, lastPos); + } } -std::string ParseLine(std::string line) +std::string +ParseLine(std::string line) { - // strip * - line = RemoveCharacters( line, '*' ); - line = RemoveCharacters( line, '\"' ); - line = RemoveCharacters( line, '[' ); - line = RemoveCharacters( line, ']' ); + // strip * + line = RemoveCharacters(line, '*'); + line = RemoveCharacters(line, '\"'); + line = RemoveCharacters(line, '['); + line = RemoveCharacters(line, ']'); - // Need to deal with space between {} - std::string::size_type startBracketPosition = line.find_first_of("{", 0); - std::string::size_type endBracketPosition = line.find_first_of("}", startBracketPosition); + // Need to deal with space between {} + std::string::size_type startBracketPosition = line.find_first_of("{", 0); + std::string::size_type endBracketPosition = line.find_first_of("}", startBracketPosition); - if ( startBracketPosition != std::string::npos && endBracketPosition != std::string::npos) { - std::string element = line.substr(startBracketPosition, endBracketPosition - startBracketPosition); + if (startBracketPosition != std::string::npos && endBracketPosition != std::string::npos) + { + std::string element = line.substr(startBracketPosition, endBracketPosition - startBracketPosition); - // Find whitespace within {} and erase - std::string::size_type whiteSpacePosition = line.find_first_of(" ", startBracketPosition); + // Find whitespace within {} and erase + std::string::size_type whiteSpacePosition = line.find_first_of(" ", startBracketPosition); - while (whiteSpacePosition != std::string::npos) - { - line.erase(whiteSpacePosition, 1); - whiteSpacePosition = line.find_first_of(" ", whiteSpacePosition); - } + while (whiteSpacePosition != std::string::npos) + { + line.erase(whiteSpacePosition, 1); + whiteSpacePosition = line.find_first_of(" ", whiteSpacePosition); } + } - return line; -} + return line; } +} // namespace itk diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index 25dcd62..cea7bb1 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -28,48 +28,47 @@ namespace itk { -bool FDFImageIO::CanReadFile(const char* file) +bool +FDFImageIO::CanReadFile(const char * file) { this->SetFileName(file); // First check the extension std::string filename = file; - if( filename == "" ) - { - itkDebugMacro(<<"No filename specified."); + if (filename == "") + { + itkDebugMacro(<< "No filename specified."); return false; - } + } - bool extensionFound = false; + bool extensionFound = false; std::string::size_type FDFPos = filename.rfind(".fdf"); - if ((FDFPos != std::string::npos) - && (FDFPos == filename.length() - 4)) - { + if ((FDFPos != std::string::npos) && (FDFPos == filename.length() - 4)) + { extensionFound = true; - } + } FDFPos = filename.rfind(".FDF"); - if ((FDFPos != std::string::npos) - && (FDFPos == filename.length() - 4)) - { + if ((FDFPos != std::string::npos) && (FDFPos == filename.length() - 4)) + { extensionFound = true; - } + } - if( !extensionFound ) - { - itkDebugMacro(<<"The filename extension is not recognized"); + if (!extensionFound) + { + itkDebugMacro(<< "The filename extension is not recognized"); return false; - } + } std::ifstream inFile; - inFile.open(m_FileName.c_str(), std::ios::in | std::ios::binary ); - if( !inFile ) - { + inFile.open(m_FileName.c_str(), std::ios::in | std::ios::binary); + if (!inFile) + { ExceptionObject exception(__FILE__, __LINE__); - std::string msg = "File \"" + m_FileName + "\" cannot be read."; + std::string msg = "File \"" + m_FileName + "\" cannot be read."; exception.SetDescription(msg.c_str()); throw exception; - } + } // Check for a neccessary header variable @@ -77,14 +76,15 @@ bool FDFImageIO::CanReadFile(const char* file) return true; } -void FDFImageIO::ReadImageInformation() +void +FDFImageIO::ReadImageInformation() { - if(!this->CanReadFile(m_FileName.c_str())) + if (!this->CanReadFile(m_FileName.c_str())) RAISE_EXCEPTION(); - std::string line; + std::string line; std::vector tokens; - std::string type, name, value; + std::string type, name, value; ImageIORegion region; @@ -92,224 +92,223 @@ void FDFImageIO::ReadImageInformation() // Check if there was an error opening the file if (!inFile) - { + { std::cout << "Unable to open the file\n"; RAISE_EXCEPTION(); - } + } this->SetFileTypeToBinary(); - while( getline( inFile, line, '\n' ) ) + while (getline(inFile, line, '\n')) + { + if (line == "\0") { - if ( line == "\0" ) - { break; - } + } // Formats the lines in the FDF header such as removing whitespace between {} - line = ParseLine( line ); - Tokenize( line, tokens, " ;" ); + line = ParseLine(line); + Tokenize(line, tokens, " ;"); - if( tokens.size() == 4 ) - { + if (tokens.size() == 4) + { type = tokens[0]; name = tokens[1]; value = tokens[3]; - if( name == "spatial_rank" ) - { + if (name == "spatial_rank") + { this->m_SpatialRank = value; - } + } - if( name == "matrix" ) - { + if (name == "matrix") + { std::vector dimensions; - StringToVector( value, dimensions ); + StringToVector(value, dimensions); // Set the number of dimensions - if( this->GetNumberOfDimensions() < dimensions.size() ) - { - this->SetNumberOfDimensions( dimensions.size() ); - } + if (this->GetNumberOfDimensions() < dimensions.size()) + { + this->SetNumberOfDimensions(dimensions.size()); + } - ImageIORegion::SizeType size( dimensions.size() ); - ImageIORegion::IndexType index( dimensions.size() ); + ImageIORegion::SizeType size(dimensions.size()); + ImageIORegion::IndexType index(dimensions.size()); - for( unsigned int i = 0; i < dimensions.size(); i++ ) - { - this->SetDimensions( i, dimensions[i] ); + for (unsigned int i = 0; i < dimensions.size(); i++) + { + this->SetDimensions(i, dimensions[i]); size[i] = dimensions[i]; index[i] = 0; - } - - region.SetSize( size ); - region.SetIndex( index ); - this->SetIORegion( region ); } - if( name == "orientation" ) - { - const unsigned numDim(this->GetNumberOfDimensions()); + region.SetSize(size); + region.SetIndex(index); + this->SetIORegion(region); + } + + if (name == "orientation") + { + const unsigned numDim(this->GetNumberOfDimensions()); std::vector orientation; - StringToVector( value, orientation ); + StringToVector(value, orientation); - vnl_matrix testDirections(numDim,numDim); + vnl_matrix testDirections(numDim, numDim); - for( unsigned int i = 0; i < numDim; i++ ) - { + for (unsigned int i = 0; i < numDim; i++) + { std::vector componentVector; - for( unsigned int j = 0; j < numDim; j++ ) - { + for (unsigned int j = 0; j < numDim; j++) + { double val = orientation[i * numDim + j]; - testDirections(j,i) = val; - componentVector.push_back( val ); - } - this->SetDirection( i, componentVector ); + testDirections(j, i) = val; + componentVector.push_back(val); } + this->SetDirection(i, componentVector); + } // check for degenerate dimensions. this will happen // if the dimension of the image is 2 but the // direction matrix in the file is 3x3. // if direction matrix is degenerate, punt and set // directions to identity - if(vnl_determinant(testDirections) == 0) + if (vnl_determinant(testDirections) == 0) + { + for (unsigned int i = 0; i < numDim; i++) { - for( unsigned int i = 0; i < numDim; i++ ) - { std::vector componentVector; - for( unsigned int j = 0; j < numDim; j++ ) - { + for (unsigned int j = 0; j < numDim; j++) + { double val = i == j ? 1.0 : 0.0; - componentVector.push_back( val ); - } - this->SetDirection( i, componentVector ); + componentVector.push_back(val); } + this->SetDirection(i, componentVector); } } - if( name == "span" ) - { - StringToVector( value, this->m_Span ); - } + } + if (name == "span") + { + StringToVector(value, this->m_Span); + } - if( name == "origin" ) - { + if (name == "origin") + { std::vector origin; - StringToVector( value, origin ); - - if( this->GetNumberOfDimensions() < origin.size() ) - { - this->SetNumberOfDimensions( origin.size() ); - } - - for( unsigned int i = 0; i < origin.size(); i++ ) - { - this->SetOrigin( i, origin[i] / 10.0 ); - } - } + StringToVector(value, origin); - if( name == "roi" ) + if (this->GetNumberOfDimensions() < origin.size()) { - StringToVector( value, this->m_Roi ); + this->SetNumberOfDimensions(origin.size()); } - if( name == "location" ) + for (unsigned int i = 0; i < origin.size(); i++) { - StringToVector( value, this->m_Location ); + this->SetOrigin(i, origin[i] / 10.0); } + } + + if (name == "roi") + { + StringToVector(value, this->m_Roi); + } - if( name == "bigendian" ) + if (name == "location") + { + StringToVector(value, this->m_Location); + } + + if (name == "bigendian") + { + if (value == "0") { - if( value == "0" ) - { this->SetByteOrderToLittleEndian(); - } + } else - { + { this->SetByteOrderToBigEndian(); - } } + } // Get the binary data type - if( name == "storage" ) - { - this->SetPixelType( SCALAR ); + if (name == "storage") + { + this->SetPixelType(SCALAR); - if( value == "double" ) - { - this->SetComponentType( DOUBLE ); - } - else if( value == "float" ) - { - this->SetComponentType( FLOAT ); - } - else if( value == "long" ) - { - this->SetComponentType( LONG ); - } - else if( value == "unsigned long" ) - { - this->SetComponentType( ULONG ); - } - else if( value == "int" ) - { - this->SetComponentType( INT ); - } - else if( value == "unsigned int" ) - { - this->SetComponentType( UINT ); - } - else if( value == "short" ) - { - this->SetComponentType( SHORT ); - } - else if( value == "unsigned short" ) - { - this->SetComponentType( USHORT ); - } - else if( value == "char" ) - { - this->SetComponentType( CHAR ); - } - else if( value == "unsigned char" ) - { - this->SetComponentType( UCHAR ); - } + if (value == "double") + { + this->SetComponentType(DOUBLE); + } + else if (value == "float") + { + this->SetComponentType(FLOAT); + } + else if (value == "long") + { + this->SetComponentType(LONG); + } + else if (value == "unsigned long") + { + this->SetComponentType(ULONG); + } + else if (value == "int") + { + this->SetComponentType(INT); + } + else if (value == "unsigned int") + { + this->SetComponentType(UINT); + } + else if (value == "short") + { + this->SetComponentType(SHORT); + } + else if (value == "unsigned short") + { + this->SetComponentType(USHORT); + } + else if (value == "char") + { + this->SetComponentType(CHAR); + } + else if (value == "unsigned char") + { + this->SetComponentType(UCHAR); + } else - { - itkExceptionMacro( "Unknown component type: " << value ); - } + { + itkExceptionMacro("Unknown component type: " << value); } + } // Get the bits - if( name == "bits" ) - { - ConvertFromString( value, this->m_Bits ); - } + if (name == "bits") + { + ConvertFromString(value, this->m_Bits); + } // Get the checksum - if( name == "checksum" ) - { - ConvertFromString( value, this->m_Checksum ); - } + if (name == "checksum") + { + ConvertFromString(value, this->m_Checksum); } + } tokens.clear(); - } + } - inFile.seekg( 0, std::ios::end ); + inFile.seekg(0, std::ios::end); long int fileSize = inFile.tellg(); this->m_InputPosition = fileSize - this->GetImageSizeInBytes(); - for( unsigned int i = 0; i < this->GetNumberOfDimensions(); i++ ) - { - this->SetSpacing( i, ( this->m_Roi[i] * 10 ) / this->GetDimensions( i ) ); - } + for (unsigned int i = 0; i < this->GetNumberOfDimensions(); i++) + { + this->SetSpacing(i, (this->m_Roi[i] * 10) / this->GetDimensions(i)); + } } -void FDFImageIO::ReadVolume(void*) -{ - -} +void +FDFImageIO::ReadVolume(void *) +{} // const std::type_info& FDFImageIO::GetPixelType() const // { @@ -341,8 +340,8 @@ void FDFImageIO::ReadVolume(void*) // return typeid(RGBAPixel); // default: // { -// itkExceptionMacro ("Invalid type: " << m_PixelType << ", only unsigned char, unsigned short, RGB are allowed."); -// return this->ConvertToTypeInfo(m_PixelType); +// itkExceptionMacro ("Invalid type: " << m_PixelType << ", only unsigned char, unsigned short, RGB +// are allowed."); return this->ConvertToTypeInfo(m_PixelType); // } // case UNKNOWN: // itkExceptionMacro ("Unknown pixel type: " << m_PixelType); @@ -390,7 +389,8 @@ void FDFImageIO::ReadVolume(void*) // return 1; // } -void FDFImageIO::Read(void* buffer) +void +FDFImageIO::Read(void * buffer) { std::ifstream inFile(m_FileName.c_str(), std::ios::in | std::ios::binary); @@ -400,201 +400,186 @@ void FDFImageIO::Read(void* buffer) RAISE_EXCEPTION(); } - inFile.seekg( this->m_InputPosition ); + inFile.seekg(this->m_InputPosition); if (!inFile) - { + { RAISE_EXCEPTION(); - } + } auto * p = static_cast(buffer); - inFile.read( p, this->GetImageSizeInBytes() ); + inFile.read(p, this->GetImageSizeInBytes()); bool success = !inFile.bad(); inFile.close(); - if( !success ) - { + if (!success) + { itkExceptionMacro("Error reading image data."); - } + } - this->SwapBytesIfNecessary( buffer, this->GetImageSizeInPixels() ); + this->SwapBytesIfNecessary(buffer, this->GetImageSizeInPixels()); } -FDFImageIO::FDFImageIO() -{ -} +FDFImageIO::FDFImageIO() {} FDFImageIO::~FDFImageIO() {} -void FDFImageIO::PrintSelf(std::ostream& os, Indent indent) const +void +FDFImageIO::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); -// os << indent << "PixelType " << m_PixelType << "\n"; -// os << indent << "Start of image in bytes from start of file " << this->m_InputPosition << "\n"; -// os << indent << "Number of pixels in image: " << this->GetImageSizeInPixels() << "\n"; -// os << indent << "Image size in bytes: " << this->GetImageSizeInBytes() << "\n"; -// os << indent << "Checksum: " << this->checksum << "\n"; -// os << indent << "Spatial Rank: " << this->spatial_rank << "\n"; -// os << indent << "Bits: " << this->bits << "\n"; -// os << indent; PrintVector(os, "Matrix", this->matrix); -// os << indent; PrintVector(os, "Location", this->location); -// os << indent; PrintVector(os, "ROI", this->roi); -// os << indent; PrintVector(os, "Span", this->span); + // os << indent << "PixelType " << m_PixelType << "\n"; + // os << indent << "Start of image in bytes from start of file " << this->m_InputPosition << "\n"; + // os << indent << "Number of pixels in image: " << this->GetImageSizeInPixels() << "\n"; + // os << indent << "Image size in bytes: " << this->GetImageSizeInBytes() << "\n"; + // os << indent << "Checksum: " << this->checksum << "\n"; + // os << indent << "Spatial Rank: " << this->spatial_rank << "\n"; + // os << indent << "Bits: " << this->bits << "\n"; + // os << indent; PrintVector(os, "Matrix", this->matrix); + // os << indent; PrintVector(os, "Location", this->location); + // os << indent; PrintVector(os, "ROI", this->roi); + // os << indent; PrintVector(os, "Span", this->span); } -bool FDFImageIO::CanWriteFile( const char * /* name */) +bool +FDFImageIO::CanWriteFile(const char * /* name */) { - //not possible to write a fdf file + // not possible to write a fdf file return false; } -void FDFImageIO::SwapBytesIfNecessary( void* buffer, unsigned long numberOfPixels ) +void +FDFImageIO::SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels) { - switch( this->GetComponentType() ) - { + switch (this->GetComponentType()) + { case CHAR: + { + if (this->m_ByteOrder == LittleEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (char*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (char *)buffer, numberOfPixels ); - } - break; + ByteSwapper::SwapRangeFromSystemToLittleEndian((char *)buffer, numberOfPixels); } - case FLOAT: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (float *)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (float *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((char *)buffer, numberOfPixels); + } break; + } + case FLOAT: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((float *)buffer, numberOfPixels); } - case UCHAR: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (unsigned char*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (unsigned char *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((float *)buffer, numberOfPixels); + } break; + } + case UCHAR: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned char *)buffer, numberOfPixels); } - case SHORT: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (short*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (short *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned char *)buffer, numberOfPixels); + } break; + } + case SHORT: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((short *)buffer, numberOfPixels); } - case USHORT: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (unsigned short*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (unsigned short *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((short *)buffer, numberOfPixels); + } break; + } + case USHORT: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned short *)buffer, numberOfPixels); } - case INT: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (int*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (int *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned short *)buffer, numberOfPixels); + } break; + } + case INT: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((int *)buffer, numberOfPixels); } - case UINT: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (unsigned int*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (unsigned int *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((int *)buffer, numberOfPixels); + } break; + } + case UINT: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned int *)buffer, numberOfPixels); } - case LONG: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (long*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (long *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned int *)buffer, numberOfPixels); + } break; + } + case LONG: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((long *)buffer, numberOfPixels); } - case ULONG: + else if (this->m_ByteOrder == BigEndian) { - if ( this->m_ByteOrder == LittleEndian ) - { - ByteSwapper::SwapRangeFromSystemToLittleEndian( - (unsigned long*)buffer, numberOfPixels ); - } - else if ( this->m_ByteOrder == BigEndian ) - { - ByteSwapper::SwapRangeFromSystemToBigEndian( - (unsigned long *)buffer, numberOfPixels ); - } + ByteSwapper::SwapRangeFromSystemToBigEndian((long *)buffer, numberOfPixels); + } break; + } + case ULONG: + { + if (this->m_ByteOrder == LittleEndian) + { + ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned long *)buffer, numberOfPixels); + } + else if (this->m_ByteOrder == BigEndian) + { + ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned long *)buffer, numberOfPixels); } + break; + } default: - ExceptionObject exception( __FILE__, __LINE__ ); - exception.SetDescription( "Pixel Type Unknown" ); + ExceptionObject exception(__FILE__, __LINE__); + exception.SetDescription("Pixel Type Unknown"); throw exception; - } + } } -void FDFImageIO::WriteImageInformation(void) +void +FDFImageIO::WriteImageInformation(void) { - //not possible to write a fdf file + // not possible to write a fdf file } -void FDFImageIO::Write(const void* /* buffer */) +void +FDFImageIO::Write(const void * /* buffer */) { - //not possible to write a fdf file + // not possible to write a fdf file } } // end namespace itk diff --git a/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index e83d36b..12cc3bf 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.cxx @@ -26,24 +26,18 @@ namespace itk { FDFImageIOFactory::FDFImageIOFactory() { - this->RegisterOverride("itkImageIOBase", - "itkFDFImageIO", - "FDF Image IO", - 1, - CreateObjectFunction::New()); + this->RegisterOverride("itkImageIOBase", "itkFDFImageIO", "FDF Image IO", 1, CreateObjectFunction::New()); } -FDFImageIOFactory::~FDFImageIOFactory() -{ -} +FDFImageIOFactory::~FDFImageIOFactory() {} -const char* +const char * FDFImageIOFactory::GetITKSourceVersion(void) const { return ITK_SOURCE_VERSION; } -const char* +const char * FDFImageIOFactory::GetDescription() const { return "FDF ImageIO Factory, allows the loading of Varian FDF images into Insight"; @@ -55,13 +49,14 @@ FDFImageIOFactory::GetDescription() const static bool FDFImageIOFactoryHasBeenRegistered; -void IOFDF_EXPORT FDFImageIOFactoryRegister__Private(void) +void IOFDF_EXPORT + FDFImageIOFactoryRegister__Private(void) { - if( ! FDFImageIOFactoryHasBeenRegistered ) - { + if (!FDFImageIOFactoryHasBeenRegistered) + { FDFImageIOFactoryHasBeenRegistered = true; FDFImageIOFactory::RegisterOneFactory(); - } + } } diff --git a/test/itkFDFImageIOTest.cxx b/test/itkFDFImageIOTest.cxx index fd962fa..e450116 100644 --- a/test/itkFDFImageIOTest.cxx +++ b/test/itkFDFImageIOTest.cxx @@ -22,41 +22,40 @@ #include "itkImage.h" -int itkFDFImageIOTest( int argc, char * argv[] ) +int +itkFDFImageIOTest(int argc, char * argv[]) { - if(argc < 3) - { + if (argc < 3) + { std::cerr << "Usage: itkFDFImageIO ; - using ReaderType = itk::ImageFileReader< ImageType >; + using ImageType = itk::Image; + using ReaderType = itk::ImageFileReader; // Register FDF Factory itk::FDFImageIOFactory::RegisterOneFactory(); ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName( argv[2] ); + reader->SetFileName(argv[2]); try - { + { reader->Update(); - } - catch( itk::ExceptionObject & exp ) - { + } + catch (itk::ExceptionObject & exp) + { std::cerr << "Exception caught" << std::endl; std::cerr << exp << std::endl; return EXIT_FAILURE; - } + } ImageType::Pointer im = reader->GetOutput(); - std::cerr << im->GetDirection() << std::endl - << im->GetOrigin() << std::endl - << im->GetSpacing() << std::endl; + std::cerr << im->GetDirection() << std::endl << im->GetOrigin() << std::endl << im->GetSpacing() << std::endl; return EXIT_SUCCESS; } From 365f94e87aa37ae68c4dfb94df85d2079f4790bb Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Tue, 18 Feb 2020 09:01:46 -0600 Subject: [PATCH 24/43] ENH: Update enums from recent enum changes in ITK --- src/itkFDFImageIO.cxx | 76 +++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index cea7bb1..c32c8a6 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -231,47 +231,47 @@ FDFImageIO::ReadImageInformation() // Get the binary data type if (name == "storage") { - this->SetPixelType(SCALAR); + this->SetPixelType(IOPixelEnum::SCALAR); if (value == "double") { - this->SetComponentType(DOUBLE); + this->SetComponentType(IOComponentEnum::DOUBLE); } else if (value == "float") { - this->SetComponentType(FLOAT); + this->SetComponentType(IOComponentEnum::FLOAT); } else if (value == "long") { - this->SetComponentType(LONG); + this->SetComponentType(IOComponentEnum::LONG); } else if (value == "unsigned long") { - this->SetComponentType(ULONG); + this->SetComponentType(IOComponentEnum::ULONG); } else if (value == "int") { - this->SetComponentType(INT); + this->SetComponentType(IOComponentEnum::INT); } else if (value == "unsigned int") { - this->SetComponentType(UINT); + this->SetComponentType(IOComponentEnum::UINT); } else if (value == "short") { - this->SetComponentType(SHORT); + this->SetComponentType(IOComponentEnum::SHORT); } else if (value == "unsigned short") { - this->SetComponentType(USHORT); + this->SetComponentType(IOComponentEnum::USHORT); } else if (value == "char") { - this->SetComponentType(CHAR); + this->SetComponentType(IOComponentEnum::CHAR); } else if (value == "unsigned char") { - this->SetComponentType(UCHAR); + this->SetComponentType(IOComponentEnum::UCHAR); } else { @@ -455,109 +455,109 @@ FDFImageIO::SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels) { switch (this->GetComponentType()) { - case CHAR: + case IOComponentEnum::CHAR: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((char *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((char *)buffer, numberOfPixels); } break; } - case FLOAT: + case IOComponentEnum::FLOAT: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((float *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((float *)buffer, numberOfPixels); } break; } - case UCHAR: + case IOComponentEnum::UCHAR: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned char *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned char *)buffer, numberOfPixels); } break; } - case SHORT: + case IOComponentEnum::SHORT: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((short *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((short *)buffer, numberOfPixels); } break; } - case USHORT: + case IOComponentEnum::USHORT: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned short *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned short *)buffer, numberOfPixels); } break; } - case INT: + case IOComponentEnum::INT: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((int *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((int *)buffer, numberOfPixels); } break; } - case UINT: + case IOComponentEnum::UINT: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned int *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned int *)buffer, numberOfPixels); } break; } - case LONG: + case IOComponentEnum::LONG: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((long *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((long *)buffer, numberOfPixels); } break; } - case ULONG: + case IOComponentEnum::ULONG: { - if (this->m_ByteOrder == LittleEndian) + if (this->m_ByteOrder == IOByteOrderEnum::LittleEndian) { ByteSwapper::SwapRangeFromSystemToLittleEndian((unsigned long *)buffer, numberOfPixels); } - else if (this->m_ByteOrder == BigEndian) + else if (this->m_ByteOrder == IOByteOrderEnum::BigEndian) { ByteSwapper::SwapRangeFromSystemToBigEndian((unsigned long *)buffer, numberOfPixels); } From c75a877e550ace57c0b05b400117a44b9f708aa5 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 16 Feb 2020 18:26:29 -0600 Subject: [PATCH 25/43] STYLE: Remove redundant void argument lists Find and remove redundant void argument lists. --- src/itkFDFImageIO.cxx | 2 +- src/itkFDFImageIOFactory.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index c32c8a6..ba201d4 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -571,7 +571,7 @@ FDFImageIO::SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels) } void -FDFImageIO::WriteImageInformation(void) +FDFImageIO::WriteImageInformation() { // not possible to write a fdf file } diff --git a/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index 12cc3bf..2b50d5f 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.cxx @@ -32,7 +32,7 @@ FDFImageIOFactory::FDFImageIOFactory() FDFImageIOFactory::~FDFImageIOFactory() {} const char * -FDFImageIOFactory::GetITKSourceVersion(void) const +FDFImageIOFactory::GetITKSourceVersion() const { return ITK_SOURCE_VERSION; } @@ -50,7 +50,7 @@ FDFImageIOFactory::GetDescription() const static bool FDFImageIOFactoryHasBeenRegistered; void IOFDF_EXPORT - FDFImageIOFactoryRegister__Private(void) + FDFImageIOFactoryRegister__Private() { if (!FDFImageIOFactoryHasBeenRegistered) { From b82d23579250125702f185018af6e7eed47437d2 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 16 Feb 2020 22:07:44 -0600 Subject: [PATCH 26/43] STYLE: Replace integer literals which are cast to bool. Finds and replaces integer literals which are cast to bool. SRCDIR= #My local SRC BLDDIR= #My local BLD cd run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-bool-literals -header-filter=.* -fix --- src/itkFDFImageIOFactory.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index 2b50d5f..131eeec 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.cxx @@ -26,7 +26,8 @@ namespace itk { FDFImageIOFactory::FDFImageIOFactory() { - this->RegisterOverride("itkImageIOBase", "itkFDFImageIO", "FDF Image IO", 1, CreateObjectFunction::New()); + this->RegisterOverride( + "itkImageIOBase", "itkFDFImageIO", "FDF Image IO", true, CreateObjectFunction::New()); } FDFImageIOFactory::~FDFImageIOFactory() {} From 01c32f6d39828889242cf0f1f230585fb1914048 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 14:29:59 -0600 Subject: [PATCH 27/43] STYLE: Prefer = default to explicitly trivial implementations This check replaces default bodies of special member functions with = default;. The explicitly defaulted function declarations enable more opportunities in optimization, because the compiler might treat explicitly defaulted functions as trivial. Additionally, the C++11 use of = default more clearly expreses the intent for the special member functions. --- src/itkFDFImageIO.cxx | 4 ++-- src/itkFDFImageIOFactory.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index ba201d4..5f09985 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -422,9 +422,9 @@ FDFImageIO::Read(void * buffer) } -FDFImageIO::FDFImageIO() {} +FDFImageIO::FDFImageIO() = default; -FDFImageIO::~FDFImageIO() {} +FDFImageIO::~FDFImageIO() = default; void FDFImageIO::PrintSelf(std::ostream & os, Indent indent) const diff --git a/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index 131eeec..ac8a7fd 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.cxx @@ -30,7 +30,7 @@ FDFImageIOFactory::FDFImageIOFactory() "itkImageIOBase", "itkFDFImageIO", "FDF Image IO", true, CreateObjectFunction::New()); } -FDFImageIOFactory::~FDFImageIOFactory() {} +FDFImageIOFactory::~FDFImageIOFactory() = default; const char * FDFImageIOFactory::GetITKSourceVersion() const From 275c9a3245539b04816a139b26a8a18e63bb5fd7 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 14:48:34 -0600 Subject: [PATCH 28/43] STYLE: Remove redundant void argument lists Find and remove redundant void argument lists. --- include/itkFDFImageIOFactory.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index 190d075..dd1dddf 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -40,9 +40,9 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase /** Class methods used to interface with the registered factories. */ const char * - GetITKSourceVersion(void) const override; + GetITKSourceVersion() const override; const char * - GetDescription(void) const override; + GetDescription() const override; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); @@ -52,7 +52,7 @@ class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase /** Register one factory of this type */ static void - RegisterOneFactory(void) + RegisterOneFactory() { FDFImageIOFactory::Pointer FdfFactory = FDFImageIOFactory::New(); ObjectFactoryBase::RegisterFactoryInternal(FdfFactory); From 9c16ae90f3473a2c9327a46313a7a433f432ec3b Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 23:52:05 -0600 Subject: [PATCH 29/43] PERF: readability container size empty The emptiness of a container should be checked using the empty() method instead of the size() method. It is not guaranteed that size() is a constant-time function, and it is generally more efficient and also shows clearer intent to use empty(). Furthermore some containers may implement the empty() method but not implement the size() method. Using empty() whenever possible makes it easier to switch to another container in the future. SRCDIR= #My local SRC BLDDIR= #My local BLD cd run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,readability-container-size-empty -header-filter=.* -fix --- src/itkFDFImageIO.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index 5f09985..a169b7f 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -35,7 +35,7 @@ FDFImageIO::CanReadFile(const char * file) // First check the extension std::string filename = file; - if (filename == "") + if (filename.empty()) { itkDebugMacro(<< "No filename specified."); return false; From 595da0c23ba25ad348925bfae36d40931bcceeb8 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Wed, 19 Feb 2020 10:45:25 -0600 Subject: [PATCH 30/43] DOC: Update copyright assignment to NumFOCUS The mission of NumFOCUS is to promote open practices in research, data, and scientific computing. https://numfocus.org --- include/itkFDFCommonImageIO.h | 2 +- include/itkFDFImageIO.h | 2 +- include/itkFDFImageIOFactory.h | 2 +- src/ImageReadWrite.cxx | 2 +- src/itkFDFCommonImageIO.cxx | 2 +- src/itkFDFImageIO.cxx | 2 +- src/itkFDFImageIOFactory.cxx | 2 +- test/itkFDFImageIOTest.cxx | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/itkFDFCommonImageIO.h b/include/itkFDFCommonImageIO.h index 407abd2..b01b176 100644 --- a/include/itkFDFCommonImageIO.h +++ b/include/itkFDFCommonImageIO.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 45497b5..072b9a3 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index dd1dddf..0f1a861 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/ImageReadWrite.cxx b/src/ImageReadWrite.cxx index c6413a3..e0aec2b 100644 --- a/src/ImageReadWrite.cxx +++ b/src/ImageReadWrite.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/itkFDFCommonImageIO.cxx b/src/itkFDFCommonImageIO.cxx index f597a1f..d69dc48 100644 --- a/src/itkFDFCommonImageIO.cxx +++ b/src/itkFDFCommonImageIO.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index a169b7f..b2a80e7 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index ac8a7fd..0bd7bf0 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/test/itkFDFImageIOTest.cxx b/test/itkFDFImageIOTest.cxx index e450116..268f980 100644 --- a/test/itkFDFImageIOTest.cxx +++ b/test/itkFDFImageIOTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Insight Software Consortium + * Copyright NumFOCUS * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From 3fdd2c1fec752378f3b498de4557881c7bbb5805 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 22 Feb 2020 18:42:41 -0600 Subject: [PATCH 31/43] ENH: Prefer https vs http for ctest submission. --- CTestConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 62f68ac..efccad4 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -1,7 +1,7 @@ set(CTEST_PROJECT_NAME "ITK") set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") -set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_METHOD "https") set(CTEST_DROP_SITE "open.cdash.org") set(CTEST_DROP_LOCATION "/submit.php?project=Insight") set(CTEST_DROP_SITE_CDASH TRUE) From dfdeff9bd7d2650da4003571749e90367f1d7bf6 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Wed, 17 Jun 2020 18:10:25 -0500 Subject: [PATCH 32/43] ENH: Update ITK Python Package to 5.1.1 in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2830ebf..2025881 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,6 @@ keywords='ITK InsightToolkit FDF', url=r'https://github.com/InsightSoftwareConsortium/ITKIOFDF', install_requires=[ - r'itk' + r'itk>=5.1.1' ] ) From 2205525acd153ae7e4325baada37fd29cc3e70ce Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Mon, 2 Nov 2020 09:38:14 -0600 Subject: [PATCH 33/43] ENH: Incorporate GitHub Actions from ITKModuleTemplate This requires the incorporation of 2 yml scripts that will test the module under various configurations for Windows, Linux and MacOS. These scripts were copied from the ITKModuleTemplate. --- .github/workflows/build-test-package.yml | 268 ++++++++++++++++++++++ .github/workflows/clang-format-linter.yml | 13 ++ README.rst | 2 + 3 files changed, 283 insertions(+) create mode 100644 .github/workflows/build-test-package.yml create mode 100644 .github/workflows/clang-format-linter.yml diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml new file mode 100644 index 0000000..f6e3bc7 --- /dev/null +++ b/.github/workflows/build-test-package.yml @@ -0,0 +1,268 @@ +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: "v5.1.1" + cmake-build-type: "MinSizeRel" + - os: windows-2019 + c-compiler: "cl.exe" + cxx-compiler: "cl.exe" + itk-git-tag: "v5.1.1" + cmake-build-type: "Release" + - os: macos-10.15 + c-compiler: "clang" + cxx-compiler: "clang++" + itk-git-tag: "v5.1.1" + cmake-build-type: "MinSizeRel" + + steps: + - uses: actions/checkout@v1 + + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install ninja + + - 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=OFF -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=OFF -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-18.04 + strategy: + max-parallel: 2 + matrix: + python-version: [36, 37, 38, 39] + include: + - itk-python-git-tag: "v5.1.1.post1" + + 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.1.1.post1" + + steps: + - uses: actions/checkout@v2 + + - 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: [6, 7, 8, 9] + include: + - itk-python-git-tag: "v5.1.1.post1" + + steps: + - 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 ../../ + 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: WindowWheel3.${{ 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-18.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 }} diff --git a/.github/workflows/clang-format-linter.yml b/.github/workflows/clang-format-linter.yml new file mode 100644 index 0000000..69166d9 --- /dev/null +++ b/.github/workflows/clang-format-linter.yml @@ -0,0 +1,13 @@ +name: clang-format linter + +on: [push,pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + - uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master diff --git a/README.rst b/README.rst index c00ce9a..7b40ed8 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ ITKIOFDF ======== +.. image:: https://github.com/InsightSoftwareConsortium/ITKIOFDF/workflows/Build,%20test,%20package/badge.svg + .. |CircleCI| image:: https://circleci.com/gh/InsightSoftwareConsortium/ITKIOFDF.svg?style=shield :target: https://circleci.com/gh/InsightSoftwareConsortium/ITKIOFDF From 8e32ed60e570cc781ca4f4223957b00178de0774 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 22 Nov 2020 13:39:51 -0500 Subject: [PATCH 34/43] DOC: Remove old CI badges --- README.rst | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/README.rst b/README.rst index 7b40ed8..d43b858 100644 --- a/README.rst +++ b/README.rst @@ -3,21 +3,6 @@ ITKIOFDF .. image:: https://github.com/InsightSoftwareConsortium/ITKIOFDF/workflows/Build,%20test,%20package/badge.svg -.. |CircleCI| image:: https://circleci.com/gh/InsightSoftwareConsortium/ITKIOFDF.svg?style=shield - :target: https://circleci.com/gh/InsightSoftwareConsortium/ITKIOFDF - -.. |TravisCI| image:: https://travis-ci.org/InsightSoftwareConsortium/ITKIOFDF.svg?branch=master - :target: https://travis-ci.org/InsightSoftwareConsortium/ITKIOFDF - -.. |AppVeyor| image:: https://img.shields.io/appveyor/ci/itkrobot/itkiofdf.svg - :target: https://ci.appveyor.com/project/itkrobot/itkiofdf - -=========== =========== =========== - Linux macOS Windows -=========== =========== =========== -|CircleCI| |TravisCI| |AppVeyor| -=========== =========== =========== - Overview -------- @@ -34,6 +19,10 @@ it, set:: in ITK's CMake build configuration. +Install the Python package with:: + + pip install itk-iofdf + License ------- From 0f328a372812bb4a870419e7a2e1ec1313255a5b Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Wed, 14 Oct 2020 11:12:47 -0500 Subject: [PATCH 35/43] 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/itkFDFImageIO.h | 2 +- include/itkFDFImageIOFactory.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/itkFDFImageIO.h b/include/itkFDFImageIO.h index 072b9a3..463ada0 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.h @@ -34,7 +34,7 @@ namespace itk class IOFDF_EXPORT FDFImageIO : public ImageIOBase { public: - ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIO); + ITK_DISALLOW_COPY_AND_MOVE(FDFImageIO); /** Standard class type alias. */ using Self = FDFImageIO; diff --git a/include/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index 0f1a861..0a89293 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.h @@ -30,7 +30,7 @@ namespace itk class IOFDF_EXPORT FDFImageIOFactory : public ObjectFactoryBase { public: - ITK_DISALLOW_COPY_AND_ASSIGN(FDFImageIOFactory); + ITK_DISALLOW_COPY_AND_MOVE(FDFImageIOFactory); /** Standard class type alias. */ using Self = FDFImageIOFactory; From c644ea831e81549a2e321afcf5dbcb9c18401777 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Wed, 2 Dec 2020 10:32:56 -0600 Subject: [PATCH 36/43] BUG: Remove deprecated CI As the GitHub Actions have been integrated, there is no need for the previous CI for this module. This specifically removes CircleCI, Appveyor and Travis CI. --- .circleci/config.yml | 63 -------------------------------------------- .travis.yml | 15 ----------- appveyor.yml | 21 --------------- 3 files changed, 99 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 770cd7b..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,63 +0,0 @@ -version: 2 -jobs: - build-and-test: - working_directory: /ITKIOFDF-build - docker: - - image: insighttoolkit/module-ci:latest - steps: - - checkout: - path: /ITKIOFDF - - run: - name: Fetch CTest driver script - command: | - curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O - - run: - name: Configure CTest script - command: | - SHASNIP=$(echo $CIRCLE_SHA1 | cut -c1-7) - cat > dashboard.cmake << EOF - set(CTEST_SITE "CircleCI") - set(CTEST_BUILD_NAME "External-ITKIOFDF-${CIRCLE_BRANCH}-${CIRCLE_BUILD_NUM}-${SHASNIP}") - set(CTEST_BUILD_CONFIGURATION "MinSizeRel") - set(CTEST_CMAKE_GENERATOR "Unix Makefiles") - set(CTEST_BUILD_FLAGS: "-j5") - set(CTEST_SOURCE_DIRECTORY /ITKIOFDF) - set(CTEST_BINARY_DIRECTORY /ITKIOFDF-build) - set(dashboard_model Experimental) - set(dashboard_no_clean 1) - set(dashboard_cache " - ITK_DIR:PATH=/ITK-build - BUILD_TESTING:BOOL=ON - ") - include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake) - EOF - - run: - name: Build and Test - no_output_timeout: 1.0h - command: | - ctest -j 2 -VV -S dashboard.cmake - package: - working_directory: ~/ITKIOFDF - machine: true - steps: - - checkout - - run: - name: Fetch build script - command: | - 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 - - run: - name: Build Python packages - no_output_timeout: 1.0h - command: | - ./dockcross-manylinux-download-cache-and-build-module-wheels.sh - - store_artifacts: - path: dist - destination: dist - -workflows: - version: 2 - build-test-package: - jobs: - - build-and-test - - package diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c0a5d09..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -sudo: true -language: cpp -os: -- osx -compiler: -- gcc -cache: - directories: - - "$HOME/Library/Caches/Homebrew" -script: -- 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 -- ./macpython-download-cache-and-build-module-wheels.sh -- tar -zcvf dist.tar.gz dist/ -- curl --upload-file dist.tar.gz https://transfer.sh/dist.tar.gz diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 99c62fc..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -branches: - only: - - master - -version: "0.0.1.{build}" - -install: - - - curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O - - ps: .\windows-download-cache-and-build-module-wheels.ps1 - -build: off - -test: off - -artifacts: - - # pushing entire folder as a zip archive - - path: dist\* - -deploy: off From b8b1b0a5320daba0ea7e98aff976c43de5df64e6 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Wed, 2 Dec 2020 10:35:07 -0600 Subject: [PATCH 37/43] COMP: Update GitHub Actions from ITKModuleTemplate --- .github/workflows/build-test-package.yml | 29 +++++++++++++++++------- setup.py | 2 +- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index f6e3bc7..21aee92 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 .. @@ -133,7 +136,7 @@ jobs: matrix: python-version: [36, 37, 38, 39] include: - - itk-python-git-tag: "v5.1.1.post1" + - itk-python-git-tag: "v5.2rc01" steps: - uses: actions/checkout@v2 @@ -169,11 +172,18 @@ jobs: max-parallel: 2 matrix: include: - - itk-python-git-tag: "v5.1.1.post1" + - 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 @@ -198,9 +208,12 @@ jobs: matrix: python-version-minor: [6, 7, 8, 9] include: - - itk-python-git-tag: "v5.1.1.post1" + - 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" @@ -215,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" @@ -236,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 2025881..b5c9961 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,6 @@ keywords='ITK InsightToolkit FDF', url=r'https://github.com/InsightSoftwareConsortium/ITKIOFDF', install_requires=[ - r'itk>=5.1.1' + r'itk>=5.2rc1' ] ) From 902553d73b99df1a7d30dc72b134aa63227336d4 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Fri, 19 Mar 2021 16:41:12 -0400 Subject: [PATCH 38/43] ENH: Update CI for ITK 5.2 RC 3 --- .github/workflows/build-test-package.yml | 12 ++++++------ setup.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 21aee92..5a978fa 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: "c7586a12e8538c59041c480880ff0ea15c9550c2" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" + itk-git-tag: "c7586a12e8538c59041c480880ff0ea15c9550c2" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "abd38d5a0040b9a8fbb0ad3127089dbb72a93342" + itk-git-tag: "c7586a12e8538c59041c480880ff0ea15c9550c2" 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.2rc03" 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.2rc03" 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.2rc03" steps: - name: Get specific version of CMake, Ninja diff --git a/setup.py b/setup.py index b5c9961..5b89a61 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='itk-iofdf', - version='1.0.0', + version='1.0.1', author='Glenn Pierce', author_email='glennpierce@gmail.com', packages=['itk'], @@ -45,6 +45,6 @@ keywords='ITK InsightToolkit FDF', url=r'https://github.com/InsightSoftwareConsortium/ITKIOFDF', install_requires=[ - r'itk>=5.2rc1' + r'itk>=5.2rc3' ] ) From 2d24be154bfda8e2789417c8d66d142d2ba304e7 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sat, 20 Mar 2021 11:22:27 -0400 Subject: [PATCH 39/43] DOC: Add PyPI, License badges --- README.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.rst b/README.rst index d43b858..1bc64d5 100644 --- a/README.rst +++ b/README.rst @@ -3,6 +3,13 @@ ITKIOFDF .. image:: https://github.com/InsightSoftwareConsortium/ITKIOFDF/workflows/Build,%20test,%20package/badge.svg +.. image:: https://img.shields.io/pypi/v/itk-iofdf.svg + :target: https://pypi.python.org/pypi/itk-iofdf + :alt: PyPI + +.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg + :target: https://github.com/InsightSoftwareConsortium/ITKIOFDF/blob/master/LICENSE) + :alt: License Overview -------- From 02f7b9695eb2f7a1444c7d18eebcf4666a926325 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 15 Jun 2021 15:33:35 -0400 Subject: [PATCH 40/43] ENH: Update package for itk-5.2.0.post3 --- .github/workflows/build-test-package.yml | 426 +++++++++++------------ setup.py | 4 +- 2 files changed, 215 insertions(+), 215 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 5a978fa..6dc81fc 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -13,158 +13,158 @@ jobs: - os: ubuntu-18.04 c-compiler: "gcc" cxx-compiler: "g++" - itk-git-tag: "c7586a12e8538c59041c480880ff0ea15c9550c2" + itk-git-tag: "v5.2.0" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "c7586a12e8538c59041c480880ff0ea15c9550c2" + itk-git-tag: "v5.2.0" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "c7586a12e8538c59041c480880ff0ea15c9550c2" + itk-git-tag: "v5.2.0" cmake-build-type: "MinSizeRel" steps: - - uses: actions/checkout@v1 - - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - - 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=OFF -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=OFF -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 + - 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-18.04 + runs-on: ubuntu-20.04 strategy: max-parallel: 2 matrix: python-version: [36, 37, 38, 39] include: - - itk-python-git-tag: "v5.2rc03" + - itk-python-git-tag: "v5.2.0.post3" 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 + - 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 @@ -172,34 +172,34 @@ jobs: max-parallel: 2 matrix: include: - - itk-python-git-tag: "v5.2rc03" + - itk-python-git-tag: "v5.2.0.post3" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: 'Specific XCode version' - run: | - sudo xcode-select -s "/Applications/Xcode_11.7.app" + - 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: 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: '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: '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 + - 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 @@ -208,49 +208,49 @@ jobs: matrix: python-version-minor: [6, 7, 8, 9] include: - - itk-python-git-tag: "v5.2rc03" + - itk-python-git-tag: "v5.2.0.post3" 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 + - 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" --no-cleanup + + - 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: @@ -260,22 +260,22 @@ jobs: runs-on: ubuntu-18.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 }} + - 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 }} diff --git a/setup.py b/setup.py index 5b89a61..d601876 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name='itk-iofdf', - version='1.0.1', + version='1.0.2', author='Glenn Pierce', author_email='glennpierce@gmail.com', packages=['itk'], @@ -45,6 +45,6 @@ keywords='ITK InsightToolkit FDF', url=r'https://github.com/InsightSoftwareConsortium/ITKIOFDF', install_requires=[ - r'itk>=5.2rc3' + r'itk>=5.2.0.post3' ] ) From fd1e44b140f759e5cea86b475888b5565a0e5a1f Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Fri, 17 Dec 2021 18:02:06 -0600 Subject: [PATCH 41/43] COMP: Modules need updated version of ITK Removal of .h includes from same named .hxx files requires removal of outdated rule that is no longer relevant. This PR will update the version of ITK that is used for the remove modules." BRANCH_NAME=update-reference-itk-version for remdir_script in *.remote.cmake; do remdir="${remdir_script//*.remote.cmake/}" if [ ! -d "${remdir}" ] ;then echo "Missing directory ${remdir}" continue fi pushd "${remdir}" || exit echo "=============== $(pwd) =========" git checkout master git fetch origin git rebase origin/master git checkout -b ${BRANCH_NAME} sed 's/itk-git-tag : .*/itk-git-tag: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe"/g' $( fgrep -Rl "itk-git-tag:" |fgrep yml ) git status diff_line_no=$(git diff |wc -l ) if [ "${diff_line_no}" -ne 0 ]; then git add -p git commit -F /tmp/update_itk_msg gh pr create -a "@me" -F /tmp/update_itk_msg else echo "Skipping changes $(pwd)" fi git fetch git rebase origin/master git push origin -f ${BRANCH_NAME}:${BRANCH_NAME} popd || exit done --- .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 6dc81fc..73188d6 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: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "v5.2.0" + itk-git-tag: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "v5.2.0" + itk-git-tag: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe" cmake-build-type: "MinSizeRel" steps: From 326e78365234de82c2d98700114eb15e00d40d30 Mon Sep 17 00:00:00 2001 From: Tom Birdsong Date: Tue, 31 May 2022 11:27:39 -0400 Subject: [PATCH 42/43] ENH: Bump ITK and replace http with https using script --- .clang-format | 2 +- .github/workflows/build-test-package.yml | 18 +++++++++--------- LICENSE | 4 ++-- README.rst | 2 +- include/itkFDFCommonImageIO.h | 2 +- include/itkFDFImageIO.h | 2 +- include/itkFDFImageIOFactory.h | 2 +- src/ImageReadWrite.cxx | 2 +- src/itkFDFCommonImageIO.cxx | 2 +- src/itkFDFImageIO.cxx | 2 +- src/itkFDFImageIOFactory.cxx | 2 +- test/itkFDFImageIOTest.cxx | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.clang-format b/.clang-format index 399e250..411b009 100644 --- a/.clang-format +++ b/.clang-format @@ -4,7 +4,7 @@ ## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option ## ## The clang-format binaries can be downloaded as part of the clang binary distributions -## from http://releases.llvm.org/download.html +## from https://releases.llvm.org/download.html ## ## Use the script Utilities/Maintenance/clang-format.bash to faciliate ## maintaining a consistent code style. diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 73188d6..09727af 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: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe" + itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" cmake-build-type: "MinSizeRel" - os: windows-2019 c-compiler: "cl.exe" cxx-compiler: "cl.exe" - itk-git-tag: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe" + itk-git-tag: "d6acfd26bfcdec606d605beb1301bddfb17c05a6" cmake-build-type: "Release" - os: macos-10.15 c-compiler: "clang" cxx-compiler: "clang++" - itk-git-tag: "a89145bccda6a36f42cfdd45d3a6b27234ff54fe" + 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.post3" + - 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.post3" + - 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.post3" + - 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" --no-cleanup 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/README.rst b/README.rst index 1bc64d5..4890b0e 100644 --- a/README.rst +++ b/README.rst @@ -14,7 +14,7 @@ ITKIOFDF Overview -------- -This is a module for the `Insight Toolkit (ITK) `_ to read or +This is a module for the `Insight Toolkit (ITK) `_ to read or write the FDF image format. It contains an `ImageIO` class to read or write the FDF image format. diff --git a/include/itkFDFCommonImageIO.h b/include/itkFDFCommonImageIO.h index b01b176..23abae6 100644 --- a/include/itkFDFCommonImageIO.h +++ b/include/itkFDFCommonImageIO.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/itkFDFImageIO.h b/include/itkFDFImageIO.h index 463ada0..30a6fb1 100644 --- a/include/itkFDFImageIO.h +++ b/include/itkFDFImageIO.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/itkFDFImageIOFactory.h b/include/itkFDFImageIOFactory.h index 0a89293..3788c18 100644 --- a/include/itkFDFImageIOFactory.h +++ b/include/itkFDFImageIOFactory.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/src/ImageReadWrite.cxx b/src/ImageReadWrite.cxx index e0aec2b..4d7e287 100644 --- a/src/ImageReadWrite.cxx +++ b/src/ImageReadWrite.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/src/itkFDFCommonImageIO.cxx b/src/itkFDFCommonImageIO.cxx index d69dc48..f5c3e5b 100644 --- a/src/itkFDFCommonImageIO.cxx +++ b/src/itkFDFCommonImageIO.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/src/itkFDFImageIO.cxx b/src/itkFDFImageIO.cxx index b2a80e7..a862fdc 100644 --- a/src/itkFDFImageIO.cxx +++ b/src/itkFDFImageIO.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/src/itkFDFImageIOFactory.cxx b/src/itkFDFImageIOFactory.cxx index 0bd7bf0..a09f48a 100644 --- a/src/itkFDFImageIOFactory.cxx +++ b/src/itkFDFImageIOFactory.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/itkFDFImageIOTest.cxx b/test/itkFDFImageIOTest.cxx index 268f980..50cb957 100644 --- a/test/itkFDFImageIOTest.cxx +++ b/test/itkFDFImageIOTest.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 d8a0b69e6e3f283322ed53375011d503af92aa73 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 18 Jun 2024 23:41:05 -0400 Subject: [PATCH 43/43] ENH: Upgrade CI for ITK 5.4.0 Upgrade CI testing to use the latest ITK 5.4.0 version and CI configuration. Committed via https://github.com/asottile/all-repos --- .github/workflows/build-test-package.yml | 286 +---------------------- 1 file changed, 10 insertions(+), 276 deletions(-) diff --git a/.github/workflows/build-test-package.yml b/.github/workflows/build-test-package.yml index 09727af..19b97f5 100644 --- a/.github/workflows/build-test-package.yml +++ b/.github/workflows/build-test-package.yml @@ -1,281 +1,15 @@ + 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" --no-cleanup - - - 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-18.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@v5.4.0 + + python-build-workflow: + uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@v5.4.0 + with: + test-notebooks: false + secrets: + pypi_password: ${{ secrets.pypi_password }}