From 5bce10bbb3621f2de9033fc70aa908d7a63615f9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 21 Mar 2017 14:29:47 -0400 Subject: [PATCH 001/135] ENH: First commit ITK Module Template --- .../Filtering/TextureFeatures/CMakeLists.txt | 29 +++ Modules/Filtering/TextureFeatures/LICENSE | 202 ++++++++++++++++++ .../TextureFeatures/itk-module.cmake | 23 ++ .../TextureFeatures/test/CMakeLists.txt | 5 + 4 files changed, 259 insertions(+) create mode 100644 Modules/Filtering/TextureFeatures/CMakeLists.txt create mode 100644 Modules/Filtering/TextureFeatures/LICENSE create mode 100644 Modules/Filtering/TextureFeatures/itk-module.cmake create mode 100644 Modules/Filtering/TextureFeatures/test/CMakeLists.txt diff --git a/Modules/Filtering/TextureFeatures/CMakeLists.txt b/Modules/Filtering/TextureFeatures/CMakeLists.txt new file mode 100644 index 00000000000..a979bd15223 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/CMakeLists.txt @@ -0,0 +1,29 @@ +project(ITKTextureFeatures) + +if(NOT ITK_SOURCE_DIR) + find_package(ITK REQUIRED) + list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) +endif() + +# This are checks specific to the example content in this module and can be +# removed. +include(CheckIncludeFileCXX) +check_include_file_cxx( + "random" + _have_random +) +if(NOT _have_random) + message(FATAL_ERROR "This module requires the C++11 \"random\" header.") +endif() +include(ITK_CheckCXXCompilerFlag) +itk_check_cxx_compiler_flag("-Wno-c++1z-extensions" _have_cxx1z_extensions_warning) +if(_have_cxx1z_extensions_warning) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++1z-extensions") +endif() + +set(ITKTextureFeatures_LIBRARIES ITKTextureFeatures) +if(NOT ITK_SOURCE_DIR) + include(ITKModuleExternal) +else() + itk_module_impl() +endif() diff --git a/Modules/Filtering/TextureFeatures/LICENSE b/Modules/Filtering/TextureFeatures/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/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. diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake new file mode 100644 index 00000000000..6b938cd4b0c --- /dev/null +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -0,0 +1,23 @@ +# the top-level README is used for describing this module, just +# re-used it for documentation here +# itk_module() defines the module dependencies in ModuleTemplate +# ModuleTemplate depends on ITKCommon +# The testing module in ModuleTemplate depends on ITKTestKernel +# and ITKMetaIO(besides ModuleTemplate and ITKCore) +# By convention those modules outside of ITK are not prefixed with +# ITK. + +# define the dependencies of the include module and the tests +itk_module( + ITKTextureFeatures + DEPENDS + ITKCommon + COMPILE_DEPENDS + ITKImageSources + TEST_DEPENDS + ITKTestKernel + ITKMetaIO + DESCRIPTION "Module ingested from upstream." + EXCLUDE_FROM_DEFAULT + ENABLE_SHARED +) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt new file mode 100644 index 00000000000..b3ad2dcc942 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -0,0 +1,5 @@ +itk_module_test() + +set(ITKTextureFeaturesTests) + +createtestdriver(MITKTextureFeatures "${ITKTextureFeatures-Test_LIBRARIES}" "${ITKTextureFeaturesTests}") From c84c35e27de41431f9ed8e5eb34aefcfb66210f4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Wed, 22 Mar 2017 11:16:47 -0400 Subject: [PATCH 002/135] ENH: First version of itkScalarImageToRunLengthFeaturesImageFilter --- .../Filtering/TextureFeatures/CMakeLists.txt | 24 +- ...calarImageToRunLengthFeaturesImageFilter.h | 186 ++++++++++++ ...larImageToRunLengthFeaturesImageFilter.hxx | 271 ++++++++++++++++++ .../TextureFeatures/itk-module.cmake | 5 +- .../TextureFeatures/test/CMakeLists.txt | 19 +- .../test/FilterCreationTest.cxx | 51 ++++ 6 files changed, 530 insertions(+), 26 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h create mode 100644 Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx create mode 100644 Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx diff --git a/Modules/Filtering/TextureFeatures/CMakeLists.txt b/Modules/Filtering/TextureFeatures/CMakeLists.txt index a979bd15223..4bd5e5d74aa 100644 --- a/Modules/Filtering/TextureFeatures/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/CMakeLists.txt @@ -1,28 +1,8 @@ -project(ITKTextureFeatures) +project(TextureFeatures) if(NOT ITK_SOURCE_DIR) - find_package(ITK REQUIRED) + find_package(ITK 4.10 REQUIRED) list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) -endif() - -# This are checks specific to the example content in this module and can be -# removed. -include(CheckIncludeFileCXX) -check_include_file_cxx( - "random" - _have_random -) -if(NOT _have_random) - message(FATAL_ERROR "This module requires the C++11 \"random\" header.") -endif() -include(ITK_CheckCXXCompilerFlag) -itk_check_cxx_compiler_flag("-Wno-c++1z-extensions" _have_cxx1z_extensions_warning) -if(_have_cxx1z_extensions_warning) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++1z-extensions") -endif() - -set(ITKTextureFeatures_LIBRARIES ITKTextureFeatures) -if(NOT ITK_SOURCE_DIR) include(ITKModuleExternal) else() itk_module_impl() diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h new file mode 100644 index 00000000000..46b4a4abcbc --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -0,0 +1,186 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkScalarImageToRunLengthFeaturesImageFilter_h +#define itkScalarImageToRunLengthFeaturesImageFilter_h + +#include "itkImageToImageFilter.h" +//////////////////////////////////////////////////////////////// +#include "itkImageRegion.h" +#include "itkConstNeighborhoodIterator.h" +//////////////////////////////////////////////////////////////// +#include "itkHistogramToRunLengthFeaturesFilter.h" +#include "itkScalarImageToRunLengthMatrixFilter.h" + +namespace itk +{ +namespace Statistics +{ +/** \class ScalarImageToRunLengthFeaturesImageFilter + * \brief This class computes colormaps thanks to run length descriptors from an image. + * + * + * \sa ScalarImageToRunLengthFeaturesFilter + * \sa ScalarImageToRunLengthMatrixFilter + * \sa HistogramToRunLengthFeaturesFilter + * + * \author: Vimort Jean-Baptiste + * \ingroup ITKStatistics + */ + +template +class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter + : public ImageToImageFilter +{ +public: + /** Standard typedefs */ + typedef ScalarImageToRunLengthFeaturesImageFilter Self; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Run-time type information (and related methods). */ + itkTypeMacro(ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + + /** standard New() method support */ + itkNewMacro(Self); + + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef TOutputImage OutputImageType; + typedef typename OutputImageType::Pointer OutputImagePointer; + typedef THistogramFrequencyContainer FrequencyContainerType; + + typedef typename InputImageType::PixelType PixelType; + typedef typename InputImageType::OffsetType OffsetType; + typedef VectorContainer OffsetVector; + typedef typename OffsetVector::Pointer OffsetVectorPointer; + typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; + + //////////////////////////////////////////////////////////////// + typedef typename InputImageType::RegionType InputRegionType; + typedef typename InputRegionType::IndexType RegionIndexType; + typedef typename InputRegionType::SizeType RegionSizeType; + + typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; + typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; + + //////////////////////////////////////////////////////////////// + + typedef ScalarImageToRunLengthMatrixFilter RunLengthMatrixFilterType; + typedef typename RunLengthMatrixFilterType::HistogramType HistogramType; + typedef HistogramToRunLengthFeaturesFilter RunLengthFeaturesFilterType; + + typedef short RunLengthFeatureName; + typedef VectorContainer FeatureNameVector; + typedef typename FeatureNameVector::Pointer FeatureNameVectorPointer; + typedef typename FeatureNameVector::ConstPointer FeatureNameVectorConstPointer; + typedef VectorContainer FeatureValueVector; + typedef typename FeatureValueVector::Pointer FeatureValueVectorPointer; + + /** Connects the input image for which the features are going to be computed + */ + using Superclass::SetInput; + void + SetInput(const InputImageType *); + + const InputImageType * + GetInput() const; + + /** Return the feature means and deviations. */ + itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector); + itkGetConstReferenceObjectMacro(FeatureStandardDeviations, FeatureValueVector); + + /** Set the desired feature set. Optional, for default value see above. */ + itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector); + itkGetConstObjectMacro(RequestedFeatures, FeatureNameVector); + + /** Set the offsets over which the co-occurrence pairs will be computed. + Optional; for default value see above. */ + itkSetConstObjectMacro(Offsets, OffsetVector); + itkGetConstObjectMacro(Offsets, OffsetVector); + + //////////////////////////////////////////////////////////////// + itkSetConstObjectMacro(NeighborhoodRadius, NeighborhoodRadiusType); + itkGetConstObjectMacro(NeighborhoodRadius, NeighborhoodRadiusType); + //////////////////////////////////////////////////////////////// + + /** Set number of histogram bins along each axis. + Optional; for default value see above. */ + void + SetNumberOfBinsPerAxis(unsigned int); + + /** Set the min and max (inclusive) pixel value that will be used for + feature calculations. Optional; for default value see above. */ + void + SetPixelValueMinMax(PixelType min, PixelType max); + + /** Set the min and max (inclusive) pixel value that will be used for + feature calculations. Optional; for default value see above. */ + void + SetDistanceValueMinMax(double min, double max); + + /** Connects the mask image for which the histogram is going to be computed. + Optional; for default value see above. */ + void + SetMaskImage(const InputImageType *); + + const InputImageType * + GetMaskImage() const; + + /** Set the pixel value of the mask that should be considered "inside" the + object. Optional; for default value see above. */ + void + SetInsidePixelValue(PixelType InsidePixelValue); + + itkGetConstMacro(FastCalculations, bool); + itkSetMacro(FastCalculations, bool); + itkBooleanMacro(FastCalculations); + +protected: + ScalarImageToRunLengthFeaturesImageFilter(); + virtual ~ScalarImageToRunLengthFeaturesImageFilter() {} + virtual void + PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + /** This method causes the filter to generate its output. */ + virtual void + GenerateData() ITK_OVERRIDE; + +private: + typename RunLengthMatrixFilterType::Pointer m_RunLengthMatrixGenerator; + + //////////////////////////////////////////////////////////////// + // RegionIndexType m_RegionInex; + // RegionSizeType m_RegionSize; + NeighborhoodRadiusType m_NeighborhoodRadius; + //////////////////////////////////////////////////////////////// + + FeatureValueVectorPointer m_FeatureMeans; + FeatureValueVectorPointer m_FeatureStandardDeviations; + FeatureNameVectorConstPointer m_RequestedFeatures; + OffsetVectorConstPointer m_Offsets; + bool m_FastCalculations; +}; +} // end of namespace Statistics +} // end of namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +# include "itkScalarImageToRunLengthFeaturesImageFilter.hxx" +#endif + +#endif diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx new file mode 100644 index 00000000000..f89d2ba1671 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -0,0 +1,271 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkScalarImageToRunLengthFeaturesImageFilter_hxx +#define itkScalarImageToRunLengthFeaturesImageFilter_hxx + +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkNeighborhood.h" +#include "itkImageRegionIteratorWithIndex.h" +#include "itkMath.h" +#include "itkRegionOfInterestImageFilter.h" + +namespace itk +{ +namespace Statistics +{ +template +ScalarImageToRunLengthFeaturesImageFilter:: + ScalarImageToRunLengthFeaturesImageFilter() +{ + this->SetNumberOfRequiredInputs(1); + this->SetNumberOfRequiredOutputs(1); + + for (int i = 0; i < 2; ++i) + { + this->ProcessObject::SetNthOutput(i, this->MakeOutput(i)); + } + + this->m_RunLengthMatrixGenerator = RunLengthMatrixFilterType::New(); + this->m_FeatureMeans = FeatureValueVector::New(); + this->m_FeatureStandardDeviations = FeatureValueVector::New(); + + // Set the requested features to the default value: + // {Energy, Entropy, InverseDifferenceMoment, Inertia, ClusterShade, + // ClusterProminence} + FeatureNameVectorPointer requestedFeatures = FeatureNameVector::New(); + // can't directly set this->m_RequestedFeatures since it is const! + + requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::LongRunEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::GreyLevelNonuniformity); + requestedFeatures->push_back(RunLengthFeaturesFilterType::RunLengthNonuniformity); + requestedFeatures->push_back(RunLengthFeaturesFilterType::LowGreyLevelRunEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::HighGreyLevelRunEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunLowGreyLevelEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunHighGreyLevelEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::LongRunLowGreyLevelEmphasis); + requestedFeatures->push_back(RunLengthFeaturesFilterType::LongRunHighGreyLevelEmphasis); + + this->SetRequestedFeatures(requestedFeatures); + + // Set the offset directions to their defaults: half of all the possible + // directions 1 pixel away. (The other half is included by symmetry.) + // We use a neighborhood iterator to calculate the appropriate offsets. + typedef Neighborhood NeighborhoodType; + NeighborhoodType hood; + hood.SetRadius(1); + + // select all "previous" neighbors that are face+edge+vertex + // connected to the current pixel. do not include the center pixel. + unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); + OffsetVectorPointer offsets = OffsetVector::New(); + for (unsigned int d = 0; d < centerIndex; d++) + { + OffsetType offset = hood.GetOffset(d); + offsets->push_back(offset); + } + this->SetOffsets(offsets); + this->m_FastCalculations = false; +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::GenerateData(void) +{ + //////////////////////////////////////////////////////////////// + typename TOutputImage::Pointer output = this->GetOutput(); + + InputRegionType InputRegion; + RegionIndexType InputRegionIndex; + RegionSizeType InputRegionSize; + + InputRegionType OutputRegion; + RegionIndexType OutputRegionIndex; + const typename InputImageType::SpacingType & Spacing = this->ProcessObject::GetOutput(0)->GetOutput()->GetSpacing(); + const typename InputImageType::PointType & InputOrigin = this->ProcessObject::GetOutput(0)->GetOutput()->GetOrigin(); + double OutputOrigin[m_NeighborhoodRadius.Dimension]; + + for (unsigned int i = 0; i < m_NeighborhoodRadius.Dimension; i++) + { + InputRegionIndex[i] = m_NeighborhoodRadius[i]; + InputRegionSize[i] = this->ProcessObject::GetOutput(0).Size[i] - 2 * m_NeighborhoodRadius[i]; + + OutputRegionIndex[i] = 0; + OutputOrigin[i] = InputOrigin[i] + Spacing[i] * InputRegionIndex[i]; + } + + InputRegion.SetIndex(InputRegionIndex); + InputRegion.SetSize(InputRegionSize); + + OutputRegion.SetIndex(OutputRegionIndex); + OutputRegion.SetSize(InputRegionSize); + + output->SetRegions(OutputRegion); + output->SetSpacing(Spacing); + output->SetOrigin(OutputOrigin); + output->SetBufferedRegion(output->GetRequestedRegion()); + output->Allocate(); + + typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; + ConstIteratorType InputIt(this->ProcessObject::GetOutput(0), InputRegion); + typedef itk::ImageRegionIteratorWithIndex IteratorType; + IteratorType OutputIt(output, OutputRegion); + + while (!InputIt.IsAtEnd()) + { + typename InputImageType::IndexType InputIndex = InputIt.GetIndex(); + InputIndex.Dimension; + + typename InputImageType::IndexType start; + typename InputImageType::IndexType end; + + for (unsigned int i = 0; i < InputIndex.Dimension; i++) + { + start[i] = InputIndex[i] - m_NeighborhoodRadius[i]; + end[i] = InputIndex[i] + m_NeighborhoodRadius[i]; + } + + typename InputImageType::RegionType ExtractedRegion; + ExtractedRegion.SetIndex(start); + ExtractedRegion.SetUpperIndex(end); + + typedef typename itk::RegionOfInterestImageFilter ExtractionFilterType; + typename ExtractionFilterType::Pointer ExtractionFilter = ExtractionFilterType::New(); + ExtractionFilter->SetInput(this->ProcessObject::GetOutput(0)); + ExtractionFilter->SetRegionOfInterest(ExtractedRegion); + + // Compute the feature for the first offset + typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); + this->m_RunLengthMatrixGenerator->SetOffset(offsetIt.Value()); + this->m_RunLengthMatrixGenerator->SetInput(ExtractionFilter->GetOutput()); + this->m_RunLengthMatrixGenerator->Update(); + typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); + runLengthMatrixCalculator->SetInput(this->m_RunLengthMatrixGenerator->GetOutput()); + runLengthMatrixCalculator->Update(); + + OutputIt.Set(runLengthMatrixCalculator.GetGreyLevelNonuniformityOutput()); + ++InputIt; + ++OutputIt; + } + + //////////////////////////////////////////////////////////////// +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::SetInput( + const InputImageType * image) +{ + // Process object is not const-correct so the const_cast is required here + this->ProcessObject::SetNthInput(0, const_cast(image)); + + this->m_RunLengthMatrixGenerator->SetInput(image); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter:: + SetNumberOfBinsPerAxis(unsigned int numberOfBins) +{ + itkDebugMacro("setting NumberOfBinsPerAxis to " << numberOfBins); + this->m_RunLengthMatrixGenerator->SetNumberOfBinsPerAxis(numberOfBins); + this->Modified(); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::SetPixelValueMinMax( + PixelType min, + PixelType max) +{ + itkDebugMacro("setting Min to " << min << "and Max to " << max); + this->m_RunLengthMatrixGenerator->SetPixelValueMinMax(min, max); + this->Modified(); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter:: + SetDistanceValueMinMax(double min, double max) +{ + itkDebugMacro("setting Min to " << min << "and Max to " << max); + this->m_RunLengthMatrixGenerator->SetDistanceValueMinMax(min, max); + this->Modified(); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::SetMaskImage( + const InputImageType * image) +{ + // Process object is not const-correct so the const_cast is required here + this->ProcessObject::SetNthInput(1, const_cast(image)); + + this->m_RunLengthMatrixGenerator->SetMaskImage(image); +} + +template +const TInputImage * +ScalarImageToRunLengthFeaturesImageFilter::GetInput() const +{ + if (this->GetNumberOfInputs() < 1) + { + return ITK_NULLPTR; + } + return static_cast(this->ProcessObject::GetInput(0)); +} + + +template +const TInputImage * +ScalarImageToRunLengthFeaturesImageFilter::GetMaskImage() const +{ + if (this->GetNumberOfInputs() < 2) + { + return ITK_NULLPTR; + } + return static_cast(this->ProcessObject::GetInput(1)); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::SetInsidePixelValue( + PixelType insidePixelValue) +{ + itkDebugMacro("setting InsidePixelValue to " << insidePixelValue); + this->m_RunLengthMatrixGenerator->SetInsidePixelValue(insidePixelValue); + this->Modified(); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::PrintSelf( + std::ostream & os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "RequestedFeatures: " << this->GetRequestedFeatures() << std::endl; + os << indent << "FeatureStandardDeviations: " << this->GetFeatureStandardDeviations() << std::endl; + os << indent << "FastCalculations: " << this->GetFastCalculations() << std::endl; + os << indent << "Offsets: " << this->GetOffsets() << std::endl; + os << indent << "FeatureMeans: " << this->GetFeatureMeans() << std::endl; +} +} // end of namespace Statistics +} // end of namespace itk + +#endif diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index 6b938cd4b0c..9db5816c144 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -9,9 +9,11 @@ # define the dependencies of the include module and the tests itk_module( - ITKTextureFeatures + TextureFeatures DEPENDS ITKCommon + ITKStatistics + ITKImageGrid COMPILE_DEPENDS ITKImageSources TEST_DEPENDS @@ -19,5 +21,4 @@ itk_module( ITKMetaIO DESCRIPTION "Module ingested from upstream." EXCLUDE_FROM_DEFAULT - ENABLE_SHARED ) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index b3ad2dcc942..0f617c69cf2 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -1,5 +1,20 @@ itk_module_test() -set(ITKTextureFeaturesTests) +set(INPUT_IMAGE ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/Scan_CBCT_1L.nrrd) -createtestdriver(MITKTextureFeatures "${ITKTextureFeatures-Test_LIBRARIES}" "${ITKTextureFeaturesTests}") +set(ITK_TEST_DRIVER itkTestDriver) + +set(TextureFeaturesTests FilterCreationTest.cxx) + +createtestdriver(TextureFeatures "${ITKTextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") + +itk_add_test( + NAME TextureFeaturesTest1 + COMMAND + TextureFeaturesTestDriver + --compare + ${CMAKE_CURRENT_SOURCE_DIR}/baseline/Scan_CBCT_1L.nrrd + ${CMAKE_CURRENT_SOURCE_DIR}/baseline/SegmC_CBCT_1L.nrrd + FilterCreationTest + ${INPUT_IMAGE} +) diff --git a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx new file mode 100644 index 00000000000..89221a16b5b --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx @@ -0,0 +1,51 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include "itkImage.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" + +int +FilterCreationTest(int argc, char * argv[]) +{ + // Parse command line argumentsa + std::string inputFilename = argv[1]; + + // Setup types + typedef itk::Image ImageType; + + typedef itk::ImageFileReader readerType; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + reader->SetFileName(inputFilename.c_str()); + + // Apply the filter + typedef itk::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName("result.nrrd"); + writer->SetInput(filter->GetOutput()); + writer->Update(); + + return EXIT_SUCCESS; +} From c2afa3717584c755acde3bccc7438b39d88d11e6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 27 Mar 2017 13:41:08 -0400 Subject: [PATCH 003/135] ENH: First working version of itkScalarImageToRunLengthFeaturesImageFilter TODO: - add multithreading - add Concept checking for the inpout and output - utilisation of the mask - creation of tests --- .../Filtering/TextureFeatures/CMakeLists.txt | 1 + ...calarImageToRunLengthFeaturesImageFilter.h | 27 ++--- ...larImageToRunLengthFeaturesImageFilter.hxx | 108 +++++++++++++----- .../TextureFeatures/test/CMakeLists.txt | 11 +- .../test/FilterCreationTest.cxx | 28 +++-- 5 files changed, 116 insertions(+), 59 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/CMakeLists.txt b/Modules/Filtering/TextureFeatures/CMakeLists.txt index 4bd5e5d74aa..e605c39ebc9 100644 --- a/Modules/Filtering/TextureFeatures/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/CMakeLists.txt @@ -4,6 +4,7 @@ if(NOT ITK_SOURCE_DIR) find_package(ITK 4.10 REQUIRED) list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) include(ITKModuleExternal) + include_directories(${ITK_INCLUDE_DIRS}) else() itk_module_impl() endif() diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 46b4a4abcbc..c219b29fcc2 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -19,10 +19,8 @@ #define itkScalarImageToRunLengthFeaturesImageFilter_h #include "itkImageToImageFilter.h" -//////////////////////////////////////////////////////////////// #include "itkImageRegion.h" #include "itkConstNeighborhoodIterator.h" -//////////////////////////////////////////////////////////////// #include "itkHistogramToRunLengthFeaturesFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" @@ -71,15 +69,17 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter typedef typename OffsetVector::Pointer OffsetVectorPointer; typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; - //////////////////////////////////////////////////////////////// typedef typename InputImageType::RegionType InputRegionType; - typedef typename InputRegionType::IndexType RegionIndexType; - typedef typename InputRegionType::SizeType RegionSizeType; + typedef typename InputRegionType::IndexType InputRegionIndexType; + typedef typename InputRegionType::SizeType InputRegionSizeType; + + typedef typename OutputImageType::RegionType OutputRegionType; + typedef typename OutputRegionType::IndexType OutputRegionIndexType; + typedef typename OutputRegionType::SizeType OutputRegionSizeType; typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; - //////////////////////////////////////////////////////////////// typedef ScalarImageToRunLengthMatrixFilter RunLengthMatrixFilterType; typedef typename RunLengthMatrixFilterType::HistogramType HistogramType; @@ -114,10 +114,8 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter itkSetConstObjectMacro(Offsets, OffsetVector); itkGetConstObjectMacro(Offsets, OffsetVector); - //////////////////////////////////////////////////////////////// - itkSetConstObjectMacro(NeighborhoodRadius, NeighborhoodRadiusType); - itkGetConstObjectMacro(NeighborhoodRadius, NeighborhoodRadiusType); - //////////////////////////////////////////////////////////////// + itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); + itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); /** Set number of histogram bins along each axis. Optional; for default value see above. */ @@ -160,16 +158,13 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter /** This method causes the filter to generate its output. */ virtual void GenerateData() ITK_OVERRIDE; + virtual void + GenerateOutputInformation() ITK_OVERRIDE; private: typename RunLengthMatrixFilterType::Pointer m_RunLengthMatrixGenerator; - //////////////////////////////////////////////////////////////// - // RegionIndexType m_RegionInex; - // RegionSizeType m_RegionSize; - NeighborhoodRadiusType m_NeighborhoodRadius; - //////////////////////////////////////////////////////////////// - + NeighborhoodRadiusType m_NeighborhoodRadius; FeatureValueVectorPointer m_FeatureMeans; FeatureValueVectorPointer m_FeatureStandardDeviations; FeatureNameVectorConstPointer m_RequestedFeatures; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index f89d2ba1671..1bf350290ff 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -23,6 +23,8 @@ #include "itkImageRegionIteratorWithIndex.h" #include "itkMath.h" #include "itkRegionOfInterestImageFilter.h" +#include "itkImageFileWriter.h" +#include namespace itk { @@ -35,7 +37,7 @@ ScalarImageToRunLengthFeaturesImageFilterSetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); - for (int i = 0; i < 2; ++i) + for (int i = 1; i < 2; ++i) { this->ProcessObject::SetNthOutput(i, this->MakeOutput(i)); } @@ -81,50 +83,91 @@ ScalarImageToRunLengthFeaturesImageFilterSetOffsets(offsets); this->m_FastCalculations = false; + NeighborhoodType Nhood; + Nhood.SetRadius(2); + this->m_NeighborhoodRadius = Nhood.GetRadius(); } template void -ScalarImageToRunLengthFeaturesImageFilter::GenerateData(void) +ScalarImageToRunLengthFeaturesImageFilter:: + GenerateOutputInformation() { - //////////////////////////////////////////////////////////////// - typename TOutputImage::Pointer output = this->GetOutput(); - InputRegionType InputRegion; - RegionIndexType InputRegionIndex; - RegionSizeType InputRegionSize; + typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); + typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); - InputRegionType OutputRegion; - RegionIndexType OutputRegionIndex; - const typename InputImageType::SpacingType & Spacing = this->ProcessObject::GetOutput(0)->GetOutput()->GetSpacing(); - const typename InputImageType::PointType & InputOrigin = this->ProcessObject::GetOutput(0)->GetOutput()->GetOrigin(); - double OutputOrigin[m_NeighborhoodRadius.Dimension]; + if (!outputPtr || !inputPtr) + { + return; + } - for (unsigned int i = 0; i < m_NeighborhoodRadius.Dimension; i++) + // Copy Information without modification. + outputPtr->CopyInformation(inputPtr); + + InputRegionType region; + InputRegionSizeType size; + InputRegionIndexType start; + start.Fill(0); + + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) { - InputRegionIndex[i] = m_NeighborhoodRadius[i]; - InputRegionSize[i] = this->ProcessObject::GetOutput(0).Size[i] - 2 * m_NeighborhoodRadius[i]; + size[i] = + (this->ImageToImageFilter::GetInput(0)->GetLargestPossibleRegion().GetSize(i)) - + (2 * this->m_NeighborhoodRadius[i]); + } + region.SetSize(size); + region.SetIndex(start); + + // Adjust output region + outputPtr->SetLargestPossibleRegion(region); +} + + +template +void +ScalarImageToRunLengthFeaturesImageFilter::GenerateData(void) +{ + typename TOutputImage::Pointer Output = this->GetOutput(); + + InputRegionType InputRegion; + InputRegionIndexType InputRegionIndex; + InputRegionSizeType InputRegionSize; + OutputRegionType OutputRegion; + + + OutputRegionIndexType OutputRegionIndex; + const typename OutputImageType::SpacingType & Spacing = Output->GetSpacing(); + const typename OutputImageType::PointType & InputOrigin = Output->GetOrigin(); + double OutputOrigin[this->m_NeighborhoodRadius.Dimension]; + + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) + { + InputRegionIndex[i] = this->m_NeighborhoodRadius[i]; + InputRegionSize[i] = + (this->ImageToImageFilter::GetInput(0)->GetLargestPossibleRegion().GetSize(i)) - + (2 * this->m_NeighborhoodRadius[i]); OutputRegionIndex[i] = 0; OutputOrigin[i] = InputOrigin[i] + Spacing[i] * InputRegionIndex[i]; } + InputRegion.SetIndex(InputRegionIndex); InputRegion.SetSize(InputRegionSize); OutputRegion.SetIndex(OutputRegionIndex); OutputRegion.SetSize(InputRegionSize); - output->SetRegions(OutputRegion); - output->SetSpacing(Spacing); - output->SetOrigin(OutputOrigin); - output->SetBufferedRegion(output->GetRequestedRegion()); - output->Allocate(); + Output->SetSpacing(Spacing); + Output->SetOrigin(OutputOrigin); + Output->SetRegions(OutputRegion); + Output->Allocate(); typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; - ConstIteratorType InputIt(this->ProcessObject::GetOutput(0), InputRegion); - typedef itk::ImageRegionIteratorWithIndex IteratorType; - IteratorType OutputIt(output, OutputRegion); + ConstIteratorType InputIt(this->ImageToImageFilter::GetInput(0), InputRegion); + typedef itk::ImageRegionIteratorWithIndex IteratorType; + IteratorType OutputIt(Output, OutputRegion); while (!InputIt.IsAtEnd()) { @@ -146,24 +189,29 @@ ScalarImageToRunLengthFeaturesImageFilter ExtractionFilterType; typename ExtractionFilterType::Pointer ExtractionFilter = ExtractionFilterType::New(); - ExtractionFilter->SetInput(this->ProcessObject::GetOutput(0)); + ExtractionFilter->SetInput(this->ImageToImageFilter::GetInput(0)); ExtractionFilter->SetRegionOfInterest(ExtractedRegion); - // Compute the feature for the first offset typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); this->m_RunLengthMatrixGenerator->SetOffset(offsetIt.Value()); this->m_RunLengthMatrixGenerator->SetInput(ExtractionFilter->GetOutput()); - this->m_RunLengthMatrixGenerator->Update(); + typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); runLengthMatrixCalculator->SetInput(this->m_RunLengthMatrixGenerator->GetOutput()); - runLengthMatrixCalculator->Update(); + runLengthMatrixCalculator->UpdateLargestPossibleRegion(); - OutputIt.Set(runLengthMatrixCalculator.GetGreyLevelNonuniformityOutput()); + + typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; + typename FeatureNameVector::ConstIterator fnameIt; + fnameIt = this->m_RequestedFeatures->Begin(); + fnameIt++; + fnameIt++; + fnameIt++; + + OutputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); ++InputIt; ++OutputIt; } - - //////////////////////////////////////////////////////////////// } template diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 0f617c69cf2..4d837a2ca4b 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -1,20 +1,23 @@ itk_module_test() -set(INPUT_IMAGE ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/Scan_CBCT_1L.nrrd) +set(INPUT_IMAGE ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/CroppedVolume.nrrd) set(ITK_TEST_DRIVER itkTestDriver) set(TextureFeaturesTests FilterCreationTest.cxx) -createtestdriver(TextureFeatures "${ITKTextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") +set(DART_TESTING_TIMEOUT 9000) +set(CTEST_TEST_TIMEOUT 9000) + +createtestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") itk_add_test( NAME TextureFeaturesTest1 COMMAND TextureFeaturesTestDriver --compare - ${CMAKE_CURRENT_SOURCE_DIR}/baseline/Scan_CBCT_1L.nrrd - ${CMAKE_CURRENT_SOURCE_DIR}/baseline/SegmC_CBCT_1L.nrrd + ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/Crop.nrrd + ${CMAKE_CURRENT_SOURCE_DIR}/Baseline/Crop.nrrd FilterCreationTest ${INPUT_IMAGE} ) diff --git a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx index 89221a16b5b..59a5454cf74 100644 --- a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx @@ -20,32 +20,42 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkHistogramToRunLengthFeaturesFilter.h" +#include "itkScalarImageToRunLengthMatrixFilter.h" +#include "itkScalarImageToRunLengthFeaturesFilter.h" + +#include "itkNeighborhood.h" +#include "itkMath.h" int FilterCreationTest(int argc, char * argv[]) { // Parse command line argumentsa std::string inputFilename = argv[1]; - // Setup types - typedef itk::Image ImageType; - - typedef itk::ImageFileReader readerType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader readerType; // Create and setup a reader readerType::Pointer reader = readerType::New(); reader->SetFileName(inputFilename.c_str()); + // Apply the filter - typedef itk::ScalarImageToRunLengthFeaturesImageFilter FilterType; - FilterType::Pointer filter = FilterType::New(); + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->UpdateLargestPossibleRegion(); + + OutputImageType::Pointer out = OutputImageType::New(); // Create and setup a writter - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName("result.nrrd"); writer->SetInput(filter->GetOutput()); - writer->Update(); + writer->UpdateLargestPossibleRegion(); return EXIT_SUCCESS; } From f035b9d3d17394e9a88292410f17ecc92ac7e5f6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 27 Mar 2017 14:16:03 -0400 Subject: [PATCH 004/135] ENH: Adding of concept checking for the input and output --- .../include/itkScalarImageToRunLengthFeaturesImageFilter.h | 7 +++++++ .../Filtering/TextureFeatures/test/FilterCreationTest.cxx | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index c219b29fcc2..782cb219dac 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -149,6 +149,13 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter itkSetMacro(FastCalculations, bool); itkBooleanMacro(FastCalculations); +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); + itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); + // End concept checking +#endif + protected: ScalarImageToRunLengthFeaturesImageFilter(); virtual ~ScalarImageToRunLengthFeaturesImageFilter() {} diff --git a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx index 59a5454cf74..857d95a7ff5 100644 --- a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx @@ -33,7 +33,7 @@ FilterCreationTest(int argc, char * argv[]) // Parse command line argumentsa std::string inputFilename = argv[1]; // Setup types - typedef itk::Image InputImageType; + typedef itk::Image InputImageType; typedef itk::Image OutputImageType; typedef itk::ImageFileReader readerType; @@ -48,8 +48,6 @@ FilterCreationTest(int argc, char * argv[]) filter->SetInput(reader->GetOutput()); filter->UpdateLargestPossibleRegion(); - OutputImageType::Pointer out = OutputImageType::New(); - // Create and setup a writter typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); From 6b75a42c14f4573ac7f56e7b97f1014436b82f77 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 27 Mar 2017 17:52:33 -0400 Subject: [PATCH 005/135] ENH: ENH Implementation of a multi threaded algorythm --- ...calarImageToRunLengthFeaturesImageFilter.h | 4 +- ...larImageToRunLengthFeaturesImageFilter.hxx | 110 +++++++++++------- .../test/FilterCreationTest.cxx | 10 +- 3 files changed, 78 insertions(+), 46 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 782cb219dac..bb0143f5cfa 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -164,7 +164,9 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter /** This method causes the filter to generate its output. */ virtual void - GenerateData() ITK_OVERRIDE; + BeforeThreadedGenerateData() ITK_OVERRIDE; + virtual void + ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; virtual void GenerateOutputInformation() ITK_OVERRIDE; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 1bf350290ff..24cd9e754f6 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -127,90 +127,116 @@ ScalarImageToRunLengthFeaturesImageFilter void -ScalarImageToRunLengthFeaturesImageFilter::GenerateData(void) +ScalarImageToRunLengthFeaturesImageFilter:: + BeforeThreadedGenerateData() { typename TOutputImage::Pointer Output = this->GetOutput(); - InputRegionType InputRegion; - InputRegionIndexType InputRegionIndex; - InputRegionSizeType InputRegionSize; - OutputRegionType OutputRegion; - - + OutputRegionType OutputRegion; OutputRegionIndexType OutputRegionIndex; + OutputRegionSizeType OutputRegionSize; const typename OutputImageType::SpacingType & Spacing = Output->GetSpacing(); const typename OutputImageType::PointType & InputOrigin = Output->GetOrigin(); double OutputOrigin[this->m_NeighborhoodRadius.Dimension]; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) { - InputRegionIndex[i] = this->m_NeighborhoodRadius[i]; - InputRegionSize[i] = + OutputRegionSize[i] = (this->ImageToImageFilter::GetInput(0)->GetLargestPossibleRegion().GetSize(i)) - (2 * this->m_NeighborhoodRadius[i]); - OutputRegionIndex[i] = 0; - OutputOrigin[i] = InputOrigin[i] + Spacing[i] * InputRegionIndex[i]; + OutputOrigin[i] = InputOrigin[i] + Spacing[i] * this->m_NeighborhoodRadius[i]; } - - - InputRegion.SetIndex(InputRegionIndex); - InputRegion.SetSize(InputRegionSize); + OutputRegionIndex.Fill(0); OutputRegion.SetIndex(OutputRegionIndex); - OutputRegion.SetSize(InputRegionSize); + OutputRegion.SetSize(OutputRegionSize); Output->SetSpacing(Spacing); Output->SetOrigin(OutputOrigin); Output->SetRegions(OutputRegion); Output->Allocate(); +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter:: + ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) +{ + TInputImage * inputPtr = const_cast(this->GetInput()); + inputPtr->DisconnectPipeline(); + TOutputImage * outputPtr = this->GetOutput(); + TInputImage * temp1; + const itk::Statistics::Histogram * temp2; + + InputRegionType inputRegionForThread; + inputRegionForThread.SetSize(outputRegionForThread.GetSize()); + + InputRegionIndexType start; + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) + { + start[i] = this->m_NeighborhoodRadius[i] + outputRegionForThread.GetIndex()[i]; + } + + inputRegionForThread.SetIndex(start); typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; - ConstIteratorType InputIt(this->ImageToImageFilter::GetInput(0), InputRegion); - typedef itk::ImageRegionIteratorWithIndex IteratorType; - IteratorType OutputIt(Output, OutputRegion); + ConstIteratorType inputIt(inputPtr, inputRegionForThread); + typedef itk::ImageRegionIteratorWithIndex IteratorType; + IteratorType outputIt(outputPtr, outputRegionForThread); + + + typename RunLengthMatrixFilterType::Pointer runLengthMatrixGenerator = RunLengthMatrixFilterType::New(); + + typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); + runLengthMatrixGenerator->SetOffset(offsetIt.Value()); - while (!InputIt.IsAtEnd()) + typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); + typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; + + typename FeatureNameVector::ConstIterator fnameIt; + fnameIt = this->m_RequestedFeatures->Begin(); + fnameIt++; + fnameIt++; + fnameIt++; + + while (!inputIt.IsAtEnd()) { - typename InputImageType::IndexType InputIndex = InputIt.GetIndex(); - InputIndex.Dimension; + typename InputImageType::IndexType inputIndex = inputIt.GetIndex(); typename InputImageType::IndexType start; typename InputImageType::IndexType end; - for (unsigned int i = 0; i < InputIndex.Dimension; i++) + for (unsigned int i = 0; i < inputIndex.Dimension; i++) { - start[i] = InputIndex[i] - m_NeighborhoodRadius[i]; - end[i] = InputIndex[i] + m_NeighborhoodRadius[i]; + start[i] = inputIndex[i] - m_NeighborhoodRadius[i]; + end[i] = inputIndex[i] + m_NeighborhoodRadius[i]; } + std::cout << inputIndex << std::endl; + + typename InputImageType::RegionType ExtractedRegion; ExtractedRegion.SetIndex(start); ExtractedRegion.SetUpperIndex(end); typedef typename itk::RegionOfInterestImageFilter ExtractionFilterType; typename ExtractionFilterType::Pointer ExtractionFilter = ExtractionFilterType::New(); - ExtractionFilter->SetInput(this->ImageToImageFilter::GetInput(0)); + ExtractionFilter->SetInput(inputPtr); + ExtractionFilter->SetRegionOfInterest(ExtractedRegion); + ExtractionFilter->UpdateLargestPossibleRegion(); + temp1 = ExtractionFilter->GetOutput(); - typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); - this->m_RunLengthMatrixGenerator->SetOffset(offsetIt.Value()); - this->m_RunLengthMatrixGenerator->SetInput(ExtractionFilter->GetOutput()); + runLengthMatrixGenerator->SetInput(temp1); + runLengthMatrixGenerator->UpdateLargestPossibleRegion(); + temp2 = runLengthMatrixGenerator->GetOutput(); - typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); - runLengthMatrixCalculator->SetInput(this->m_RunLengthMatrixGenerator->GetOutput()); + runLengthMatrixCalculator->SetInput(temp2); runLengthMatrixCalculator->UpdateLargestPossibleRegion(); - - typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; - typename FeatureNameVector::ConstIterator fnameIt; - fnameIt = this->m_RequestedFeatures->Begin(); - fnameIt++; - fnameIt++; - fnameIt++; - - OutputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); - ++InputIt; - ++OutputIt; + outputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); + ++inputIt; + ++outputIt; } } diff --git a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx index 857d95a7ff5..3b7941aadb2 100644 --- a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx @@ -40,19 +40,23 @@ FilterCreationTest(int argc, char * argv[]) // Create and setup a reader readerType::Pointer reader = readerType::New(); reader->SetFileName(inputFilename.c_str()); - + reader->UpdateLargestPossibleRegion(); + InputImageType::Pointer im = reader->GetOutput(); // Apply the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - filter->SetInput(reader->GetOutput()); + filter->SetInput(im); // reader->GetOutput()); filter->UpdateLargestPossibleRegion(); + OutputImageType::Pointer output = filter->GetOutput(); + + std::cout << "@@@@@@@@@@@@@@@@@@" << std::endl; // Create and setup a writter typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetFileName("result.nrrd"); - writer->SetInput(filter->GetOutput()); + writer->SetInput(output); // filter->GetOutput()); writer->UpdateLargestPossibleRegion(); return EXIT_SUCCESS; From 974fdce6dfe05f82ce9906a8f3b1732d11308b9e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Wed, 29 Mar 2017 10:39:31 -0400 Subject: [PATCH 006/135] ENH: Taking the mask into acount --- ...calarImageToRunLengthFeaturesImageFilter.h | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index bb0143f5cfa..e9f050de66a 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -98,8 +98,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter void SetInput(const InputImageType *); - const InputImageType * - GetInput() const; /** Return the feature means and deviations. */ itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector); @@ -132,18 +130,21 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter void SetDistanceValueMinMax(double min, double max); - /** Connects the mask image for which the histogram is going to be computed. - Optional; for default value see above. */ + /** Method to set the mask image */ void - SetMaskImage(const InputImageType *); + SetMaskImage(const InputImageType * image); + /** Method to get the mask image */ const InputImageType * GetMaskImage() const; - /** Set the pixel value of the mask that should be considered "inside" the - object. Optional; for default value see above. */ - void - SetInsidePixelValue(PixelType InsidePixelValue); + /** + * Set the pixel value of the mask that should be considered "inside" the + * object. Defaults to 1. + */ + itkSetMacro(InsidePixelValue, PixelType); + itkGetConstMacro(InsidePixelValue, PixelType); + itkGetConstMacro(FastCalculations, bool); itkSetMacro(FastCalculations, bool); @@ -179,6 +180,8 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter FeatureNameVectorConstPointer m_RequestedFeatures; OffsetVectorConstPointer m_Offsets; bool m_FastCalculations; + + PixelType m_InsidePixelValue; }; } // end of namespace Statistics } // end of namespace itk From 7a47af92e2b254a7291d29d65ae522961fffe4d7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 30 Mar 2017 17:21:26 -0400 Subject: [PATCH 007/135] ENH: Adding of variable get/set functions and transmission of those variable to each thread --- ...calarImageToRunLengthFeaturesImageFilter.h | 116 +++++++++--- ...larImageToRunLengthFeaturesImageFilter.hxx | 166 +++++++++--------- 2 files changed, 167 insertions(+), 115 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index e9f050de66a..0ccfc81172b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -23,6 +23,9 @@ #include "itkConstNeighborhoodIterator.h" #include "itkHistogramToRunLengthFeaturesFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" +#include "itkNumericTraits.h" +#include "itkHistogram.h" + namespace itk { @@ -80,9 +83,13 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; + typedef typename NumericTraits::RealType MeasurementType; + typedef typename NumericTraits::RealType RealType; + typedef Histogram HistogramType; + typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; + typedef ScalarImageToRunLengthMatrixFilter RunLengthMatrixFilterType; - typedef typename RunLengthMatrixFilterType::HistogramType HistogramType; typedef HistogramToRunLengthFeaturesFilter RunLengthFeaturesFilterType; typedef short RunLengthFeatureName; @@ -92,13 +99,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter typedef VectorContainer FeatureValueVector; typedef typename FeatureValueVector::Pointer FeatureValueVectorPointer; - /** Connects the input image for which the features are going to be computed - */ - using Superclass::SetInput; - void - SetInput(const InputImageType *); - - /** Return the feature means and deviations. */ itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector); itkGetConstReferenceObjectMacro(FeatureStandardDeviations, FeatureValueVector); @@ -107,36 +107,83 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector); itkGetConstObjectMacro(RequestedFeatures, FeatureNameVector); - /** Set the offsets over which the co-occurrence pairs will be computed. - Optional; for default value see above. */ - itkSetConstObjectMacro(Offsets, OffsetVector); - itkGetConstObjectMacro(Offsets, OffsetVector); - itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); - /** Set number of histogram bins along each axis. - Optional; for default value see above. */ + /** Method to set the mask image */ void - SetNumberOfBinsPerAxis(unsigned int); + SetMaskImage(const InputImageType * image); - /** Set the min and max (inclusive) pixel value that will be used for - feature calculations. Optional; for default value see above. */ + /** Method to get the mask image */ + const InputImageType * + GetMaskImage() const; + + /** Specify the default number of bins per axis */ + itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); + + /** + * Set the offsets over which the intensity/distance pairs will be computed. + * Invoking this function clears the previous offsets. + * Note: for each individual offset in the OffsetVector, the rightmost non-zero + * offset element must be positive. For example, in the offset list of a 2D image, + * (1, 0) means the offset along x-axis. (1, 0) has to be set instead + * of (-1, 0). This is required from the iterating order of pixel iterator. + * + */ + itkSetObjectMacro(Offsets, OffsetVector); + + /** + * Set offset over which the intensity/distance pairs will be computed. + * Invoking this function clears the previous offset(s). + * Note: for each individual offset, the rightmost non-zero + * offset element must be positive. For example, in the offset list of a 2D image, + * (1, 0) means the offset along x-axis. (1, 0) has to be set instead + * of (-1, 0). This is required from the iterating order of pixel iterator. + * + */ void - SetPixelValueMinMax(PixelType min, PixelType max); + SetOffset(const OffsetType offset); + + /** + * Get the current offset(s). + */ + itkGetModifiableObjectMacro(Offsets, OffsetVector); - /** Set the min and max (inclusive) pixel value that will be used for - feature calculations. Optional; for default value see above. */ + /** Set number of histogram bins along each axis */ + itkSetMacro(NumberOfBinsPerAxis, unsigned int); + + /** Get number of histogram bins along each axis */ + itkGetConstMacro(NumberOfBinsPerAxis, unsigned int); + + /** + * Set the min and max (inclusive) pixel value that will be used in + * generating the histogram. + */ void - SetDistanceValueMinMax(double min, double max); + SetPixelValueMinMax(PixelType min, PixelType max); - /** Method to set the mask image */ + /** Get the min pixel value defining one dimension of the joint histogram. */ + itkGetConstMacro(Min, PixelType); + + /** Get the max pixel value defining one dimension of the joint histogram. */ + itkGetConstMacro(Max, PixelType); + + /** + * Set the min and max (inclusive) pixel value that will be used in + * generating the histogram. + */ void - SetMaskImage(const InputImageType * image); + SetDistanceValueMinMax(RealType min, RealType max); - /** Method to get the mask image */ - const InputImageType * - GetMaskImage() const; + /** + * Get the min distance value defining one dimension of the joint histogram. + */ + itkGetConstMacro(MinDistance, RealType); + + /** + * Get the max distance value defining one dimension of the joint histogram. + */ + itkGetConstMacro(MaxDistance, RealType); /** * Set the pixel value of the mask that should be considered "inside" the @@ -166,6 +213,9 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter /** This method causes the filter to generate its output. */ virtual void BeforeThreadedGenerateData() ITK_OVERRIDE; + virtual void + AfterThreadedGenerateData() ITK_OVERRIDE; + virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; virtual void @@ -178,10 +228,18 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter FeatureValueVectorPointer m_FeatureMeans; FeatureValueVectorPointer m_FeatureStandardDeviations; FeatureNameVectorConstPointer m_RequestedFeatures; - OffsetVectorConstPointer m_Offsets; + OffsetVectorPointer m_Offsets; bool m_FastCalculations; - PixelType m_InsidePixelValue; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_Min; + PixelType m_Max; + RealType m_MinDistance; + RealType m_MaxDistance; + PixelType m_InsidePixelValue; + + MeasurementVectorType m_LowerBound; + MeasurementVectorType m_UpperBound; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 24cd9e754f6..09fb855098b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -33,6 +33,12 @@ namespace Statistics template ScalarImageToRunLengthFeaturesImageFilter:: ScalarImageToRunLengthFeaturesImageFilter() + : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) + , m_Min(NumericTraits::NonpositiveMin()) + , m_Max(NumericTraits::max()) + , m_MinDistance(NumericTraits::ZeroValue()) + , m_MaxDistance(NumericTraits::max()) + , m_InsidePixelValue(NumericTraits::OneValue()) { this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); @@ -85,7 +91,18 @@ ScalarImageToRunLengthFeaturesImageFilterm_FastCalculations = false; NeighborhoodType Nhood; Nhood.SetRadius(2); + + const unsigned int measurementVectorSize = 2; + this->m_NeighborhoodRadius = Nhood.GetRadius(); + + this->m_LowerBound.SetSize(measurementVectorSize); + this->m_UpperBound.SetSize(measurementVectorSize); + + this->m_LowerBound[0] = this->m_Min; + this->m_LowerBound[1] = this->m_MinDistance; + this->m_UpperBound[0] = this->m_Max; + this->m_UpperBound[1] = this->m_MaxDistance; } template @@ -93,7 +110,6 @@ void ScalarImageToRunLengthFeaturesImageFilter:: GenerateOutputInformation() { - typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); @@ -162,11 +178,11 @@ void ScalarImageToRunLengthFeaturesImageFilter:: ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { - TInputImage * inputPtr = const_cast(this->GetInput()); + + TInputImage * inputPtr = const_cast(this->GetInput()); + TOutputImage * outputPtr = this->GetOutput(); + inputPtr->DisconnectPipeline(); - TOutputImage * outputPtr = this->GetOutput(); - TInputImage * temp1; - const itk::Statistics::Histogram * temp2; InputRegionType inputRegionForThread; inputRegionForThread.SetSize(outputRegionForThread.GetSize()); @@ -177,110 +193,83 @@ ScalarImageToRunLengthFeaturesImageFilterm_NeighborhoodRadius[i] + outputRegionForThread.GetIndex()[i]; } + inputRegionForThread.SetIndex(start); + typedef typename itk::RegionOfInterestImageFilter ExtractionFilterType; + typename ExtractionFilterType::Pointer ExtractionFilter = ExtractionFilterType::New(); + ExtractionFilter->SetInput(inputPtr); + typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; ConstIteratorType inputIt(inputPtr, inputRegionForThread); typedef itk::ImageRegionIteratorWithIndex IteratorType; IteratorType outputIt(outputPtr, outputRegionForThread); - typename RunLengthMatrixFilterType::Pointer runLengthMatrixGenerator = RunLengthMatrixFilterType::New(); - - typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); + typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); runLengthMatrixGenerator->SetOffset(offsetIt.Value()); + runLengthMatrixGenerator->SetDistanceValueMinMax(m_MinDistance, m_MaxDistance); + runLengthMatrixGenerator->SetNumberOfBinsPerAxis(m_NumberOfBinsPerAxis); + runLengthMatrixGenerator->SetPixelValueMinMax(m_Min, m_Max); + runLengthMatrixGenerator->SetInsidePixelValue(m_InsidePixelValue); + typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); - typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; - typename FeatureNameVector::ConstIterator fnameIt; + typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; + typename FeatureNameVector::ConstIterator fnameIt; fnameIt = this->m_RequestedFeatures->Begin(); fnameIt++; fnameIt++; fnameIt++; - while (!inputIt.IsAtEnd()) { typename InputImageType::IndexType inputIndex = inputIt.GetIndex(); - typename InputImageType::IndexType start; - typename InputImageType::IndexType end; - for (unsigned int i = 0; i < inputIndex.Dimension; i++) + if ((this->GetMaskImage() && this->GetMaskImage()->GetPixel(inputIndex) != this->m_InsidePixelValue)) { - start[i] = inputIndex[i] - m_NeighborhoodRadius[i]; - end[i] = inputIndex[i] + m_NeighborhoodRadius[i]; + outputIt.Set(0); } + else + { + typename InputImageType::IndexType start; + typename InputImageType::IndexType end; + + for (unsigned int i = 0; i < inputIndex.Dimension; i++) + { + start[i] = inputIndex[i] - m_NeighborhoodRadius[i]; + end[i] = inputIndex[i] + m_NeighborhoodRadius[i]; + } - std::cout << inputIndex << std::endl; + typename InputImageType::RegionType ExtractedRegion; + ExtractedRegion.SetIndex(start); + ExtractedRegion.SetUpperIndex(end); + inputPtr->SetRequestedRegion(ExtractedRegion); + ExtractionFilter->SetRegionOfInterest(ExtractedRegion); - typename InputImageType::RegionType ExtractedRegion; - ExtractedRegion.SetIndex(start); - ExtractedRegion.SetUpperIndex(end); - typedef typename itk::RegionOfInterestImageFilter ExtractionFilterType; - typename ExtractionFilterType::Pointer ExtractionFilter = ExtractionFilterType::New(); - ExtractionFilter->SetInput(inputPtr); + runLengthMatrixGenerator->SetInput(ExtractionFilter->GetOutput()); - ExtractionFilter->SetRegionOfInterest(ExtractedRegion); - ExtractionFilter->UpdateLargestPossibleRegion(); - temp1 = ExtractionFilter->GetOutput(); + runLengthMatrixCalculator->SetInput(runLengthMatrixGenerator->GetOutput()); + runLengthMatrixCalculator->UpdateLargestPossibleRegion(); - runLengthMatrixGenerator->SetInput(temp1); - runLengthMatrixGenerator->UpdateLargestPossibleRegion(); - temp2 = runLengthMatrixGenerator->GetOutput(); - runLengthMatrixCalculator->SetInput(temp2); - runLengthMatrixCalculator->UpdateLargestPossibleRegion(); + outputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); - outputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); + outputPtr->SetRequestedRegionToLargestPossibleRegion(); + } ++inputIt; ++outputIt; } } -template -void -ScalarImageToRunLengthFeaturesImageFilter::SetInput( - const InputImageType * image) -{ - // Process object is not const-correct so the const_cast is required here - this->ProcessObject::SetNthInput(0, const_cast(image)); - - this->m_RunLengthMatrixGenerator->SetInput(image); -} - template void ScalarImageToRunLengthFeaturesImageFilter:: - SetNumberOfBinsPerAxis(unsigned int numberOfBins) -{ - itkDebugMacro("setting NumberOfBinsPerAxis to " << numberOfBins); - this->m_RunLengthMatrixGenerator->SetNumberOfBinsPerAxis(numberOfBins); - this->Modified(); -} - -template -void -ScalarImageToRunLengthFeaturesImageFilter::SetPixelValueMinMax( - PixelType min, - PixelType max) -{ - itkDebugMacro("setting Min to " << min << "and Max to " << max); - this->m_RunLengthMatrixGenerator->SetPixelValueMinMax(min, max); - this->Modified(); -} - -template -void -ScalarImageToRunLengthFeaturesImageFilter:: - SetDistanceValueMinMax(double min, double max) -{ - itkDebugMacro("setting Min to " << min << "and Max to " << max); - this->m_RunLengthMatrixGenerator->SetDistanceValueMinMax(min, max); - this->Modified(); -} + AfterThreadedGenerateData() +{} template void @@ -289,41 +278,46 @@ ScalarImageToRunLengthFeaturesImageFilterProcessObject::SetNthInput(1, const_cast(image)); - - this->m_RunLengthMatrixGenerator->SetMaskImage(image); } template const TInputImage * -ScalarImageToRunLengthFeaturesImageFilter::GetInput() const +ScalarImageToRunLengthFeaturesImageFilter::GetMaskImage() const { - if (this->GetNumberOfInputs() < 1) + if (this->GetNumberOfInputs() < 2) { return ITK_NULLPTR; } - return static_cast(this->ProcessObject::GetInput(0)); + return static_cast(this->ProcessObject::GetInput(1)); } - template -const TInputImage * -ScalarImageToRunLengthFeaturesImageFilter::GetMaskImage() const +void +ScalarImageToRunLengthFeaturesImageFilter::SetPixelValueMinMax( + PixelType min, + PixelType max) { - if (this->GetNumberOfInputs() < 2) + if (this->m_Min != min || this->m_Max != max) { - return ITK_NULLPTR; + itkDebugMacro("setting Min to " << min << "and Max to " << max); + this->m_Min = min; + this->m_Max = max; + this->Modified(); } - return static_cast(this->ProcessObject::GetInput(1)); } template void -ScalarImageToRunLengthFeaturesImageFilter::SetInsidePixelValue( - PixelType insidePixelValue) +ScalarImageToRunLengthFeaturesImageFilter:: + SetDistanceValueMinMax(RealType min, RealType max) { - itkDebugMacro("setting InsidePixelValue to " << insidePixelValue); - this->m_RunLengthMatrixGenerator->SetInsidePixelValue(insidePixelValue); - this->Modified(); + if (Math::NotExactlyEquals(this->m_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) + { + itkDebugMacro("setting MinDistance to " << min << "and MaxDistance to " << max); + this->m_MinDistance = min; + this->m_MaxDistance = max; + this->Modified(); + } } template From d85b0daed22f1f1e90cde8737f793bb36c4bf505 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 3 Apr 2017 13:16:09 -0400 Subject: [PATCH 008/135] ENH: Implementation of a more complete test --- .../test/FilterCreationTest.cxx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx index 3b7941aadb2..6bf1cdb07f7 100644 --- a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx @@ -39,24 +39,35 @@ FilterCreationTest(int argc, char * argv[]) // Create and setup a reader readerType::Pointer reader = readerType::New(); - reader->SetFileName(inputFilename.c_str()); + /// reader->SetFileName( inputFilename.c_str() ); + reader->SetFileName( + "/home/jean-baptiste/Professional/Projects/TextureFeatures/ITKTextureFeatures/test/Baseline/Scan_CBCT_1L.nrrd"); reader->UpdateLargestPossibleRegion(); InputImageType::Pointer im = reader->GetOutput(); + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + maskReader->SetFileName( + "/home/jean-baptiste/Professional/Projects/TextureFeatures/ITKTextureFeatures/test/Baseline/SegmC_CBCT_1L.nrrd"); + maskReader->UpdateLargestPossibleRegion(); + InputImageType::Pointer mask = maskReader->GetOutput(); + // Apply the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - filter->SetInput(im); // reader->GetOutput()); + filter->SetInput(im); + filter->SetMaskImage(mask); + filter->SetNumberOfBinsPerAxis(10); + filter->SetPixelValueMinMax(-300, 4000); + filter->SetDistanceValueMinMax(0, 200); filter->UpdateLargestPossibleRegion(); OutputImageType::Pointer output = filter->GetOutput(); - std::cout << "@@@@@@@@@@@@@@@@@@" << std::endl; - // Create and setup a writter typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetFileName("result.nrrd"); - writer->SetInput(output); // filter->GetOutput()); + writer->SetInput(output); writer->UpdateLargestPossibleRegion(); return EXIT_SUCCESS; From a8fd29022999a0daa45348762902e6a7fc07522f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 3 Apr 2017 13:17:05 -0400 Subject: [PATCH 009/135] ENH: First version of the reimplementation of the "ScalarImageToRunLengthMatrixFilter" --- ...calarImageToRunLengthFeaturesImageFilter.h | 73 ++-- ...larImageToRunLengthFeaturesImageFilter.hxx | 351 +++++++++++------- 2 files changed, 240 insertions(+), 184 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 0ccfc81172b..552f1cc743e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -60,48 +60,36 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter /** standard New() method support */ itkNewMacro(Self); - typedef TInputImage InputImageType; - typedef typename InputImageType::Pointer InputImagePointer; - typedef TOutputImage OutputImageType; - typedef typename OutputImageType::Pointer OutputImagePointer; - typedef THistogramFrequencyContainer FrequencyContainerType; + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef THistogramFrequencyContainer FrequencyContainerType; + + typedef typename InputImageType::PixelType PixelType; + typedef typename InputImageType::IndexType IndexType; + typedef typename InputImageType::PointType PointType; - typedef typename InputImageType::PixelType PixelType; typedef typename InputImageType::OffsetType OffsetType; typedef VectorContainer OffsetVector; typedef typename OffsetVector::Pointer OffsetVectorPointer; typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; - typedef typename InputImageType::RegionType InputRegionType; - typedef typename InputRegionType::IndexType InputRegionIndexType; - typedef typename InputRegionType::SizeType InputRegionSizeType; - + typedef typename InputImageType::RegionType InputRegionType; typedef typename OutputImageType::RegionType OutputRegionType; - typedef typename OutputRegionType::IndexType OutputRegionIndexType; - typedef typename OutputRegionType::SizeType OutputRegionSizeType; typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; + typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; typedef typename NumericTraits::RealType MeasurementType; typedef typename NumericTraits::RealType RealType; typedef Histogram HistogramType; typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; - - - typedef ScalarImageToRunLengthMatrixFilter RunLengthMatrixFilterType; - typedef HistogramToRunLengthFeaturesFilter RunLengthFeaturesFilterType; + typedef HistogramToRunLengthFeaturesFilter RunLengthFeaturesFilterType; typedef short RunLengthFeatureName; typedef VectorContainer FeatureNameVector; - typedef typename FeatureNameVector::Pointer FeatureNameVectorPointer; typedef typename FeatureNameVector::ConstPointer FeatureNameVectorConstPointer; - typedef VectorContainer FeatureValueVector; - typedef typename FeatureValueVector::Pointer FeatureValueVectorPointer; - /** Return the feature means and deviations. */ - itkGetConstReferenceObjectMacro(FeatureMeans, FeatureValueVector); - itkGetConstReferenceObjectMacro(FeatureStandardDeviations, FeatureValueVector); /** Set the desired feature set. Optional, for default value see above. */ itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector); @@ -207,39 +195,42 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter protected: ScalarImageToRunLengthFeaturesImageFilter(); virtual ~ScalarImageToRunLengthFeaturesImageFilter() {} + + void + NormalizeOffsetDirection(OffsetType & offset); + bool + IsInsideNeighborhood(OffsetType iteratedOffset); + void + IncreaseHistograme(typename HistogramType::Pointer & hist, + typename TInputImage::Pointer inputPtr, + MeasurementVectorType run, + typename HistogramType::IndexType & hIndex, + const PixelType curentInNeighborhoodPixelIntensity, + IndexType curentInNeighborhoodIndex, + IndexType lastGoodIndex); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** This method causes the filter to generate its output. */ virtual void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void - AfterThreadedGenerateData() ITK_OVERRIDE; - virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; - virtual void - GenerateOutputInformation() ITK_OVERRIDE; + // virtual void GenerateOutputInformation() ITK_OVERRIDE; private: - typename RunLengthMatrixFilterType::Pointer m_RunLengthMatrixGenerator; - NeighborhoodRadiusType m_NeighborhoodRadius; - FeatureValueVectorPointer m_FeatureMeans; - FeatureValueVectorPointer m_FeatureStandardDeviations; FeatureNameVectorConstPointer m_RequestedFeatures; OffsetVectorPointer m_Offsets; bool m_FastCalculations; - - unsigned int m_NumberOfBinsPerAxis; - PixelType m_Min; - PixelType m_Max; - RealType m_MinDistance; - RealType m_MaxDistance; - PixelType m_InsidePixelValue; - - MeasurementVectorType m_LowerBound; - MeasurementVectorType m_UpperBound; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_Min; + PixelType m_Max; + RealType m_MinDistance; + RealType m_MaxDistance; + PixelType m_InsidePixelValue; + MeasurementVectorType m_LowerBound; + MeasurementVectorType m_UpperBound; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 09fb855098b..f014cfd80b0 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -24,6 +24,7 @@ #include "itkMath.h" #include "itkRegionOfInterestImageFilter.h" #include "itkImageFileWriter.h" +#include "itkNeighborhoodAlgorithm.h" #include namespace itk @@ -48,14 +49,10 @@ ScalarImageToRunLengthFeaturesImageFilterProcessObject::SetNthOutput(i, this->MakeOutput(i)); } - this->m_RunLengthMatrixGenerator = RunLengthMatrixFilterType::New(); - this->m_FeatureMeans = FeatureValueVector::New(); - this->m_FeatureStandardDeviations = FeatureValueVector::New(); - // Set the requested features to the default value: // {Energy, Entropy, InverseDifferenceMoment, Inertia, ClusterShade, // ClusterProminence} - FeatureNameVectorPointer requestedFeatures = FeatureNameVector::New(); + typename FeatureNameVector::Pointer requestedFeatures = FeatureNameVector::New(); // can't directly set this->m_RequestedFeatures since it is const! requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunEmphasis); @@ -79,7 +76,7 @@ ScalarImageToRunLengthFeaturesImageFilterm_LowerBound[1] = this->m_MinDistance; this->m_UpperBound[0] = this->m_Max; this->m_UpperBound[1] = this->m_MaxDistance; -} - -template -void -ScalarImageToRunLengthFeaturesImageFilter:: - GenerateOutputInformation() -{ - typename Superclass::OutputImagePointer outputPtr = this->GetOutput(); - typename Superclass::InputImageConstPointer inputPtr = this->GetInput(); - - if (!outputPtr || !inputPtr) - { - return; - } - // Copy Information without modification. - outputPtr->CopyInformation(inputPtr); - - InputRegionType region; - InputRegionSizeType size; - InputRegionIndexType start; - start.Fill(0); - - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) - { - size[i] = - (this->ImageToImageFilter::GetInput(0)->GetLargestPossibleRegion().GetSize(i)) - - (2 * this->m_NeighborhoodRadius[i]); - } - - region.SetSize(size); - region.SetIndex(start); - - // Adjust output region - outputPtr->SetLargestPossibleRegion(region); + TOutputImage * outputPtr = this->GetOutput(); + outputPtr->FillBuffer(0); } - template void ScalarImageToRunLengthFeaturesImageFilter:: BeforeThreadedGenerateData() { - typename TOutputImage::Pointer Output = this->GetOutput(); - - OutputRegionType OutputRegion; - OutputRegionIndexType OutputRegionIndex; - OutputRegionSizeType OutputRegionSize; - const typename OutputImageType::SpacingType & Spacing = Output->GetSpacing(); - const typename OutputImageType::PointType & InputOrigin = Output->GetOrigin(); - double OutputOrigin[this->m_NeighborhoodRadius.Dimension]; - - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) - { - OutputRegionSize[i] = - (this->ImageToImageFilter::GetInput(0)->GetLargestPossibleRegion().GetSize(i)) - - (2 * this->m_NeighborhoodRadius[i]); - OutputOrigin[i] = InputOrigin[i] + Spacing[i] * this->m_NeighborhoodRadius[i]; - } - OutputRegionIndex.Fill(0); - - OutputRegion.SetIndex(OutputRegionIndex); - OutputRegion.SetSize(OutputRegionSize); - - Output->SetSpacing(Spacing); - Output->SetOrigin(OutputOrigin); - Output->SetRegions(OutputRegion); - Output->Allocate(); + this->m_LowerBound[0] = this->m_Min; + this->m_LowerBound[1] = this->m_MinDistance; + this->m_UpperBound[0] = this->m_Max; + this->m_UpperBound[1] = this->m_MaxDistance; } template @@ -178,98 +121,199 @@ void ScalarImageToRunLengthFeaturesImageFilter:: ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { - - TInputImage * inputPtr = const_cast(this->GetInput()); - TOutputImage * outputPtr = this->GetOutput(); - - inputPtr->DisconnectPipeline(); - - InputRegionType inputRegionForThread; - inputRegionForThread.SetSize(outputRegionForThread.GetSize()); - - InputRegionIndexType start; - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) - { - start[i] = this->m_NeighborhoodRadius[i] + outputRegionForThread.GetIndex()[i]; - } - - - inputRegionForThread.SetIndex(start); - - typedef typename itk::RegionOfInterestImageFilter ExtractionFilterType; - typename ExtractionFilterType::Pointer ExtractionFilter = ExtractionFilterType::New(); - ExtractionFilter->SetInput(inputPtr); - - typedef itk::ImageRegionConstIteratorWithIndex ConstIteratorType; - ConstIteratorType inputIt(inputPtr, inputRegionForThread); - typedef itk::ImageRegionIteratorWithIndex IteratorType; - IteratorType outputIt(outputPtr, outputRegionForThread); - - typename RunLengthMatrixFilterType::Pointer runLengthMatrixGenerator = RunLengthMatrixFilterType::New(); - typename OffsetVector::ConstIterator offsetIt = this->m_Offsets->Begin(); - runLengthMatrixGenerator->SetOffset(offsetIt.Value()); - runLengthMatrixGenerator->SetDistanceValueMinMax(m_MinDistance, m_MaxDistance); - runLengthMatrixGenerator->SetNumberOfBinsPerAxis(m_NumberOfBinsPerAxis); - runLengthMatrixGenerator->SetPixelValueMinMax(m_Min, m_Max); - runLengthMatrixGenerator->SetInsidePixelValue(m_InsidePixelValue); - - + // Recuperation of the different inputs/outputs + typename TInputImage::Pointer inputPtr = TInputImage::New(); + inputPtr = const_cast(this->GetInput()); + typename TInputImage::Pointer maskPointer = TInputImage::New(); + maskPointer = const_cast(this->GetMaskImage()); + typename TOutputImage::Pointer outputPtr = TOutputImage::New(); + outputPtr = this->GetOutput(); + + // Creation of the filter that will compute the Run Lenght features once the histogrham computed typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); - typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; typename FeatureNameVector::ConstIterator fnameIt; fnameIt = this->m_RequestedFeatures->Begin(); fnameIt++; fnameIt++; fnameIt++; - while (!inputIt.IsAtEnd()) - { - typename InputImageType::IndexType inputIndex = inputIt.GetIndex(); - - if ((this->GetMaskImage() && this->GetMaskImage()->GetPixel(inputIndex) != this->m_InsidePixelValue)) + // Creation of a region with the sqme size than the neighborhood that + // will be used to check if each voxel has already been visited + InputRegionType boolRegion; + typename InputRegionType::IndexType boolStart; + typename InputRegionType::SizeType boolSize; + IndexType boolCurentInNeighborhoodIndex; + typedef Image BoolImageType; + typename BoolImageType::Pointer alreadyVisitedImage = BoolImageType::New(); + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) + { + boolSize[i] = this->m_NeighborhoodRadius[i] * 2 + 1; + boolStart[i] = 0; + boolCurentInNeighborhoodIndex[i] = m_NeighborhoodRadius[i]; + } + boolRegion.SetIndex(boolStart); + boolRegion.SetSize(boolSize); + alreadyVisitedImage->CopyInformation(inputPtr); + alreadyVisitedImage->SetRegions(boolRegion); + alreadyVisitedImage->Allocate(); + + // Creation of the histogram that will be fill and used to compute the features + const unsigned int measurementVectorSize = 2; + typename HistogramType::IndexType hIndex; + typename HistogramType::Pointer hist = HistogramType::New(); + hist->SetMeasurementVectorSize(measurementVectorSize); + typename HistogramType::SizeType size(2); + size.Fill(this->m_NumberOfBinsPerAxis); + MeasurementVectorType run(hist->GetMeasurementVectorSize()); + hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); + // Separation of the non-boundery region that will be processed in a different way + NeighborhoodAlgorithm::ImageBoundaryFacesCalculator BoundaryFacesCalculator; + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = + BoundaryFacesCalculator(inputPtr, outputRegionForThread, m_NeighborhoodRadius); + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = + faceList.begin(); + + /// ***** Non-boundary Region ***** + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, inputPtr, *fit); + typedef itk::ImageRegionIterator IteratorType; + IteratorType outputIt(outputPtr, *fit); + + // Iteration over the all image region + while (!inputNIt.IsAtEnd()) + { + if ((maskPointer && maskPointer->GetPixel(inputNIt.GetIndex()) != this->m_InsidePixelValue)) { - outputIt.Set(0); + ++inputNIt; + ++outputIt; + continue; } - else + hist->SetToZero(); + hist->Modified(); + // Iteration over all the offsets + typename OffsetVector::ConstIterator offsets; + for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) { - typename InputImageType::IndexType start; - typename InputImageType::IndexType end; + alreadyVisitedImage->FillBuffer(false); + OffsetType offset = offsets.Value(); + this->NormalizeOffsetDirection(offset); - for (unsigned int i = 0; i < inputIndex.Dimension; i++) + // Iteration over the all neighborhood + for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { - start[i] = inputIndex[i] - m_NeighborhoodRadius[i]; - end[i] = inputIndex[i] + m_NeighborhoodRadius[i]; + IndexType curentInNeighborhoodIndex = inputNIt.GetIndex(nb); + const PixelType curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + // Cecking if the value is out-of-bounds or is outside the mask. + if (curentInNeighborhoodPixelIntensity < this->m_Min || curentInNeighborhoodPixelIntensity > this->m_Max || + alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + inputNIt.GetOffset(nb)) || + (maskPointer && maskPointer->GetPixel(curentInNeighborhoodIndex) != this->m_InsidePixelValue)) + { + continue; + } + + MeasurementType curentInNeighborhoodBinMin = hist->GetBinMinFromValue(0, curentInNeighborhoodPixelIntensity); + MeasurementType curentInNeighborhoodBinMax = hist->GetBinMaxFromValue(0, curentInNeighborhoodPixelIntensity); + MeasurementType lastBinMax = hist->GetDimensionMaxs(0)[hist->GetSize(0) - 1]; + + PixelType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; + IndexType lastGoodIndex = curentInNeighborhoodIndex; + bool runLengthSegmentAlreadyVisited = false; + bool insideNeighborhood = true; + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) + { + int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); + if (boundDistance < 0) + { + insideNeighborhood = false; + break; + } + } + + // Scan from the iterated pixel at index, following the direction of + // offset. Run length is computed as the length of continuous pixel + // whose pixel values are in the same bin. + while (insideNeighborhood) + { + // For the same offset, each run length segment can only be visited once + if (alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + iteratedOffset)) + { + runLengthSegmentAlreadyVisited = true; + break; + } + pixelIntensity = inputNIt.GetPixel(iteratedOffset); + + // Special attention paid to boundaries of bins. + // For the last bin, it is left close and right close (following the previous + // gerrit patch). For all other bins, the bin is left close and right open. + if (pixelIntensity >= curentInNeighborhoodBinMin && + (pixelIntensity < curentInNeighborhoodBinMax || + (Math::ExactlyEquals(pixelIntensity, curentInNeighborhoodBinMax) && + Math::ExactlyEquals(curentInNeighborhoodBinMax, lastBinMax)))) + { + alreadyVisitedImage->SetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); + lastGoodIndex = inputNIt.GetIndex(iteratedOffset); + iteratedOffset += offset; + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) + { + int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); + if (boundDistance < 0) + { + insideNeighborhood = false; + break; + } + } + } + else + { + break; + } + } + if (runLengthSegmentAlreadyVisited) + { + continue; + } + + PointType curentInNeighborhoodPoint; + inputPtr->TransformIndexToPhysicalPoint(curentInNeighborhoodIndex, curentInNeighborhoodPoint); + PointType point; + inputPtr->TransformIndexToPhysicalPoint(lastGoodIndex, point); + + run[0] = curentInNeighborhoodPixelIntensity; + run[1] = curentInNeighborhoodPoint.EuclideanDistanceTo(point); + if (run[1] >= this->m_MinDistance && run[1] <= this->m_MaxDistance) + { + hist->GetIndex(run, hIndex); + hist->IncreaseFrequencyOfIndex(hIndex, 1); + } } + } - typename InputImageType::RegionType ExtractedRegion; - ExtractedRegion.SetIndex(start); - ExtractedRegion.SetUpperIndex(end); - - inputPtr->SetRequestedRegion(ExtractedRegion); - ExtractionFilter->SetRegionOfInterest(ExtractedRegion); - - - runLengthMatrixGenerator->SetInput(ExtractionFilter->GetOutput()); - - runLengthMatrixCalculator->SetInput(runLengthMatrixGenerator->GetOutput()); - runLengthMatrixCalculator->UpdateLargestPossibleRegion(); - - - outputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); + runLengthMatrixCalculator->SetInput(hist); + runLengthMatrixCalculator->Update(); + outputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); - outputPtr->SetRequestedRegionToLargestPossibleRegion(); - } - ++inputIt; + ++inputNIt; ++outputIt; } -} -template -void -ScalarImageToRunLengthFeaturesImageFilter:: - AfterThreadedGenerateData() -{} + /// ***** With-boundary Regions ***** + fit++; + for (fit; fit != faceList.end(); ++fit) + { + // NeighborhoodIteratorType boundaryInputNIt(m_NeighborhoodRadius, inputPtr, *fit ); + // typedef itk::ImageRegionIterator< OutputImageType> IteratorType; + // IteratorType boundaryOutputIt( outputPtr, *fit ); + + // // Iteration over the all image region + // while( !boundaryInputNIt.IsAtEnd() ) + // { + // boundaryOutputIt.Set( 0 ); + // ++boundaryInputNIt; + // ++boundaryOutputIt; + // } + } +} template void @@ -299,7 +343,6 @@ ScalarImageToRunLengthFeaturesImageFilterm_Min != min || this->m_Max != max) { - itkDebugMacro("setting Min to " << min << "and Max to " << max); this->m_Min = min; this->m_Max = max; this->Modified(); @@ -313,13 +356,37 @@ ScalarImageToRunLengthFeaturesImageFilterm_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) { - itkDebugMacro("setting MinDistance to " << min << "and MaxDistance to " << max); this->m_MinDistance = min; this->m_MaxDistance = max; this->Modified(); } } +template +void +ScalarImageToRunLengthFeaturesImageFilter:: + NormalizeOffsetDirection(OffsetType & offset) +{ + itkDebugMacro("old offset = " << offset << std::endl); + int sign = 1; + bool metLastNonZero = false; + for (int i = offset.GetOffsetDimension() - 1; i >= 0; i--) + { + if (metLastNonZero) + { + offset[i] *= sign; + } + else if (offset[i] != 0) + { + sign = (offset[i] > 0) ? 1 : -1; + metLastNonZero = true; + offset[i] *= sign; + } + } + + itkDebugMacro("new offset = " << offset << std::endl); +} + template void ScalarImageToRunLengthFeaturesImageFilter::PrintSelf( @@ -328,10 +395,8 @@ ScalarImageToRunLengthFeaturesImageFilterGetRequestedFeatures() << std::endl; - os << indent << "FeatureStandardDeviations: " << this->GetFeatureStandardDeviations() << std::endl; os << indent << "FastCalculations: " << this->GetFastCalculations() << std::endl; os << indent << "Offsets: " << this->GetOffsets() << std::endl; - os << indent << "FeatureMeans: " << this->GetFeatureMeans() << std::endl; } } // end of namespace Statistics } // end of namespace itk From f7eca2947b512154091ae6e66ff810972a10e25d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 7 Apr 2017 11:31:07 -0400 Subject: [PATCH 010/135] ENH: The filter now also treat the boundaries --- ...calarImageToRunLengthFeaturesImageFilter.h | 2 +- ...larImageToRunLengthFeaturesImageFilter.hxx | 270 ++++++++++-------- 2 files changed, 148 insertions(+), 124 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 552f1cc743e..f32a9231f91 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -188,7 +188,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); - itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); + itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); // End concept checking #endif diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index f014cfd80b0..195b0a39dc6 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -101,8 +101,10 @@ ScalarImageToRunLengthFeaturesImageFilterm_UpperBound[0] = this->m_Max; this->m_UpperBound[1] = this->m_MaxDistance; - TOutputImage * outputPtr = this->GetOutput(); - outputPtr->FillBuffer(0); + TOutputImage * outputPtr = this->GetOutput(); + typename TOutputImage::PixelType pixelNull; + pixelNull.Fill(0); + outputPtr->FillBuffer(pixelNull); } template @@ -133,10 +135,7 @@ ScalarImageToRunLengthFeaturesImageFilterm_RequestedFeatures->Begin(); - fnameIt++; - fnameIt++; - fnameIt++; + typename TOutputImage::PixelType outputPixel; // Creation of a region with the sqme size than the neighborhood that // will be used to check if each voxel has already been visited @@ -175,143 +174,126 @@ ScalarImageToRunLengthFeaturesImageFilter IteratorType; - IteratorType outputIt(outputPtr, *fit); - - // Iteration over the all image region - while (!inputNIt.IsAtEnd()) + for (fit; fit != faceList.end(); ++fit) { - if ((maskPointer && maskPointer->GetPixel(inputNIt.GetIndex()) != this->m_InsidePixelValue)) - { - ++inputNIt; - ++outputIt; - continue; - } - hist->SetToZero(); - hist->Modified(); - // Iteration over all the offsets - typename OffsetVector::ConstIterator offsets; - for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) - { - alreadyVisitedImage->FillBuffer(false); - OffsetType offset = offsets.Value(); - this->NormalizeOffsetDirection(offset); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, inputPtr, *fit); + typedef itk::ImageRegionIterator IteratorType; + IteratorType outputIt(outputPtr, *fit); - // Iteration over the all neighborhood - for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) + // Iteration over the all image region + while (!inputNIt.IsAtEnd()) + { + // If the voxel is outside of the image, don't treat it + if (fit == faceList.begin()) { - IndexType curentInNeighborhoodIndex = inputNIt.GetIndex(nb); - const PixelType curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); - // Cecking if the value is out-of-bounds or is outside the mask. - if (curentInNeighborhoodPixelIntensity < this->m_Min || curentInNeighborhoodPixelIntensity > this->m_Max || - alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + inputNIt.GetOffset(nb)) || - (maskPointer && maskPointer->GetPixel(curentInNeighborhoodIndex) != this->m_InsidePixelValue)) + bool isInImage; + inputNIt.GetPixel(inputNIt.GetCenterNeighborhoodIndex(), isInImage); + if (!isInImage) { continue; } - - MeasurementType curentInNeighborhoodBinMin = hist->GetBinMinFromValue(0, curentInNeighborhoodPixelIntensity); - MeasurementType curentInNeighborhoodBinMax = hist->GetBinMaxFromValue(0, curentInNeighborhoodPixelIntensity); - MeasurementType lastBinMax = hist->GetDimensionMaxs(0)[hist->GetSize(0) - 1]; - - PixelType pixelIntensity(NumericTraits::ZeroValue()); - OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; - IndexType lastGoodIndex = curentInNeighborhoodIndex; - bool runLengthSegmentAlreadyVisited = false; - bool insideNeighborhood = true; - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) - { - int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); - if (boundDistance < 0) - { - insideNeighborhood = false; - break; - } - } - - // Scan from the iterated pixel at index, following the direction of - // offset. Run length is computed as the length of continuous pixel - // whose pixel values are in the same bin. - while (insideNeighborhood) + } + // If the voxel is outside of the mask, don't treat it + if ((maskPointer && maskPointer->GetPixel(inputNIt.GetIndex()) != this->m_InsidePixelValue)) + { + ++inputNIt; + ++outputIt; + continue; + } + // Initialisation of the histogram + hist->SetToZero(); + hist->Modified(); + // Iteration over all the offsets + typename OffsetVector::ConstIterator offsets; + for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) + { + alreadyVisitedImage->FillBuffer(false); + OffsetType offset = offsets.Value(); + this->NormalizeOffsetDirection(offset); + // Iteration over the all neighborhood + for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { - // For the same offset, each run length segment can only be visited once - if (alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + iteratedOffset)) + IndexType curentInNeighborhoodIndex = inputNIt.GetIndex(nb); + const PixelType curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + // Cecking if the value is out-of-bounds or is outside the mask. + if (curentInNeighborhoodPixelIntensity < this->m_Min || curentInNeighborhoodPixelIntensity > this->m_Max || + alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + inputNIt.GetOffset(nb)) || + (maskPointer && maskPointer->GetPixel(curentInNeighborhoodIndex) != this->m_InsidePixelValue)) { - runLengthSegmentAlreadyVisited = true; - break; + continue; } - pixelIntensity = inputNIt.GetPixel(iteratedOffset); - - // Special attention paid to boundaries of bins. - // For the last bin, it is left close and right close (following the previous - // gerrit patch). For all other bins, the bin is left close and right open. - if (pixelIntensity >= curentInNeighborhoodBinMin && - (pixelIntensity < curentInNeighborhoodBinMax || - (Math::ExactlyEquals(pixelIntensity, curentInNeighborhoodBinMax) && - Math::ExactlyEquals(curentInNeighborhoodBinMax, lastBinMax)))) + // Declaration and initialisation of the variables usefull to iterate over the run + MeasurementType curentInNeighborhoodBinMin = hist->GetBinMinFromValue(0, curentInNeighborhoodPixelIntensity); + MeasurementType curentInNeighborhoodBinMax = hist->GetBinMaxFromValue(0, curentInNeighborhoodPixelIntensity); + MeasurementType lastBinMax = hist->GetDimensionMaxs(0)[hist->GetSize(0) - 1]; + PixelType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; + IndexType lastGoodIndex = curentInNeighborhoodIndex; + bool runLengthSegmentAlreadyVisited = false; + bool insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); + // Scan from the iterated pixel at index, following the direction of + // offset. Run length is computed as the length of continuous pixel + // whose pixel values are in the same bin. + while (insideNeighborhood) { - alreadyVisitedImage->SetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); - lastGoodIndex = inputNIt.GetIndex(iteratedOffset); - iteratedOffset += offset; - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) + // If the voxel reached is outside of the image, stop the iterations + if (fit == faceList.begin()) { - int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); - if (boundDistance < 0) + bool isInImage; + inputNIt.GetPixel(iteratedOffset, isInImage); + if (!isInImage) { - insideNeighborhood = false; break; } } + // For the same offset, each run length segment can only be visited once + if (alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + iteratedOffset)) + { + runLengthSegmentAlreadyVisited = true; + break; + } + pixelIntensity = inputNIt.GetPixel(iteratedOffset); + // Special attention paid to boundaries of bins. + // For the last bin, it is left close and right close (following the previous + // gerrit patch). For all other bins, the bin is left close and right open. + if (pixelIntensity >= curentInNeighborhoodBinMin && + (pixelIntensity < curentInNeighborhoodBinMax || + (Math::ExactlyEquals(pixelIntensity, curentInNeighborhoodBinMax) && + Math::ExactlyEquals(curentInNeighborhoodBinMax, lastBinMax)))) + { + alreadyVisitedImage->SetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); + lastGoodIndex = inputNIt.GetIndex(iteratedOffset); + iteratedOffset += offset; + insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); + } + else + { + break; + } } - else + if (runLengthSegmentAlreadyVisited) { - break; + continue; } - } - if (runLengthSegmentAlreadyVisited) - { - continue; - } - - PointType curentInNeighborhoodPoint; - inputPtr->TransformIndexToPhysicalPoint(curentInNeighborhoodIndex, curentInNeighborhoodPoint); - PointType point; - inputPtr->TransformIndexToPhysicalPoint(lastGoodIndex, point); - - run[0] = curentInNeighborhoodPixelIntensity; - run[1] = curentInNeighborhoodPoint.EuclideanDistanceTo(point); - if (run[1] >= this->m_MinDistance && run[1] <= this->m_MaxDistance) - { - hist->GetIndex(run, hIndex); - hist->IncreaseFrequencyOfIndex(hIndex, 1); + // Increase the good bin in the histogram + this->IncreaseHistograme( + hist, inputPtr, run, hIndex, curentInNeighborhoodPixelIntensity, curentInNeighborhoodIndex, lastGoodIndex); } } - } - - runLengthMatrixCalculator->SetInput(hist); - runLengthMatrixCalculator->Update(); - outputIt.Set(runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); - - ++inputNIt; - ++outputIt; - } - - /// ***** With-boundary Regions ***** - fit++; - for (fit; fit != faceList.end(); ++fit) - { - // NeighborhoodIteratorType boundaryInputNIt(m_NeighborhoodRadius, inputPtr, *fit ); - // typedef itk::ImageRegionIterator< OutputImageType> IteratorType; - // IteratorType boundaryOutputIt( outputPtr, *fit ); + // Compute the run lenght features + runLengthMatrixCalculator->SetInput(hist); + runLengthMatrixCalculator->Update(); + for (fnameIt = this->m_RequestedFeatures->Begin(); fnameIt != m_RequestedFeatures->End(); ++fnameIt) + { + outputPixel.SetNthComponent( + (InternalRunLengthFeatureName)fnameIt.Value(), + runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); + } + outputIt.Set(outputPixel); - // // Iteration over the all image region - // while( !boundaryInputNIt.IsAtEnd() ) - // { - // boundaryOutputIt.Set( 0 ); - // ++boundaryInputNIt; - // ++boundaryOutputIt; - // } + ++inputNIt; + ++outputIt; + } } } @@ -383,10 +365,52 @@ ScalarImageToRunLengthFeaturesImageFilter InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + + // Apply the filter + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx similarity index 53% rename from Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx rename to Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx index 6bf1cdb07f7..891cc491470 100644 --- a/Modules/Filtering/TextureFeatures/test/FilterCreationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx @@ -15,59 +15,55 @@ * limitations under the License. * *=========================================================================*/ +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" #include "itkImage.h" +#include "itkVector.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" -#include "itkHistogramToRunLengthFeaturesFilter.h" -#include "itkScalarImageToRunLengthMatrixFilter.h" -#include "itkScalarImageToRunLengthFeaturesFilter.h" - #include "itkNeighborhood.h" -#include "itkMath.h" int -FilterCreationTest(int argc, char * argv[]) +ScalarImageToRunLengthFeaturesImageFilterTest(int argc, char * argv[]) { - // Parse command line argumentsa - std::string inputFilename = argv[1]; // Setup types - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader readerType; + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; // Create and setup a reader readerType::Pointer reader = readerType::New(); - /// reader->SetFileName( inputFilename.c_str() ); - reader->SetFileName( - "/home/jean-baptiste/Professional/Projects/TextureFeatures/ITKTextureFeatures/test/Baseline/Scan_CBCT_1L.nrrd"); - reader->UpdateLargestPossibleRegion(); - InputImageType::Pointer im = reader->GetOutput(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); // Create and setup a maskReader readerType::Pointer maskReader = readerType::New(); - maskReader->SetFileName( - "/home/jean-baptiste/Professional/Projects/TextureFeatures/ITKTextureFeatures/test/Baseline/SegmC_CBCT_1L.nrrd"); - maskReader->UpdateLargestPossibleRegion(); - InputImageType::Pointer mask = maskReader->GetOutput(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); // Apply the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - filter->SetInput(im); - filter->SetMaskImage(mask); - filter->SetNumberOfBinsPerAxis(10); - filter->SetPixelValueMinMax(-300, 4000); - filter->SetDistanceValueMinMax(0, 200); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); + hood.SetRadius(std::atoi(argv[9])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } filter->UpdateLargestPossibleRegion(); - OutputImageType::Pointer output = filter->GetOutput(); // Create and setup a writter typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - writer->SetFileName("result.nrrd"); - writer->SetInput(output); + std::string outputFilename = argv[3]; + writer->SetFileName(outputFilename.c_str()); + writer->SetInput(filter->GetOutput()); writer->UpdateLargestPossibleRegion(); return EXIT_SUCCESS; diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx new file mode 100644 index 00000000000..16010e2ad30 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx @@ -0,0 +1,84 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" +#include "itkVectorIndexSelectionCastImageFilter.h" + +int +ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); + hood.SetRadius(std::atoi(argv[9])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + for (unsigned int i = 0; i < 10; i++) + { + typedef itk::Image imageFeatures; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); + indexSelectionFilter->SetIndex(i); + indexSelectionFilter->SetInput(filter->GetOutput()); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; + ss << i; + std::string s = ss.str(); + writer->SetFileName(outputFilename + "_" + s + ".nrrd"); + writer->SetInput(indexSelectionFilter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + } + + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx new file mode 100644 index 00000000000..698d3cd5b59 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx @@ -0,0 +1,64 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" + +int +ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + if (argc >= 4) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[3])); + filter->SetPixelValueMinMax(std::atof(argv[4]), std::atof(argv[5])); + filter->SetDistanceValueMinMax(std::atof(argv[6]), std::atof(argv[7])); + hood.SetRadius(std::atoi(argv[8])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[2]; + writer->SetFileName(outputFilename.c_str()); + writer->SetInput(filter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + + return EXIT_SUCCESS; +} From 7f02ba7cb4c2793554cbf957cafa195315f37605 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 11 Apr 2017 10:01:01 -0400 Subject: [PATCH 012/135] STYLE: Cleaning of the code - Deletion of unused libraries - Deletion of useless variable (fastComputation) - Code style correction (variables starting with lower case) - Orthographic corrections --- ...calarImageToRunLengthFeaturesImageFilter.h | 7 ------ ...larImageToRunLengthFeaturesImageFilter.hxx | 24 ++++++++----------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index f32a9231f91..0c659bde746 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -19,7 +19,6 @@ #define itkScalarImageToRunLengthFeaturesImageFilter_h #include "itkImageToImageFilter.h" -#include "itkImageRegion.h" #include "itkConstNeighborhoodIterator.h" #include "itkHistogramToRunLengthFeaturesFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" @@ -180,11 +179,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter itkSetMacro(InsidePixelValue, PixelType); itkGetConstMacro(InsidePixelValue, PixelType); - - itkGetConstMacro(FastCalculations, bool); - itkSetMacro(FastCalculations, bool); - itkBooleanMacro(FastCalculations); - #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); @@ -222,7 +216,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter NeighborhoodRadiusType m_NeighborhoodRadius; FeatureNameVectorConstPointer m_RequestedFeatures; OffsetVectorPointer m_Offsets; - bool m_FastCalculations; unsigned int m_NumberOfBinsPerAxis; PixelType m_Min; PixelType m_Max; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 195b0a39dc6..aaf757106ab 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -1,4 +1,4 @@ -/*========================================================================= +/*========================================================================= * * Copyright Insight Software Consortium * @@ -23,9 +23,7 @@ #include "itkImageRegionIteratorWithIndex.h" #include "itkMath.h" #include "itkRegionOfInterestImageFilter.h" -#include "itkImageFileWriter.h" #include "itkNeighborhoodAlgorithm.h" -#include namespace itk { @@ -85,13 +83,12 @@ ScalarImageToRunLengthFeaturesImageFilterpush_back(offset); } this->SetOffsets(offsets); - this->m_FastCalculations = false; - NeighborhoodType Nhood; - Nhood.SetRadius(2); + NeighborhoodType nhood; + nhood.SetRadius(2); const unsigned int measurementVectorSize = 2; - this->m_NeighborhoodRadius = Nhood.GetRadius(); + this->m_NeighborhoodRadius = nhood.GetRadius(); this->m_LowerBound.SetSize(measurementVectorSize); this->m_UpperBound.SetSize(measurementVectorSize); @@ -137,7 +134,7 @@ ScalarImageToRunLengthFeaturesImageFilterSetRegions(boolRegion); alreadyVisitedImage->Allocate(); - // Creation of the histogram that will be fill and used to compute the features + // Creation of the histogram that will be filled and used to compute the features const unsigned int measurementVectorSize = 2; typename HistogramType::IndexType hIndex; typename HistogramType::Pointer hist = HistogramType::New(); @@ -167,9 +164,9 @@ ScalarImageToRunLengthFeaturesImageFilterGetMeasurementVectorSize()); hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); // Separation of the non-boundery region that will be processed in a different way - NeighborhoodAlgorithm::ImageBoundaryFacesCalculator BoundaryFacesCalculator; + NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - BoundaryFacesCalculator(inputPtr, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(inputPtr, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); @@ -210,7 +207,7 @@ ScalarImageToRunLengthFeaturesImageFilterFillBuffer(false); OffsetType offset = offsets.Value(); this->NormalizeOffsetDirection(offset); - // Iteration over the all neighborhood + // Iteration over the all neighborhood region for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { IndexType curentInNeighborhoodIndex = inputNIt.GetIndex(nb); @@ -275,7 +272,7 @@ ScalarImageToRunLengthFeaturesImageFilterIncreaseHistograme( hist, inputPtr, run, hIndex, curentInNeighborhoodPixelIntensity, curentInNeighborhoodIndex, lastGoodIndex); } @@ -419,7 +416,6 @@ ScalarImageToRunLengthFeaturesImageFilterGetRequestedFeatures() << std::endl; - os << indent << "FastCalculations: " << this->GetFastCalculations() << std::endl; os << indent << "Offsets: " << this->GetOffsets() << std::endl; } } // end of namespace Statistics From fb84d210bc37c1096094717383879c3c7bb04e97 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 13 Apr 2017 09:47:55 -0400 Subject: [PATCH 013/135] ENH: Digitalisation of the input image as a pre-treatement in order to improve the computation time --- ...calarImageToRunLengthFeaturesImageFilter.h | 23 +++---- ...larImageToRunLengthFeaturesImageFilter.hxx | 63 +++++++++++++------ 2 files changed, 56 insertions(+), 30 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 0c659bde746..8f47cf02715 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -213,17 +213,18 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter // virtual void GenerateOutputInformation() ITK_OVERRIDE; private: - NeighborhoodRadiusType m_NeighborhoodRadius; - FeatureNameVectorConstPointer m_RequestedFeatures; - OffsetVectorPointer m_Offsets; - unsigned int m_NumberOfBinsPerAxis; - PixelType m_Min; - PixelType m_Max; - RealType m_MinDistance; - RealType m_MaxDistance; - PixelType m_InsidePixelValue; - MeasurementVectorType m_LowerBound; - MeasurementVectorType m_UpperBound; + typename InputImageType::Pointer m_digitalisedInputImage; + NeighborhoodRadiusType m_NeighborhoodRadius; + FeatureNameVectorConstPointer m_RequestedFeatures; + OffsetVectorPointer m_Offsets; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_Min; + PixelType m_Max; + RealType m_MinDistance; + RealType m_MaxDistance; + PixelType m_InsidePixelValue; + MeasurementVectorType m_LowerBound; + MeasurementVectorType m_UpperBound; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index aaf757106ab..cb80c4017ee 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -113,6 +113,34 @@ ScalarImageToRunLengthFeaturesImageFilterm_LowerBound[1] = this->m_MinDistance; this->m_UpperBound[0] = this->m_Max; this->m_UpperBound[1] = this->m_MaxDistance; + + typename HistogramType::Pointer hist = HistogramType::New(); + hist->SetMeasurementVectorSize(2); + typename HistogramType::SizeType size(2); + size.Fill(this->m_NumberOfBinsPerAxis); + hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); + + this->m_digitalisedInputImage = InputImageType::New(); + this->m_digitalisedInputImage->SetRegions(this->GetInput()->GetRequestedRegion()); + this->m_digitalisedInputImage->CopyInformation(this->GetInput()); + this->m_digitalisedInputImage->Allocate(); + typedef itk::ImageRegionIterator IteratorType; + IteratorType digitIt(this->m_digitalisedInputImage, this->m_digitalisedInputImage->GetLargestPossibleRegion()); + typedef itk::ImageRegionConstIterator ConstIteratorType; + ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); + while (!inputIt.IsAtEnd()) + { + if (inputIt.Get() < this->m_Min || inputIt.Get() > this->m_Max) + { + digitIt.Set(inputIt.Get()); + } + else + { + digitIt.Set(hist->GetBinMinFromValue(0, inputIt.Get())); + } + ++inputIt; + ++digitIt; + } } template @@ -121,8 +149,6 @@ ScalarImageToRunLengthFeaturesImageFilter(this->GetInput()); typename TInputImage::Pointer maskPointer = TInputImage::New(); maskPointer = const_cast(this->GetMaskImage()); typename TOutputImage::Pointer outputPtr = TOutputImage::New(); @@ -150,7 +176,7 @@ ScalarImageToRunLengthFeaturesImageFilterCopyInformation(inputPtr); + alreadyVisitedImage->CopyInformation(this->m_digitalisedInputImage); alreadyVisitedImage->SetRegions(boolRegion); alreadyVisitedImage->Allocate(); @@ -166,14 +192,14 @@ ScalarImageToRunLengthFeaturesImageFilter boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - boundaryFacesCalculator(inputPtr, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(this->m_digitalisedInputImage, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); /// ***** Non-boundary Region ***** for (fit; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, inputPtr, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_digitalisedInputImage, *fit); typedef itk::ImageRegionIterator IteratorType; IteratorType outputIt(outputPtr, *fit); @@ -220,14 +246,11 @@ ScalarImageToRunLengthFeaturesImageFilterGetBinMinFromValue(0, curentInNeighborhoodPixelIntensity); - MeasurementType curentInNeighborhoodBinMax = hist->GetBinMaxFromValue(0, curentInNeighborhoodPixelIntensity); - MeasurementType lastBinMax = hist->GetDimensionMaxs(0)[hist->GetSize(0) - 1]; - PixelType pixelIntensity(NumericTraits::ZeroValue()); - OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; - IndexType lastGoodIndex = curentInNeighborhoodIndex; - bool runLengthSegmentAlreadyVisited = false; - bool insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); + PixelType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; + IndexType lastGoodIndex = curentInNeighborhoodIndex; + bool runLengthSegmentAlreadyVisited = false; + bool insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); // Scan from the iterated pixel at index, following the direction of // offset. Run length is computed as the length of continuous pixel // whose pixel values are in the same bin. @@ -253,10 +276,7 @@ ScalarImageToRunLengthFeaturesImageFilter= curentInNeighborhoodBinMin && - (pixelIntensity < curentInNeighborhoodBinMax || - (Math::ExactlyEquals(pixelIntensity, curentInNeighborhoodBinMax) && - Math::ExactlyEquals(curentInNeighborhoodBinMax, lastBinMax)))) + if (pixelIntensity == curentInNeighborhoodPixelIntensity) { alreadyVisitedImage->SetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); lastGoodIndex = inputNIt.GetIndex(iteratedOffset); @@ -273,8 +293,13 @@ ScalarImageToRunLengthFeaturesImageFilterIncreaseHistograme( - hist, inputPtr, run, hIndex, curentInNeighborhoodPixelIntensity, curentInNeighborhoodIndex, lastGoodIndex); + this->IncreaseHistograme(hist, + this->m_digitalisedInputImage, + run, + hIndex, + curentInNeighborhoodPixelIntensity, + curentInNeighborhoodIndex, + lastGoodIndex); } } // Compute the run lenght features From 15b04841fc3085caf73d27c85a0cfd63da1ed26d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 13 Apr 2017 11:42:08 -0400 Subject: [PATCH 014/135] ENH: Implementation of a new method to comute the lenght of the runs in order to improve the computation time --- ...calarImageToRunLengthFeaturesImageFilter.h | 41 ++++++++--------- ...larImageToRunLengthFeaturesImageFilter.hxx | 45 ++++++++++--------- 2 files changed, 45 insertions(+), 41 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 8f47cf02715..afe69bec59f 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -193,15 +193,15 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter void NormalizeOffsetDirection(OffsetType & offset); bool - IsInsideNeighborhood(OffsetType iteratedOffset); + IsInsideNeighborhood(const OffsetType & iteratedOffset); void - IncreaseHistograme(typename HistogramType::Pointer & hist, - typename TInputImage::Pointer inputPtr, - MeasurementVectorType run, - typename HistogramType::IndexType & hIndex, - const PixelType curentInNeighborhoodPixelIntensity, - IndexType curentInNeighborhoodIndex, - IndexType lastGoodIndex); + IncreaseHistograme(typename HistogramType::Pointer & hist, + const typename TInputImage::Pointer & inputPtr, + MeasurementVectorType & run, + typename HistogramType::IndexType & hIndex, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; @@ -213,18 +213,19 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter // virtual void GenerateOutputInformation() ITK_OVERRIDE; private: - typename InputImageType::Pointer m_digitalisedInputImage; - NeighborhoodRadiusType m_NeighborhoodRadius; - FeatureNameVectorConstPointer m_RequestedFeatures; - OffsetVectorPointer m_Offsets; - unsigned int m_NumberOfBinsPerAxis; - PixelType m_Min; - PixelType m_Max; - RealType m_MinDistance; - RealType m_MaxDistance; - PixelType m_InsidePixelValue; - MeasurementVectorType m_LowerBound; - MeasurementVectorType m_UpperBound; + typename InputImageType::Pointer m_digitalisedInputImage; + NeighborhoodRadiusType m_NeighborhoodRadius; + FeatureNameVectorConstPointer m_RequestedFeatures; + OffsetVectorPointer m_Offsets; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_Min; + PixelType m_Max; + RealType m_MinDistance; + RealType m_MaxDistance; + PixelType m_InsidePixelValue; + MeasurementVectorType m_LowerBound; + MeasurementVectorType m_UpperBound; + typename TInputImage::SpacingType m_spacing; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index cb80c4017ee..fa761445cbb 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -141,6 +141,7 @@ ScalarImageToRunLengthFeaturesImageFilterGetInput()->GetSpacing(); } template @@ -246,11 +247,11 @@ ScalarImageToRunLengthFeaturesImageFilter::ZeroValue()); - OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; - IndexType lastGoodIndex = curentInNeighborhoodIndex; - bool runLengthSegmentAlreadyVisited = false; - bool insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); + PixelType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; + unsigned int pixelDistance = 0; + bool runLengthSegmentAlreadyVisited = false; + bool insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); // Scan from the iterated pixel at index, following the direction of // offset. Run length is computed as the length of continuous pixel // whose pixel values are in the same bin. @@ -279,7 +280,7 @@ ScalarImageToRunLengthFeaturesImageFilterSetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); - lastGoodIndex = inputNIt.GetIndex(iteratedOffset); + pixelDistance++; iteratedOffset += offset; insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); } @@ -298,8 +299,8 @@ ScalarImageToRunLengthFeaturesImageFilter bool ScalarImageToRunLengthFeaturesImageFilter:: - IsInsideNeighborhood(OffsetType iteratedOffset) + IsInsideNeighborhood(const OffsetType & iteratedOffset) { bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) @@ -411,21 +412,23 @@ ScalarImageToRunLengthFeaturesImageFilter void ScalarImageToRunLengthFeaturesImageFilter::IncreaseHistograme( - typename HistogramType::Pointer & hist, - typename TInputImage::Pointer inputPtr, - MeasurementVectorType run, - typename HistogramType::IndexType & hIndex, - const PixelType curentInNeighborhoodPixelIntensity, - IndexType curentInNeighborhoodIndex, - IndexType lastGoodIndex) + typename HistogramType::Pointer & hist, + const typename TInputImage::Pointer & inputPtr, + MeasurementVectorType & run, + typename HistogramType::IndexType & hIndex, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance) { - PointType curentInNeighborhoodPoint; - inputPtr->TransformIndexToPhysicalPoint(curentInNeighborhoodIndex, curentInNeighborhoodPoint); - PointType point; - inputPtr->TransformIndexToPhysicalPoint(lastGoodIndex, point); + float offsetDistance = 0; + for (unsigned int i = 0; i < offset.GetOffsetDimension(); ++i) + { + offsetDistance += std::pow(offset[i] * m_spacing[i], 2); + } + offsetDistance = std::pow(offsetDistance, 1.0 / offset.GetOffsetDimension()); run[0] = curentInNeighborhoodPixelIntensity; - run[1] = curentInNeighborhoodPoint.EuclideanDistanceTo(point); + run[1] = offsetDistance * pixelDistance; if (run[1] >= this->m_MinDistance && run[1] <= this->m_MaxDistance) { hist->GetIndex(run, hIndex); From e0cefe0b852e523c9cc5d30a5b87eeb8014ac31f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 13 Apr 2017 11:50:20 -0400 Subject: [PATCH 015/135] STYLE: Adding of the DOXYGEN documentation and KWStyle correction --- ...calarImageToRunLengthFeaturesImageFilter.h | 66 +++++++++++++++++-- ...larImageToRunLengthFeaturesImageFilter.hxx | 22 +++---- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index afe69bec59f..4891e78343c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -31,15 +31,71 @@ namespace itk namespace Statistics { /** \class ScalarImageToRunLengthFeaturesImageFilter - * \brief This class computes colormaps thanks to run length descriptors from an image. + * \brief This class computes run length features for each voxel of + * a given image and a mask image if provided. The output image can then be + * displayed by using colormaps. * + * This filter computes a N-D image where each voxel will contain + * a vector of up to 10 scalars representing the run length features + * (of the specified neighborhood) from a N-D scalar image. + * The run length features are computed for each spatial + * direction and averaged afterward. + * The result obtained is a possible texture description. See the following references. + * M. M. Galloway. Texture analysis using gray level run lengths. Computer + * Graphics and Image Processing, 4:172-179, 1975. + * + * A. Chu, C. M. Sehgal, and J. F. Greenleaf. Use of gray value distribution of + * run lengths for texture analysis. Pattern Recognition Letters, 11:415-420, + * 1990. + * + * B. R. Dasarathy and E. B. Holder. Image characterizations based on joint + * gray-level run-length distributions. Pattern Recognition Letters, 12:490-502, + * 1991. + * + * Template Parameters: + * -# The input image type: a N dimensional image where the pixel type MUST be integer. + * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points. + * -# The type of histogram frequency container: if you are using a large number + * of bins per axis, a sparse frequency container may be advisable. + * The default is to use a dense frequency container. + * + * Inputs and parameters: + * -# An image + * -# A mask defining the region over which texture features will be + * calculated. (Optional) + * -# The pixel value that defines the "inside" of the mask. (Optional, defaults + * to 1 if a mask is set.) + * -# The set of features to be calculated. These features are defined + * in the HistogramToRunLengthFeaturesFilter class. + * -# The number of intensity bins. (Optional, defaults to 256.) + * -# The set of directions (offsets) to average across. (Optional, defaults to + * {(-1, 0), (-1, -1), (0, -1), (1, -1)} for 2D images and scales analogously + * for ND images.) + * -# The pixel intensity range over which the features will be calculated. + * (Optional, defaults to the full dynamic range of the pixel type.) + * -# The distance range over which the features will be calculated. + * (Optional, defaults to the full dynamic range of double type.) + * + * Recommendations: + * -# Input image: To improve the computation time, the useful data should take as much + * space as possible in the input image. If the useful data is concentrated in one part of + * the image a crop step should be considered prior to the usage of this filter. + * -# Mask: Even if optional, the usage of a mask will greatly improve the computation time. + * -# Number of intensity bins: The number of bins should be adapted to the type of results expected + * and the intensity and distances ranges. In addition a high number of bins will increase the + * computation time. + * -# Pixel intensity range: For better results the Pixel intensity should be adapted to the input image + * intensity range. For example they could be the minimum and maximum intensity of the image, or 0 and + * the maximum intensity (if the negative values are considered as noise). + * -# Distance range: For better results the distance range should be adapted to the spacing of the input image + * and the size of the neighborhood. * * \sa ScalarImageToRunLengthFeaturesFilter * \sa ScalarImageToRunLengthMatrixFilter * \sa HistogramToRunLengthFeaturesFilter * - * \author: Vimort Jean-Baptiste - * \ingroup ITKStatistics + * \author: Jean-Baptiste Vimort + * \ingroup TextureFeatures */ template @@ -213,7 +269,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter // virtual void GenerateOutputInformation() ITK_OVERRIDE; private: - typename InputImageType::Pointer m_digitalisedInputImage; + typename InputImageType::Pointer m_DigitalisedInputImageg; NeighborhoodRadiusType m_NeighborhoodRadius; FeatureNameVectorConstPointer m_RequestedFeatures; OffsetVectorPointer m_Offsets; @@ -225,7 +281,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter PixelType m_InsidePixelValue; MeasurementVectorType m_LowerBound; MeasurementVectorType m_UpperBound; - typename TInputImage::SpacingType m_spacing; + typename TInputImage::SpacingType m_Spacing; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index fa761445cbb..a70af5bf633 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -120,12 +120,12 @@ ScalarImageToRunLengthFeaturesImageFilterm_NumberOfBinsPerAxis); hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); - this->m_digitalisedInputImage = InputImageType::New(); - this->m_digitalisedInputImage->SetRegions(this->GetInput()->GetRequestedRegion()); - this->m_digitalisedInputImage->CopyInformation(this->GetInput()); - this->m_digitalisedInputImage->Allocate(); + this->m_DigitalisedInputImageg = InputImageType::New(); + this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); + this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); + this->m_DigitalisedInputImageg->Allocate(); typedef itk::ImageRegionIterator IteratorType; - IteratorType digitIt(this->m_digitalisedInputImage, this->m_digitalisedInputImage->GetLargestPossibleRegion()); + IteratorType digitIt(this->m_DigitalisedInputImageg, this->m_DigitalisedInputImageg->GetLargestPossibleRegion()); typedef itk::ImageRegionConstIterator ConstIteratorType; ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); while (!inputIt.IsAtEnd()) @@ -141,7 +141,7 @@ ScalarImageToRunLengthFeaturesImageFilterGetInput()->GetSpacing(); + m_Spacing = this->GetInput()->GetSpacing(); } template @@ -177,7 +177,7 @@ ScalarImageToRunLengthFeaturesImageFilterCopyInformation(this->m_digitalisedInputImage); + alreadyVisitedImage->CopyInformation(this->m_DigitalisedInputImageg); alreadyVisitedImage->SetRegions(boolRegion); alreadyVisitedImage->Allocate(); @@ -193,14 +193,14 @@ ScalarImageToRunLengthFeaturesImageFilter boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - boundaryFacesCalculator(this->m_digitalisedInputImage, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); /// ***** Non-boundary Region ***** for (fit; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_digitalisedInputImage, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit); typedef itk::ImageRegionIterator IteratorType; IteratorType outputIt(outputPtr, *fit); @@ -295,7 +295,7 @@ ScalarImageToRunLengthFeaturesImageFilterIncreaseHistograme(hist, - this->m_digitalisedInputImage, + this->m_DigitalisedInputImageg, run, hIndex, curentInNeighborhoodPixelIntensity, @@ -423,7 +423,7 @@ ScalarImageToRunLengthFeaturesImageFilter Date: Thu, 13 Apr 2017 13:42:23 -0400 Subject: [PATCH 016/135] ENH: Simplification of the code in order to improve the computation time --- ...calarImageToRunLengthFeaturesImageFilter.h | 12 ++- ...larImageToRunLengthFeaturesImageFilter.hxx | 81 ++++++++++--------- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 4891e78343c..c0a5af27a7e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -251,13 +251,11 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - IncreaseHistograme(typename HistogramType::Pointer & hist, - const typename TInputImage::Pointer & inputPtr, - MeasurementVectorType & run, - typename HistogramType::IndexType & hIndex, - const PixelType & curentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance); + IncreaseHistograme(typename HistogramType::Pointer & hist, + MeasurementVectorType & run, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index a70af5bf633..a86164bcf09 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -120,6 +120,8 @@ ScalarImageToRunLengthFeaturesImageFilterm_NumberOfBinsPerAxis); hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); + typename TInputImage::Pointer maskPointer = TInputImage::New(); + maskPointer = const_cast(this->GetMaskImage()); this->m_DigitalisedInputImageg = InputImageType::New(); this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); @@ -130,9 +132,13 @@ ScalarImageToRunLengthFeaturesImageFilterGetInput(), this->GetInput()->GetLargestPossibleRegion()); while (!inputIt.IsAtEnd()) { - if (inputIt.Get() < this->m_Min || inputIt.Get() > this->m_Max) + if (maskPointer && maskPointer->GetPixel(inputIt.GetIndex()) != this->m_InsidePixelValue) { - digitIt.Set(inputIt.Get()); + digitIt.Set(this->m_Min - 10); + } + else if (inputIt.Get() < this->m_Min || inputIt.Get() > this->m_Max) + { + digitIt.Set(this->m_Min - 1); } else { @@ -150,8 +156,6 @@ ScalarImageToRunLengthFeaturesImageFilter(this->GetMaskImage()); typename TOutputImage::Pointer outputPtr = TOutputImage::New(); outputPtr = this->GetOutput(); @@ -197,6 +201,24 @@ ScalarImageToRunLengthFeaturesImageFilter::FaceListType::iterator fit = faceList.begin(); + // Declaration of the variables usefull to iterate over the all image region + bool isInImage; + typename OffsetVector::ConstIterator offsets; + + // Declaration of the variables usefull to iterate over the all the offsets + OffsetType offset; + + // Declaration of the variables usefull to iterate over the all neighborhood region + PixelType curentInNeighborhoodPixelIntensity; + + // Declaration of the variables usefull to iterate over the run + PixelType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType iteratedOffset; + OffsetType tempOffset; + unsigned int pixelDistance; + bool runLengthSegmentAlreadyVisited; + bool insideNeighborhood; + /// ***** Non-boundary Region ***** for (fit; fit != faceList.end(); ++fit) { @@ -210,7 +232,6 @@ ScalarImageToRunLengthFeaturesImageFilterGetPixel(inputNIt.GetIndex()) != this->m_InsidePixelValue)) + if (inputNIt.GetCenterPixel() < (this->m_Min - 5)) // the pixel is outside of the mask { ++inputNIt; ++outputIt; @@ -228,30 +249,28 @@ ScalarImageToRunLengthFeaturesImageFilterSetToZero(); hist->Modified(); // Iteration over all the offsets - typename OffsetVector::ConstIterator offsets; for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) { alreadyVisitedImage->FillBuffer(false); - OffsetType offset = offsets.Value(); + offset = offsets.Value(); this->NormalizeOffsetDirection(offset); // Iteration over the all neighborhood region for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { - IndexType curentInNeighborhoodIndex = inputNIt.GetIndex(nb); - const PixelType curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + tempOffset = inputNIt.GetOffset(nb); // Cecking if the value is out-of-bounds or is outside the mask. - if (curentInNeighborhoodPixelIntensity < this->m_Min || curentInNeighborhoodPixelIntensity > this->m_Max || - alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + inputNIt.GetOffset(nb)) || - (maskPointer && maskPointer->GetPixel(curentInNeighborhoodIndex) != this->m_InsidePixelValue)) + if (curentInNeighborhoodPixelIntensity < + this->m_Min || // the pixel is outside of the mask or outside of bounds + alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + tempOffset)) { continue; } - // Declaration and initialisation of the variables usefull to iterate over the run - PixelType pixelIntensity(NumericTraits::ZeroValue()); - OffsetType iteratedOffset = inputNIt.GetOffset(nb) + offset; - unsigned int pixelDistance = 0; - bool runLengthSegmentAlreadyVisited = false; - bool insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); + // Initialisation of the variables usefull to iterate over the run + iteratedOffset = tempOffset + offset; + pixelDistance = 0; + runLengthSegmentAlreadyVisited = false; + insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); // Scan from the iterated pixel at index, following the direction of // offset. Run length is computed as the length of continuous pixel // whose pixel values are in the same bin. @@ -260,7 +279,6 @@ ScalarImageToRunLengthFeaturesImageFilterIncreaseHistograme(hist, - this->m_DigitalisedInputImageg, - run, - hIndex, - curentInNeighborhoodPixelIntensity, - offset, - pixelDistance); + this->IncreaseHistograme(hist, run, curentInNeighborhoodPixelIntensity, offset, pixelDistance); } } // Compute the run lenght features @@ -412,13 +424,11 @@ ScalarImageToRunLengthFeaturesImageFilter void ScalarImageToRunLengthFeaturesImageFilter::IncreaseHistograme( - typename HistogramType::Pointer & hist, - const typename TInputImage::Pointer & inputPtr, - MeasurementVectorType & run, - typename HistogramType::IndexType & hIndex, - const PixelType & curentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance) + typename HistogramType::Pointer & hist, + MeasurementVectorType & run, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance) { float offsetDistance = 0; for (unsigned int i = 0; i < offset.GetOffsetDimension(); ++i) @@ -431,8 +441,7 @@ ScalarImageToRunLengthFeaturesImageFilter= this->m_MinDistance && run[1] <= this->m_MaxDistance) { - hist->GetIndex(run, hIndex); - hist->IncreaseFrequencyOfIndex(hIndex, 1); + hist->IncreaseFrequencyOfMeasurement(run, 1); } } From 08da6524395d942b682a1f18b47ddd71e8bea1d1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 14 Apr 2017 10:49:18 -0400 Subject: [PATCH 017/135] STYLE: Modification of the data for the tests --- .../TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 | 2 +- .../TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 | 2 +- .../TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 | 2 +- .../TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 | 2 +- .../TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 | 1 + .../test/Data/resultSeparateFeatures_0.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_1.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_2.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_3.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_4.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_5.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_6.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_7.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_8.nrrd.sha512 | 2 +- .../test/Data/resultSeparateFeatures_9.nrrd.sha512 | 2 +- .../test/Data/resultTestWithoutMask1.nrrd.sha512 | 2 +- .../test/Data/resultTestWithoutMask2.nrrd.sha512 | 2 +- .../test/Data/resultTestWithoutMask3.nrrd.sha512 | 2 +- .../TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 | 2 +- 19 files changed, 19 insertions(+), 18 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 index 25bb2599b2f..d0997ab78c4 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 @@ -1 +1 @@ -e61838622b8396b727247daf1578b81a76337aeb9cbb2de867b6060eff9165e675bc623057e969cb3f893ded8f7dad309558256dd969983bebc4f9a84dad8873 \ No newline at end of file +51021537bf300d3c919ca231341ec7c8c68a067ee72bf37a3929fa6f1aa1dd282c9b850c4f84baf104a4bc167b4b5739eee3868e58fc41a24006db975e7655d3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 index 9c380a0cf08..7f087e8f9fa 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 @@ -1 +1 @@ -e9efd1ed0712289c27e285ed66481c6799eeaaa17983e2a264bbec262040bfa50d3e3e4b86d0b19f1a61a58491f66ad44ef0548dce8664b4fe9da87466d4621c \ No newline at end of file +ee3ee74d47e22850be988fe756d3aec0f2d8b6925bc4610c8d2746ad3f64aaf427e18467454e398ebfe13aa026913f89b3c40feac9971f985954fd7eb7c8fad5 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 index 9660853e033..8d0bae64ad2 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 @@ -1 +1 @@ -1dcb31ed386ac94540df7f477c010b6379e7036231b8a7fe8fb2ef87583132121bfbe90777364917cd0ccafed585c887e78ed54b832a25a035a806030d50d39f \ No newline at end of file +703ce13ca1d97ce082268d858ceb56f5e119a2353e3c3c2db1ab3f4938b2ac2ab7ea33436d89faa34bc7d6b45f32e9050524a01bf0550696efea6068223826f2 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 index df0c524c0bf..d3e7c119a9d 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 @@ -1 +1 @@ -6ee20729caf3df50f73434e2fbe63fcea88be2d692da29a520e7ff248689019222e8cecfd578e3808dafde1739081e0f58f8fd91efa878e21265e88a8420053c \ No newline at end of file +03787f9d9b93c2e5859fe8c6def0f50d77dab9bee2229bc864e654fdba311af2971addd93e4d6673db038b91487724eaebf50de6966bd906be8c75f3ea39f139 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 new file mode 100644 index 00000000000..7a212be2477 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 @@ -0,0 +1 @@ +58995cbe8e732547734cf6ff6ece433d9166c36f0e50eb529dfdcbdba078f71caf7a6a79bd1644c33dbb3c64ff256a57676d7f41fc343718f436982c51007fac \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 index 453958ab4cd..3534446f207 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 @@ -1 +1 @@ -bd1b368ea1efc1dfd758fc743fa2a13900364760688903c9aa1a10152a70756904984c29703c96e82316a1b98fc52e5251f455a15f36a96de2189e894058ff4d \ No newline at end of file +d49e8304412d63f2d5dd8f3cd4bbba32691ef0c2c9957d5f6aac578c436baada357e2e21b5e9106c234361692e3f721c598f7e70351f0641415a0c31d0d15048 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 index 33e71ead34c..1965bb162e9 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 @@ -1 +1 @@ -819336fc8abce97b1a43a50b5571a50982cb1abd67ee52ced91f7617ef1d8b5cd95fbc71d29ec7c0023be242b40607d60382b96d0cbce19912d5aeb57320a1e5 \ No newline at end of file +a66bc8c5ada58e587a09cb58bf9f24b3732e38914bbab6dd7c617fa9971a8b025efbbee3534757dcf251e9f974b68aeb4db73f4e9f34b3321a039852514f776f \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 index 5746a92d455..8c6f08b63a4 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 @@ -1 +1 @@ -1c7612ff95b6e677a1f8c3e0e9ecb6a21a6d6860216575f0c1c9dac59681bce24e45c1349006b7a134f880ade37c7f280f38ff857277794b13b1cdd38700c284 \ No newline at end of file +46e6fd68dd1d55a6280c4b9d03c7c492ecae4418067a7c3d345c35da2a002b82eaa1def361c74e5d196b5b88f79b07a4ca6a617907135dcb8ec248dbc0de4bbf \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 index f391f1c0f96..f77fcebe408 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 @@ -1 +1 @@ -20b300a45b7b6606ad42582fcaa7d2d0022dba3764f8dbe13ebc792a0e46983fbea32ce7947ebd95a34f146600b89a4d54c0e68938d3c382fa4db2f9293eec9b \ No newline at end of file +0f1f8fa49b135cda157b9db7b59a644c05d3b182c99b5c14b0d0d463162d6a82b262864bce78a9286998f515109634b0622896e11ebd2d0943295f996353214d \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 index c8fca6702c5..82d3cadcb57 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 @@ -1 +1 @@ -fa92160f104934f7c8aab7199a40f851a22874e789fb34c9d5961c9a89663b6f500ea308e2b82ac59f5c6e9829511ad8975acb8a3317c04effea006b9de5ea56 \ No newline at end of file +7accbd845ecd30b87e87379efbc3aa51e259f054335cba8d62b7d4fd2313298eb707e036dd6612638ae2c0402d45d52fd1d2a423eaef4d7584aa60720073ae1a \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 index 1ae93e089a9..7b7a04cb2fe 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 @@ -1 +1 @@ -b54ee21166aa3c6a2d8d2018cb5dd17a2f4d5a20bb7b3df4be6b97ebff91b75a28338265e88e7400ea17d9a2025ce54ba4df5b603ccd0923ff069985d683fe71 \ No newline at end of file +9f06ab36f190e263cef24088e3ade25f573526e92ad441d262c1045c995ead7eec962851ea7ed33161b7d93a7e44ee59004c0edbc10079800ee9ae041b1e6ce2 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 index a63c48da01f..d54c978d845 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 @@ -1 +1 @@ -6a7a48a3b7fe55d53d4552b433199862fd8673b03ff86c512dfb4d22ed6477f239743f6c127df54445ca726c071a0b4deb27df9044322cdc34debd9599f1e3f4 \ No newline at end of file +0d4aa40f5317785743e291f86632a8be79939ddc13a8c54901d7dda9f0f3dbc1aaebce3074c4befd08fac38872968eedccdd6a659f42d1c8765cf308671a3a85 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 index e8db91347d0..0baa427bacd 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 @@ -1 +1 @@ -0ebacdd3e7b474c8a523d2f85b8f6a81c2b74f646abd7ee7e4af7082919dee328cec21e1a810d885961b2dcaab2e5fbdb18fd150d5131de0913eec4983aeabe6 \ No newline at end of file +a30a333e6c1eecf7c0c4eb5194a0d117fac2379545563ba0d5566bfecf48e0786e309d107fb8455529aa657b302465698a070fec320d0bec6aa7c0b55ca53a22 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 index 19b3df5be31..25c7842c289 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 @@ -1 +1 @@ -d76fdbbab26dc01c71011a4e6904a7a5ade8f7e38d763e8c231e6c49150b5fbbf6a1cda966276ca1b93cb5c48493ffa06f602f783e22d7bd62fb0cdaa7788c0a \ No newline at end of file +b0d5c5f4c3afad6308e60d002a74a2bfa0607cb0aeeb9bcd60adb03ddc8abb16b5bdfebf11cfde667dcb4e5aeb942ff437a9613999f32d114266a98d70d87974 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 index 66a8f517044..6ee930ee69e 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 @@ -1 +1 @@ -20526d77a8747969d5badfd4bd7533f7e34b6ade83776dfdeb65ff4cb03f33a9788121207bb11b633a99820b0df00854d959ef9c49909bca86880a0ae916a761 \ No newline at end of file +ced65409bb679bef2470c7ca9340f70f2722d36be7d18edaf29794f0e18f64e8a70152054ba3ab9a68947a65c26cfde9752c4435713d161e4107d5e664a5d9be \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 index 3dbb0e07b65..d274a7a5f58 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 @@ -1 +1 @@ -fa50c62ec3216a1a2c2a0fed2097ee414f65c3565131f868410dc3f986595a32587779ad8548c29a093428e44c6b4ec7a3a15eb55a04972492b749aca55fc282 \ No newline at end of file +bec7c53d7f4bde54dff10b42d577a67588af5e83b9d2b9e3e50e91a260c1f34dc6f382efd78a72d9460c4d4bd84fbded506ecb63cfb70e3dad492cfb8de19229 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 index 367c436ec15..d41059db1a0 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 @@ -1 +1 @@ -8914eafe372460e4004ebf43b14a21311169dd09c3bbc36b64583005d9de5a012c23d6a510bb1acab12eb178c7cb43e79d970fe7a4f0f50f9a47e0404e1aae45 \ No newline at end of file +0443594d42c08bb7e4dbafa99b70b410a759d3343aa4dc91c16caf6af9d2ca6fcf2905d38f70dfe9dfacab3d4418aa8eb201a87c945026544fbc4f5231857db2 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 index b263f54d3e8..524b8f85e1c 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 @@ -1 +1 @@ -8291f3e8c95a72cc57c4aacbd3d984eb0a9db89d4333e529afcdf69b874e2280c657f89cdff54e78b6591144a430108a0c9bba11ffae7ec69338bb7a111584e5 \ No newline at end of file +050633e8a1b6e298e44200b2c0a42e3e42fdcb3b95518dfa4207cb8efeebab5f3f391ad06c6b56ea8430845b32693b153795ebbf874e8eb5055ecfddb723dfd5 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 index 5e5f718b1c2..f2149cb4f85 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 @@ -1 +1 @@ -d6d34340cfb78b5233bb3c6ce61867c4feef26c27f8fe54c10fecb62238f27654f5bf490505ca2b5c59c1a300c8c550d47f3ab03700007311a70675a29d3b88a \ No newline at end of file +647bbf865f9443c0c27e660cbad44d39ee5c503d548455d15b34ea4599b3e7ba99bfca7fd95d2d87b0ef3ce766acd12790959b23914d2a18dc758d42831806a9 \ No newline at end of file From 94c40525fe5117668f3d443b9d78a30f82d5972f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 14 Apr 2017 10:51:24 -0400 Subject: [PATCH 018/135] ENH: Adding of a progress reporter in the threaded generated data --- .../include/itkScalarImageToRunLengthFeaturesImageFilter.hxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index a86164bcf09..f6c6a32cfa6 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -24,6 +24,7 @@ #include "itkMath.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" +#include "itkProgressReporter.h" namespace itk { @@ -159,6 +160,8 @@ ScalarImageToRunLengthFeaturesImageFilterGetOutput(); + ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); + // Creation of the filter that will compute the Run Lenght features once the histogrham computed typename RunLengthFeaturesFilterType::Pointer runLengthMatrixCalculator = RunLengthFeaturesFilterType::New(); typedef typename RunLengthFeaturesFilterType::RunLengthFeatureName InternalRunLengthFeatureName; @@ -241,6 +244,7 @@ ScalarImageToRunLengthFeaturesImageFilterm_Min - 5)) // the pixel is outside of the mask { + progress.CompletedPixel(); ++inputNIt; ++outputIt; continue; @@ -326,6 +330,7 @@ ScalarImageToRunLengthFeaturesImageFilter Date: Mon, 17 Apr 2017 14:26:23 -0400 Subject: [PATCH 019/135] ENH: Correction of the test parameters --- .../TextureFeatures/test/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index bbf92a105f3..17d847516d1 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -38,7 +38,7 @@ itk_add_test( 0 4200 0 - 0.4 + 0.7 2 ) @@ -53,10 +53,10 @@ itk_add_test( DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask2.nrrd 10 - 1000 + 0 4200 0 - 0.4 + 1.25 4 ) @@ -74,7 +74,7 @@ itk_add_test( 0 4200 0 - 1 + 1.8 6 ) @@ -93,7 +93,7 @@ itk_add_test( 0 4200 0 - 0.4 + 0.7 2 ) @@ -109,10 +109,10 @@ itk_add_test( DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage2.nrrd 10 - 1000 + 0 4200 0 - 0.4 + 1.25 4 ) @@ -131,7 +131,7 @@ itk_add_test( 0 4200 0 - 0.4 + 0.7 2 ) @@ -177,6 +177,6 @@ itk_add_test( 0 4200 0 - 0.4 + 0.7 2 ) From 73f844de772037bacbf14846f17e2cd8010ae3cd Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 17 Apr 2017 15:27:28 -0400 Subject: [PATCH 020/135] ENH: New algorythm without the utilisation of the itkHistogram class in order to have a faster computation --- ...calarImageToRunLengthFeaturesImageFilter.h | 63 ++-- ...larImageToRunLengthFeaturesImageFilter.hxx | 283 ++++++++++-------- 2 files changed, 178 insertions(+), 168 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index c0a5af27a7e..16320ca72ba 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -19,12 +19,7 @@ #define itkScalarImageToRunLengthFeaturesImageFilter_h #include "itkImageToImageFilter.h" -#include "itkConstNeighborhoodIterator.h" -#include "itkHistogramToRunLengthFeaturesFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" -#include "itkNumericTraits.h" -#include "itkHistogram.h" - namespace itk { @@ -55,9 +50,6 @@ namespace Statistics * Template Parameters: * -# The input image type: a N dimensional image where the pixel type MUST be integer. * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points. - * -# The type of histogram frequency container: if you are using a large number - * of bins per axis, a sparse frequency container may be advisable. - * The default is to use a dense frequency container. * * Inputs and parameters: * -# An image @@ -65,8 +57,6 @@ namespace Statistics * calculated. (Optional) * -# The pixel value that defines the "inside" of the mask. (Optional, defaults * to 1 if a mask is set.) - * -# The set of features to be calculated. These features are defined - * in the HistogramToRunLengthFeaturesFilter class. * -# The number of intensity bins. (Optional, defaults to 256.) * -# The set of directions (offsets) to average across. (Optional, defaults to * {(-1, 0), (-1, -1), (0, -1), (1, -1)} for 2D images and scales analogously @@ -98,7 +88,7 @@ namespace Statistics * \ingroup TextureFeatures */ -template +template class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter : public ImageToImageFilter { @@ -115,9 +105,8 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter /** standard New() method support */ itkNewMacro(Self); - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef THistogramFrequencyContainer FrequencyContainerType; + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; typedef typename InputImageType::PixelType PixelType; typedef typename InputImageType::IndexType IndexType; @@ -135,21 +124,10 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; - typedef typename NumericTraits::RealType MeasurementType; - typedef typename NumericTraits::RealType RealType; - typedef Histogram HistogramType; - typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; - typedef HistogramToRunLengthFeaturesFilter RunLengthFeaturesFilterType; - - typedef short RunLengthFeatureName; - typedef VectorContainer FeatureNameVector; - typedef typename FeatureNameVector::ConstPointer FeatureNameVectorConstPointer; - - - /** Set the desired feature set. Optional, for default value see above. */ - itkSetConstObjectMacro(RequestedFeatures, FeatureNameVector); - itkGetConstObjectMacro(RequestedFeatures, FeatureNameVector); + typedef typename NumericTraits::RealType MeasurementType; + typedef typename NumericTraits::RealType RealType; + /** Method to set/get the Neighborhood radius */ itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); @@ -235,10 +213,20 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter itkSetMacro(InsidePixelValue, PixelType); itkGetConstMacro(InsidePixelValue, PixelType); + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename NumericTraits::ScalarRealType OutputRealType; + + + /** Create the Output */ + typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; + using Superclass::MakeOutput; + DataObject::Pointer + MakeOutput(DataObjectPointerArraySizeType idx); + #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); - itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); + itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); // End concept checking #endif @@ -251,11 +239,15 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - IncreaseHistograme(typename HistogramType::Pointer & hist, - MeasurementVectorType & run, - const PixelType & curentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance); + IncreaseHistograme(unsigned int ** hist, + unsigned int & totalNumberOfRuns, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance); + void + ComputeFeatures(unsigned int ** hist, + const unsigned int & totalNumberOfRuns, + typename TOutputImage::PixelType & outputPixel); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; @@ -269,7 +261,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter private: typename InputImageType::Pointer m_DigitalisedInputImageg; NeighborhoodRadiusType m_NeighborhoodRadius; - FeatureNameVectorConstPointer m_RequestedFeatures; OffsetVectorPointer m_Offsets; unsigned int m_NumberOfBinsPerAxis; PixelType m_Min; @@ -277,8 +268,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter RealType m_MinDistance; RealType m_MaxDistance; PixelType m_InsidePixelValue; - MeasurementVectorType m_LowerBound; - MeasurementVectorType m_UpperBound; typename TInputImage::SpacingType m_Spacing; }; } // end of namespace Statistics diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index f6c6a32cfa6..1a119e70726 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -19,20 +19,15 @@ #define itkScalarImageToRunLengthFeaturesImageFilter_hxx #include "itkScalarImageToRunLengthFeaturesImageFilter.h" -#include "itkNeighborhood.h" -#include "itkImageRegionIteratorWithIndex.h" -#include "itkMath.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" -#include "itkProgressReporter.h" namespace itk { namespace Statistics { -template -ScalarImageToRunLengthFeaturesImageFilter:: - ScalarImageToRunLengthFeaturesImageFilter() +template +ScalarImageToRunLengthFeaturesImageFilter::ScalarImageToRunLengthFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_Min(NumericTraits::NonpositiveMin()) , m_Max(NumericTraits::max()) @@ -43,30 +38,6 @@ ScalarImageToRunLengthFeaturesImageFilterSetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); - for (int i = 1; i < 2; ++i) - { - this->ProcessObject::SetNthOutput(i, this->MakeOutput(i)); - } - - // Set the requested features to the default value: - // {Energy, Entropy, InverseDifferenceMoment, Inertia, ClusterShade, - // ClusterProminence} - typename FeatureNameVector::Pointer requestedFeatures = FeatureNameVector::New(); - // can't directly set this->m_RequestedFeatures since it is const! - - requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::LongRunEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::GreyLevelNonuniformity); - requestedFeatures->push_back(RunLengthFeaturesFilterType::RunLengthNonuniformity); - requestedFeatures->push_back(RunLengthFeaturesFilterType::LowGreyLevelRunEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::HighGreyLevelRunEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunLowGreyLevelEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::ShortRunHighGreyLevelEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::LongRunLowGreyLevelEmphasis); - requestedFeatures->push_back(RunLengthFeaturesFilterType::LongRunHighGreyLevelEmphasis); - - this->SetRequestedFeatures(requestedFeatures); - // Set the offset directions to their defaults: half of all the possible // directions 1 pixel away. (The other half is included by symmetry.) // We use a neighborhood iterator to calculate the appropriate offsets. @@ -86,41 +57,31 @@ ScalarImageToRunLengthFeaturesImageFilterSetOffsets(offsets); NeighborhoodType nhood; nhood.SetRadius(2); - - const unsigned int measurementVectorSize = 2; - this->m_NeighborhoodRadius = nhood.GetRadius(); - this->m_LowerBound.SetSize(measurementVectorSize); - this->m_UpperBound.SetSize(measurementVectorSize); - - this->m_LowerBound[0] = this->m_Min; - this->m_LowerBound[1] = this->m_MinDistance; - this->m_UpperBound[0] = this->m_Max; - this->m_UpperBound[1] = this->m_MaxDistance; - TOutputImage * outputPtr = this->GetOutput(); typename TOutputImage::PixelType pixelNull; pixelNull.Fill(0); outputPtr->FillBuffer(pixelNull); } -template -void -ScalarImageToRunLengthFeaturesImageFilter:: - BeforeThreadedGenerateData() +template +DataObject::Pointer +ScalarImageToRunLengthFeaturesImageFilter::MakeOutput(DataObjectPointerArraySizeType idx) { - this->m_LowerBound[0] = this->m_Min; - this->m_LowerBound[1] = this->m_MinDistance; - this->m_UpperBound[0] = this->m_Max; - this->m_UpperBound[1] = this->m_MaxDistance; + DataObject::Pointer output; - typename HistogramType::Pointer hist = HistogramType::New(); - hist->SetMeasurementVectorSize(2); - typename HistogramType::SizeType size(2); - size.Fill(this->m_NumberOfBinsPerAxis); - hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); + // if (std::is_same) + // { + + // } +} + +template +void +ScalarImageToRunLengthFeaturesImageFilter::BeforeThreadedGenerateData() +{ typename TInputImage::Pointer maskPointer = TInputImage::New(); maskPointer = const_cast(this->GetMaskImage()); this->m_DigitalisedInputImageg = InputImageType::New(); @@ -131,6 +92,7 @@ ScalarImageToRunLengthFeaturesImageFilterm_DigitalisedInputImageg, this->m_DigitalisedInputImageg->GetLargestPossibleRegion()); typedef itk::ImageRegionConstIterator ConstIteratorType; ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); + unsigned int binNumber; while (!inputIt.IsAtEnd()) { if (maskPointer && maskPointer->GetPixel(inputIt.GetIndex()) != this->m_InsidePixelValue) @@ -143,7 +105,8 @@ ScalarImageToRunLengthFeaturesImageFilterGetBinMinFromValue(0, inputIt.Get())); + binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / m_NumberOfBinsPerAxis); + digitIt.Set(binNumber); } ++inputIt; ++digitIt; @@ -151,10 +114,11 @@ ScalarImageToRunLengthFeaturesImageFilterGetInput()->GetSpacing(); } -template +template void -ScalarImageToRunLengthFeaturesImageFilter:: - ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) +ScalarImageToRunLengthFeaturesImageFilter::ThreadedGenerateData( + const OutputRegionType & outputRegionForThread, + ThreadIdType threadId) { // Recuperation of the different inputs/outputs typename TOutputImage::Pointer outputPtr = TOutputImage::New(); @@ -162,11 +126,8 @@ ScalarImageToRunLengthFeaturesImageFilterSetRegions(boolRegion); alreadyVisitedImage->Allocate(); - // Creation of the histogram that will be filled and used to compute the features - const unsigned int measurementVectorSize = 2; - typename HistogramType::IndexType hIndex; - typename HistogramType::Pointer hist = HistogramType::New(); - hist->SetMeasurementVectorSize(measurementVectorSize); - typename HistogramType::SizeType size(2); - size.Fill(this->m_NumberOfBinsPerAxis); - MeasurementVectorType run(hist->GetMeasurementVectorSize()); - hist->Initialize(size, this->m_LowerBound, this->m_UpperBound); // Separation of the non-boundery region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = @@ -209,7 +161,13 @@ ScalarImageToRunLengthFeaturesImageFilterm_Min - 5)) // the pixel is outside of the mask { @@ -250,8 +199,14 @@ ScalarImageToRunLengthFeaturesImageFilterSetToZero(); - hist->Modified(); + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + { + hist[a][b] = 0; + } + } + totalNumberOfRuns = 0; // Iteration over all the offsets for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) { @@ -316,18 +271,11 @@ ScalarImageToRunLengthFeaturesImageFilterIncreaseHistograme(hist, run, curentInNeighborhoodPixelIntensity, offset, pixelDistance); + this->IncreaseHistograme(hist, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); } } // Compute the run lenght features - runLengthMatrixCalculator->SetInput(hist); - runLengthMatrixCalculator->Update(); - for (fnameIt = this->m_RequestedFeatures->Begin(); fnameIt != m_RequestedFeatures->End(); ++fnameIt) - { - outputPixel.SetNthComponent( - (InternalRunLengthFeatureName)fnameIt.Value(), - runLengthMatrixCalculator->GetFeature((InternalRunLengthFeatureName)fnameIt.Value())); - } + this->ComputeFeatures(hist, totalNumberOfRuns, outputPixel); outputIt.Set(outputPixel); progress.CompletedPixel(); @@ -337,18 +285,17 @@ ScalarImageToRunLengthFeaturesImageFilter +template void -ScalarImageToRunLengthFeaturesImageFilter::SetMaskImage( - const InputImageType * image) +ScalarImageToRunLengthFeaturesImageFilter::SetMaskImage(const InputImageType * image) { // Process object is not const-correct so the const_cast is required here this->ProcessObject::SetNthInput(1, const_cast(image)); } -template +template const TInputImage * -ScalarImageToRunLengthFeaturesImageFilter::GetMaskImage() const +ScalarImageToRunLengthFeaturesImageFilter::GetMaskImage() const { if (this->GetNumberOfInputs() < 2) { @@ -357,11 +304,9 @@ ScalarImageToRunLengthFeaturesImageFilter(this->ProcessObject::GetInput(1)); } -template +template void -ScalarImageToRunLengthFeaturesImageFilter::SetPixelValueMinMax( - PixelType min, - PixelType max) +ScalarImageToRunLengthFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) { if (this->m_Min != min || this->m_Max != max) { @@ -371,10 +316,9 @@ ScalarImageToRunLengthFeaturesImageFilter +template void -ScalarImageToRunLengthFeaturesImageFilter:: - SetDistanceValueMinMax(RealType min, RealType max) +ScalarImageToRunLengthFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) { if (Math::NotExactlyEquals(this->m_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) { @@ -384,10 +328,9 @@ ScalarImageToRunLengthFeaturesImageFilter +template void -ScalarImageToRunLengthFeaturesImageFilter:: - NormalizeOffsetDirection(OffsetType & offset) +ScalarImageToRunLengthFeaturesImageFilter::NormalizeOffsetDirection(OffsetType & offset) { itkDebugMacro("old offset = " << offset << std::endl); int sign = 1; @@ -408,10 +351,10 @@ ScalarImageToRunLengthFeaturesImageFilterGetRequestedFeatures() << std::endl; - os << indent << "Offsets: " << this->GetOffsets() << std::endl; + OutputRealType shortRunEmphasis = NumericTraits::ZeroValue(); + OutputRealType longRunEmphasis = NumericTraits::ZeroValue(); + OutputRealType greyLevelNonuniformity = NumericTraits::ZeroValue(); + OutputRealType runLengthNonuniformity = NumericTraits::ZeroValue(); + OutputRealType lowGreyLevelRunEmphasis = NumericTraits::ZeroValue(); + OutputRealType highGreyLevelRunEmphasis = NumericTraits::ZeroValue(); + OutputRealType shortRunLowGreyLevelEmphasis = NumericTraits::ZeroValue(); + OutputRealType shortRunHighGreyLevelEmphasis = NumericTraits::ZeroValue(); + OutputRealType longRunLowGreyLevelEmphasis = NumericTraits::ZeroValue(); + OutputRealType longRunHighGreyLevelEmphasis = NumericTraits::ZeroValue(); + + vnl_vector greyLevelNonuniformityVector(m_NumberOfBinsPerAxis, 0.0); + vnl_vector runLengthNonuniformityVector(m_NumberOfBinsPerAxis, 0.0); + + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + { + OutputRealType frequency = hist[a][b]; + if (Math::ExactlyEquals(frequency, NumericTraits::ZeroValue())) + { + continue; + } + + double i2 = static_cast((a + 1) * (a + 1)); + double j2 = static_cast((b + 1) * (b + 1)); + + // Traditional measures + shortRunEmphasis += (frequency / j2); + longRunEmphasis += (frequency * j2); + + greyLevelNonuniformityVector[a] += frequency; + runLengthNonuniformityVector[b] += frequency; + + // measures from Chu et al. + lowGreyLevelRunEmphasis += (frequency / i2); + highGreyLevelRunEmphasis += (frequency * i2); + + // measures from Dasarathy and Holder + shortRunLowGreyLevelEmphasis += (frequency / (i2 * j2)); + shortRunHighGreyLevelEmphasis += (frequency * i2 / j2); + longRunLowGreyLevelEmphasis += (frequency * j2 / i2); + longRunHighGreyLevelEmphasis += (frequency * i2 * j2); + } + } + greyLevelNonuniformity = greyLevelNonuniformityVector.squared_magnitude(); + runLengthNonuniformity = runLengthNonuniformityVector.squared_magnitude(); + + // Normalize all measures by the total number of runs + + shortRunEmphasis /= static_cast(totalNumberOfRuns); + longRunEmphasis /= static_cast(totalNumberOfRuns); + greyLevelNonuniformity /= static_cast(totalNumberOfRuns); + runLengthNonuniformity /= static_cast(totalNumberOfRuns); + + lowGreyLevelRunEmphasis /= static_cast(totalNumberOfRuns); + highGreyLevelRunEmphasis /= static_cast(totalNumberOfRuns); + + shortRunLowGreyLevelEmphasis /= static_cast(totalNumberOfRuns); + shortRunHighGreyLevelEmphasis /= static_cast(totalNumberOfRuns); + longRunLowGreyLevelEmphasis /= static_cast(totalNumberOfRuns); + longRunHighGreyLevelEmphasis /= static_cast(totalNumberOfRuns); + + outputPixel[0] = shortRunEmphasis; + outputPixel[1] = longRunEmphasis; + outputPixel[2] = greyLevelNonuniformity; + outputPixel[3] = runLengthNonuniformity; + outputPixel[4] = lowGreyLevelRunEmphasis; + outputPixel[5] = highGreyLevelRunEmphasis; + outputPixel[6] = shortRunLowGreyLevelEmphasis; + outputPixel[7] = shortRunHighGreyLevelEmphasis; + outputPixel[8] = longRunLowGreyLevelEmphasis; + outputPixel[9] = longRunHighGreyLevelEmphasis; } + +template +void +ScalarImageToRunLengthFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +{} } // end of namespace Statistics } // end of namespace itk From 26978fbbf71b9471ce7a99ff5692bb0f963867a3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 18 Apr 2017 11:10:44 -0400 Subject: [PATCH 021/135] ENH: This filter now accept ITK::VectorImage as an output (in addition of the ITK::Image of ITK::Vector already suported) --- ...larImageToRunLengthFeaturesImageFilter.hxx | 14 +++- .../TextureFeatures/test/CMakeLists.txt | 39 +++++++++++ ...FeaturesImageFilterTestWithVectorImage.cxx | 70 +++++++++++++++++++ 3 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 1a119e70726..062fd948a5e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -112,6 +112,17 @@ ScalarImageToRunLengthFeaturesImageFilter::BeforeThre ++digitIt; } m_Spacing = this->GetInput()->GetSpacing(); + + // Support VectorImages by setting number of components on output. + typename TOutputImage::Pointer outputPtr = TOutputImage::New(); + outputPtr = this->GetOutput(); + int a = outputPtr->GetNumberOfComponentsPerPixel(); + if (10 != outputPtr->GetNumberOfComponentsPerPixel()) + { + outputPtr->SetNumberOfComponentsPerPixel(10); + } + outputPtr->Allocate(); + outputPtr->UpdateOutputData(); } template @@ -157,7 +168,8 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe faceList.begin(); // Declaration of the variables usefull to iterate over the all image region - bool isInImage; + bool isInImage; + outputPixel = outputPtr->GetPixel(boolCurentInNeighborhoodIndex); typename OffsetVector::ConstIterator offsets; // Declaration of the variables usefull to iterate over the all the offsets diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 17d847516d1..d04994c8ed7 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -11,6 +11,7 @@ set( ScalarImageToRunLengthFeaturesImageFilterTest.cxx ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx + ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx ) set(TestOutput ${ITK_TEST_OUTPUT_DIR}) @@ -24,6 +25,25 @@ itk_add_test( ScalarImageToRunLengthFeaturesImageFilterCreationTest ) +itk_add_test( + NAME ScalarImageToRunLengthFeaturesImageFilterVectorlImage1 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage1.nrrd} + ${TEMP}/resultVectorImage1.nrrd + ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultVectorlImage1.nrrd + 10 + 0 + 4200 + 0 + 0.7 + 2 +) + itk_add_test( NAME ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask1 COMMAND @@ -78,6 +98,25 @@ itk_add_test( 6 ) +itk_add_test( + NAME ScalarImageToRunLengthFeaturesImageFilterVectorImage2 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage2.nrrd} + ${TEMP}/resultVectorImage2.nrrd + ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultVectorImage2.nrrd + 10 + 0 + 4200 + 0 + 1.25 + 4 +) + itk_add_test( NAME ScalarImageToRunLengthFeaturesImageFilterPartialImage1 COMMAND diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx new file mode 100644 index 00000000000..9dabaec7811 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx @@ -0,0 +1,70 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVectorImage.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" + +int +ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); + hood.SetRadius(std::atoi(argv[9])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + writer->SetFileName(outputFilename.c_str()); + writer->SetInput(filter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + + return EXIT_SUCCESS; +} From c30cf1dc931800698bb51e0a578e43101ded548d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 18 Apr 2017 17:22:15 -0400 Subject: [PATCH 022/135] PERF: Deletion of a useless verification --- .../itkScalarImageToRunLengthFeaturesImageFilter.hxx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 062fd948a5e..cced8de4856 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -189,7 +189,6 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe OffsetType iteratedOffset; OffsetType tempOffset; unsigned int pixelDistance; - bool runLengthSegmentAlreadyVisited; bool insideNeighborhood; /// ***** Non-boundary Region ***** @@ -240,7 +239,6 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe // Initialisation of the variables usefull to iterate over the run iteratedOffset = tempOffset + offset; pixelDistance = 0; - runLengthSegmentAlreadyVisited = false; insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); // Scan from the iterated pixel at index, following the direction of // offset. Run length is computed as the length of continuous pixel @@ -256,12 +254,6 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe break; } } - // For the same offset, each run length segment can only be visited once - if (alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + iteratedOffset)) - { - runLengthSegmentAlreadyVisited = true; - break; - } pixelIntensity = inputNIt.GetPixel(iteratedOffset); // Special attention paid to boundaries of bins. // For the last bin, it is left close and right close (following the previous @@ -278,10 +270,6 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe break; } } - if (runLengthSegmentAlreadyVisited) - { - continue; - } // Increase the coresponding bin in the histogram this->IncreaseHistograme(hist, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); } From 464b4d4d49400361420e108b99ffe9246bed41fa Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 20 Apr 2017 09:30:43 -0400 Subject: [PATCH 023/135] PERF: Utilisation of std::sqrt intstead of std::pow --- .../include/itkScalarImageToRunLengthFeaturesImageFilter.hxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index cced8de4856..c4d356b3a36 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -116,7 +116,6 @@ ScalarImageToRunLengthFeaturesImageFilter::BeforeThre // Support VectorImages by setting number of components on output. typename TOutputImage::Pointer outputPtr = TOutputImage::New(); outputPtr = this->GetOutput(); - int a = outputPtr->GetNumberOfComponentsPerPixel(); if (10 != outputPtr->GetNumberOfComponentsPerPixel()) { outputPtr->SetNumberOfComponentsPerPixel(10); @@ -383,7 +382,7 @@ ScalarImageToRunLengthFeaturesImageFilter::IncreaseHi { offsetDistance += (offset[i] * m_Spacing[i]) * (offset[i] * m_Spacing[i]); } - offsetDistance = std::pow(offsetDistance, 1.0 / offset.GetOffsetDimension()); + offsetDistance = std::sqrt(offsetDistance); int offsetDistanceBin = (int)((offsetDistance * pixelDistance - m_MinDistance) / ((m_MaxDistance - m_MinDistance) / m_NumberOfBinsPerAxis)); From 3aa442635eab118218a3ae47d4af5caa153f3afc Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 24 Apr 2017 09:38:00 -0400 Subject: [PATCH 024/135] BUG: Correction of the VectorImage implementation for itkScalarImageToRunLengthFeaturesImageFilter Creation of an UpdateOutputInformation function --- ...calarImageToRunLengthFeaturesImageFilter.h | 10 ++---- ...larImageToRunLengthFeaturesImageFilter.hxx | 32 ++++++++++--------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 16320ca72ba..837f7e45bb0 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -216,13 +216,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter typedef typename OutputImageType::PixelType OutputPixelType; typedef typename NumericTraits::ScalarRealType OutputRealType; - - /** Create the Output */ - typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; - using Superclass::MakeOutput; - DataObject::Pointer - MakeOutput(DataObjectPointerArraySizeType idx); - #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); @@ -256,7 +249,8 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter BeforeThreadedGenerateData() ITK_OVERRIDE; virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; - // virtual void GenerateOutputInformation() ITK_OVERRIDE; + virtual void + UpdateOutputInformation() ITK_OVERRIDE; private: typename InputImageType::Pointer m_DigitalisedInputImageg; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index c4d356b3a36..5fe63e9e266 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -65,18 +65,6 @@ ScalarImageToRunLengthFeaturesImageFilter::ScalarImag outputPtr->FillBuffer(pixelNull); } -template -DataObject::Pointer -ScalarImageToRunLengthFeaturesImageFilter::MakeOutput(DataObjectPointerArraySizeType idx) -{ - DataObject::Pointer output; - - // if (std::is_same) - // { - - // } -} - template void @@ -116,12 +104,12 @@ ScalarImageToRunLengthFeaturesImageFilter::BeforeThre // Support VectorImages by setting number of components on output. typename TOutputImage::Pointer outputPtr = TOutputImage::New(); outputPtr = this->GetOutput(); - if (10 != outputPtr->GetNumberOfComponentsPerPixel()) + if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) { - outputPtr->SetNumberOfComponentsPerPixel(10); + typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; + AccessorFunctorType::SetVectorLength(outputPtr, 10); } outputPtr->Allocate(); - outputPtr->UpdateOutputData(); } template @@ -284,6 +272,20 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe } } +template +void +ScalarImageToRunLengthFeaturesImageFilter::UpdateOutputInformation() +{ + // Call superclass's version + Superclass::UpdateOutputInformation(); + + if (strcmp(this->GetOutput()->GetNameOfClass(), "VectorImage") == 0) + { + typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; + AccessorFunctorType::SetVectorLength(this->GetOutput(), 10); + } +} + template void ScalarImageToRunLengthFeaturesImageFilter::SetMaskImage(const InputImageType * image) From d621ae8f0a26921fc6f69ac60fde28128511692a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 24 Apr 2017 09:50:42 -0400 Subject: [PATCH 025/135] BUG: Correction and adding of some tests for ImageVector computation --- .../TextureFeatures/test/CMakeLists.txt | 89 ++++++++++++++----- .../test/Data/resultPartialImage1.nrrd.sha512 | 2 +- .../test/Data/resultPartialImage2.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_0.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_1.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_2.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_3.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_4.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_5.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_6.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_7.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_8.nrrd.sha512 | 2 +- .../Data/resultSeparateFeatures_9.nrrd.sha512 | 2 +- .../Data/resultTestWithoutMask1.nrrd.sha512 | 2 +- .../Data/resultTestWithoutMask2.nrrd.sha512 | 2 +- .../Data/resultTestWithoutMask3.nrrd.sha512 | 2 +- .../test/Data/resultWholeImage.nrrd.sha512 | 2 +- ...eaturesImageFilterTestSeparateFeatures.cxx | 9 +- ...eFilterTestVectorImageSeparateFeatures.cxx | 87 ++++++++++++++++++ 19 files changed, 176 insertions(+), 41 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index d04994c8ed7..69c175f7771 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -12,6 +12,7 @@ set( ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx + ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx ) set(TestOutput ${ITK_TEST_OUTPUT_DIR}) @@ -25,25 +26,6 @@ itk_add_test( ScalarImageToRunLengthFeaturesImageFilterCreationTest ) -itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterVectorlImage1 - COMMAND - TextureFeaturesTestDriver - --compare - DATA{${INPUTDATA}/resultPartialImage1.nrrd} - ${TEMP}/resultVectorImage1.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultVectorlImage1.nrrd - 10 - 0 - 4200 - 0 - 0.7 - 2 -) - itk_add_test( NAME ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask1 COMMAND @@ -98,6 +80,25 @@ itk_add_test( 6 ) +itk_add_test( + NAME ScalarImageToRunLengthFeaturesImageFilterVectorlImage1 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage1.nrrd} + ${TEMP}/resultVectorImage1.nrrd + ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultVectorImage1.nrrd + 10 + 0 + 4200 + 0 + 0.7 + 2 +) + itk_add_test( NAME ScalarImageToRunLengthFeaturesImageFilterVectorImage2 COMMAND @@ -216,6 +217,52 @@ itk_add_test( 0 4200 0 - 0.7 - 2 + 1.25 + 4 +) + +itk_add_test( + NAME ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_1.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_1.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_2.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_2.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_3.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_3.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_4.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_4.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_5.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_5.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_6.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_6.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_7.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_7.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_8.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_8.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_9.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_9.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_0.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_0.nrrd + ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures + DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures + 10 + 0 + 4200 + 0 + 1.25 + 4 ) diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 index 8d0bae64ad2..375da115e85 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 @@ -1 +1 @@ -703ce13ca1d97ce082268d858ceb56f5e119a2353e3c3c2db1ab3f4938b2ac2ab7ea33436d89faa34bc7d6b45f32e9050524a01bf0550696efea6068223826f2 \ No newline at end of file +8c70b43e107ee5fd21549ed9865eb1c75969b1e52aa1694ba2026556f39df9120a5375611565652501830c0a7d3cc8b5b9af92e453e30a476187f869bb02d8d5 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 index d3e7c119a9d..4d243c4d436 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 @@ -1 +1 @@ -03787f9d9b93c2e5859fe8c6def0f50d77dab9bee2229bc864e654fdba311af2971addd93e4d6673db038b91487724eaebf50de6966bd906be8c75f3ea39f139 \ No newline at end of file +8932e5c79a498fcd8dbf7eb947431cf5a9c0f4fc9be4f73d4df884f76d94b01d6461278b98c30a3a700885fdc94097b4c42c322bf5a9743230289e3fa8f4949e \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 index 3534446f207..a523f0cc02a 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 @@ -1 +1 @@ -d49e8304412d63f2d5dd8f3cd4bbba32691ef0c2c9957d5f6aac578c436baada357e2e21b5e9106c234361692e3f721c598f7e70351f0641415a0c31d0d15048 \ No newline at end of file +93e24c141eafa6695a39ddd6576a0525421a4f785d348c1ef4e448114bc3dc04892851dce1d75254db3af8bfa176fd53b3f1389623eb08368dbf97651658fdc9 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 index 1965bb162e9..77b6325328a 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 @@ -1 +1 @@ -a66bc8c5ada58e587a09cb58bf9f24b3732e38914bbab6dd7c617fa9971a8b025efbbee3534757dcf251e9f974b68aeb4db73f4e9f34b3321a039852514f776f \ No newline at end of file +bb7b2358b4fbc0e3760380873aaacfee5f1f77239655f2723328df1c57a8a2c7de877557da04405dded6c3305d85f6c0a98cd0b324b3b77c3627c1c85d2630cb \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 index 8c6f08b63a4..950ebb1fb98 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 @@ -1 +1 @@ -46e6fd68dd1d55a6280c4b9d03c7c492ecae4418067a7c3d345c35da2a002b82eaa1def361c74e5d196b5b88f79b07a4ca6a617907135dcb8ec248dbc0de4bbf \ No newline at end of file +0f81d5019786648bd25c3c66b9246c3e8b0d8e408f1a0cc7c1cc1c6a63a4362e3c4067ffdd9e3a9770cdc553dba89ac617add0af9ca424a88943170dee18fb73 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 index f77fcebe408..6f1d0f5d377 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 @@ -1 +1 @@ -0f1f8fa49b135cda157b9db7b59a644c05d3b182c99b5c14b0d0d463162d6a82b262864bce78a9286998f515109634b0622896e11ebd2d0943295f996353214d \ No newline at end of file +e236783b1dacb95f20d24a51bf1c9cec07cb4443ed8229e53c8b02f84e873542a062d14263af50f33a8f3e3fa067e2f2f6816a8bf04209f990490c489da111f8 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 index 82d3cadcb57..6f4f89003f6 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 @@ -1 +1 @@ -7accbd845ecd30b87e87379efbc3aa51e259f054335cba8d62b7d4fd2313298eb707e036dd6612638ae2c0402d45d52fd1d2a423eaef4d7584aa60720073ae1a \ No newline at end of file +45368c67b67d4e015f3bd1924921bbe560116e48c7a1c3807358efee80bbf55ae86f48cddca20cefc08838eac3932504d7fb0a0aedd53a9a63380c771a0991a7 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 index 7b7a04cb2fe..77b34c4aef9 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 @@ -1 +1 @@ -9f06ab36f190e263cef24088e3ade25f573526e92ad441d262c1045c995ead7eec962851ea7ed33161b7d93a7e44ee59004c0edbc10079800ee9ae041b1e6ce2 \ No newline at end of file +cb93020a468ba4732d5dc247811a34ba5029c47120a3a5a354c129975682264350dffca7529f665f358e1448cbaa6f7311966d8b76c036966d6ab07dc6a69d4d \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 index d54c978d845..8f6499e69f2 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 @@ -1 +1 @@ -0d4aa40f5317785743e291f86632a8be79939ddc13a8c54901d7dda9f0f3dbc1aaebce3074c4befd08fac38872968eedccdd6a659f42d1c8765cf308671a3a85 \ No newline at end of file +2ab51fd7bdcba5e7556260b22af076e678428b7b07b6a2e436547d40eb519fdd4ad4a9e535d3bd0a5fb19bc0fde25e17d88ae0ea033aad91d2af2ed248f6c440 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 index 0baa427bacd..33045afc176 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 @@ -1 +1 @@ -a30a333e6c1eecf7c0c4eb5194a0d117fac2379545563ba0d5566bfecf48e0786e309d107fb8455529aa657b302465698a070fec320d0bec6aa7c0b55ca53a22 \ No newline at end of file +bba2452afe4e93a14f937d4e45a818d68877966c75cac4793d79c3a8a59646477ee7828a9b5fb89c6bc80c4a0c34f7af3d683dfec07c4dad5d0ceb071117c03f \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 index 25c7842c289..c282f2afafe 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 @@ -1 +1 @@ -b0d5c5f4c3afad6308e60d002a74a2bfa0607cb0aeeb9bcd60adb03ddc8abb16b5bdfebf11cfde667dcb4e5aeb942ff437a9613999f32d114266a98d70d87974 \ No newline at end of file +4720691961c132f0e859feb37b4cba1c3fbab39cf52dd2d5ede82e3b427097aad677872f14c1053d6eb2edcad7815d748e0a17b89eb82407ce252b7055e5d4ca \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 index 6ee930ee69e..8a211a47c14 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 @@ -1 +1 @@ -ced65409bb679bef2470c7ca9340f70f2722d36be7d18edaf29794f0e18f64e8a70152054ba3ab9a68947a65c26cfde9752c4435713d161e4107d5e664a5d9be \ No newline at end of file +eddafd8685feb10c672458b1785c40bcb854b04739af7e0bb83c59bc0f5a10f153ef4f9a35e9dc075118c6888d36fd1f131f3be5fb7b59c9d2013dc446c0e0d3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 index d274a7a5f58..75f26f04214 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 @@ -1 +1 @@ -bec7c53d7f4bde54dff10b42d577a67588af5e83b9d2b9e3e50e91a260c1f34dc6f382efd78a72d9460c4d4bd84fbded506ecb63cfb70e3dad492cfb8de19229 \ No newline at end of file +703536a733bf6b0b3363a7fcdb7815f39eec979af46831f6e667a95e56970a4303e2848b6377364b01d42c360bf757672d0af279c7fa816b170fcd3f82a5a2e3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 index d41059db1a0..4cc72d9def4 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 @@ -1 +1 @@ -0443594d42c08bb7e4dbafa99b70b410a759d3343aa4dc91c16caf6af9d2ca6fcf2905d38f70dfe9dfacab3d4418aa8eb201a87c945026544fbc4f5231857db2 \ No newline at end of file +c22139d6fc5ad86b46eb56f01d1add99d3f42d323a9e06ab1c31c3cb818bd6d8fc32f5780eb7a77ab7f62621b54aa4df66d1b55ef6c4082027bad1a3de3b1d5f \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 index 524b8f85e1c..8603179ae45 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 @@ -1 +1 @@ -050633e8a1b6e298e44200b2c0a42e3e42fdcb3b95518dfa4207cb8efeebab5f3f391ad06c6b56ea8430845b32693b153795ebbf874e8eb5055ecfddb723dfd5 \ No newline at end of file +bec921ec2279d8fad501058a24050ea3b88ebd06edb32f37cfb79a5eccaa690598adeb09604394855aa2ef2a8f9dc7691ceb1adc18be3df74c37a45924543618 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 index f2149cb4f85..93942e15070 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 @@ -1 +1 @@ -647bbf865f9443c0c27e660cbad44d39ee5c503d548455d15b34ea4599b3e7ba99bfca7fd95d2d87b0ef3ce766acd12790959b23914d2a18dc758d42831806a9 \ No newline at end of file +a53485703dec98137203d2f7beb22e364a56f088096464192f77964d101006c1225fc261d70b78945f40667f17f9b8fb44f124d785a65dd0d0c06601d976ed63 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx index 16010e2ad30..a2c5e9c7d15 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx @@ -59,13 +59,14 @@ ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures(int argc, char * a } filter->UpdateLargestPossibleRegion(); + typedef itk::Image imageFeatures; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); + indexSelectionFilter->SetInput(filter->GetOutput()); + for (unsigned int i = 0; i < 10; i++) { - typedef itk::Image imageFeatures; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; - IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetIndex(i); - indexSelectionFilter->SetInput(filter->GetOutput()); // Create and setup a writter typedef itk::ImageFileWriter WriterType; diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx new file mode 100644 index 00000000000..7eb674faf79 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -0,0 +1,87 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkImageAlgorithm.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" +#include "itkVectorIndexSelectionCastImageFilter.h" +#include "itkVectorImageToImageAdaptor.h" +#include "itkNthElementImageAdaptor.h" + +int +ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); + hood.SetRadius(std::atoi(argv[9])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + typedef itk::Image imageFeatures; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); + indexSelectionFilter->SetInput(filter->GetOutput()); + + for (unsigned int i = 0; i < 10; i++) + { + indexSelectionFilter->SetIndex(i); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; + ss << i; + std::string s = ss.str(); + writer->SetFileName(outputFilename + "_" + s + ".nrrd"); + writer->SetInput(indexSelectionFilter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + } + + + return EXIT_SUCCESS; +} From 8b3693bba02905037955e9158f5f580f70bc3eb5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 24 Apr 2017 12:48:58 -0400 Subject: [PATCH 026/135] PERF: Creation of the itkScalarImageToTextureFeaturesImageFilter class This class only contains accessor to the different variables for now It doesn't compute anything: the computing functions need to be created --- ...kScalarImageToTextureFeaturesImageFilter.h | 217 +++++++++++++++++ ...calarImageToTextureFeaturesImageFilter.hxx | 222 ++++++++++++++++++ 2 files changed, 439 insertions(+) create mode 100644 Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h create mode 100644 Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h new file mode 100644 index 00000000000..9b2037479c5 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -0,0 +1,217 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkScalarImageToTextureFeaturesImageFilter_h +#define itkScalarImageToTextureFeaturesImageFilter_h + +#include "itkImageToImageFilter.h" +#include "itkScalarImageToRunLengthMatrixFilter.h" + +namespace itk +{ +namespace Statistics +{ +/** \class ScalarImageToTextureFeaturesImageFilter + * \brief + * + * \author: Jean-Baptiste Vimort + * \ingroup TextureFeatures + */ + +template +class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public ImageToImageFilter +{ +public: + /** Standard typedefs */ + typedef ScalarImageToTextureFeaturesImageFilter Self; + typedef ImageToImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Run-time type information (and related methods). */ + itkTypeMacro(ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); + + /** standard New() method support */ + itkNewMacro(Self); + + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + + typedef typename InputImageType::PixelType PixelType; + typedef typename InputImageType::IndexType IndexType; + typedef typename InputImageType::PointType PointType; + + typedef typename InputImageType::OffsetType OffsetType; + typedef VectorContainer OffsetVector; + typedef typename OffsetVector::Pointer OffsetVectorPointer; + typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; + + typedef typename InputImageType::RegionType InputRegionType; + typedef typename OutputImageType::RegionType OutputRegionType; + + typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; + typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; + typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + + typedef typename NumericTraits::RealType MeasurementType; + typedef typename NumericTraits::RealType RealType; + + /** Method to set/get the Neighborhood radius */ + itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); + itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); + + /** Method to set the mask image */ + void + SetMaskImage(const InputImageType * image); + + /** Method to get the mask image */ + const InputImageType * + GetMaskImage() const; + + /** Specify the default number of bins per axis */ + itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); + + /** + * Set the offsets over which the intensity/distance pairs will be computed. + * Invoking this function clears the previous offsets. + * Note: for each individual offset in the OffsetVector, the rightmost non-zero + * offset element must be positive. For example, in the offset list of a 2D image, + * (1, 0) means the offset along x-axis. (1, 0) has to be set instead + * of (-1, 0). This is required from the iterating order of pixel iterator. + * + */ + itkSetObjectMacro(Offsets, OffsetVector); + + /** + * Set offset over which the intensity/distance pairs will be computed. + * Invoking this function clears the previous offset(s). + * Note: for each individual offset, the rightmost non-zero + * offset element must be positive. For example, in the offset list of a 2D image, + * (1, 0) means the offset along x-axis. (1, 0) has to be set instead + * of (-1, 0). This is required from the iterating order of pixel iterator. + * + */ + void + SetOffset(const OffsetType offset); + + /** + * Get the current offset(s). + */ + itkGetModifiableObjectMacro(Offsets, OffsetVector); + + /** Set number of histogram bins along each axis */ + itkSetMacro(NumberOfBinsPerAxis, unsigned int); + + /** Get number of histogram bins along each axis */ + itkGetConstMacro(NumberOfBinsPerAxis, unsigned int); + + /** + * Set the min and max (inclusive) pixel value that will be used in + * generating the histogram. + */ + void + SetPixelValueMinMax(PixelType min, PixelType max); + + /** Get the min pixel value defining one dimension of the joint histogram. */ + itkGetConstMacro(Min, PixelType); + + /** Get the max pixel value defining one dimension of the joint histogram. */ + itkGetConstMacro(Max, PixelType); + + /** + * Set the min and max (inclusive) pixel value that will be used in + * generating the histogram. + */ + void + SetDistanceValueMinMax(RealType min, RealType max); + + /** + * Get the min distance value defining one dimension of the joint histogram. + */ + itkGetConstMacro(MinDistance, RealType); + + /** + * Get the max distance value defining one dimension of the joint histogram. + */ + itkGetConstMacro(MaxDistance, RealType); + + /** + * Set the pixel value of the mask that should be considered "inside" the + * object. Defaults to 1. + */ + itkSetMacro(InsidePixelValue, PixelType); + itkGetConstMacro(InsidePixelValue, PixelType); + + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename NumericTraits::ScalarRealType OutputRealType; + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); + itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); + // End concept checking +#endif + +protected: + ScalarImageToTextureFeaturesImageFilter(); + virtual ~ScalarImageToTextureFeaturesImageFilter() {} + + void + NormalizeOffsetDirection(OffsetType & offset); + bool + IsInsideNeighborhood(const OffsetType & iteratedOffset); + void + IncreaseHistograme(unsigned int ** hist, + unsigned int & totalNumberOfRuns, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance); + void + ComputeFeatures(unsigned int ** hist, + const unsigned int & totalNumberOfRuns, + typename TOutputImage::PixelType & outputPixel); + virtual void + PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + /** This method causes the filter to generate its output. */ + virtual void + BeforeThreadedGenerateData() ITK_OVERRIDE; + virtual void + ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; + virtual void + UpdateOutputInformation() ITK_OVERRIDE; + +private: + typename InputImageType::Pointer m_DigitalisedInputImageg; + NeighborhoodRadiusType m_NeighborhoodRadius; + OffsetVectorPointer m_Offsets; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_Min; + PixelType m_Max; + RealType m_MinDistance; + RealType m_MaxDistance; + PixelType m_InsidePixelValue; + typename TInputImage::SpacingType m_Spacing; +}; +} // end of namespace Statistics +} // end of namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +# include "itkScalarImageToTextureFeaturesImageFilter.hxx" +#endif + +#endif diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx new file mode 100644 index 00000000000..a22ccc133c1 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -0,0 +1,222 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkScalarImageToTextureFeaturesImageFilter_hxx +#define itkScalarImageToTextureFeaturesImageFilter_hxx + +#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkRegionOfInterestImageFilter.h" +#include "itkNeighborhoodAlgorithm.h" + +namespace itk +{ +namespace Statistics +{ +template +ScalarImageToTextureFeaturesImageFilter::ScalarImageToTextureFeaturesImageFilter() + : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) + , m_Min(NumericTraits::NonpositiveMin()) + , m_Max(NumericTraits::max()) + , m_MinDistance(NumericTraits::ZeroValue()) + , m_MaxDistance(NumericTraits::max()) + , m_InsidePixelValue(NumericTraits::OneValue()) +{ + this->SetNumberOfRequiredInputs(1); + this->SetNumberOfRequiredOutputs(1); + + // Set the offset directions to their defaults: half of all the possible + // directions 1 pixel away. (The other half is included by symmetry.) + // We use a neighborhood iterator to calculate the appropriate offsets. + typedef Neighborhood NeighborhoodType; + NeighborhoodType hood; + hood.SetRadius(1); + + // select all "previous" neighbors that are face+edge+vertex + // connected to the iterated pixel. do not include the curentInNeighborhood pixel. + unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); + OffsetVectorPointer offsets = OffsetVector::New(); + for (unsigned int d = 0; d < centerIndex; d++) + { + OffsetType offset = hood.GetOffset(d); + offsets->push_back(offset); + } + this->SetOffsets(offsets); + NeighborhoodType nhood; + nhood.SetRadius(2); + this->m_NeighborhoodRadius = nhood.GetRadius(); + + TOutputImage * outputPtr = this->GetOutput(); + typename TOutputImage::PixelType pixelNull; + pixelNull.Fill(0); + outputPtr->FillBuffer(pixelNull); +} + + +template +void +ScalarImageToTextureFeaturesImageFilter::BeforeThreadedGenerateData() +{ + typename TInputImage::Pointer maskPointer = TInputImage::New(); + maskPointer = const_cast(this->GetMaskImage()); + this->m_DigitalisedInputImageg = InputImageType::New(); + this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); + this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); + this->m_DigitalisedInputImageg->Allocate(); + typedef itk::ImageRegionIterator IteratorType; + IteratorType digitIt(this->m_DigitalisedInputImageg, this->m_DigitalisedInputImageg->GetLargestPossibleRegion()); + typedef itk::ImageRegionConstIterator ConstIteratorType; + ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); + unsigned int binNumber; + while (!inputIt.IsAtEnd()) + { + if (maskPointer && maskPointer->GetPixel(inputIt.GetIndex()) != this->m_InsidePixelValue) + { + digitIt.Set(this->m_Min - 10); + } + else if (inputIt.Get() < this->m_Min || inputIt.Get() > this->m_Max) + { + digitIt.Set(this->m_Min - 1); + } + else + { + binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / m_NumberOfBinsPerAxis); + digitIt.Set(binNumber); + } + ++inputIt; + ++digitIt; + } + m_Spacing = this->GetInput()->GetSpacing(); + + // Support VectorImages by setting number of components on output. + typename TOutputImage::Pointer outputPtr = TOutputImage::New(); + outputPtr = this->GetOutput(); + if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) + { + typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; + AccessorFunctorType::SetVectorLength(outputPtr, 10); + } + outputPtr->Allocate(); +} + +template +void +ScalarImageToTextureFeaturesImageFilter::ThreadedGenerateData( + const OutputRegionType & outputRegionForThread, + ThreadIdType threadId) +{} + +template +void +ScalarImageToTextureFeaturesImageFilter::UpdateOutputInformation() +{ + // Call superclass's version + Superclass::UpdateOutputInformation(); + + if (strcmp(this->GetOutput()->GetNameOfClass(), "VectorImage") == 0) + { + typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; + AccessorFunctorType::SetVectorLength(this->GetOutput(), 10); + } +} + +template +void +ScalarImageToTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) +{ + // Process object is not const-correct so the const_cast is required here + this->ProcessObject::SetNthInput(1, const_cast(image)); +} + +template +const TInputImage * +ScalarImageToTextureFeaturesImageFilter::GetMaskImage() const +{ + if (this->GetNumberOfInputs() < 2) + { + return ITK_NULLPTR; + } + return static_cast(this->ProcessObject::GetInput(1)); +} + +template +void +ScalarImageToTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) +{ + if (this->m_Min != min || this->m_Max != max) + { + this->m_Min = min; + this->m_Max = max; + this->Modified(); + } +} + +template +void +ScalarImageToTextureFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) +{ + if (Math::NotExactlyEquals(this->m_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) + { + this->m_MinDistance = min; + this->m_MaxDistance = max; + this->Modified(); + } +} + +template +bool +ScalarImageToTextureFeaturesImageFilter::IsInsideNeighborhood( + const OffsetType & iteratedOffset) +{ + bool insideNeighborhood = true; + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) + { + int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); + if (boundDistance < 0) + { + insideNeighborhood = false; + break; + } + } + return insideNeighborhood; +} + +template +void +ScalarImageToTextureFeaturesImageFilter::IncreaseHistograme( + unsigned int ** hist, + unsigned int & totalNumberOfRuns, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance) +{} + +template +void +ScalarImageToTextureFeaturesImageFilter::ComputeFeatures( + unsigned int ** hist, + const unsigned int & totalNumberOfRuns, + typename TOutputImage::PixelType & outputPixel) +{} + +template +void +ScalarImageToTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +{} +} // end of namespace Statistics +} // end of namespace itk + +#endif From 0e753203d98a0551e14749bac565253e626bb72f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 24 Apr 2017 13:01:31 -0400 Subject: [PATCH 027/135] PERF: Adding of an intern variable in order to choose if the histogram need to be internally normalized --- .../include/itkScalarImageToTextureFeaturesImageFilter.h | 9 +++++++-- .../itkScalarImageToTextureFeaturesImageFilter.hxx | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index 9b2037479c5..225f2419566 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -156,6 +156,12 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image itkSetMacro(InsidePixelValue, PixelType); itkGetConstMacro(InsidePixelValue, PixelType); + /** Set the calculator to normalize the histogram (divide all bins by the + total frequency). Normalization is off by default. */ + itkSetMacro(Normalize, bool); + itkGetConstMacro(Normalize, bool); + itkBooleanMacro(Normalize); + typedef typename OutputImageType::PixelType OutputPixelType; typedef typename NumericTraits::ScalarRealType OutputRealType; @@ -170,8 +176,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image ScalarImageToTextureFeaturesImageFilter(); virtual ~ScalarImageToTextureFeaturesImageFilter() {} - void - NormalizeOffsetDirection(OffsetType & offset); bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void @@ -206,6 +210,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image RealType m_MaxDistance; PixelType m_InsidePixelValue; typename TInputImage::SpacingType m_Spacing; + bool m_Normalize; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index a22ccc133c1..c9acd6a2c6e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -63,6 +63,7 @@ ScalarImageToTextureFeaturesImageFilter::ScalarImageT typename TOutputImage::PixelType pixelNull; pixelNull.Fill(0); outputPtr->FillBuffer(pixelNull); + this->m_Normalize = false; } From bdc656cbac86d67dfdf47fa6640179d786b26e50 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 24 Apr 2017 14:54:34 -0400 Subject: [PATCH 028/135] ENH: Implementation of the computation part for ScalarImageToTextureFeaturesImageFilter --- ...kScalarImageToTextureFeaturesImageFilter.h | 27 +- ...calarImageToTextureFeaturesImageFilter.hxx | 298 ++++++++++++++++-- 2 files changed, 277 insertions(+), 48 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index 225f2419566..116490bf24b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -139,16 +139,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image void SetDistanceValueMinMax(RealType min, RealType max); - /** - * Get the min distance value defining one dimension of the joint histogram. - */ - itkGetConstMacro(MinDistance, RealType); - - /** - * Get the max distance value defining one dimension of the joint histogram. - */ - itkGetConstMacro(MaxDistance, RealType); - /** * Set the pixel value of the mask that should be considered "inside" the * object. Defaults to 1. @@ -179,15 +169,16 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - IncreaseHistograme(unsigned int ** hist, - unsigned int & totalNumberOfRuns, - const PixelType & curentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance); - void ComputeFeatures(unsigned int ** hist, - const unsigned int & totalNumberOfRuns, + const unsigned int & totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel); + void + ComputeMeansAndVariances(unsigned int ** hist, + const unsigned int & totalNumberOfFreq, + double & pixelMean, + double & marginalMean, + double & marginalDevSquared, + double & pixelVariance); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; @@ -206,8 +197,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image unsigned int m_NumberOfBinsPerAxis; PixelType m_Min; PixelType m_Max; - RealType m_MinDistance; - RealType m_MaxDistance; PixelType m_InsidePixelValue; typename TInputImage::SpacingType m_Spacing; bool m_Normalize; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index c9acd6a2c6e..24dcb65e1d7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -31,8 +31,6 @@ ScalarImageToTextureFeaturesImageFilter::ScalarImageT : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_Min(NumericTraits::NonpositiveMin()) , m_Max(NumericTraits::max()) - , m_MinDistance(NumericTraits::ZeroValue()) - , m_MaxDistance(NumericTraits::max()) , m_InsidePixelValue(NumericTraits::OneValue()) { this->SetNumberOfRequiredInputs(1); @@ -108,7 +106,7 @@ ScalarImageToTextureFeaturesImageFilter::BeforeThread if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) { typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; - AccessorFunctorType::SetVectorLength(outputPtr, 10); + AccessorFunctorType::SetVectorLength(outputPtr, 8); } outputPtr->Allocate(); } @@ -118,7 +116,129 @@ void ScalarImageToTextureFeaturesImageFilter::ThreadedGenerateData( const OutputRegionType & outputRegionForThread, ThreadIdType threadId) -{} +{ + // Recuperation of the different inputs/outputs + typename TOutputImage::Pointer outputPtr = TOutputImage::New(); + outputPtr = this->GetOutput(); + + ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); + + // Creation of the output pixel type + typename TOutputImage::PixelType outputPixel; + + // Separation of the non-boundery region that will be processed in a different way + NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = + boundaryFacesCalculator(this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius); + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = + faceList.begin(); + + // Declaration of the variables usefull to iterate over the all image region + bool isInImage; + IndexType firstIndex; + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) + { + firstIndex[i] = 0; + } + outputPixel = outputPtr->GetPixel(firstIndex); + typename OffsetVector::ConstIterator offsets; + + // Declaration of the variables usefull to iterate over the all the offsets + OffsetType offset; + unsigned int totalNumberOfFreq; + unsigned int ** hist = new unsigned int *[m_NumberOfBinsPerAxis]; + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + hist[a] = new unsigned int[m_NumberOfBinsPerAxis]; + } + + // Declaration of the variables usefull to iterate over the all neighborhood region + PixelType curentInNeighborhoodPixelIntensity; + + // Declaration of the variables usefull to iterate over the run + PixelType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType tempOffset; + + /// ***** Non-boundary Region ***** + for (fit; fit != faceList.end(); ++fit) + { + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit); + typedef itk::ImageRegionIterator IteratorType; + IteratorType outputIt(outputPtr, *fit); + + // Iteration over the all image region + while (!inputNIt.IsAtEnd()) + { + // If the voxel is outside of the mask, don't treat it + if (inputNIt.GetCenterPixel() < (this->m_Min - 5)) // the pixel is outside of the mask + { + progress.CompletedPixel(); + ++inputNIt; + ++outputIt; + continue; + } + // Initialisation of the histogram + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + { + hist[a][b] = 0; + } + } + totalNumberOfFreq = 0; + // Iteration over all the offsets + for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) + { + offset = offsets.Value(); + // Iteration over the all neighborhood region + for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) + { + // Test if the curent voxel is in the mask and is the range of the image intensity sepcified + curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + if (curentInNeighborhoodPixelIntensity < this->m_Min) + { + continue; + } + + // Test if the curent offset is still pointing to a voxel inside th neighborhood + tempOffset = inputNIt.GetOffset(nb) + offset; + if (!(this->IsInsideNeighborhood(tempOffset))) + { + continue; + } + + // Test if the part of the neighborhood pointed by the offset is still part of the image + if (fit == faceList.begin()) + { + inputNIt.GetPixel(tempOffset, isInImage); + if (!isInImage) + { + break; + } + } + + // Test if the pointed voxel is in the mask and is the range of the image intensity sepcified + pixelIntensity = inputNIt.GetPixel(tempOffset); + if (pixelIntensity < this->m_Min) + { + continue; + } + + // Increase the coresponding bin in the histogram + totalNumberOfFreq++; + hist[curentInNeighborhoodPixelIntensity][pixelIntensity]++; + } + } + // Compute the run lenght features + this->ComputeFeatures(hist, totalNumberOfFreq, outputPixel); + outputIt.Set(outputPixel); + + progress.CompletedPixel(); + ++inputNIt; + ++outputIt; + } + } +} template void @@ -130,7 +250,7 @@ ScalarImageToTextureFeaturesImageFilter::UpdateOutput if (strcmp(this->GetOutput()->GetNameOfClass(), "VectorImage") == 0) { typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; - AccessorFunctorType::SetVectorLength(this->GetOutput(), 10); + AccessorFunctorType::SetVectorLength(this->GetOutput(), 8); } } @@ -165,18 +285,6 @@ ScalarImageToTextureFeaturesImageFilter::SetPixelValu } } -template -void -ScalarImageToTextureFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) -{ - if (Math::NotExactlyEquals(this->m_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) - { - this->m_MinDistance = min; - this->m_MaxDistance = max; - this->Modified(); - } -} - template bool ScalarImageToTextureFeaturesImageFilter::IsInsideNeighborhood( @@ -195,23 +303,155 @@ ScalarImageToTextureFeaturesImageFilter::IsInsideNeig return insideNeighborhood; } -template -void -ScalarImageToTextureFeaturesImageFilter::IncreaseHistograme( - unsigned int ** hist, - unsigned int & totalNumberOfRuns, - const PixelType & curentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance) -{} - template void ScalarImageToTextureFeaturesImageFilter::ComputeFeatures( unsigned int ** hist, - const unsigned int & totalNumberOfRuns, + const unsigned int & totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel) -{} +{ + // Now get the various means and variances. This is takes two passes + // through the histogram. + double pixelMean; + double marginalMean; + double marginalDevSquared; + double pixelVariance; + + this->ComputeMeansAndVariances(hist, totalNumberOfFreq, pixelMean, marginalMean, marginalDevSquared, pixelVariance); + + // Finally compute the texture features. Another one pass. + MeasurementType energy = NumericTraits::ZeroValue(); + MeasurementType entropy = NumericTraits::ZeroValue(); + MeasurementType correlation = NumericTraits::ZeroValue(); + + MeasurementType inverseDifferenceMoment = NumericTraits::ZeroValue(); + + MeasurementType inertia = NumericTraits::ZeroValue(); + MeasurementType clusterShade = NumericTraits::ZeroValue(); + MeasurementType clusterProminence = NumericTraits::ZeroValue(); + MeasurementType haralickCorrelation = NumericTraits::ZeroValue(); + + double pixelVarianceSquared = pixelVariance * pixelVariance; + // Variance is only used in correlation. If variance is 0, then + // (index[0] - pixelMean) * (index[1] - pixelMean) + // should be zero as well. In this case, set the variance to 1. in + // order to avoid NaN correlation. + if (Math::FloatAlmostEqual(pixelVarianceSquared, 0.0, 4, 2 * NumericTraits::epsilon())) + { + pixelVarianceSquared = 1.; + } + const double log2 = std::log(2.0); + + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + { + float frequency = hist[a][b] / (float)totalNumberOfFreq; + if (Math::AlmostEquals(frequency, NumericTraits::ZeroValue())) + { + continue; // no use doing these calculations if we're just multiplying by + // zero. + } + + energy += frequency * frequency; + entropy -= (frequency > 0.0001) ? frequency * std::log(frequency) / log2 : 0; + correlation += ((a - pixelMean) * (b - pixelMean) * frequency) / pixelVarianceSquared; + inverseDifferenceMoment += frequency / (1.0 + (a - b) * (a - b)); + inertia += (a - b) * (a - b) * frequency; + clusterShade += std::pow((a - pixelMean) + (b - pixelMean), 3) * frequency; + clusterProminence += std::pow((a - pixelMean) + (b - pixelMean), 4) * frequency; + haralickCorrelation += a * b * frequency; + } + } + + haralickCorrelation = (haralickCorrelation - marginalMean * marginalMean) / marginalDevSquared; + + outputPixel[0] = energy; + outputPixel[1] = entropy; + outputPixel[2] = correlation; + outputPixel[3] = inverseDifferenceMoment; + outputPixel[4] = inertia; + outputPixel[5] = clusterShade; + outputPixel[6] = clusterProminence; + outputPixel[7] = haralickCorrelation; +} + +template +void +ScalarImageToTextureFeaturesImageFilter::ComputeMeansAndVariances( + unsigned int ** hist, + const unsigned int & totalNumberOfFreq, + double & pixelMean, + double & marginalMean, + double & marginalDevSquared, + double & pixelVariance) +{ + // This function takes two passes through the histogram and two passes through + // an array of the same length as a histogram axis. This could probably be + // cleverly compressed to one pass, but it's not clear that that's necessary. + + // Initialize everything + double * marginalSums = new double[m_NumberOfBinsPerAxis]; + + for (double * ms_It = marginalSums; ms_It < marginalSums + m_NumberOfBinsPerAxis; ms_It++) + { + *ms_It = 0; + } + pixelMean = 0; + + // Ok, now do the first pass through the histogram to get the marginal sums + // and compute the pixel mean + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + { + int k = hist[a][b]; + float frequency = hist[a][b] / (float)totalNumberOfFreq; + pixelMean += a * frequency; + marginalSums[a] += frequency; + } + } + + /* Now get the mean and deviaton of the marginal sums. + Compute incremental mean and SD, a la Knuth, "The Art of Computer + Programming, Volume 2: Seminumerical Algorithms", section 4.2.2. + Compute mean and standard deviation using the recurrence relation: + M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k + S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) + for 2 <= k <= n, then + sigma = std::sqrt(S(n) / n) (or divide by n-1 for sample SD instead of + population SD). + */ + marginalMean = marginalSums[0]; + marginalDevSquared = 0; + for (unsigned int arrayIndex = 1; arrayIndex < m_NumberOfBinsPerAxis; arrayIndex++) + { + int k = arrayIndex + 1; + double M_k_minus_1 = marginalMean; + double S_k_minus_1 = marginalDevSquared; + double x_k = marginalSums[arrayIndex]; + + double M_k = M_k_minus_1 + (x_k - M_k_minus_1) / k; + double S_k = S_k_minus_1 + (x_k - M_k_minus_1) * (x_k - M_k); + + marginalMean = M_k; + marginalDevSquared = S_k; + } + marginalDevSquared = marginalDevSquared / m_NumberOfBinsPerAxis; + + // OK, now compute the pixel variances. + pixelVariance = 0; + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + { + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + { + float frequency = hist[a][b] / (float)totalNumberOfFreq; + pixelVariance += (a - pixelMean) * (a - pixelMean) * (frequency); + } + } + + delete[] marginalSums; +} template void From 0eb983316da4e964270c876352f407c2fef6dfb9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 25 Apr 2017 13:58:22 -0400 Subject: [PATCH 029/135] ENH: Adding of tests for ScalarImageToTextureFeaturesImageFilter --- .../TextureFeatures/test/CMakeLists.txt | 222 ++++++++++++++++++ .../test/Data/resultPartialImage3.nrrd.sha512 | 2 +- .../test/Data/resultPartialImage4.nrrd.sha512 | 1 + .../resultSeparateFeatures_11.nrrd.sha512 | 1 + .../resultSeparateFeatures_12.nrrd.sha512 | 1 + .../resultSeparateFeatures_13.nrrd.sha512 | 1 + .../resultSeparateFeatures_14.nrrd.sha512 | 1 + .../resultSeparateFeatures_15.nrrd.sha512 | 1 + .../resultSeparateFeatures_16.nrrd.sha512 | 1 + .../resultSeparateFeatures_17.nrrd.sha512 | 1 + .../resultSeparateFeatures_18.nrrd.sha512 | 1 + .../Data/resultTestWithoutMask4.nrrd.sha512 | 1 + .../Data/resultTestWithoutMask5.nrrd.sha512 | 1 + .../Data/resultTestWithoutMask6.nrrd.sha512 | 1 + .../test/Data/resultWholeImage2.nrrd.sha512 | 1 + ...TextureFeaturesImageFilterCreationTest.cxx | 37 +++ ...rImageToTextureFeaturesImageFilterTest.cxx | 69 ++++++ ...eaturesImageFilterTestSeparateFeatures.cxx | 84 +++++++ ...eFilterTestVectorImageSeparateFeatures.cxx | 86 +++++++ ...FeaturesImageFilterTestWithVectorImage.cxx | 69 ++++++ ...tureFeaturesImageFilterTestWithoutMask.cxx | 63 +++++ 21 files changed, 644 insertions(+), 1 deletion(-) create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultPartialImage4.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_11.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_12.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_13.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_14.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_15.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_16.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_17.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_18.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask4.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask5.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask6.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Data/resultWholeImage2.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 69c175f7771..02fdbe8218b 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -13,6 +13,12 @@ set( ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + ScalarImageToTextureFeaturesImageFilterCreationTest.cxx + ScalarImageToTextureFeaturesImageFilterTest.cxx + ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx + ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx + ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx + ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx ) set(TestOutput ${ITK_TEST_OUTPUT_DIR}) @@ -266,3 +272,219 @@ itk_add_test( 1.25 4 ) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterCreationTest + COMMAND + TextureFeaturesTestDriver + ScalarImageToTextureFeaturesImageFilterCreationTest +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterTestWithoutMask1 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultTestWithoutMask4.nrrd} + ${TEMP}/resultTestWithoutMask4.nrrd + ScalarImageToTextureFeaturesImageFilterTestWithoutMask + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultTestWithoutMask4.nrrd + 10 + 0 + 4200 + 2 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterTestWithoutMask2 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultTestWithoutMask5.nrrd} + ${TEMP}/resultTestWithoutMask5.nrrd + ScalarImageToTextureFeaturesImageFilterTestWithoutMask + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultTestWithoutMask5.nrrd + 10 + 0 + 4200 + 4 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterTestWithoutMask3 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultTestWithoutMask6.nrrd} + ${TEMP}/resultTestWithoutMask6.nrrd + ScalarImageToTextureFeaturesImageFilterTestWithoutMask + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultTestWithoutMask6.nrrd + 10 + 0 + 4200 + 6 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterVectorlImage1 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage3.nrrd} + ${TEMP}/resultVectorImage3.nrrd + ScalarImageToTextureFeaturesImageFilterTestWithVectorImage + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultVectorImage3.nrrd + 10 + 0 + 4200 + 2 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterVectorImage2 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage4.nrrd} + ${TEMP}/resultVectorImage4.nrrd + ScalarImageToTextureFeaturesImageFilterTestWithVectorImage + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultVectorImage4.nrrd + 10 + 0 + 4200 + 4 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterPartialImage1 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage3.nrrd} + ${TEMP}/resultPartialImage3.nrrd + ScalarImageToTextureFeaturesImageFilterTest + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultPartialImage3.nrrd + 10 + 0 + 4200 + 2 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterPartialImage2 + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultPartialImage4.nrrd} + ${TEMP}/resultPartialImage4.nrrd + ScalarImageToTextureFeaturesImageFilterTest + DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + ${TEMP}/resultPartialImage4.nrrd + 10 + 0 + 4200 + 4 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterTestWholeImage + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultWholeImage2.nrrd} + ${TEMP}/resultWholeImage2.nrrd + ScalarImageToTextureFeaturesImageFilterTest + DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + ${TEMP}/resultWholeImage2.nrrd + 10 + 0 + 4200 + 2 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_11.nrrd} + ${TEMP}/resultSeparateFeatures_11.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_12.nrrd} + ${TEMP}/resultSeparateFeatures_12.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_13.nrrd} + ${TEMP}/resultSeparateFeatures_13.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_14.nrrd} + ${TEMP}/resultSeparateFeatures_14.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_15.nrrd} + ${TEMP}/resultSeparateFeatures_15.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_16.nrrd} + ${TEMP}/resultSeparateFeatures_16.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_17.nrrd} + ${TEMP}/resultSeparateFeatures_17.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_18.nrrd} + ${TEMP}/resultSeparateFeatures_18.nrrd + ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures + DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + ${TEMP}/resultSeparateFeatures + 10 + 0 + 4200 + 4 +) + +itk_add_test( + NAME ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures + COMMAND + TextureFeaturesTestDriver + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_11.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_11.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_12.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_12.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_13.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_13.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_14.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_14.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_15.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_15.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_16.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_16.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_17.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_17.nrrd + --compare + DATA{${INPUTDATA}/resultSeparateFeatures_18.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd + ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures + DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + ${TEMP}/resultVectorImageSeparateFeatures + 10 + 0 + 4200 + 4 +) diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 index 7a212be2477..88935cb6fa2 100644 --- a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 @@ -1 +1 @@ -58995cbe8e732547734cf6ff6ece433d9166c36f0e50eb529dfdcbdba078f71caf7a6a79bd1644c33dbb3c64ff256a57676d7f41fc343718f436982c51007fac \ No newline at end of file +678389c0a5434f2786688f5bcaf36d994e06c2f5025456251b948ec2e8f46e1b0535b947833351340f63bbda1fe2b2d85fbae4e74ce7f112cf0b24c42b3d8538 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage4.nrrd.sha512 new file mode 100644 index 00000000000..926a79b05ba --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage4.nrrd.sha512 @@ -0,0 +1 @@ +a1fc063ca220eef5bc9f973550ce3b25818809e5348a9fd202b166cdcdf72f18bfed27ed3e2c48ebecef9abf51ce1d5032dd0e7daec127f0a6debca4ea24c42a \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_11.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_11.nrrd.sha512 new file mode 100644 index 00000000000..e4d5a55d244 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_11.nrrd.sha512 @@ -0,0 +1 @@ +f654bcc438a39619134eb003d119c2aa4d59a92c5a77a95391fd5fa73e5841fc7a158c40d36dfee8b7e4083ac2d6b96e046aac580d1f5797c43ccb393dbc2454 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_12.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_12.nrrd.sha512 new file mode 100644 index 00000000000..7c3bfd27787 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_12.nrrd.sha512 @@ -0,0 +1 @@ +f6aa157c18a57e5ff73f149f884dd55911465d6fa0b848a69d92bc0fff445f73d822e302d41a5fa0006dbff3c533ef31783b32ebfaf97ad206be4c71a6707f03 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_13.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_13.nrrd.sha512 new file mode 100644 index 00000000000..fa8a44a9498 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_13.nrrd.sha512 @@ -0,0 +1 @@ +583b3efa528829dfe682776b128eb0d15295de20f1f75879cc49febb4f0bbfd052bf68346b984f34b8756ce71344bca23643268fd44c39259b5c6e18202a52e1 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_14.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_14.nrrd.sha512 new file mode 100644 index 00000000000..4a598e9f0c1 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_14.nrrd.sha512 @@ -0,0 +1 @@ +266fd05a257d104fe0093c8082813d81fd5132ab2ba88a141ef1e83bc3a1195a80235a87ecdffbb28cc8a80b6e1788205f735e8ffbe1e51d79203b01fc66eee3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_15.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_15.nrrd.sha512 new file mode 100644 index 00000000000..07ae7715f7f --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_15.nrrd.sha512 @@ -0,0 +1 @@ +0ff74662a7de30f4817f6304455ab6bbdbe0872dba61c6791b5f1e954ed381619744dc2a76613d1b3470714a9e5a3d20e0e0c4aecf106db88ab3fe4deea381f9 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_16.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_16.nrrd.sha512 new file mode 100644 index 00000000000..745e5c6e511 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_16.nrrd.sha512 @@ -0,0 +1 @@ +80f4edc5ccc766df5053eb549050e89400072678a65b106a19e0eef271491ae8ad8afad2c9ab2fae783aad11b2bbfedf28ffa72f108b8936f07e9694b373c25c \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_17.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_17.nrrd.sha512 new file mode 100644 index 00000000000..872ae1eec2b --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_17.nrrd.sha512 @@ -0,0 +1 @@ +6a37df8d4f3c360d0029edde5973a68edba69a3ab504437db9173f87afb6aff16ee31f48084d021abf03b3ea3bfe6314c0a0589f6895ac1947ba63214ce881db \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_18.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_18.nrrd.sha512 new file mode 100644 index 00000000000..f7dcbde08a5 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_18.nrrd.sha512 @@ -0,0 +1 @@ +e876e3b86c5e3591522ee7b6f6d8986c992e51f175d7105bd27b54bef366f97839b96e52139138067bd8db822f022e86d90d6d41b63703b7145c5e1cbdd97b3a \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask4.nrrd.sha512 new file mode 100644 index 00000000000..cbc84d618f3 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask4.nrrd.sha512 @@ -0,0 +1 @@ +abaa5d133f43b29e75223b4929fc5f2933fc930b25089fac4dd56e5e4bbb1f4d77b505c9c7609bdddc8d2afc843aab64b5d7881bd4ee61938c3a99fe0a53ff30 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask5.nrrd.sha512 new file mode 100644 index 00000000000..b26c2a6b59f --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask5.nrrd.sha512 @@ -0,0 +1 @@ +01cfaf271b9c4acf9211e2ab6684e8ef0869b8c3e76e93e2f28f39e5902ddf3b7e7effc6cc64fea99441243a665db91649403e69bafe357161dfe851b0f10773 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask6.nrrd.sha512 new file mode 100644 index 00000000000..21b849b272f --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask6.nrrd.sha512 @@ -0,0 +1 @@ +5bcaf5d18e8e9e15e108da7dc8165b491b43b624a55ead9b12b5b411598cb993194a459685cf3f2cb9103ee583c29d244eacf64ac57b2617e5eaf9044594de80 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage2.nrrd.sha512 new file mode 100644 index 00000000000..f4fedaf4a7a --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage2.nrrd.sha512 @@ -0,0 +1 @@ +e0545eda598ec24d1a66d580a8796c98015897e638879f8c42cbfb6e644e011cdf1b8d2d4a1012a647a210bd924c582a79746a833a7b6c3d92cd4baee26d399b \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx new file mode 100644 index 00000000000..e2802a27b41 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx @@ -0,0 +1,37 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" + +int +ScalarImageToTextureFeaturesImageFilterCreationTest(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx new file mode 100644 index 00000000000..29532a4a38d --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx @@ -0,0 +1,69 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" + +int +ScalarImageToTextureFeaturesImageFilterTest(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + hood.SetRadius(std::atoi(argv[7])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + writer->SetFileName(outputFilename.c_str()); + writer->SetInput(filter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx new file mode 100644 index 00000000000..a2e228a1d85 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -0,0 +1,84 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" +#include "itkVectorIndexSelectionCastImageFilter.h" + +int +ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + hood.SetRadius(std::atoi(argv[7])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + typedef itk::Image imageFeatures; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); + indexSelectionFilter->SetInput(filter->GetOutput()); + + for (unsigned int i = 0; i < 8; i++) + { + indexSelectionFilter->SetIndex(i); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; + ss << i + 1; + std::string s = ss.str(); + writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); + writer->SetInput(indexSelectionFilter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + } + + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx new file mode 100644 index 00000000000..67c1dc090c7 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -0,0 +1,86 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkImageAlgorithm.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" +#include "itkVectorIndexSelectionCastImageFilter.h" +#include "itkVectorImageToImageAdaptor.h" +#include "itkNthElementImageAdaptor.h" + +int +ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + hood.SetRadius(std::atoi(argv[7])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + typedef itk::Image imageFeatures; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); + indexSelectionFilter->SetInput(filter->GetOutput()); + + for (unsigned int i = 0; i < 8; i++) + { + indexSelectionFilter->SetIndex(i); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; + ss << i + 1; + std::string s = ss.str(); + writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); + writer->SetInput(indexSelectionFilter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + } + + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx new file mode 100644 index 00000000000..54aa2b99c9e --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -0,0 +1,69 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVectorImage.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" + +int +ScalarImageToTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); + filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); + hood.SetRadius(std::atoi(argv[7])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + writer->SetFileName(outputFilename.c_str()); + writer->SetInput(filter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx new file mode 100644 index 00000000000..4242fdaf95e --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx @@ -0,0 +1,63 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" +#include "itkNeighborhood.h" + +int +ScalarImageToTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + if (argc >= 4) + { + filter->SetNumberOfBinsPerAxis(std::atoi(argv[3])); + filter->SetPixelValueMinMax(std::atof(argv[4]), std::atof(argv[5])); + hood.SetRadius(std::atoi(argv[6])); + filter->SetNeighborhoodRadius(hood.GetRadius()); + } + filter->UpdateLargestPossibleRegion(); + + // Create and setup a writter + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[2]; + writer->SetFileName(outputFilename.c_str()); + writer->SetInput(filter->GetOutput()); + writer->UpdateLargestPossibleRegion(); + + return EXIT_SUCCESS; +} From b61025a00ff59113fe2ff225428578175a25aa0c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 25 Apr 2017 14:48:17 -0400 Subject: [PATCH 030/135] STYLE: Creation of the documentation for ScalarImageToTextureFeaturesImageFilt er --- ...calarImageToRunLengthFeaturesImageFilter.h | 3 +- ...kScalarImageToTextureFeaturesImageFilter.h | 52 ++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 837f7e45bb0..db045aff183 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -49,7 +49,8 @@ namespace Statistics * * Template Parameters: * -# The input image type: a N dimensional image where the pixel type MUST be integer. - * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points. + * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or an + * ImageVector. * * Inputs and parameters: * -# An image diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index 116490bf24b..ad1d9c4511b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -26,11 +26,59 @@ namespace itk namespace Statistics { /** \class ScalarImageToTextureFeaturesImageFilter - * \brief + * \brief This class computes texture descriptions for each voxel of + * a given image and a mask image if provided. The output image can then be + * displayed by using colormaps. + * + * This filter computes a N-D image where each voxel will contain + * a vector of up to 8 scalars representing the texture features + * (of the specified neighborhood) from a N-D scalar image. + * The texture features are computed for each spatial + * direction and averaged afterward. + * + * This filter use grey-level co-occurence matrix in order to compute description a la Haralick. (See + * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for + * Image Classification. IEEE Transactions on Systems, Man and Cybernetics. + * SMC-3(6):610-620. See also Haralick, R.M. 1979. Statistical and Structural + * Approaches to Texture. Proceedings of the IEEE, 67:786-804.) + * + * Template Parameters: + * -# The input image type: a N dimensional image where the pixel type MUST be integer. + * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or an + * ImageVector. + * + * Inputs and parameters: + * -# An image + * -# A mask defining the region over which texture features will be + * calculated. (Optional) + * -# The pixel value that defines the "inside" of the mask. (Optional, defaults + * to 1 if a mask is set.) + * -# The number of intensity bins. (Optional, defaults to 256.) + * -# The set of directions (offsets) to average across. (Optional, defaults to + * {(-1, 0), (-1, -1), (0, -1), (1, -1)} for 2D images and scales analogously + * for ND images.) + * -# The pixel intensity range over which the features will be calculated. + * (Optional, defaults to the full dynamic range of the pixel type.) + * + * Recommendations: + * -# Input image: To improve the computation time, the useful data should take as much + * space as possible in the input image. If the useful data is concentrated in one part of + * the image a crop step should be considered prior to the usage of this filter. + * -# Mask: Even if optional, the usage of a mask will greatly improve the computation time. + * -# Number of intensity bins: The number of bins should be adapted to the type of results expected + * and the intensity and distances ranges. In addition a high number of bins will increase the + * computation time. + * -# Pixel intensity range: For better results the Pixel intensity should be adapted to the input image + * intensity range. For example they could be the minimum and maximum intensity of the image, or 0 and + * the maximum intensity (if the negative values are considered as noise). + * + * \sa HistogramToTextureFeaturesFilter + * \sa ScalarImageToCooccurrenceMatrixFilte + * \sa ScalarImageToTextureFeaturesFilter * * \author: Jean-Baptiste Vimort * \ingroup TextureFeatures - */ + **/ template class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public ImageToImageFilter From aee8d621352c344c4778f235c138c733c1fb5441 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 27 Apr 2017 09:33:31 -0400 Subject: [PATCH 031/135] ENH: Creation of the wrapping --- .../itkScalarImageToRunLengthFeaturesImageFilter.h | 1 + .../itkScalarImageToTextureFeaturesImageFilter.h | 1 + .../TextureFeatures/wrapping/CMakeLists.txt | 12 ++++++++++++ .../TextureFeatures/wrapping/itkFixedArray.wrap | 9 +++++++++ ...itkScalarImageToRunLengthFeaturesImageFilter.wrap | 12 ++++++++++++ .../itkScalarImageToTextureFeaturesImageFilter.wrap | 12 ++++++++++++ .../TextureFeatures/wrapping/itkVector.wrap | 9 +++++++++ 7 files changed, 56 insertions(+) create mode 100644 Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt create mode 100644 Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap create mode 100644 Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap create mode 100644 Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap create mode 100644 Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index db045aff183..8fd9c89868b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -20,6 +20,7 @@ #include "itkImageToImageFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" +#include "itkConstNeighborhoodIterator.h" namespace itk { diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index ad1d9c4511b..2a087ae3fb1 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -20,6 +20,7 @@ #include "itkImageToImageFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" +#include "itkConstNeighborhoodIterator.h" namespace itk { diff --git a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt new file mode 100644 index 00000000000..679c3f5c340 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt @@ -0,0 +1,12 @@ +itk_wrap_module(TextureFeatures) + +set( + WRAPPER_SUBMODULE_ORDER + itkFixedArray + itkVector + itkScalarImageToTextureFeaturesImageFilter + itkScalarImageToRunLengthFeaturesImageFilter +) + +itk_auto_load_submodules() +itk_end_wrap_module() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap new file mode 100644 index 00000000000..d073013dd07 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap @@ -0,0 +1,9 @@ +itk_wrap_class("itk::FixedArray") +unique(vector_dims "8;10;${ITK_WRAP_VECTOR_COMPONENTS}") +unique(vector_types "F;${WRAP_ITK_SCALAR}") +foreach(d ${vector_dims}) + foreach(t ${vector_types}) + itk_wrap_template("${ITKM_FA${t}${d}}" "${ITKT_FA${t}${d}}") + endforeach() +endforeach() +itk_end_wrap_class() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap new file mode 100644 index 00000000000..d04b0e8bc87 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap @@ -0,0 +1,12 @@ +itk_wrap_class("itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_INT}) + itk_wrap_template("${ITKM_I${t}${d}}${ITKM_I${ITKM_V${ITKM_F}10}${d}}" + "${ITKT_I${t}${d}}, ${ITKT_I${ITKM_V${ITKM_F}10}${d}}" + ) + itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}" + "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" + ) + endforeach() +endforeach() +itk_end_wrap_class() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap new file mode 100644 index 00000000000..0102c707ff4 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap @@ -0,0 +1,12 @@ +itk_wrap_class("itk::Statistics::ScalarImageToTextureFeaturesImageFilter" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_INT}) + itk_wrap_template("${ITKM_I${t}${d}}${ITKM_I${ITKM_V${ITKM_F}8}${d}}" + "${ITKT_I${t}${d}}, ${ITKT_I${ITKT_V${ITKM_F}8}${d}}" + ) + itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}" + "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" + ) + endforeach() +endforeach() +itk_end_wrap_class() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap new file mode 100644 index 00000000000..07e2aca2d05 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap @@ -0,0 +1,9 @@ +itk_wrap_class("itk::Vector") +unique(vector_dims "8;10;${ITK_WRAP_VECTOR_COMPONENTS}") +unique(vector_types "F;${WRAP_ITK_SCALAR}") +foreach(d ${vector_dims}) + foreach(t ${vector_types}) + add_template("${ITKM_V${t}${d}}" "${ITKT_V${t}${d}}") + endforeach() +endforeach() +itk_end_wrap_class() From 5ead68099d53e2331f8bd676376c15cb6caa46c8 Mon Sep 17 00:00:00 2001 From: Francois Budin Date: Thu, 27 Apr 2017 22:11:05 -0400 Subject: [PATCH 032/135] BUG: Wrapping required types itk::ScalarImageToRunLengthFeaturesImageFilter and itk::ScalarImageToTextureFeaturesImageFilter rely on some types of itk::Image and itk::ImageToImageFilter that are not instantiated by the default wrapping process. Specific image dimensions are required for this filter (8 and 10). --- .../TextureFeatures/wrapping/CMakeLists.txt | 2 - .../wrapping/itkFixedArray.wrap | 9 ---- ...arImageToRunLengthFeaturesImageFilter.wrap | 43 +++++++++++++++++-- ...alarImageToTextureFeaturesImageFilter.wrap | 41 +++++++++++++++++- .../TextureFeatures/wrapping/itkVector.wrap | 9 ---- 5 files changed, 79 insertions(+), 25 deletions(-) delete mode 100644 Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap delete mode 100644 Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap diff --git a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt index 679c3f5c340..6da3f2ed10b 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt @@ -2,8 +2,6 @@ itk_wrap_module(TextureFeatures) set( WRAPPER_SUBMODULE_ORDER - itkFixedArray - itkVector itkScalarImageToTextureFeaturesImageFilter itkScalarImageToRunLengthFeaturesImageFilter ) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap deleted file mode 100644 index d073013dd07..00000000000 --- a/Modules/Filtering/TextureFeatures/wrapping/itkFixedArray.wrap +++ /dev/null @@ -1,9 +0,0 @@ -itk_wrap_class("itk::FixedArray") -unique(vector_dims "8;10;${ITK_WRAP_VECTOR_COMPONENTS}") -unique(vector_types "F;${WRAP_ITK_SCALAR}") -foreach(d ${vector_dims}) - foreach(t ${vector_types}) - itk_wrap_template("${ITKM_FA${t}${d}}" "${ITKT_FA${t}${d}}") - endforeach() -endforeach() -itk_end_wrap_class() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap index d04b0e8bc87..b8aec5cbb03 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap @@ -1,11 +1,48 @@ +set(OutputVectorDim 10) +itk_wrap_class("itk::FixedArray") +itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") +itk_end_wrap_class() + +itk_wrap_class("itk::Vector") +itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") +itk_end_wrap_class() + +wrap_type("itk::Image" "I" "itkImage.h") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + add_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}") +endforeach() +end_wrap_type() + +itk_wrap_class("itk::Image") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}") +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::ImageSource") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("${ITKM_IV${ITKM_F}${OutputVectorDim}${d}}" "${ITKT_IV${ITKM_F}${OutputVectorDim}${d}}") +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::ImageToImageFilter") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_INT}) + itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" + "${ITKT_I${t}${d}}, itk::Image,${d}>" + ) + endforeach() +endforeach() +itk_end_wrap_class() + itk_wrap_class("itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) - itk_wrap_template("${ITKM_I${t}${d}}${ITKM_I${ITKM_V${ITKM_F}10}${d}}" - "${ITKT_I${t}${d}}, ${ITKT_I${ITKM_V${ITKM_F}10}${d}}" + itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" + "${ITKT_I${t}${d}}, itk::Image,${d}>" ) itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}" - "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" + "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" ) endforeach() endforeach() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap index 0102c707ff4..d57e91828ed 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap @@ -1,8 +1,45 @@ +set(OutputVectorDim 8) +itk_wrap_class("itk::FixedArray") +itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") +itk_end_wrap_class() + +itk_wrap_class("itk::Vector") +itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") +itk_end_wrap_class() + +wrap_type("itk::Image" "I" "itkImage.h") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + add_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}") +endforeach() +end_wrap_type() + +itk_wrap_class("itk::Image") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}") +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::ImageSource") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" "itk::Image,${d}>") +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::ImageToImageFilter") +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + foreach(t ${WRAP_ITK_INT}) + itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" + "${ITKT_I${t}${d}}, itk::Image,${d}>" + ) + endforeach() +endforeach() +itk_end_wrap_class() + itk_wrap_class("itk::Statistics::ScalarImageToTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) - itk_wrap_template("${ITKM_I${t}${d}}${ITKM_I${ITKM_V${ITKM_F}8}${d}}" - "${ITKT_I${t}${d}}, ${ITKT_I${ITKT_V${ITKM_F}8}${d}}" + itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" + "${ITKT_I${t}${d}}, itk::Image,${d}>" ) itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}" "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap deleted file mode 100644 index 07e2aca2d05..00000000000 --- a/Modules/Filtering/TextureFeatures/wrapping/itkVector.wrap +++ /dev/null @@ -1,9 +0,0 @@ -itk_wrap_class("itk::Vector") -unique(vector_dims "8;10;${ITK_WRAP_VECTOR_COMPONENTS}") -unique(vector_types "F;${WRAP_ITK_SCALAR}") -foreach(d ${vector_dims}) - foreach(t ${vector_types}) - add_template("${ITKM_V${t}${d}}" "${ITKT_V${t}${d}}") - endforeach() -endforeach() -itk_end_wrap_class() From 7d8d37b4692df932c1d4c8f5208b36aba504b987 Mon Sep 17 00:00:00 2001 From: Francois Budin Date: Thu, 27 Apr 2017 22:13:35 -0400 Subject: [PATCH 033/135] BUG: Missing methods definition SetOffset() and SetDistanceValueMinMax() were not defined for class itk::ScalarImageToTextureFeaturesImageFilter . SetOffset() was not defined for class itk::ScalarImageToRunLengthFeaturesImageFilter . --- ...larImageToRunLengthFeaturesImageFilter.hxx | 8 +++++++ ...calarImageToTextureFeaturesImageFilter.hxx | 21 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 5fe63e9e266..1fb7b2fb61a 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -65,6 +65,14 @@ ScalarImageToRunLengthFeaturesImageFilter::ScalarImag outputPtr->FillBuffer(pixelNull); } +template +void +ScalarImageToRunLengthFeaturesImageFilter::SetOffset(const OffsetType offset) +{ + OffsetVectorPointer offsetVector = OffsetVector::New(); + offsetVector->push_back(offset); + this->SetOffsets(offsetVector); +} template void diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index 24dcb65e1d7..40ebc96ea44 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -64,6 +64,27 @@ ScalarImageToTextureFeaturesImageFilter::ScalarImageT this->m_Normalize = false; } +template +void +ScalarImageToTextureFeaturesImageFilter::SetOffset(const OffsetType offset) +{ + OffsetVectorPointer offsetVector = OffsetVector::New(); + offsetVector->push_back(offset); + this->SetOffsets(offsetVector); +} + +template +void +ScalarImageToTextureFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) +{ + if (Math::NotExactlyEquals(this->m_Min, min) || Math::NotExactlyEquals(this->m_Max, max)) + { + itkDebugMacro("setting MinDistance to " << min << "and MaxDistance to " << max); + this->m_Min = min; + this->m_Max = max; + this->Modified(); + } +} template void From 27f3b62fc3f27810dc0bae4618b3e4f8cadb7951 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 28 Apr 2017 10:21:00 -0400 Subject: [PATCH 034/135] ENH: Supretion of an unused variable --- .../itkScalarImageToTextureFeaturesImageFilter.h | 13 +++---------- .../itkScalarImageToTextureFeaturesImageFilter.hxx | 13 ------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index 2a087ae3fb1..6289ec05754 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -67,7 +67,7 @@ namespace Statistics * the image a crop step should be considered prior to the usage of this filter. * -# Mask: Even if optional, the usage of a mask will greatly improve the computation time. * -# Number of intensity bins: The number of bins should be adapted to the type of results expected - * and the intensity and distances ranges. In addition a high number of bins will increase the + * and the intensity range. In addition a high number of bins will increase the * computation time. * -# Pixel intensity range: For better results the Pixel intensity should be adapted to the input image * intensity range. For example they could be the minimum and maximum intensity of the image, or 0 and @@ -135,7 +135,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); /** - * Set the offsets over which the intensity/distance pairs will be computed. + * Set the offsets over which the intensities pairs will be computed. * Invoking this function clears the previous offsets. * Note: for each individual offset in the OffsetVector, the rightmost non-zero * offset element must be positive. For example, in the offset list of a 2D image, @@ -146,7 +146,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image itkSetObjectMacro(Offsets, OffsetVector); /** - * Set offset over which the intensity/distance pairs will be computed. + * Set offset over which the intensities pairs will be computed. * Invoking this function clears the previous offset(s). * Note: for each individual offset, the rightmost non-zero * offset element must be positive. For example, in the offset list of a 2D image, @@ -181,13 +181,6 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image /** Get the max pixel value defining one dimension of the joint histogram. */ itkGetConstMacro(Max, PixelType); - /** - * Set the min and max (inclusive) pixel value that will be used in - * generating the histogram. - */ - void - SetDistanceValueMinMax(RealType min, RealType max); - /** * Set the pixel value of the mask that should be considered "inside" the * object. Defaults to 1. diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index 40ebc96ea44..72b95d5e860 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -73,19 +73,6 @@ ScalarImageToTextureFeaturesImageFilter::SetOffset(co this->SetOffsets(offsetVector); } -template -void -ScalarImageToTextureFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) -{ - if (Math::NotExactlyEquals(this->m_Min, min) || Math::NotExactlyEquals(this->m_Max, max)) - { - itkDebugMacro("setting MinDistance to " << min << "and MaxDistance to " << max); - this->m_Min = min; - this->m_Max = max; - this->Modified(); - } -} - template void ScalarImageToTextureFeaturesImageFilter::BeforeThreadedGenerateData() From 8d3724c9c58a0a2176f091de6052c8e09621aa67 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 1 May 2017 17:34:28 -0400 Subject: [PATCH 035/135] ENH: EMH: Adding of tests for every Set function of each filter --- .../TextureFeatures/test/CMakeLists.txt | 16 ++-- ...nLengthFeaturesImageFilterCreationTest.cxx | 37 --------- ...thFeaturesImageFilterInstantiationTest.cxx | 79 +++++++++++++++++++ ...TextureFeaturesImageFilterCreationTest.cxx | 37 --------- ...reFeaturesImageFilterInstantiationTest.cxx | 75 ++++++++++++++++++ 5 files changed, 164 insertions(+), 80 deletions(-) delete mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterCreationTest.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx delete mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx create mode 100644 Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 02fdbe8218b..fd6c7ab3641 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -7,13 +7,13 @@ set(ITK_TEST_DRIVER itkTestDriver) set( TextureFeaturesTests - ScalarImageToRunLengthFeaturesImageFilterCreationTest.cxx + ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx ScalarImageToRunLengthFeaturesImageFilterTest.cxx ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterCreationTest.cxx + ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx ScalarImageToTextureFeaturesImageFilterTest.cxx ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx @@ -26,10 +26,12 @@ set(TestOutput ${ITK_TEST_OUTPUT_DIR}) createtestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterCreationTest + NAME ScalarImageToRunLengthFeaturesImageFilterInstantiationTest COMMAND TextureFeaturesTestDriver - ScalarImageToRunLengthFeaturesImageFilterCreationTest + ScalarImageToRunLengthFeaturesImageFilterInstantiationTest + DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} ) itk_add_test( @@ -274,10 +276,12 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterCreationTest + NAME ScalarImageToTextureFeaturesImageFilterInstantiationTest COMMAND TextureFeaturesTestDriver - ScalarImageToTextureFeaturesImageFilterCreationTest + ScalarImageToTextureFeaturesImageFilterInstantiationTest + DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} + DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} ) itk_add_test( diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterCreationTest.cxx deleted file mode 100644 index ae8a6e14c99..00000000000 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterCreationTest.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" - -#include "itkImage.h" -#include "itkVector.h" -#include "itkImageFileReader.h" - -int -ScalarImageToRunLengthFeaturesImageFilterCreationTest(int argc, char * argv[]) -{ - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; - - // Apply the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; - FilterType::Pointer filter = FilterType::New(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx new file mode 100644 index 00000000000..84fb4452ac4 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx @@ -0,0 +1,79 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToRunLengthFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkTestingMacros.h" + +int +ScalarImageToRunLengthFeaturesImageFilterInstantiationTest(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + + hood.SetRadius(3); + NeighborhoodType::OffsetType offset = { { -1, 0, 1 } }; + + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + filter->SetNumberOfBinsPerAxis(15); + filter->SetPixelValueMinMax(-62, 2456); + filter->SetDistanceValueMinMax(0.15, 1.5); + filter->SetNeighborhoodRadius(hood.GetRadius()); + filter->SetInsidePixelValue(0); + filter->SetOffset(offset); + + filter->UpdateLargestPossibleRegion(); + + TEST_SET_GET_VALUE(reader->GetOutput(), filter->GetInput()); + TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); + TEST_SET_GET_VALUE(15, filter->GetNumberOfBinsPerAxis()); + TEST_SET_GET_VALUE(-62, filter->GetMin()); + TEST_SET_GET_VALUE(2456, filter->GetMax()); + TEST_SET_GET_VALUE(0.15, filter->GetMinDistance()); + TEST_SET_GET_VALUE(1.5, filter->GetMaxDistance()); + TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); + TEST_SET_GET_VALUE(0, filter->GetInsidePixelValue()); + + filter->UpdateLargestPossibleRegion(); + + + return EXIT_SUCCESS; +} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx deleted file mode 100644 index e2802a27b41..00000000000 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterCreationTest.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" - -#include "itkImage.h" -#include "itkVector.h" -#include "itkImageFileReader.h" - -int -ScalarImageToTextureFeaturesImageFilterCreationTest(int argc, char * argv[]) -{ - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; - - // Apply the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; - FilterType::Pointer filter = FilterType::New(); - - return EXIT_SUCCESS; -} diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx new file mode 100644 index 00000000000..b2944303fec --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx @@ -0,0 +1,75 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkScalarImageToTextureFeaturesImageFilter.h" + +#include "itkImage.h" +#include "itkVector.h" +#include "itkImageFileReader.h" +#include "itkTestingMacros.h" + +int +ScalarImageToTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) +{ + // Setup types + typedef itk::Image InputImageType; + typedef itk::Image, 3> OutputImageType; + typedef itk::ImageFileReader readerType; + typedef itk::Neighborhood NeighborhoodType; + NeighborhoodType hood; + + // Create and setup a reader + readerType::Pointer reader = readerType::New(); + std::string inputFilename = argv[1]; + reader->SetFileName(inputFilename.c_str()); + + // Create and setup a maskReader + readerType::Pointer maskReader = readerType::New(); + std::string maskFilename = argv[2]; + maskReader->SetFileName(maskFilename.c_str()); + + // Apply the filter + typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); + + hood.SetRadius(3); + NeighborhoodType::OffsetType offset = { { -1, 0, 1 } }; + + filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); + filter->SetNumberOfBinsPerAxis(15); + filter->SetPixelValueMinMax(-62, 2456); + filter->SetNeighborhoodRadius(hood.GetRadius()); + filter->SetInsidePixelValue(0); + filter->SetOffset(offset); + + filter->UpdateLargestPossibleRegion(); + + TEST_SET_GET_VALUE(reader->GetOutput(), filter->GetInput()); + TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); + TEST_SET_GET_VALUE(15, filter->GetNumberOfBinsPerAxis()); + TEST_SET_GET_VALUE(-62, filter->GetMin()); + TEST_SET_GET_VALUE(2456, filter->GetMax()); + TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); + TEST_SET_GET_VALUE(0, filter->GetInsidePixelValue()); + + filter->UpdateLargestPossibleRegion(); + + return EXIT_SUCCESS; +} From 41927e2b2197f8acc6ee248220e7d3cb9541a041 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 1 May 2017 17:36:43 -0400 Subject: [PATCH 036/135] BUG: Correction of unwanted rounding due to integers --- .../itkScalarImageToRunLengthFeaturesImageFilter.hxx | 8 ++++---- .../itkScalarImageToTextureFeaturesImageFilter.hxx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index 1fb7b2fb61a..f8bf6dd53c2 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -95,13 +95,13 @@ ScalarImageToRunLengthFeaturesImageFilter::BeforeThre { digitIt.Set(this->m_Min - 10); } - else if (inputIt.Get() < this->m_Min || inputIt.Get() > this->m_Max) + else if (inputIt.Get() < this->m_Min || inputIt.Get() >= this->m_Max) { digitIt.Set(this->m_Min - 1); } else { - binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / m_NumberOfBinsPerAxis); + binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis); digitIt.Set(binNumber); } ++inputIt; @@ -394,8 +394,8 @@ ScalarImageToRunLengthFeaturesImageFilter::IncreaseHi } offsetDistance = std::sqrt(offsetDistance); - int offsetDistanceBin = - (int)((offsetDistance * pixelDistance - m_MinDistance) / ((m_MaxDistance - m_MinDistance) / m_NumberOfBinsPerAxis)); + int offsetDistanceBin = (int)((offsetDistance * pixelDistance - m_MinDistance) / + ((m_MaxDistance - m_MinDistance) / (float)m_NumberOfBinsPerAxis)); if (offsetDistanceBin < m_NumberOfBinsPerAxis) { diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index 72b95d5e860..7408af06929 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -94,13 +94,13 @@ ScalarImageToTextureFeaturesImageFilter::BeforeThread { digitIt.Set(this->m_Min - 10); } - else if (inputIt.Get() < this->m_Min || inputIt.Get() > this->m_Max) + else if (inputIt.Get() < this->m_Min || inputIt.Get() >= this->m_Max) { digitIt.Set(this->m_Min - 1); } else { - binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / m_NumberOfBinsPerAxis); + binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis); digitIt.Set(binNumber); } ++inputIt; From ea681c11b3abb8b5baa5eb2bf3714d8b52af65d2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Wed, 17 May 2017 08:10:04 -0400 Subject: [PATCH 037/135] ENH: Wrapping of reders/writters able to deal with the output images of each filter --- ...arImageToRunLengthFeaturesImageFilter.wrap | 24 ++++++++++++++++--- ...alarImageToTextureFeaturesImageFilter.wrap | 24 ++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap index b8aec5cbb03..7d8517db42e 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap @@ -13,19 +13,19 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() end_wrap_type() -itk_wrap_class("itk::Image") +itk_wrap_class("itk::Image" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}") endforeach() itk_end_wrap_class() -itk_wrap_class("itk::ImageSource") +itk_wrap_class("itk::ImageSource" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("${ITKM_IV${ITKM_F}${OutputVectorDim}${d}}" "${ITKT_IV${ITKM_F}${OutputVectorDim}${d}}") endforeach() itk_end_wrap_class() -itk_wrap_class("itk::ImageToImageFilter") +itk_wrap_class("itk::ImageToImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" @@ -35,6 +35,24 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() +itk_wrap_simple_class("itk::ImageIOBase") + +itk_wrap_class("itk::ImageFileReader" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" + "itk::Image,${d}>" + ) +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::ImageFileWriter" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" + "itk::Image,${d}>" + ) +endforeach() +itk_end_wrap_class() + itk_wrap_class("itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap index d57e91828ed..ba35ea2d1f4 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap @@ -13,19 +13,19 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() end_wrap_type() -itk_wrap_class("itk::Image") +itk_wrap_class("itk::Image" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("V${ITKM_F}${OutputVectorDim}${d}" "itk::Vector<${ITKT_F},${OutputVectorDim}>,${d}") endforeach() itk_end_wrap_class() -itk_wrap_class("itk::ImageSource") +itk_wrap_class("itk::ImageSource" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" "itk::Image,${d}>") endforeach() itk_end_wrap_class() -itk_wrap_class("itk::ImageToImageFilter") +itk_wrap_class("itk::ImageToImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" @@ -35,6 +35,24 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() +itk_wrap_simple_class("itk::ImageIOBase" ) + +itk_wrap_class("itk::ImageFileReader" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" + "itk::Image,${d}>" + ) +endforeach() +itk_end_wrap_class() + +itk_wrap_class("itk::ImageFileWriter" POINTER) +foreach(d ${ITK_WRAP_IMAGE_DIMS}) + itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" + "itk::Image,${d}>" + ) +endforeach() +itk_end_wrap_class() + itk_wrap_class("itk::Statistics::ScalarImageToTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) From a3482ae6fd41f7304b5e49c9fc3779f6a4bdf89c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Wed, 17 May 2017 08:50:01 -0400 Subject: [PATCH 038/135] STYLE: Correction of the doxygen documentation Adding of the neighborhood radius as a parameter --- .../include/itkScalarImageToRunLengthFeaturesImageFilter.h | 1 + .../include/itkScalarImageToTextureFeaturesImageFilter.h | 1 + 2 files changed, 2 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h index 8fd9c89868b..95be1c59a6d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h @@ -67,6 +67,7 @@ namespace Statistics * (Optional, defaults to the full dynamic range of the pixel type.) * -# The distance range over which the features will be calculated. * (Optional, defaults to the full dynamic range of double type.) + * -# The size of the neighborhood radius. (Optional, defaults to 2.) * * Recommendations: * -# Input image: To improve the computation time, the useful data should take as much diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index 6289ec05754..b7db10b6ab0 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -60,6 +60,7 @@ namespace Statistics * for ND images.) * -# The pixel intensity range over which the features will be calculated. * (Optional, defaults to the full dynamic range of the pixel type.) + * -# The size of the neighborhood radius. (Optional, defaults to 2.) * * Recommendations: * -# Input image: To improve the computation time, the useful data should take as much From 290800bc97aa29f55c0a731da3e0b6e5c24d6902 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 25 May 2017 17:09:09 -0500 Subject: [PATCH 039/135] ENH: Add scikit-build configuration Eventually, this will move to ITKModuleExternal.cmake --- .../Filtering/TextureFeatures/CMakeLists.txt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/CMakeLists.txt b/Modules/Filtering/TextureFeatures/CMakeLists.txt index e605c39ebc9..1091a194e05 100644 --- a/Modules/Filtering/TextureFeatures/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/CMakeLists.txt @@ -3,6 +3,28 @@ project(TextureFeatures) if(NOT ITK_SOURCE_DIR) find_package(ITK 4.10 REQUIRED) list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) + + if(SKBUILD) + set( + PY_SITE_PACKAGES_PATH + ${CMAKE_INSTALL_PREFIX} + CACHE PATH + "The install + prefix for python package contents" + ) + install( + CODE + " + unset(CMAKE_INSTALL_COMPONENT) + set(COMPONENT \"PythonWheelRuntimeLibraries\") + set(CMAKE_INSTALL_DO_STRIP 1) + include\(\"${PROJECT_BINARY_DIR}/cmake_install.cmake\") + unset(CMAKE_INSTALL_COMPONENT) + return() + " + ) + endif() + include(ITKModuleExternal) include_directories(${ITK_INCLUDE_DIRS}) else() From badec00cd76bc7ea6049b829b19d890e5f22a08a Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 10 Jun 2017 17:50:24 +0200 Subject: [PATCH 040/135] ENH: Move testing data from Data to Input and Baseline folders. Move test data from a 'Data' folder to the 'Input' and 'Baseline' folders for the sake of consistency across the ITK testing framework. Additional unimportant style changes to the CMakeLists.txt file for the sake of readability: make all test input parameters be on the same line. --- .../resultPartialImage1.nrrd.sha512 | 0 .../resultPartialImage2.nrrd.sha512 | 0 .../resultPartialImage3.nrrd.sha512 | 0 .../resultPartialImage4.nrrd.sha512 | 0 .../resultSeparateFeatures_0.nrrd.sha512 | 0 .../resultSeparateFeatures_1.nrrd.sha512 | 0 .../resultSeparateFeatures_11.nrrd.sha512 | 0 .../resultSeparateFeatures_12.nrrd.sha512 | 0 .../resultSeparateFeatures_13.nrrd.sha512 | 0 .../resultSeparateFeatures_14.nrrd.sha512 | 0 .../resultSeparateFeatures_15.nrrd.sha512 | 0 .../resultSeparateFeatures_16.nrrd.sha512 | 0 .../resultSeparateFeatures_17.nrrd.sha512 | 0 .../resultSeparateFeatures_18.nrrd.sha512 | 0 .../resultSeparateFeatures_2.nrrd.sha512 | 0 .../resultSeparateFeatures_3.nrrd.sha512 | 0 .../resultSeparateFeatures_4.nrrd.sha512 | 0 .../resultSeparateFeatures_5.nrrd.sha512 | 0 .../resultSeparateFeatures_6.nrrd.sha512 | 0 .../resultSeparateFeatures_7.nrrd.sha512 | 0 .../resultSeparateFeatures_8.nrrd.sha512 | 0 .../resultSeparateFeatures_9.nrrd.sha512 | 0 .../resultTestWithoutMask1.nrrd.sha512 | 0 .../resultTestWithoutMask2.nrrd.sha512 | 0 .../resultTestWithoutMask3.nrrd.sha512 | 0 .../resultTestWithoutMask4.nrrd.sha512 | 0 .../resultTestWithoutMask5.nrrd.sha512 | 0 .../resultTestWithoutMask6.nrrd.sha512 | 0 .../resultWholeImage.nrrd.sha512 | 0 .../resultWholeImage2.nrrd.sha512 | 0 .../TextureFeatures/test/CMakeLists.txt | 180 +++++++++--------- .../{Data => Input}/Scan_CBCT_13R.nrrd.sha512 | 0 .../Scan_CBCT_13R_D1_crop.nrrd.sha512 | 0 .../SegmC_CBCT_13R.nrrd.sha512 | 0 .../SegmC_CBCT_13R_D1_crop.nrrd.sha512 | 0 35 files changed, 90 insertions(+), 90 deletions(-) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultPartialImage1.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultPartialImage2.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultPartialImage3.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultPartialImage4.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_0.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_1.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_11.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_12.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_13.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_14.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_15.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_16.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_17.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_18.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_2.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_3.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_4.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_5.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_6.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_7.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_8.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultSeparateFeatures_9.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultTestWithoutMask1.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultTestWithoutMask2.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultTestWithoutMask3.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultTestWithoutMask4.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultTestWithoutMask5.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultTestWithoutMask6.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultWholeImage.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Baseline}/resultWholeImage2.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Input}/Scan_CBCT_13R.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Input}/Scan_CBCT_13R_D1_crop.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Input}/SegmC_CBCT_13R.nrrd.sha512 (100%) rename Modules/Filtering/TextureFeatures/test/{Data => Input}/SegmC_CBCT_13R_D1_crop.nrrd.sha512 (100%) diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultPartialImage1.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultPartialImage2.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultPartialImage3.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultPartialImage4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultPartialImage4.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_0.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_1.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_11.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_11.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_12.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_12.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_13.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_13.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_14.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_14.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_15.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_15.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_16.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_16.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_17.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_17.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_18.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_18.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_2.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_3.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_4.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_5.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_6.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_7.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_8.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultSeparateFeatures_9.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask1.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask2.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask3.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask4.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask5.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultTestWithoutMask6.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultWholeImage.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/resultWholeImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/resultWholeImage2.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index fd6c7ab3641..6b850396ebc 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -30,8 +30,8 @@ itk_add_test( COMMAND TextureFeaturesTestDriver ScalarImageToRunLengthFeaturesImageFilterInstantiationTest - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ) itk_add_test( @@ -39,10 +39,10 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultTestWithoutMask1.nrrd} + DATA{Baseline/resultTestWithoutMask1.nrrd} ${TEMP}/resultTestWithoutMask1.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask1.nrrd 10 0 @@ -57,10 +57,10 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultTestWithoutMask2.nrrd} + DATA{Baseline/resultTestWithoutMask2.nrrd} ${TEMP}/resultTestWithoutMask2.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask2.nrrd 10 0 @@ -75,10 +75,10 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultTestWithoutMask3.nrrd} + DATA{Baseline/resultTestWithoutMask3.nrrd} ${TEMP}/resultTestWithoutMask3.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask3.nrrd 10 0 @@ -93,11 +93,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage1.nrrd} + DATA{Baseline/resultPartialImage1.nrrd} ${TEMP}/resultVectorImage1.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage1.nrrd 10 0 @@ -112,11 +112,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage2.nrrd} + DATA{Baseline/resultPartialImage2.nrrd} ${TEMP}/resultVectorImage2.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage2.nrrd 10 0 @@ -131,11 +131,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage1.nrrd} + DATA{Baseline/resultPartialImage1.nrrd} ${TEMP}/resultPartialImage1.nrrd ScalarImageToRunLengthFeaturesImageFilterTest - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage1.nrrd 10 0 @@ -150,11 +150,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage2.nrrd} + DATA{Baseline/resultPartialImage2.nrrd} ${TEMP}/resultPartialImage2.nrrd ScalarImageToRunLengthFeaturesImageFilterTest - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage2.nrrd 10 0 @@ -169,11 +169,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultWholeImage.nrrd} + DATA{Baseline/resultWholeImage.nrrd} ${TEMP}/resultWholeImage.nrrd ScalarImageToRunLengthFeaturesImageFilterTest - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultWholeImage.nrrd 10 0 @@ -188,38 +188,38 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultSeparateFeatures_1.nrrd} + DATA{Baseline/resultSeparateFeatures_1.nrrd} ${TEMP}/resultSeparateFeatures_1.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_2.nrrd} + DATA{Baseline/resultSeparateFeatures_2.nrrd} ${TEMP}/resultSeparateFeatures_2.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_3.nrrd} + DATA{Baseline/resultSeparateFeatures_3.nrrd} ${TEMP}/resultSeparateFeatures_3.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_4.nrrd} + DATA{Baseline/resultSeparateFeatures_4.nrrd} ${TEMP}/resultSeparateFeatures_4.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_5.nrrd} + DATA{Baseline/resultSeparateFeatures_5.nrrd} ${TEMP}/resultSeparateFeatures_5.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_6.nrrd} + DATA{Baseline/resultSeparateFeatures_6.nrrd} ${TEMP}/resultSeparateFeatures_6.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_7.nrrd} + DATA{Baseline/resultSeparateFeatures_7.nrrd} ${TEMP}/resultSeparateFeatures_7.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_8.nrrd} + DATA{Baseline/resultSeparateFeatures_8.nrrd} ${TEMP}/resultSeparateFeatures_8.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_9.nrrd} + DATA{Baseline/resultSeparateFeatures_9.nrrd} ${TEMP}/resultSeparateFeatures_9.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_0.nrrd} + DATA{Baseline/resultSeparateFeatures_0.nrrd} ${TEMP}/resultSeparateFeatures_0.nrrd ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultSeparateFeatures 10 0 @@ -234,38 +234,38 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultSeparateFeatures_1.nrrd} + DATA{Baseline/resultSeparateFeatures_1.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_1.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_2.nrrd} + DATA{Baseline/resultSeparateFeatures_2.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_2.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_3.nrrd} + DATA{Baseline/resultSeparateFeatures_3.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_3.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_4.nrrd} + DATA{Baseline/resultSeparateFeatures_4.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_4.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_5.nrrd} + DATA{Baseline/resultSeparateFeatures_5.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_5.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_6.nrrd} + DATA{Baseline/resultSeparateFeatures_6.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_6.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_7.nrrd} + DATA{Baseline/resultSeparateFeatures_7.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_7.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_8.nrrd} + DATA{Baseline/resultSeparateFeatures_8.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_8.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_9.nrrd} + DATA{Baseline/resultSeparateFeatures_9.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_9.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_0.nrrd} + DATA{Baseline/resultSeparateFeatures_0.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_0.nrrd ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures 10 0 @@ -280,8 +280,8 @@ itk_add_test( COMMAND TextureFeaturesTestDriver ScalarImageToTextureFeaturesImageFilterInstantiationTest - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ) itk_add_test( @@ -289,10 +289,10 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultTestWithoutMask4.nrrd} + DATA{Baseline/resultTestWithoutMask4.nrrd} ${TEMP}/resultTestWithoutMask4.nrrd ScalarImageToTextureFeaturesImageFilterTestWithoutMask - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask4.nrrd 10 0 @@ -305,10 +305,10 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultTestWithoutMask5.nrrd} + DATA{Baseline/resultTestWithoutMask5.nrrd} ${TEMP}/resultTestWithoutMask5.nrrd ScalarImageToTextureFeaturesImageFilterTestWithoutMask - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask5.nrrd 10 0 @@ -321,10 +321,10 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultTestWithoutMask6.nrrd} + DATA{Baseline/resultTestWithoutMask6.nrrd} ${TEMP}/resultTestWithoutMask6.nrrd ScalarImageToTextureFeaturesImageFilterTestWithoutMask - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask6.nrrd 10 0 @@ -337,11 +337,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage3.nrrd} + DATA{Baseline/resultPartialImage3.nrrd} ${TEMP}/resultVectorImage3.nrrd ScalarImageToTextureFeaturesImageFilterTestWithVectorImage - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage3.nrrd 10 0 @@ -354,11 +354,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage4.nrrd} + DATA{Baseline/resultPartialImage4.nrrd} ${TEMP}/resultVectorImage4.nrrd ScalarImageToTextureFeaturesImageFilterTestWithVectorImage - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage4.nrrd 10 0 @@ -371,11 +371,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage3.nrrd} + DATA{Baseline/resultPartialImage3.nrrd} ${TEMP}/resultPartialImage3.nrrd ScalarImageToTextureFeaturesImageFilterTest - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage3.nrrd 10 0 @@ -388,11 +388,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultPartialImage4.nrrd} + DATA{Baseline/resultPartialImage4.nrrd} ${TEMP}/resultPartialImage4.nrrd ScalarImageToTextureFeaturesImageFilterTest - DATA{${INPUTDATA}/Scan_CBCT_13R_D1_crop.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R_D1_crop.nrrd} + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} + DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage4.nrrd 10 0 @@ -405,11 +405,11 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultWholeImage2.nrrd} + DATA{Baseline/resultWholeImage2.nrrd} ${TEMP}/resultWholeImage2.nrrd ScalarImageToTextureFeaturesImageFilterTest - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultWholeImage2.nrrd 10 0 @@ -422,32 +422,32 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultSeparateFeatures_11.nrrd} + DATA{Baseline/resultSeparateFeatures_11.nrrd} ${TEMP}/resultSeparateFeatures_11.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_12.nrrd} + DATA{Baseline/resultSeparateFeatures_12.nrrd} ${TEMP}/resultSeparateFeatures_12.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_13.nrrd} + DATA{Baseline/resultSeparateFeatures_13.nrrd} ${TEMP}/resultSeparateFeatures_13.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_14.nrrd} + DATA{Baseline/resultSeparateFeatures_14.nrrd} ${TEMP}/resultSeparateFeatures_14.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_15.nrrd} + DATA{Baseline/resultSeparateFeatures_15.nrrd} ${TEMP}/resultSeparateFeatures_15.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_16.nrrd} + DATA{Baseline/resultSeparateFeatures_16.nrrd} ${TEMP}/resultSeparateFeatures_16.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_17.nrrd} + DATA{Baseline/resultSeparateFeatures_17.nrrd} ${TEMP}/resultSeparateFeatures_17.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_18.nrrd} + DATA{Baseline/resultSeparateFeatures_18.nrrd} ${TEMP}/resultSeparateFeatures_18.nrrd ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultSeparateFeatures 10 0 @@ -460,32 +460,32 @@ itk_add_test( COMMAND TextureFeaturesTestDriver --compare - DATA{${INPUTDATA}/resultSeparateFeatures_11.nrrd} + DATA{Baseline/resultSeparateFeatures_11.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_11.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_12.nrrd} + DATA{Baseline/resultSeparateFeatures_12.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_12.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_13.nrrd} + DATA{Baseline/resultSeparateFeatures_13.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_13.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_14.nrrd} + DATA{Baseline/resultSeparateFeatures_14.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_14.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_15.nrrd} + DATA{Baseline/resultSeparateFeatures_15.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_15.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_16.nrrd} + DATA{Baseline/resultSeparateFeatures_16.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_16.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_17.nrrd} + DATA{Baseline/resultSeparateFeatures_17.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_17.nrrd --compare - DATA{${INPUTDATA}/resultSeparateFeatures_18.nrrd} + DATA{Baseline/resultSeparateFeatures_18.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures - DATA{${INPUTDATA}/Scan_CBCT_13R.nrrd} - DATA{${INPUTDATA}/SegmC_CBCT_13R.nrrd} + DATA{Input/Scan_CBCT_13R.nrrd} + DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures 10 0 diff --git a/Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R_D1_crop.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/Scan_CBCT_13R_D1_crop.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R_D1_crop.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 similarity index 100% rename from Modules/Filtering/TextureFeatures/test/Data/SegmC_CBCT_13R_D1_crop.nrrd.sha512 rename to Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 From 23506b08999e9047dd8a8ece3e2cfa18b25c9eaf Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 10 Jun 2017 17:56:59 +0200 Subject: [PATCH 041/135] BUG: Remove call to FillBuffer on unallocated memory. Remove unnecessary call to FillBuffer on output image in class constructor. Since the output image region is unknown in the constructor, and given that no allocation was being done, tests were failing at the class' constructors. --- .../include/itkScalarImageToRunLengthFeaturesImageFilter.hxx | 5 ----- .../include/itkScalarImageToTextureFeaturesImageFilter.hxx | 4 ---- 2 files changed, 9 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index f8bf6dd53c2..fc10d52a3e3 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -58,11 +58,6 @@ ScalarImageToRunLengthFeaturesImageFilter::ScalarImag NeighborhoodType nhood; nhood.SetRadius(2); this->m_NeighborhoodRadius = nhood.GetRadius(); - - TOutputImage * outputPtr = this->GetOutput(); - typename TOutputImage::PixelType pixelNull; - pixelNull.Fill(0); - outputPtr->FillBuffer(pixelNull); } template diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index 7408af06929..c50bd759378 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -57,10 +57,6 @@ ScalarImageToTextureFeaturesImageFilter::ScalarImageT nhood.SetRadius(2); this->m_NeighborhoodRadius = nhood.GetRadius(); - TOutputImage * outputPtr = this->GetOutput(); - typename TOutputImage::PixelType pixelNull; - pixelNull.Fill(0); - outputPtr->FillBuffer(pixelNull); this->m_Normalize = false; } From 828d6e7e965221fbf4f61d90cb527af57997761b Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 10 Jun 2017 17:12:36 +0200 Subject: [PATCH 042/135] ENH: Finish PrintSelf methods implementation. Print all member variable values in the PrintSelf methods. --- ...larImageToRunLengthFeaturesImageFilter.hxx | 21 ++++++++++++++++++- ...calarImageToTextureFeaturesImageFilter.hxx | 21 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index f8bf6dd53c2..4b7bef70cb5 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -489,7 +489,26 @@ ScalarImageToRunLengthFeaturesImageFilter::ComputeFea template void ScalarImageToRunLengthFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const -{} +{ + Superclass::PrintSelf(os, indent); + + itkPrintSelfObjectMacro(DigitalisedInputImageg); + + os << indent << "NeighborhoodRadius" + << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; + + itkPrintSelfObjectMacro(Offsets); + + os << indent << "NumberOfBinsPerAxis" << m_NumberOfBinsPerAxis << std::endl; + os << indent << "Min" << static_cast::PrintType>(m_Min) << std::endl; + os << indent << "Max" << static_cast::PrintType>(m_Max) << std::endl; + os << indent << "MinDistance" << static_cast::PrintType>(m_MinDistance) << std::endl; + os << indent << "MaxDistance" << static_cast::PrintType>(m_MaxDistance) << std::endl; + os << indent << "InsidePixelValue" << static_cast::PrintType>(m_InsidePixelValue) + << std::endl; + os << indent << "Spacing" + << static_cast::PrintType>(m_Spacing) << std::endl; +} } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index 7408af06929..f25595424bd 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -464,7 +464,26 @@ ScalarImageToTextureFeaturesImageFilter::ComputeMeans template void ScalarImageToTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const -{} +{ + + Superclass::PrintSelf(os, indent); + + itkPrintSelfObjectMacro(DigitalisedInputImageg); + + os << indent << "NeighborhoodRadius" + << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; + + itkPrintSelfObjectMacro(Offsets); + + os << indent << "NumberOfBinsPerAxis" << m_NumberOfBinsPerAxis << std::endl; + os << indent << "Min" << static_cast::PrintType>(m_Min) << std::endl; + os << indent << "Max" << static_cast::PrintType>(m_Max) << std::endl; + os << indent << "InsidePixelValue" << static_cast::PrintType>(m_InsidePixelValue) + << std::endl; + os << indent << "Spacing" + << static_cast::PrintType>(m_Spacing) << std::endl; + os << indent << "Normalize" << m_Normalize << std::endl; +} } // end of namespace Statistics } // end of namespace itk From ab6022af16d0c3876dcd22b4286957c94cd6b0bc Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 13 Jun 2017 16:21:49 -0400 Subject: [PATCH 043/135] COMP: Use itk::Math::abs instead of std::abs itk::Math::abs is defined for integer arguments while std::abs is not for all compilers. --- .../include/itkScalarImageToRunLengthFeaturesImageFilter.hxx | 2 +- .../include/itkScalarImageToTextureFeaturesImageFilter.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx index fc10d52a3e3..f35584bd9d7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx @@ -363,7 +363,7 @@ ScalarImageToRunLengthFeaturesImageFilter::IsInsideNe bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) { - int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); + int boundDistance = m_NeighborhoodRadius[i] - Math::abs(iteratedOffset[i]); if (boundDistance < 0) { insideNeighborhood = false; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index c50bd759378..b4332ea0740 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -297,7 +297,7 @@ ScalarImageToTextureFeaturesImageFilter::IsInsideNeig bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) { - int boundDistance = m_NeighborhoodRadius[i] - std::abs(iteratedOffset[i]); + int boundDistance = m_NeighborhoodRadius[i] - Math::abs(iteratedOffset[i]); if (boundDistance < 0) { insideNeighborhood = false; From f1fce071aa356ac03b215d27e5ce34588478eca1 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 10 Jun 2017 16:25:39 +0200 Subject: [PATCH 044/135] ENH: Increase code coverage. Increase code coverage: - Exercise basic object methods. - Check all Set/Get methods consistently using the TEST_SET_GET_VALUE macro. Use variables to hold the tested values. Check the input argument list and display a usage message in case of error. Use the TRY_EXPECT_NO_EXCEPTION macro to surround filter update calls. Remove unnecessary variables (e.g. filename strings) to save typing/increase readability. Style changes to make testing consistent across the toolkit, and make the code more readable: - Declare the input/output image dimensions as constants - Declare the pixel types. - Capitalize the typedef aliases. - Reduce indentation to the two space standard. - Use white spaces and CR/LFs to increase readaibility. --- ...thFeaturesImageFilterInstantiationTest.cxx | 97 +++++++++++++------ ...mageToRunLengthFeaturesImageFilterTest.cxx | 92 +++++++++++++----- ...eaturesImageFilterTestSeparateFeatures.cxx | 93 ++++++++++++------ ...eFilterTestVectorImageSeparateFeatures.cxx | 92 ++++++++++++------ ...FeaturesImageFilterTestWithVectorImage.cxx | 82 +++++++++++----- ...ngthFeaturesImageFilterTestWithoutMask.cxx | 72 ++++++++++---- ...reFeaturesImageFilterInstantiationTest.cxx | 88 +++++++++++------ ...rImageToTextureFeaturesImageFilterTest.cxx | 69 ++++++++----- ...eaturesImageFilterTestSeparateFeatures.cxx | 86 ++++++++++------ ...eFilterTestVectorImageSeparateFeatures.cxx | 84 ++++++++++------ ...FeaturesImageFilterTestWithVectorImage.cxx | 75 +++++++++----- ...tureFeaturesImageFilterTestWithoutMask.cxx | 66 +++++++++---- 12 files changed, 700 insertions(+), 296 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx index 84fb4452ac4..22dad132ecc 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx @@ -25,55 +25,88 @@ int ScalarImageToRunLengthFeaturesImageFilterInstantiationTest(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 3) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 10; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); + + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); - hood.SetRadius(3); - NeighborhoodType::OffsetType offset = { { -1, 0, 1 } }; filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); - filter->SetNumberOfBinsPerAxis(15); - filter->SetPixelValueMinMax(-62, 2456); - filter->SetDistanceValueMinMax(0.15, 1.5); - filter->SetNeighborhoodRadius(hood.GetRadius()); - filter->SetInsidePixelValue(0); - filter->SetOffset(offset); + TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); - filter->UpdateLargestPossibleRegion(); + unsigned int numberOfBinsPerAxis = 15; + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); - TEST_SET_GET_VALUE(reader->GetOutput(), filter->GetInput()); - TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); - TEST_SET_GET_VALUE(15, filter->GetNumberOfBinsPerAxis()); - TEST_SET_GET_VALUE(-62, filter->GetMin()); - TEST_SET_GET_VALUE(2456, filter->GetMax()); - TEST_SET_GET_VALUE(0.15, filter->GetMinDistance()); - TEST_SET_GET_VALUE(1.5, filter->GetMaxDistance()); + FilterType::PixelType pixelValueMin = -62; + FilterType::PixelType pixelValueMax = 2456; + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + TEST_SET_GET_VALUE(pixelValueMin, filter->GetMin()); + TEST_SET_GET_VALUE(pixelValueMax, filter->GetMax()); + + FilterType::RealType minDistance = 0.15; + FilterType::RealType maxDistance = 1.5; + filter->SetDistanceValueMinMax(minDistance, maxDistance); + TEST_SET_GET_VALUE(minDistance, filter->GetMinDistance()); + TEST_SET_GET_VALUE(maxDistance, filter->GetMaxDistance()); + + NeighborhoodType::SizeValueType neighborhoodRadius = 3; + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); + filter->SetNeighborhoodRadius(hood.GetRadius()); TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); - TEST_SET_GET_VALUE(0, filter->GetInsidePixelValue()); - filter->UpdateLargestPossibleRegion(); + FilterType::PixelType insidePixelValue = 0; + filter->SetInsidePixelValue(insidePixelValue); + TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); + + FilterType::OffsetType offset = { { -1, 0, 1 } }; + FilterType::OffsetVector::Pointer offsetVector = FilterType::OffsetVector::New(); + offsetVector->push_back(offset); + filter->SetOffsets(offsetVector); + TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + + filter->SetOffsets(offsetVector); + TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + + + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx index 891cc491470..a75a9c4cc0c 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx @@ -22,49 +22,95 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkNeighborhood.h" +#include "itkTestingMacros.h" int ScalarImageToRunLengthFeaturesImageFilterTest(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [minDistance]" + << " [maxDistance]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 10; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + FilterType::Pointer filter = FilterType::New(); + + EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); - hood.SetRadius(std::atoi(argv[9])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + TEST_SET_GET_VALUE(pixelValueMin, filter->GetMin()); + TEST_SET_GET_VALUE(pixelValueMax, filter->GetMax()); + + FilterType::RealType minDistance = std::atof(argv[7]); + FilterType::RealType maxDistance = std::atof(argv[8]); + filter->SetDistanceValueMinMax(minDistance, maxDistance); + TEST_SET_GET_VALUE(minDistance, filter->GetMinDistance()); + TEST_SET_GET_VALUE(maxDistance, filter->GetMaxDistance()); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); + TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); } - filter->UpdateLargestPossibleRegion(); - // Create and setup a writter + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + // Create and set up a writer typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - writer->SetFileName(outputFilename.c_str()); + writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + TRY_EXPECT_NO_EXCEPTION(writer->Update()); + + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx index a2c5e9c7d15..9df6891d917 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx @@ -23,63 +23,100 @@ #include "itkImageFileWriter.h" #include "itkNeighborhood.h" #include "itkVectorIndexSelectionCastImageFilter.h" +#include "itkTestingMacros.h" int ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [minDistance]" + << " [maxDistance]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 10; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); + + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); - hood.SetRadius(std::atoi(argv[9])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + FilterType::RealType minDistance = std::atof(argv[7]); + FilterType::RealType maxDistance = std::atof(argv[8]); + filter->SetDistanceValueMinMax(minDistance, maxDistance); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - typedef itk::Image imageFeatures; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + + typedef itk::Image FeatureImageType; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); - for (unsigned int i = 0; i < 10; i++) + for (unsigned int i = 0; i < VectorComponentDimension; i++) { indexSelectionFilter->SetIndex(i); - // Create and setup a writter - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + // Create and set up a writer + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i; std::string s = ss.str(); writer->SetFileName(outputFilename + "_" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + + TRY_EXPECT_NO_EXCEPTION(writer->Update()); } + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 7eb674faf79..ac03e375ea1 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -25,63 +25,99 @@ #include "itkVectorIndexSelectionCastImageFilter.h" #include "itkVectorImageToImageAdaptor.h" #include "itkNthElementImageAdaptor.h" +#include "itkTestingMacros.h" int ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [minDistance]" + << " [maxDistance]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 10; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); - hood.SetRadius(std::atoi(argv[9])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + FilterType::RealType minDistance = std::atof(argv[7]); + FilterType::RealType maxDistance = std::atof(argv[8]); + filter->SetDistanceValueMinMax(minDistance, maxDistance); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - typedef itk::Image imageFeatures; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + + typedef itk::Image FeatureImageType; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); - for (unsigned int i = 0; i < 10; i++) + for (unsigned int i = 0; i < VectorComponentDimension; i++) { indexSelectionFilter->SetIndex(i); - // Create and setup a writter - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + // Create and set up a writer + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i; std::string s = ss.str(); writer->SetFileName(outputFilename + "_" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + + TRY_EXPECT_NO_EXCEPTION(writer->Update()); } + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx index 9dabaec7811..46a978f79f6 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx @@ -22,49 +22,85 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkNeighborhood.h" +#include "itkTestingMacros.h" int ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [minDistance]" + << " [maxDistance]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + + EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - filter->SetDistanceValueMinMax(std::atof(argv[7]), std::atof(argv[8])); - hood.SetRadius(std::atoi(argv[9])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + FilterType::RealType minDistance = std::atof(argv[7]); + FilterType::RealType maxDistance = std::atof(argv[8]); + filter->SetDistanceValueMinMax(minDistance, maxDistance); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - // Create and setup a writter + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + // Create and set up a writer typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - writer->SetFileName(outputFilename.c_str()); + writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + TRY_EXPECT_NO_EXCEPTION(writer->Update()); + + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx index 698d3cd5b59..df6f904ebb9 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx @@ -22,43 +22,79 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkNeighborhood.h" +#include "itkTestingMacros.h" int ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 3) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [minDistance]" + << " [maxDistance]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 10; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + reader->SetFileName(argv[1]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + if (argc >= 4) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[3])); - filter->SetPixelValueMinMax(std::atof(argv[4]), std::atof(argv[5])); - filter->SetDistanceValueMinMax(std::atof(argv[6]), std::atof(argv[7])); - hood.SetRadius(std::atoi(argv[8])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[3]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[4]); + FilterType::PixelType pixelValueMax = std::atof(argv[5]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + FilterType::RealType minDistance = std::atof(argv[6]); + FilterType::RealType maxDistance = std::atof(argv[7]); + filter->SetDistanceValueMinMax(minDistance, maxDistance); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[8]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - // Create and setup a writter + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + // Create and set up a writer typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[2]; - writer->SetFileName(outputFilename.c_str()); + writer->SetFileName(argv[2]); writer->SetInput(filter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + TRY_EXPECT_NO_EXCEPTION(writer->Update()); + + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx index b2944303fec..b18f7228885 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx @@ -25,51 +25,83 @@ int ScalarImageToTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 3) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 8; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); + + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); - hood.SetRadius(3); - NeighborhoodType::OffsetType offset = { { -1, 0, 1 } }; filter->SetInput(reader->GetOutput()); + filter->SetMaskImage(maskReader->GetOutput()); - filter->SetNumberOfBinsPerAxis(15); - filter->SetPixelValueMinMax(-62, 2456); - filter->SetNeighborhoodRadius(hood.GetRadius()); - filter->SetInsidePixelValue(0); - filter->SetOffset(offset); + TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); - filter->UpdateLargestPossibleRegion(); + unsigned int numberOfBinsPerAxis = 15; + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); - TEST_SET_GET_VALUE(reader->GetOutput(), filter->GetInput()); - TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); - TEST_SET_GET_VALUE(15, filter->GetNumberOfBinsPerAxis()); - TEST_SET_GET_VALUE(-62, filter->GetMin()); - TEST_SET_GET_VALUE(2456, filter->GetMax()); + + FilterType::PixelType min = -62; + FilterType::PixelType max = 2456; + filter->SetPixelValueMinMax(min, max); + TEST_SET_GET_VALUE(min, filter->GetMin()); + TEST_SET_GET_VALUE(max, filter->GetMax()); + + NeighborhoodType::SizeValueType neighborhoodRadius = 3; + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); + filter->SetNeighborhoodRadius(hood.GetRadius()); TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); - TEST_SET_GET_VALUE(0, filter->GetInsidePixelValue()); - filter->UpdateLargestPossibleRegion(); + FilterType::PixelType insidePixelValue = 0; + filter->SetInsidePixelValue(insidePixelValue); + TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); + + FilterType::OffsetType offset = { { -1, 0, 1 } }; + FilterType::OffsetVector::Pointer offsetVector = FilterType::OffsetVector::New(); + offsetVector->push_back(offset); + filter->SetOffsets(offsetVector); + TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + + filter->SetOffsets(offsetVector); + TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + + + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx index 29532a4a38d..f585a4f858d 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx @@ -22,48 +22,73 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkNeighborhood.h" +#include "itkTestingMacros.h" int ScalarImageToTextureFeaturesImageFilterTest(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 3) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 8; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - hood.SetRadius(std::atoi(argv[7])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - // Create and setup a writter + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + // Create and set up a writer typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - writer->SetFileName(outputFilename.c_str()); + writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + TRY_EXPECT_NO_EXCEPTION(writer->Update()); + + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx index a2e228a1d85..cf2eb80b911 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -23,62 +23,94 @@ #include "itkImageFileWriter.h" #include "itkNeighborhood.h" #include "itkVectorIndexSelectionCastImageFilter.h" +#include "itkTestingMacros.h" int ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 8; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); + + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - hood.SetRadius(std::atoi(argv[7])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType min = std::atof(argv[5]); + FilterType::PixelType max = std::atof(argv[6]); + filter->SetPixelValueMinMax(min, max); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - typedef itk::Image imageFeatures; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + + typedef itk::Image FeatureImageType; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); - for (unsigned int i = 0; i < 8; i++) + for (unsigned int i = 0; i < VectorComponentDimension; i++) { indexSelectionFilter->SetIndex(i); - // Create and setup a writter - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + // Create and set up a writer + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i + 1; std::string s = ss.str(); writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + + TRY_EXPECT_NO_EXCEPTION(writer->Update()); } + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 67c1dc090c7..7f6df51cabe 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -25,62 +25,92 @@ #include "itkVectorIndexSelectionCastImageFilter.h" #include "itkVectorImageToImageAdaptor.h" #include "itkNthElementImageAdaptor.h" +#include "itkTestingMacros.h" int ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 8; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - hood.SetRadius(std::atoi(argv[7])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - typedef itk::Image imageFeatures; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + + typedef itk::Image FeatureImageType; + typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); - for (unsigned int i = 0; i < 8; i++) + for (unsigned int i = 0; i < VectorComponentDimension; i++) { indexSelectionFilter->SetIndex(i); - // Create and setup a writter - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + // Create and setup a writer + typedef itk::ImageFileWriter WriterType; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i + 1; std::string s = ss.str(); writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + + TRY_EXPECT_NO_EXCEPTION(writer->Update()); } + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx index 54aa2b99c9e..8586042d27f 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -22,48 +22,79 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkNeighborhood.h" +#include "itkTestingMacros.h" int ScalarImageToTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 4) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " maskImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Create and setup a maskReader - readerType::Pointer maskReader = readerType::New(); - std::string maskFilename = argv[2]; - maskReader->SetFileName(maskFilename.c_str()); + // Create and set up a maskReader + ReaderType::Pointer maskReader = ReaderType::New(); + maskReader->SetFileName(argv[2]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + + EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); + + filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); + if (argc >= 5) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[4])); - filter->SetPixelValueMinMax(std::atof(argv[5]), std::atof(argv[6])); - hood.SetRadius(std::atoi(argv[7])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - // Create and setup a writter + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + // Create and set up a writer typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - writer->SetFileName(outputFilename.c_str()); + writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + TRY_EXPECT_NO_EXCEPTION(writer->Update()); + + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx index 4242fdaf95e..44bffbf5105 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx @@ -22,42 +22,72 @@ #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "itkNeighborhood.h" +#include "itkTestingMacros.h" int ScalarImageToTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) { - // Setup types - typedef itk::Image InputImageType; - typedef itk::Image, 3> OutputImageType; - typedef itk::ImageFileReader readerType; + if (argc < 3) + { + std::cerr << "Missing parameters." << std::endl; + std::cerr << "Usage: " << argv[0] << " inputImageFile" + << " outputImageFile" + << " [numberOfBinsPerAxis]" + << " [pixelValueMin]" + << " [pixelValueMax]" + << " [neighborhoodRadius]" << std::endl; + return EXIT_FAILURE; + } + + const unsigned int ImageDimension = 3; + const unsigned int VectorComponentDimension = 8; + + // Declare types + typedef int InputPixelType; + typedef float OutputPixelComponentType; + typedef itk::Vector OutputPixelType; + + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; typedef itk::Neighborhood NeighborhoodType; - NeighborhoodType hood; - // Create and setup a reader - readerType::Pointer reader = readerType::New(); - std::string inputFilename = argv[1]; - reader->SetFileName(inputFilename.c_str()); + // Create and set up a reader + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(argv[1]); - // Apply the filter + // Create the filter typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); + filter->SetInput(reader->GetOutput()); + if (argc >= 4) { - filter->SetNumberOfBinsPerAxis(std::atoi(argv[3])); - filter->SetPixelValueMinMax(std::atof(argv[4]), std::atof(argv[5])); - hood.SetRadius(std::atoi(argv[6])); + unsigned int numberOfBinsPerAxis = std::atoi(argv[3]); + filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); + + FilterType::PixelType pixelValueMin = std::atof(argv[4]); + FilterType::PixelType pixelValueMax = std::atof(argv[5]); + filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[6]); + NeighborhoodType hood; + hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); } - filter->UpdateLargestPossibleRegion(); - // Create and setup a writter + TRY_EXPECT_NO_EXCEPTION(filter->Update()); + + // Create and set up a writer typedef itk::ImageFileWriter WriterType; WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[2]; - writer->SetFileName(outputFilename.c_str()); + writer->SetFileName(argv[2]); writer->SetInput(filter->GetOutput()); - writer->UpdateLargestPossibleRegion(); + TRY_EXPECT_NO_EXCEPTION(writer->Update()); + + + std::cout << "Test finished." << std::endl; return EXIT_SUCCESS; } From 5e6b6e4b19679d67e5d11bfa8c9bbffa3ed8577e Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Jun 2017 11:56:23 -0400 Subject: [PATCH 045/135] BUG: Fix internal image initialization and type Removed superfluous allocation of image object. Switch to raw pointers to pipeline object. The use of raw pointers is perfected over smart pointer for internal pipeline methods, since the pipeline holds the references to the object. Particularly, in threaded methods having concurrence modification of the reference count can cause delay. --- .../itkScalarImageToTextureFeaturesImageFilter.hxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index 6d564f7e9e9..a0caed1a3f3 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -73,8 +73,7 @@ template void ScalarImageToTextureFeaturesImageFilter::BeforeThreadedGenerateData() { - typename TInputImage::Pointer maskPointer = TInputImage::New(); - maskPointer = const_cast(this->GetMaskImage()); + InputImageType * maskPointer = const_cast(this->GetMaskImage()); this->m_DigitalisedInputImageg = InputImageType::New(); this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); @@ -105,8 +104,7 @@ ScalarImageToTextureFeaturesImageFilter::BeforeThread m_Spacing = this->GetInput()->GetSpacing(); // Support VectorImages by setting number of components on output. - typename TOutputImage::Pointer outputPtr = TOutputImage::New(); - outputPtr = this->GetOutput(); + OutputImageType * outputPtr = this->GetOutput(); if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) { typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; @@ -122,8 +120,7 @@ ScalarImageToTextureFeaturesImageFilter::ThreadedGene ThreadIdType threadId) { // Recuperation of the different inputs/outputs - typename TOutputImage::Pointer outputPtr = TOutputImage::New(); - outputPtr = this->GetOutput(); + OutputImageType * outputPtr = this->GetOutput(); ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); From ac6f8ce98e7740eaa262f2f5776007f90a34bd58 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Jun 2017 12:12:19 -0400 Subject: [PATCH 046/135] BUG: use vnl_matrix over nested array allocation The hist array was not being deleted and leaking memory. The usage of vnl_matrix create as single block of allocate memory, enabling coherent memory access. Using the vnl_matrix over a raw array enable the class to automatically free the memory and follows resource acquisition is initialization (RAII) best practices. --- ...kScalarImageToTextureFeaturesImageFilter.h | 14 +++++----- ...calarImageToTextureFeaturesImageFilter.hxx | 28 +++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h index b7db10b6ab0..51725f6a030 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h @@ -212,16 +212,16 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - ComputeFeatures(unsigned int ** hist, + ComputeFeatures(vnl_matrix & hist, const unsigned int & totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel); void - ComputeMeansAndVariances(unsigned int ** hist, - const unsigned int & totalNumberOfFreq, - double & pixelMean, - double & marginalMean, - double & marginalDevSquared, - double & pixelVariance); + ComputeMeansAndVariances(vnl_matrix & hist, + const unsigned int & totalNumberOfFreq, + double & pixelMean, + double & marginalMean, + double & marginalDevSquared, + double & pixelVariance); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx index a0caed1a3f3..608e267eb1e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx @@ -145,13 +145,11 @@ ScalarImageToTextureFeaturesImageFilter::ThreadedGene typename OffsetVector::ConstIterator offsets; // Declaration of the variables usefull to iterate over the all the offsets - OffsetType offset; - unsigned int totalNumberOfFreq; - unsigned int ** hist = new unsigned int *[m_NumberOfBinsPerAxis]; - for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) - { - hist[a] = new unsigned int[m_NumberOfBinsPerAxis]; - } + OffsetType offset; + unsigned int totalNumberOfFreq; + + + vnl_matrix hist(m_NumberOfBinsPerAxis, m_NumberOfBinsPerAxis); // Declaration of the variables usefull to iterate over the all neighborhood region PixelType curentInNeighborhoodPixelIntensity; @@ -161,7 +159,7 @@ ScalarImageToTextureFeaturesImageFilter::ThreadedGene OffsetType tempOffset; /// ***** Non-boundary Region ***** - for (fit; fit != faceList.end(); ++fit) + for (; fit != faceList.end(); ++fit) { NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit); typedef itk::ImageRegionIterator IteratorType; @@ -307,7 +305,7 @@ ScalarImageToTextureFeaturesImageFilter::IsInsideNeig template void ScalarImageToTextureFeaturesImageFilter::ComputeFeatures( - unsigned int ** hist, + vnl_matrix & hist, const unsigned int & totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel) { @@ -380,12 +378,12 @@ ScalarImageToTextureFeaturesImageFilter::ComputeFeatu template void ScalarImageToTextureFeaturesImageFilter::ComputeMeansAndVariances( - unsigned int ** hist, - const unsigned int & totalNumberOfFreq, - double & pixelMean, - double & marginalMean, - double & marginalDevSquared, - double & pixelVariance) + vnl_matrix & hist, + const unsigned int & totalNumberOfFreq, + double & pixelMean, + double & marginalMean, + double & marginalDevSquared, + double & pixelVariance) { // This function takes two passes through the histogram and two passes through // an array of the same length as a histogram axis. This could probably be From 07bab785f28302164420913c4108ea0fe7a2b614 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 23 Jun 2017 16:13:15 -0400 Subject: [PATCH 047/135] STYLE: Renaming itkScalarImageToTextureFeatureImageFilter into itkCoocurenceTextureFeatureImageFilter --- ...itkCoocurenceTextureFeaturesImageFilter.h} | 18 +++--- ...kCoocurenceTextureFeaturesImageFilter.hxx} | 31 +++++----- .../TextureFeatures/test/CMakeLists.txt | 56 +++++++++---------- ...eFeaturesImageFilterInstantiationTest.cxx} | 8 +-- ...curenceTextureFeaturesImageFilterTest.cxx} | 6 +- ...aturesImageFilterTestSeparateFeatures.cxx} | 6 +- ...FilterTestVectorImageSeparateFeatures.cxx} | 6 +- ...eaturesImageFilterTestWithVectorImage.cxx} | 8 +-- ...ureFeaturesImageFilterTestWithoutMask.cxx} | 6 +- .../TextureFeatures/wrapping/CMakeLists.txt | 2 +- ...CoocurenceTextureFeaturesImageFilter.wrap} | 2 +- 11 files changed, 74 insertions(+), 75 deletions(-) rename Modules/Filtering/TextureFeatures/include/{itkScalarImageToTextureFeaturesImageFilter.h => itkCoocurenceTextureFeaturesImageFilter.h} (94%) rename Modules/Filtering/TextureFeatures/include/{itkScalarImageToTextureFeaturesImageFilter.hxx => itkCoocurenceTextureFeaturesImageFilter.hxx} (92%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx => CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx} (91%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToTextureFeaturesImageFilterTest.cxx => CoocurenceTextureFeaturesImageFilterTest.cxx} (93%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx => CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx} (94%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx => CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx} (94%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx => CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx} (90%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx => CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx} (93%) rename Modules/Filtering/TextureFeatures/wrapping/{itkScalarImageToTextureFeaturesImageFilter.wrap => itkCoocurenceTextureFeaturesImageFilter.wrap} (96%) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.h similarity index 94% rename from Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h rename to Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.h index 51725f6a030..5681f85c956 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkScalarImageToTextureFeaturesImageFilter_h -#define itkScalarImageToTextureFeaturesImageFilter_h +#ifndef itkCoocurenceTextureFeaturesImageFilter_h +#define itkCoocurenceTextureFeaturesImageFilter_h #include "itkImageToImageFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" @@ -26,7 +26,7 @@ namespace itk { namespace Statistics { -/** \class ScalarImageToTextureFeaturesImageFilter +/** \class CoocurenceTextureFeaturesImageFilter * \brief This class computes texture descriptions for each voxel of * a given image and a mask image if provided. The output image can then be * displayed by using colormaps. @@ -83,17 +83,17 @@ namespace Statistics **/ template -class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public ImageToImageFilter +class ITK_TEMPLATE_EXPORT CoocurenceTextureFeaturesImageFilter : public ImageToImageFilter { public: /** Standard typedefs */ - typedef ScalarImageToTextureFeaturesImageFilter Self; + typedef CoocurenceTextureFeaturesImageFilter Self; typedef ImageToImageFilter Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** Run-time type information (and related methods). */ - itkTypeMacro(ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); + itkTypeMacro(CoocurenceTextureFeaturesImageFilter, ImageToImageFilter); /** standard New() method support */ itkNewMacro(Self); @@ -206,8 +206,8 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image #endif protected: - ScalarImageToTextureFeaturesImageFilter(); - virtual ~ScalarImageToTextureFeaturesImageFilter() {} + CoocurenceTextureFeaturesImageFilter(); + virtual ~CoocurenceTextureFeaturesImageFilter() {} bool IsInsideNeighborhood(const OffsetType & iteratedOffset); @@ -248,7 +248,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToTextureFeaturesImageFilter : public Image } // end of namespace itk #ifndef ITK_MANUAL_INSTANTIATION -# include "itkScalarImageToTextureFeaturesImageFilter.hxx" +# include "itkCoocurenceTextureFeaturesImageFilter.hxx" #endif #endif diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.hxx similarity index 92% rename from Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx rename to Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.hxx index 608e267eb1e..8ce43e184a2 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.hxx @@ -15,10 +15,10 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkScalarImageToTextureFeaturesImageFilter_hxx -#define itkScalarImageToTextureFeaturesImageFilter_hxx +#ifndef itkCoocurenceTextureFeaturesImageFilter_hxx +#define itkCoocurenceTextureFeaturesImageFilter_hxx -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" @@ -27,7 +27,7 @@ namespace itk namespace Statistics { template -ScalarImageToTextureFeaturesImageFilter::ScalarImageToTextureFeaturesImageFilter() +CoocurenceTextureFeaturesImageFilter::CoocurenceTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_Min(NumericTraits::NonpositiveMin()) , m_Max(NumericTraits::max()) @@ -62,7 +62,7 @@ ScalarImageToTextureFeaturesImageFilter::ScalarImageT template void -ScalarImageToTextureFeaturesImageFilter::SetOffset(const OffsetType offset) +CoocurenceTextureFeaturesImageFilter::SetOffset(const OffsetType offset) { OffsetVectorPointer offsetVector = OffsetVector::New(); offsetVector->push_back(offset); @@ -71,7 +71,7 @@ ScalarImageToTextureFeaturesImageFilter::SetOffset(co template void -ScalarImageToTextureFeaturesImageFilter::BeforeThreadedGenerateData() +CoocurenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() { InputImageType * maskPointer = const_cast(this->GetMaskImage()); this->m_DigitalisedInputImageg = InputImageType::New(); @@ -115,7 +115,7 @@ ScalarImageToTextureFeaturesImageFilter::BeforeThread template void -ScalarImageToTextureFeaturesImageFilter::ThreadedGenerateData( +CoocurenceTextureFeaturesImageFilter::ThreadedGenerateData( const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { @@ -241,7 +241,7 @@ ScalarImageToTextureFeaturesImageFilter::ThreadedGene template void -ScalarImageToTextureFeaturesImageFilter::UpdateOutputInformation() +CoocurenceTextureFeaturesImageFilter::UpdateOutputInformation() { // Call superclass's version Superclass::UpdateOutputInformation(); @@ -255,7 +255,7 @@ ScalarImageToTextureFeaturesImageFilter::UpdateOutput template void -ScalarImageToTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) +CoocurenceTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) { // Process object is not const-correct so the const_cast is required here this->ProcessObject::SetNthInput(1, const_cast(image)); @@ -263,7 +263,7 @@ ScalarImageToTextureFeaturesImageFilter::SetMaskImage template const TInputImage * -ScalarImageToTextureFeaturesImageFilter::GetMaskImage() const +CoocurenceTextureFeaturesImageFilter::GetMaskImage() const { if (this->GetNumberOfInputs() < 2) { @@ -274,7 +274,7 @@ ScalarImageToTextureFeaturesImageFilter::GetMaskImage template void -ScalarImageToTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) +CoocurenceTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) { if (this->m_Min != min || this->m_Max != max) { @@ -286,8 +286,7 @@ ScalarImageToTextureFeaturesImageFilter::SetPixelValu template bool -ScalarImageToTextureFeaturesImageFilter::IsInsideNeighborhood( - const OffsetType & iteratedOffset) +CoocurenceTextureFeaturesImageFilter::IsInsideNeighborhood(const OffsetType & iteratedOffset) { bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) @@ -304,7 +303,7 @@ ScalarImageToTextureFeaturesImageFilter::IsInsideNeig template void -ScalarImageToTextureFeaturesImageFilter::ComputeFeatures( +CoocurenceTextureFeaturesImageFilter::ComputeFeatures( vnl_matrix & hist, const unsigned int & totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel) @@ -377,7 +376,7 @@ ScalarImageToTextureFeaturesImageFilter::ComputeFeatu template void -ScalarImageToTextureFeaturesImageFilter::ComputeMeansAndVariances( +CoocurenceTextureFeaturesImageFilter::ComputeMeansAndVariances( vnl_matrix & hist, const unsigned int & totalNumberOfFreq, double & pixelMean, @@ -454,7 +453,7 @@ ScalarImageToTextureFeaturesImageFilter::ComputeMeans template void -ScalarImageToTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +CoocurenceTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 6b850396ebc..07477a4017c 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -13,12 +13,12 @@ set( ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx - ScalarImageToTextureFeaturesImageFilterTest.cxx - ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx - ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx - ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx + CoocurenceTextureFeaturesImageFilterTest.cxx + CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx + CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx + CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx + CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx ) set(TestOutput ${ITK_TEST_OUTPUT_DIR}) @@ -276,22 +276,22 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterInstantiationTest + NAME CoocurenceTextureFeaturesImageFilterInstantiationTest COMMAND TextureFeaturesTestDriver - ScalarImageToTextureFeaturesImageFilterInstantiationTest + CoocurenceTextureFeaturesImageFilterInstantiationTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterTestWithoutMask1 + NAME CoocurenceTextureFeaturesImageFilterTestWithoutMask1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask4.nrrd} ${TEMP}/resultTestWithoutMask4.nrrd - ScalarImageToTextureFeaturesImageFilterTestWithoutMask + CoocurenceTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask4.nrrd 10 @@ -301,13 +301,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterTestWithoutMask2 + NAME CoocurenceTextureFeaturesImageFilterTestWithoutMask2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask5.nrrd} ${TEMP}/resultTestWithoutMask5.nrrd - ScalarImageToTextureFeaturesImageFilterTestWithoutMask + CoocurenceTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask5.nrrd 10 @@ -317,13 +317,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterTestWithoutMask3 + NAME CoocurenceTextureFeaturesImageFilterTestWithoutMask3 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask6.nrrd} ${TEMP}/resultTestWithoutMask6.nrrd - ScalarImageToTextureFeaturesImageFilterTestWithoutMask + CoocurenceTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask6.nrrd 10 @@ -333,13 +333,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterVectorlImage1 + NAME CoocurenceTextureFeaturesImageFilterVectorlImage1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage3.nrrd} ${TEMP}/resultVectorImage3.nrrd - ScalarImageToTextureFeaturesImageFilterTestWithVectorImage + CoocurenceTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage3.nrrd @@ -350,13 +350,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterVectorImage2 + NAME CoocurenceTextureFeaturesImageFilterVectorImage2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage4.nrrd} ${TEMP}/resultVectorImage4.nrrd - ScalarImageToTextureFeaturesImageFilterTestWithVectorImage + CoocurenceTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage4.nrrd @@ -367,13 +367,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterPartialImage1 + NAME CoocurenceTextureFeaturesImageFilterPartialImage1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage3.nrrd} ${TEMP}/resultPartialImage3.nrrd - ScalarImageToTextureFeaturesImageFilterTest + CoocurenceTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage3.nrrd @@ -384,13 +384,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterPartialImage2 + NAME CoocurenceTextureFeaturesImageFilterPartialImage2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage4.nrrd} ${TEMP}/resultPartialImage4.nrrd - ScalarImageToTextureFeaturesImageFilterTest + CoocurenceTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage4.nrrd @@ -401,13 +401,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterTestWholeImage + NAME CoocurenceTextureFeaturesImageFilterTestWholeImage COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultWholeImage2.nrrd} ${TEMP}/resultWholeImage2.nrrd - ScalarImageToTextureFeaturesImageFilterTest + CoocurenceTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultWholeImage2.nrrd @@ -418,7 +418,7 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures + NAME CoocurenceTextureFeaturesImageFilterTestSeparateFeatures COMMAND TextureFeaturesTestDriver --compare @@ -445,7 +445,7 @@ itk_add_test( --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} ${TEMP}/resultSeparateFeatures_18.nrrd - ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures + CoocurenceTextureFeaturesImageFilterTestSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultSeparateFeatures @@ -456,7 +456,7 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures + NAME CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures COMMAND TextureFeaturesTestDriver --compare @@ -483,7 +483,7 @@ itk_add_test( --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd - ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures + CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx similarity index 91% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx index b18f7228885..0e3c42577b4 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -23,7 +23,7 @@ #include "itkTestingMacros.h" int -ScalarImageToTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) +CoocurenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) { if (argc < 3) { @@ -57,10 +57,10 @@ ScalarImageToTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[] maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurenceTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTest.cxx similarity index 93% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTest.cxx index f585a4f858d..0067672d819 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -ScalarImageToTextureFeaturesImageFilterTest(int argc, char * argv[]) +CoocurenceTextureFeaturesImageFilterTest(int argc, char * argv[]) { if (argc < 3) { @@ -57,7 +57,7 @@ ScalarImageToTextureFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx similarity index 94% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index cf2eb80b911..3d639ecc4b5 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -26,7 +26,7 @@ #include "itkTestingMacros.h" int -ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) +CoocurenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) { if (argc < 4) { @@ -64,7 +64,7 @@ ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * arg // Create the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx similarity index 94% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 7f6df51cabe..a021076d7e6 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkImageAlgorithm.h" @@ -28,7 +28,7 @@ #include "itkTestingMacros.h" int -ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) +CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) { if (argc < 4) { @@ -64,7 +64,7 @@ ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx similarity index 90% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 8586042d27f..6199fcc5978 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVectorImage.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -ScalarImageToTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) +CoocurenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) { if (argc < 4) { @@ -60,10 +60,10 @@ ScalarImageToTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToTextureFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurenceTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx similarity index 93% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx index 44bffbf5105..97fd8e16ac0 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToTextureFeaturesImageFilter.h" +#include "itkCoocurenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -ScalarImageToTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) +CoocurenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) { if (argc < 3) { @@ -57,7 +57,7 @@ ScalarImageToTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) reader->SetFileName(argv[1]); // Create the filter - typedef itk::Statistics::ScalarImageToTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt index 6da3f2ed10b..44ff08be55f 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt @@ -2,7 +2,7 @@ itk_wrap_module(TextureFeatures) set( WRAPPER_SUBMODULE_ORDER - itkScalarImageToTextureFeaturesImageFilter + itkCoocurenceTextureFeaturesImageFilter itkScalarImageToRunLengthFeaturesImageFilter ) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurenceTextureFeaturesImageFilter.wrap similarity index 96% rename from Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap rename to Modules/Filtering/TextureFeatures/wrapping/itkCoocurenceTextureFeaturesImageFilter.wrap index ba35ea2d1f4..50245e47d03 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurenceTextureFeaturesImageFilter.wrap @@ -53,7 +53,7 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() -itk_wrap_class("itk::Statistics::ScalarImageToTextureFeaturesImageFilter" POINTER) +itk_wrap_class("itk::Statistics::CoocurenceTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" From 406a7afedc54f3589c9aa17cfaf7e9dd7d613cc5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 23 Jun 2017 17:01:00 -0400 Subject: [PATCH 048/135] STYLE: Renaming itkScalarImageToRunLengthFeaturesImageFilter in itkRunLengthTextureFeaturesImageFilter --- ... itkRunLengthTextureFeaturesImageFilter.h} | 19 +++---- ...tkRunLengthTextureFeaturesImageFilter.hxx} | 35 ++++++------ .../TextureFeatures/test/CMakeLists.txt | 56 +++++++++---------- ...eFeaturesImageFilterInstantiationTest.cxx} | 8 +-- ...nLengthTextureFeaturesImageFilterTest.cxx} | 8 +-- ...aturesImageFilterTestSeparateFeatures.cxx} | 6 +- ...FilterTestVectorImageSeparateFeatures.cxx} | 6 +- ...eaturesImageFilterTestWithVectorImage.cxx} | 8 +-- ...ureFeaturesImageFilterTestWithoutMask.cxx} | 6 +- .../TextureFeatures/wrapping/CMakeLists.txt | 2 +- ...kRunLengthTextureFeaturesImageFilter.wrap} | 2 +- 11 files changed, 77 insertions(+), 79 deletions(-) rename Modules/Filtering/TextureFeatures/include/{itkScalarImageToRunLengthFeaturesImageFilter.h => itkRunLengthTextureFeaturesImageFilter.h} (94%) rename Modules/Filtering/TextureFeatures/include/{itkScalarImageToRunLengthFeaturesImageFilter.hxx => itkRunLengthTextureFeaturesImageFilter.hxx} (91%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx => RunLengthTextureFeaturesImageFilterInstantiationTest.cxx} (91%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToRunLengthFeaturesImageFilterTest.cxx => RunLengthTextureFeaturesImageFilterTest.cxx} (92%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx => RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx} (94%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx => RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx} (94%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx => RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx} (90%) rename Modules/Filtering/TextureFeatures/test/{ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx => RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx} (93%) rename Modules/Filtering/TextureFeatures/wrapping/{itkScalarImageToRunLengthFeaturesImageFilter.wrap => itkRunLengthTextureFeaturesImageFilter.wrap} (96%) diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h similarity index 94% rename from Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h rename to Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 95be1c59a6d..8b15a1a515d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkScalarImageToRunLengthFeaturesImageFilter_h -#define itkScalarImageToRunLengthFeaturesImageFilter_h +#ifndef itkRunLengthTextureFeaturesImageFilter_h +#define itkRunLengthTextureFeaturesImageFilter_h #include "itkImageToImageFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" @@ -26,7 +26,7 @@ namespace itk { namespace Statistics { -/** \class ScalarImageToRunLengthFeaturesImageFilter +/** \class RunLengthTextureFeaturesImageFilter * \brief This class computes run length features for each voxel of * a given image and a mask image if provided. The output image can then be * displayed by using colormaps. @@ -92,18 +92,17 @@ namespace Statistics */ template -class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter - : public ImageToImageFilter +class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToImageFilter { public: /** Standard typedefs */ - typedef ScalarImageToRunLengthFeaturesImageFilter Self; + typedef RunLengthTextureFeaturesImageFilter Self; typedef ImageToImageFilter Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** Run-time type information (and related methods). */ - itkTypeMacro(ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + itkTypeMacro(RunLengthTextureFeaturesImageFilter, ImageToImageFilter); /** standard New() method support */ itkNewMacro(Self); @@ -227,8 +226,8 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter #endif protected: - ScalarImageToRunLengthFeaturesImageFilter(); - virtual ~ScalarImageToRunLengthFeaturesImageFilter() {} + RunLengthTextureFeaturesImageFilter(); + virtual ~RunLengthTextureFeaturesImageFilter() {} void NormalizeOffsetDirection(OffsetType & offset); @@ -271,7 +270,7 @@ class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthFeaturesImageFilter } // end of namespace itk #ifndef ITK_MANUAL_INSTANTIATION -# include "itkScalarImageToRunLengthFeaturesImageFilter.hxx" +# include "itkRunLengthTextureFeaturesImageFilter.hxx" #endif #endif diff --git a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx similarity index 91% rename from Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx rename to Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 484bd9a329e..1022f759e8c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkScalarImageToRunLengthFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -15,10 +15,10 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkScalarImageToRunLengthFeaturesImageFilter_hxx -#define itkScalarImageToRunLengthFeaturesImageFilter_hxx +#ifndef itkRunLengthTextureFeaturesImageFilter_hxx +#define itkRunLengthTextureFeaturesImageFilter_hxx -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" @@ -27,7 +27,7 @@ namespace itk namespace Statistics { template -ScalarImageToRunLengthFeaturesImageFilter::ScalarImageToRunLengthFeaturesImageFilter() +RunLengthTextureFeaturesImageFilter::RunLengthTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_Min(NumericTraits::NonpositiveMin()) , m_Max(NumericTraits::max()) @@ -62,7 +62,7 @@ ScalarImageToRunLengthFeaturesImageFilter::ScalarImag template void -ScalarImageToRunLengthFeaturesImageFilter::SetOffset(const OffsetType offset) +RunLengthTextureFeaturesImageFilter::SetOffset(const OffsetType offset) { OffsetVectorPointer offsetVector = OffsetVector::New(); offsetVector->push_back(offset); @@ -71,7 +71,7 @@ ScalarImageToRunLengthFeaturesImageFilter::SetOffset( template void -ScalarImageToRunLengthFeaturesImageFilter::BeforeThreadedGenerateData() +RunLengthTextureFeaturesImageFilter::BeforeThreadedGenerateData() { typename TInputImage::Pointer maskPointer = TInputImage::New(); maskPointer = const_cast(this->GetMaskImage()); @@ -117,7 +117,7 @@ ScalarImageToRunLengthFeaturesImageFilter::BeforeThre template void -ScalarImageToRunLengthFeaturesImageFilter::ThreadedGenerateData( +RunLengthTextureFeaturesImageFilter::ThreadedGenerateData( const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { @@ -277,7 +277,7 @@ ScalarImageToRunLengthFeaturesImageFilter::ThreadedGe template void -ScalarImageToRunLengthFeaturesImageFilter::UpdateOutputInformation() +RunLengthTextureFeaturesImageFilter::UpdateOutputInformation() { // Call superclass's version Superclass::UpdateOutputInformation(); @@ -291,7 +291,7 @@ ScalarImageToRunLengthFeaturesImageFilter::UpdateOutp template void -ScalarImageToRunLengthFeaturesImageFilter::SetMaskImage(const InputImageType * image) +RunLengthTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) { // Process object is not const-correct so the const_cast is required here this->ProcessObject::SetNthInput(1, const_cast(image)); @@ -299,7 +299,7 @@ ScalarImageToRunLengthFeaturesImageFilter::SetMaskIma template const TInputImage * -ScalarImageToRunLengthFeaturesImageFilter::GetMaskImage() const +RunLengthTextureFeaturesImageFilter::GetMaskImage() const { if (this->GetNumberOfInputs() < 2) { @@ -310,7 +310,7 @@ ScalarImageToRunLengthFeaturesImageFilter::GetMaskIma template void -ScalarImageToRunLengthFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) +RunLengthTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) { if (this->m_Min != min || this->m_Max != max) { @@ -322,7 +322,7 @@ ScalarImageToRunLengthFeaturesImageFilter::SetPixelVa template void -ScalarImageToRunLengthFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) +RunLengthTextureFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) { if (Math::NotExactlyEquals(this->m_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) { @@ -334,7 +334,7 @@ ScalarImageToRunLengthFeaturesImageFilter::SetDistanc template void -ScalarImageToRunLengthFeaturesImageFilter::NormalizeOffsetDirection(OffsetType & offset) +RunLengthTextureFeaturesImageFilter::NormalizeOffsetDirection(OffsetType & offset) { itkDebugMacro("old offset = " << offset << std::endl); int sign = 1; @@ -357,8 +357,7 @@ ScalarImageToRunLengthFeaturesImageFilter::NormalizeO template bool -ScalarImageToRunLengthFeaturesImageFilter::IsInsideNeighborhood( - const OffsetType & iteratedOffset) +RunLengthTextureFeaturesImageFilter::IsInsideNeighborhood(const OffsetType & iteratedOffset) { bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) @@ -375,7 +374,7 @@ ScalarImageToRunLengthFeaturesImageFilter::IsInsideNe template void -ScalarImageToRunLengthFeaturesImageFilter::IncreaseHistograme( +RunLengthTextureFeaturesImageFilter::IncreaseHistograme( unsigned int ** hist, unsigned int & totalNumberOfRuns, const PixelType & curentInNeighborhoodPixelIntensity, @@ -401,7 +400,7 @@ ScalarImageToRunLengthFeaturesImageFilter::IncreaseHi template void -ScalarImageToRunLengthFeaturesImageFilter::ComputeFeatures( +RunLengthTextureFeaturesImageFilter::ComputeFeatures( unsigned int ** hist, const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel) @@ -483,7 +482,7 @@ ScalarImageToRunLengthFeaturesImageFilter::ComputeFea template void -ScalarImageToRunLengthFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +RunLengthTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 07477a4017c..9e420568bfe 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -7,12 +7,12 @@ set(ITK_TEST_DRIVER itkTestDriver) set( TextureFeaturesTests - ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx - ScalarImageToRunLengthFeaturesImageFilterTest.cxx - ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx - ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx - ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx - ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + RunLengthTextureFeaturesImageFilterInstantiationTest.cxx + RunLengthTextureFeaturesImageFilterTest.cxx + RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx + RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx + RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx + RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx CoocurenceTextureFeaturesImageFilterTest.cxx CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -26,22 +26,22 @@ set(TestOutput ${ITK_TEST_OUTPUT_DIR}) createtestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterInstantiationTest + NAME RunLengthTextureFeaturesImageFilterInstantiationTest COMMAND TextureFeaturesTestDriver - ScalarImageToRunLengthFeaturesImageFilterInstantiationTest + RunLengthTextureFeaturesImageFilterInstantiationTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask1 + NAME RunLengthTextureFeaturesImageFilterTestWithoutMask1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask1.nrrd} ${TEMP}/resultTestWithoutMask1.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask + RunLengthTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask1.nrrd 10 @@ -53,13 +53,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask2 + NAME RunLengthTextureFeaturesImageFilterTestWithoutMask2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask2.nrrd} ${TEMP}/resultTestWithoutMask2.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask + RunLengthTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask2.nrrd 10 @@ -71,13 +71,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask3 + NAME RunLengthTextureFeaturesImageFilterTestWithoutMask3 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask3.nrrd} ${TEMP}/resultTestWithoutMask3.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask + RunLengthTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask3.nrrd 10 @@ -89,13 +89,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterVectorlImage1 + NAME RunLengthTextureFeaturesImageFilterVectorlImage1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage1.nrrd} ${TEMP}/resultVectorImage1.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage + RunLengthTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage1.nrrd @@ -108,13 +108,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterVectorImage2 + NAME RunLengthTextureFeaturesImageFilterVectorImage2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage2.nrrd} ${TEMP}/resultVectorImage2.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage + RunLengthTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage2.nrrd @@ -127,13 +127,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterPartialImage1 + NAME RunLengthTextureFeaturesImageFilterPartialImage1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage1.nrrd} ${TEMP}/resultPartialImage1.nrrd - ScalarImageToRunLengthFeaturesImageFilterTest + RunLengthTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage1.nrrd @@ -146,13 +146,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterPartialImage2 + NAME RunLengthTextureFeaturesImageFilterPartialImage2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage2.nrrd} ${TEMP}/resultPartialImage2.nrrd - ScalarImageToRunLengthFeaturesImageFilterTest + RunLengthTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage2.nrrd @@ -165,13 +165,13 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterTestWholeImage + NAME RunLengthTextureFeaturesImageFilterTestWholeImage COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultWholeImage.nrrd} ${TEMP}/resultWholeImage.nrrd - ScalarImageToRunLengthFeaturesImageFilterTest + RunLengthTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultWholeImage.nrrd @@ -184,7 +184,7 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures + NAME RunLengthTextureFeaturesImageFilterTestSeparateFeatures COMMAND TextureFeaturesTestDriver --compare @@ -217,7 +217,7 @@ itk_add_test( --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} ${TEMP}/resultSeparateFeatures_0.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures + RunLengthTextureFeaturesImageFilterTestSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultSeparateFeatures @@ -230,7 +230,7 @@ itk_add_test( ) itk_add_test( - NAME ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures + NAME RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures COMMAND TextureFeaturesTestDriver --compare @@ -263,7 +263,7 @@ itk_add_test( --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_0.nrrd - ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures + RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx similarity index 91% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx rename to Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index 22dad132ecc..74d4c2473b1 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -23,7 +23,7 @@ #include "itkTestingMacros.h" int -ScalarImageToRunLengthFeaturesImageFilterInstantiationTest(int argc, char * argv[]) +RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) { if (argc < 3) { @@ -56,11 +56,11 @@ ScalarImageToRunLengthFeaturesImageFilterInstantiationTest(int argc, char * argv maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx similarity index 92% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx rename to Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index a75a9c4cc0c..73eb201b8d3 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -ScalarImageToRunLengthFeaturesImageFilterTest(int argc, char * argv[]) +RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) { if (argc < 4) { @@ -64,11 +64,11 @@ ScalarImageToRunLengthFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx similarity index 94% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx rename to Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index 9df6891d917..a49b33409d7 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -26,7 +26,7 @@ #include "itkTestingMacros.h" int -ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) +RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) { if (argc < 4) { @@ -66,7 +66,7 @@ ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures(int argc, char * a maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx similarity index 94% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx rename to Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index ac03e375ea1..4fd4d19f6f8 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkImageAlgorithm.h" @@ -28,7 +28,7 @@ #include "itkTestingMacros.h" int -ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) +RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) { if (argc < 4) { @@ -67,7 +67,7 @@ ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures(int arg maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx similarity index 90% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx rename to Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index 46a978f79f6..d20f47d24f1 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVectorImage.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) +RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) { if (argc < 4) { @@ -62,10 +62,10 @@ ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage(int argc, char * ar maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, ScalarImageToRunLengthFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx similarity index 93% rename from Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx rename to Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index df6f904ebb9..83ade0e9dc6 100644 --- a/Modules/Filtering/TextureFeatures/test/ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkScalarImageToRunLengthFeaturesImageFilter.h" +#include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) +RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) { if (argc < 3) { @@ -60,7 +60,7 @@ ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask(int argc, char * argv[] reader->SetFileName(argv[1]); // Create the filter - typedef itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt index 44ff08be55f..51775887f98 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt @@ -3,7 +3,7 @@ itk_wrap_module(TextureFeatures) set( WRAPPER_SUBMODULE_ORDER itkCoocurenceTextureFeaturesImageFilter - itkScalarImageToRunLengthFeaturesImageFilter + itkRunLengthTextureFeaturesImageFilter ) itk_auto_load_submodules() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap similarity index 96% rename from Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap rename to Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap index 7d8517db42e..86a77048287 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkScalarImageToRunLengthFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap @@ -53,7 +53,7 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() -itk_wrap_class("itk::Statistics::ScalarImageToRunLengthFeaturesImageFilter" POINTER) +itk_wrap_class("itk::Statistics::RunLengthTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" From 95c49bc5dd53549fa8e11d2d77ef824b99c95f6c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 26 Jun 2017 09:31:57 -0400 Subject: [PATCH 049/135] STYLE: Typo correction, Coocurence => Coocurrence --- ...tkCoocurrenceTextureFeaturesImageFilter.h} | 18 +++--- ...CoocurrenceTextureFeaturesImageFilter.hxx} | 31 +++++----- .../TextureFeatures/test/CMakeLists.txt | 56 +++++++++---------- ...eFeaturesImageFilterInstantiationTest.cxx} | 8 +-- ...urrenceTextureFeaturesImageFilterTest.cxx} | 6 +- ...aturesImageFilterTestSeparateFeatures.cxx} | 6 +- ...FilterTestVectorImageSeparateFeatures.cxx} | 6 +- ...eaturesImageFilterTestWithVectorImage.cxx} | 8 +-- ...ureFeaturesImageFilterTestWithoutMask.cxx} | 6 +- .../TextureFeatures/wrapping/CMakeLists.txt | 2 +- ...oocurrenceTextureFeaturesImageFilter.wrap} | 2 +- 11 files changed, 75 insertions(+), 74 deletions(-) rename Modules/Filtering/TextureFeatures/include/{itkCoocurenceTextureFeaturesImageFilter.h => itkCoocurrenceTextureFeaturesImageFilter.h} (94%) rename Modules/Filtering/TextureFeatures/include/{itkCoocurenceTextureFeaturesImageFilter.hxx => itkCoocurrenceTextureFeaturesImageFilter.hxx} (92%) rename Modules/Filtering/TextureFeatures/test/{CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx => CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx} (91%) rename Modules/Filtering/TextureFeatures/test/{CoocurenceTextureFeaturesImageFilterTest.cxx => CoocurrenceTextureFeaturesImageFilterTest.cxx} (93%) rename Modules/Filtering/TextureFeatures/test/{CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx => CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx} (94%) rename Modules/Filtering/TextureFeatures/test/{CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx => CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx} (94%) rename Modules/Filtering/TextureFeatures/test/{CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx => CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx} (90%) rename Modules/Filtering/TextureFeatures/test/{CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx => CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx} (93%) rename Modules/Filtering/TextureFeatures/wrapping/{itkCoocurenceTextureFeaturesImageFilter.wrap => itkCoocurrenceTextureFeaturesImageFilter.wrap} (96%) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h similarity index 94% rename from Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.h rename to Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 5681f85c956..578ecf12695 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkCoocurenceTextureFeaturesImageFilter_h -#define itkCoocurenceTextureFeaturesImageFilter_h +#ifndef itkCoocurrenceTextureFeaturesImageFilter_h +#define itkCoocurrenceTextureFeaturesImageFilter_h #include "itkImageToImageFilter.h" #include "itkScalarImageToRunLengthMatrixFilter.h" @@ -26,7 +26,7 @@ namespace itk { namespace Statistics { -/** \class CoocurenceTextureFeaturesImageFilter +/** \class CoocurrenceTextureFeaturesImageFilter * \brief This class computes texture descriptions for each voxel of * a given image and a mask image if provided. The output image can then be * displayed by using colormaps. @@ -83,17 +83,17 @@ namespace Statistics **/ template -class ITK_TEMPLATE_EXPORT CoocurenceTextureFeaturesImageFilter : public ImageToImageFilter +class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageToImageFilter { public: /** Standard typedefs */ - typedef CoocurenceTextureFeaturesImageFilter Self; + typedef CoocurrenceTextureFeaturesImageFilter Self; typedef ImageToImageFilter Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** Run-time type information (and related methods). */ - itkTypeMacro(CoocurenceTextureFeaturesImageFilter, ImageToImageFilter); + itkTypeMacro(CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); /** standard New() method support */ itkNewMacro(Self); @@ -206,8 +206,8 @@ class ITK_TEMPLATE_EXPORT CoocurenceTextureFeaturesImageFilter : public ImageToI #endif protected: - CoocurenceTextureFeaturesImageFilter(); - virtual ~CoocurenceTextureFeaturesImageFilter() {} + CoocurrenceTextureFeaturesImageFilter(); + virtual ~CoocurrenceTextureFeaturesImageFilter() {} bool IsInsideNeighborhood(const OffsetType & iteratedOffset); @@ -248,7 +248,7 @@ class ITK_TEMPLATE_EXPORT CoocurenceTextureFeaturesImageFilter : public ImageToI } // end of namespace itk #ifndef ITK_MANUAL_INSTANTIATION -# include "itkCoocurenceTextureFeaturesImageFilter.hxx" +# include "itkCoocurrenceTextureFeaturesImageFilter.hxx" #endif #endif diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx similarity index 92% rename from Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.hxx rename to Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 8ce43e184a2..845d652a9c9 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -15,10 +15,10 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkCoocurenceTextureFeaturesImageFilter_hxx -#define itkCoocurenceTextureFeaturesImageFilter_hxx +#ifndef itkCoocurrenceTextureFeaturesImageFilter_hxx +#define itkCoocurrenceTextureFeaturesImageFilter_hxx -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" @@ -27,7 +27,7 @@ namespace itk namespace Statistics { template -CoocurenceTextureFeaturesImageFilter::CoocurenceTextureFeaturesImageFilter() +CoocurrenceTextureFeaturesImageFilter::CoocurrenceTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_Min(NumericTraits::NonpositiveMin()) , m_Max(NumericTraits::max()) @@ -62,7 +62,7 @@ CoocurenceTextureFeaturesImageFilter::CoocurenceTextu template void -CoocurenceTextureFeaturesImageFilter::SetOffset(const OffsetType offset) +CoocurrenceTextureFeaturesImageFilter::SetOffset(const OffsetType offset) { OffsetVectorPointer offsetVector = OffsetVector::New(); offsetVector->push_back(offset); @@ -71,7 +71,7 @@ CoocurenceTextureFeaturesImageFilter::SetOffset(const template void -CoocurenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() +CoocurrenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() { InputImageType * maskPointer = const_cast(this->GetMaskImage()); this->m_DigitalisedInputImageg = InputImageType::New(); @@ -115,7 +115,7 @@ CoocurenceTextureFeaturesImageFilter::BeforeThreadedG template void -CoocurenceTextureFeaturesImageFilter::ThreadedGenerateData( +CoocurrenceTextureFeaturesImageFilter::ThreadedGenerateData( const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { @@ -241,7 +241,7 @@ CoocurenceTextureFeaturesImageFilter::ThreadedGenerat template void -CoocurenceTextureFeaturesImageFilter::UpdateOutputInformation() +CoocurrenceTextureFeaturesImageFilter::UpdateOutputInformation() { // Call superclass's version Superclass::UpdateOutputInformation(); @@ -255,7 +255,7 @@ CoocurenceTextureFeaturesImageFilter::UpdateOutputInf template void -CoocurenceTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) +CoocurrenceTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) { // Process object is not const-correct so the const_cast is required here this->ProcessObject::SetNthInput(1, const_cast(image)); @@ -263,7 +263,7 @@ CoocurenceTextureFeaturesImageFilter::SetMaskImage(co template const TInputImage * -CoocurenceTextureFeaturesImageFilter::GetMaskImage() const +CoocurrenceTextureFeaturesImageFilter::GetMaskImage() const { if (this->GetNumberOfInputs() < 2) { @@ -274,7 +274,7 @@ CoocurenceTextureFeaturesImageFilter::GetMaskImage() template void -CoocurenceTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) +CoocurrenceTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) { if (this->m_Min != min || this->m_Max != max) { @@ -286,7 +286,8 @@ CoocurenceTextureFeaturesImageFilter::SetPixelValueMi template bool -CoocurenceTextureFeaturesImageFilter::IsInsideNeighborhood(const OffsetType & iteratedOffset) +CoocurrenceTextureFeaturesImageFilter::IsInsideNeighborhood( + const OffsetType & iteratedOffset) { bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) @@ -303,7 +304,7 @@ CoocurenceTextureFeaturesImageFilter::IsInsideNeighbo template void -CoocurenceTextureFeaturesImageFilter::ComputeFeatures( +CoocurrenceTextureFeaturesImageFilter::ComputeFeatures( vnl_matrix & hist, const unsigned int & totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel) @@ -376,7 +377,7 @@ CoocurenceTextureFeaturesImageFilter::ComputeFeatures template void -CoocurenceTextureFeaturesImageFilter::ComputeMeansAndVariances( +CoocurrenceTextureFeaturesImageFilter::ComputeMeansAndVariances( vnl_matrix & hist, const unsigned int & totalNumberOfFreq, double & pixelMean, @@ -453,7 +454,7 @@ CoocurenceTextureFeaturesImageFilter::ComputeMeansAnd template void -CoocurenceTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +CoocurrenceTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 9e420568bfe..8c3242ce161 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -13,12 +13,12 @@ set( RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx - CoocurenceTextureFeaturesImageFilterTest.cxx - CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx - CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx - CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx - CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx + CoocurrenceTextureFeaturesImageFilterTest.cxx + CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx + CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx + CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx ) set(TestOutput ${ITK_TEST_OUTPUT_DIR}) @@ -276,22 +276,22 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterInstantiationTest + NAME CoocurrenceTextureFeaturesImageFilterInstantiationTest COMMAND TextureFeaturesTestDriver - CoocurenceTextureFeaturesImageFilterInstantiationTest + CoocurrenceTextureFeaturesImageFilterInstantiationTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterTestWithoutMask1 + NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask4.nrrd} ${TEMP}/resultTestWithoutMask4.nrrd - CoocurenceTextureFeaturesImageFilterTestWithoutMask + CoocurrenceTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask4.nrrd 10 @@ -301,13 +301,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterTestWithoutMask2 + NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask5.nrrd} ${TEMP}/resultTestWithoutMask5.nrrd - CoocurenceTextureFeaturesImageFilterTestWithoutMask + CoocurrenceTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask5.nrrd 10 @@ -317,13 +317,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterTestWithoutMask3 + NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask3 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask6.nrrd} ${TEMP}/resultTestWithoutMask6.nrrd - CoocurenceTextureFeaturesImageFilterTestWithoutMask + CoocurrenceTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultTestWithoutMask6.nrrd 10 @@ -333,13 +333,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterVectorlImage1 + NAME CoocurrenceTextureFeaturesImageFilterVectorlImage1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage3.nrrd} ${TEMP}/resultVectorImage3.nrrd - CoocurenceTextureFeaturesImageFilterTestWithVectorImage + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage3.nrrd @@ -350,13 +350,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterVectorImage2 + NAME CoocurrenceTextureFeaturesImageFilterVectorImage2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage4.nrrd} ${TEMP}/resultVectorImage4.nrrd - CoocurenceTextureFeaturesImageFilterTestWithVectorImage + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultVectorImage4.nrrd @@ -367,13 +367,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterPartialImage1 + NAME CoocurrenceTextureFeaturesImageFilterPartialImage1 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage3.nrrd} ${TEMP}/resultPartialImage3.nrrd - CoocurenceTextureFeaturesImageFilterTest + CoocurrenceTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage3.nrrd @@ -384,13 +384,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterPartialImage2 + NAME CoocurrenceTextureFeaturesImageFilterPartialImage2 COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage4.nrrd} ${TEMP}/resultPartialImage4.nrrd - CoocurenceTextureFeaturesImageFilterTest + CoocurrenceTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${TEMP}/resultPartialImage4.nrrd @@ -401,13 +401,13 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterTestWholeImage + NAME CoocurrenceTextureFeaturesImageFilterTestWholeImage COMMAND TextureFeaturesTestDriver --compare DATA{Baseline/resultWholeImage2.nrrd} ${TEMP}/resultWholeImage2.nrrd - CoocurenceTextureFeaturesImageFilterTest + CoocurrenceTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultWholeImage2.nrrd @@ -418,7 +418,7 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterTestSeparateFeatures + NAME CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures COMMAND TextureFeaturesTestDriver --compare @@ -445,7 +445,7 @@ itk_add_test( --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} ${TEMP}/resultSeparateFeatures_18.nrrd - CoocurenceTextureFeaturesImageFilterTestSeparateFeatures + CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultSeparateFeatures @@ -456,7 +456,7 @@ itk_add_test( ) itk_add_test( - NAME CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures + NAME CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures COMMAND TextureFeaturesTestDriver --compare @@ -483,7 +483,7 @@ itk_add_test( --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd - CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures + CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures diff --git a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx similarity index 91% rename from Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 0e3c42577b4..8891419cdad 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -23,7 +23,7 @@ #include "itkTestingMacros.h" int -CoocurenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) +CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) { if (argc < 3) { @@ -57,10 +57,10 @@ CoocurenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurenceTextureFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx similarity index 93% rename from Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTest.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 0067672d819..555693f4106 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -CoocurenceTextureFeaturesImageFilterTest(int argc, char * argv[]) +CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) { if (argc < 3) { @@ -57,7 +57,7 @@ CoocurenceTextureFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx similarity index 94% rename from Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 3d639ecc4b5..6268b229020 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -26,7 +26,7 @@ #include "itkTestingMacros.h" int -CoocurenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) +CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) { if (argc < 4) { @@ -64,7 +64,7 @@ CoocurenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[] // Create the filter - typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx similarity index 94% rename from Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index a021076d7e6..506a7cd71bc 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkImageAlgorithm.h" @@ -28,7 +28,7 @@ #include "itkTestingMacros.h" int -CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) +CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, char * argv[]) { if (argc < 4) { @@ -64,7 +64,7 @@ CoocurenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, ch maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx similarity index 90% rename from Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 6199fcc5978..c6b8c281374 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVectorImage.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -CoocurenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) +CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) { if (argc < 4) { @@ -60,10 +60,10 @@ CoocurenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurenceTextureFeaturesImageFilter, ImageToImageFilter); + EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx similarity index 93% rename from Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx rename to Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 97fd8e16ac0..8decaffefcd 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkCoocurenceTextureFeaturesImageFilter.h" +#include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkImage.h" #include "itkVector.h" @@ -25,7 +25,7 @@ #include "itkTestingMacros.h" int -CoocurenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) +CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) { if (argc < 3) { @@ -57,7 +57,7 @@ CoocurenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) reader->SetFileName(argv[1]); // Create the filter - typedef itk::Statistics::CoocurenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt index 51775887f98..001b280b81f 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/wrapping/CMakeLists.txt @@ -2,7 +2,7 @@ itk_wrap_module(TextureFeatures) set( WRAPPER_SUBMODULE_ORDER - itkCoocurenceTextureFeaturesImageFilter + itkCoocurrenceTextureFeaturesImageFilter itkRunLengthTextureFeaturesImageFilter ) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurenceTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap similarity index 96% rename from Modules/Filtering/TextureFeatures/wrapping/itkCoocurenceTextureFeaturesImageFilter.wrap rename to Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap index 50245e47d03..6ca8222e22d 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurenceTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap @@ -53,7 +53,7 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() -itk_wrap_class("itk::Statistics::CoocurenceTextureFeaturesImageFilter" POINTER) +itk_wrap_class("itk::Statistics::CoocurrenceTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_INT}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" From d3badb788b54195452bac1d5fc465a0557b595b4 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Fri, 30 Jun 2017 10:24:42 +0200 Subject: [PATCH 050/135] STYLE: Remove unnecessary variables from CMakeLists.txt. Remove unused variables from the test/CMakeLists.txt file: INPUTDATA, ITK_TEST_DRIVER, AND TestOutput. Replace the TEMP variable for its value (ITK_TEST_OUTPUT_DIR) for the sake of consistentcy across the toolkit's (remote module) test CMakeLists.txt practices. --- .../TextureFeatures/test/CMakeLists.txt | 151 +++++++++--------- 1 file changed, 72 insertions(+), 79 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 6b850396ebc..a60fd679dc8 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -1,10 +1,5 @@ itk_module_test() -set(INPUTDATA ${CMAKE_CURRENT_SOURCE_DIR}/Data) -set(TEMP ${ITK_TEST_OUTPUT_DIR}) - -set(ITK_TEST_DRIVER itkTestDriver) - set( TextureFeaturesTests ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx @@ -21,8 +16,6 @@ set( ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx ) -set(TestOutput ${ITK_TEST_OUTPUT_DIR}) - createtestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") itk_add_test( @@ -40,10 +33,10 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask1.nrrd} - ${TEMP}/resultTestWithoutMask1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask1.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultTestWithoutMask1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask1.nrrd 10 0 4200 @@ -58,10 +51,10 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask2.nrrd} - ${TEMP}/resultTestWithoutMask2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask2.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultTestWithoutMask2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask2.nrrd 10 0 4200 @@ -76,10 +69,10 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask3.nrrd} - ${TEMP}/resultTestWithoutMask3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask3.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultTestWithoutMask3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask3.nrrd 10 0 4200 @@ -94,11 +87,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage1.nrrd} - ${TEMP}/resultVectorImage1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage1.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultVectorImage1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage1.nrrd 10 0 4200 @@ -113,11 +106,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage2.nrrd} - ${TEMP}/resultVectorImage2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage2.nrrd ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultVectorImage2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage2.nrrd 10 0 4200 @@ -132,11 +125,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage1.nrrd} - ${TEMP}/resultPartialImage1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage1.nrrd ScalarImageToRunLengthFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultPartialImage1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage1.nrrd 10 0 4200 @@ -151,11 +144,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage2.nrrd} - ${TEMP}/resultPartialImage2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage2.nrrd ScalarImageToRunLengthFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultPartialImage2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage2.nrrd 10 0 4200 @@ -170,11 +163,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultWholeImage.nrrd} - ${TEMP}/resultWholeImage.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultWholeImage.nrrd ScalarImageToRunLengthFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} - ${TEMP}/resultWholeImage.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultWholeImage.nrrd 10 0 4200 @@ -189,38 +182,38 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultSeparateFeatures_1.nrrd} - ${TEMP}/resultSeparateFeatures_1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_1.nrrd --compare DATA{Baseline/resultSeparateFeatures_2.nrrd} - ${TEMP}/resultSeparateFeatures_2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_2.nrrd --compare DATA{Baseline/resultSeparateFeatures_3.nrrd} - ${TEMP}/resultSeparateFeatures_3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_3.nrrd --compare DATA{Baseline/resultSeparateFeatures_4.nrrd} - ${TEMP}/resultSeparateFeatures_4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_4.nrrd --compare DATA{Baseline/resultSeparateFeatures_5.nrrd} - ${TEMP}/resultSeparateFeatures_5.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_5.nrrd --compare DATA{Baseline/resultSeparateFeatures_6.nrrd} - ${TEMP}/resultSeparateFeatures_6.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_6.nrrd --compare DATA{Baseline/resultSeparateFeatures_7.nrrd} - ${TEMP}/resultSeparateFeatures_7.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_7.nrrd --compare DATA{Baseline/resultSeparateFeatures_8.nrrd} - ${TEMP}/resultSeparateFeatures_8.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_8.nrrd --compare DATA{Baseline/resultSeparateFeatures_9.nrrd} - ${TEMP}/resultSeparateFeatures_9.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_9.nrrd --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} - ${TEMP}/resultSeparateFeatures_0.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_0.nrrd ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} - ${TEMP}/resultSeparateFeatures + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures 10 0 4200 @@ -235,38 +228,38 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultSeparateFeatures_1.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_1.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_1.nrrd --compare DATA{Baseline/resultSeparateFeatures_2.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_2.nrrd --compare DATA{Baseline/resultSeparateFeatures_3.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_3.nrrd --compare DATA{Baseline/resultSeparateFeatures_4.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_4.nrrd --compare DATA{Baseline/resultSeparateFeatures_5.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_5.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_5.nrrd --compare DATA{Baseline/resultSeparateFeatures_6.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_6.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_6.nrrd --compare DATA{Baseline/resultSeparateFeatures_7.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_7.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_7.nrrd --compare DATA{Baseline/resultSeparateFeatures_8.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_8.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_8.nrrd --compare DATA{Baseline/resultSeparateFeatures_9.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_9.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_9.nrrd --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_0.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_0.nrrd ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures 10 0 4200 @@ -290,10 +283,10 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask4.nrrd} - ${TEMP}/resultTestWithoutMask4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask4.nrrd ScalarImageToTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultTestWithoutMask4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask4.nrrd 10 0 4200 @@ -306,10 +299,10 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask5.nrrd} - ${TEMP}/resultTestWithoutMask5.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask5.nrrd ScalarImageToTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultTestWithoutMask5.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask5.nrrd 10 0 4200 @@ -322,10 +315,10 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultTestWithoutMask6.nrrd} - ${TEMP}/resultTestWithoutMask6.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask6.nrrd ScalarImageToTextureFeaturesImageFilterTestWithoutMask DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultTestWithoutMask6.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask6.nrrd 10 0 4200 @@ -338,11 +331,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage3.nrrd} - ${TEMP}/resultVectorImage3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage3.nrrd ScalarImageToTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultVectorImage3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage3.nrrd 10 0 4200 @@ -355,11 +348,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage4.nrrd} - ${TEMP}/resultVectorImage4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage4.nrrd ScalarImageToTextureFeaturesImageFilterTestWithVectorImage DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultVectorImage4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage4.nrrd 10 0 4200 @@ -372,11 +365,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage3.nrrd} - ${TEMP}/resultPartialImage3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage3.nrrd ScalarImageToTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultPartialImage3.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage3.nrrd 10 0 4200 @@ -389,11 +382,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultPartialImage4.nrrd} - ${TEMP}/resultPartialImage4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage4.nrrd ScalarImageToTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} - ${TEMP}/resultPartialImage4.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage4.nrrd 10 0 4200 @@ -406,11 +399,11 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultWholeImage2.nrrd} - ${TEMP}/resultWholeImage2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultWholeImage2.nrrd ScalarImageToTextureFeaturesImageFilterTest DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} - ${TEMP}/resultWholeImage2.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultWholeImage2.nrrd 10 0 4200 @@ -423,32 +416,32 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultSeparateFeatures_11.nrrd} - ${TEMP}/resultSeparateFeatures_11.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_11.nrrd --compare DATA{Baseline/resultSeparateFeatures_12.nrrd} - ${TEMP}/resultSeparateFeatures_12.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_12.nrrd --compare DATA{Baseline/resultSeparateFeatures_13.nrrd} - ${TEMP}/resultSeparateFeatures_13.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_13.nrrd --compare DATA{Baseline/resultSeparateFeatures_14.nrrd} - ${TEMP}/resultSeparateFeatures_14.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_14.nrrd --compare DATA{Baseline/resultSeparateFeatures_15.nrrd} - ${TEMP}/resultSeparateFeatures_15.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_15.nrrd --compare DATA{Baseline/resultSeparateFeatures_16.nrrd} - ${TEMP}/resultSeparateFeatures_16.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_16.nrrd --compare DATA{Baseline/resultSeparateFeatures_17.nrrd} - ${TEMP}/resultSeparateFeatures_17.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_17.nrrd --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} - ${TEMP}/resultSeparateFeatures_18.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_18.nrrd ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} - ${TEMP}/resultSeparateFeatures + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures 10 0 4200 @@ -461,32 +454,32 @@ itk_add_test( TextureFeaturesTestDriver --compare DATA{Baseline/resultSeparateFeatures_11.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_11.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_11.nrrd --compare DATA{Baseline/resultSeparateFeatures_12.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_12.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_12.nrrd --compare DATA{Baseline/resultSeparateFeatures_13.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_13.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_13.nrrd --compare DATA{Baseline/resultSeparateFeatures_14.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_14.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_14.nrrd --compare DATA{Baseline/resultSeparateFeatures_15.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_15.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_15.nrrd --compare DATA{Baseline/resultSeparateFeatures_16.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_16.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_16.nrrd --compare DATA{Baseline/resultSeparateFeatures_17.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_17.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_17.nrrd --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_18.nrrd ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} - ${TEMP}/resultVectorImageSeparateFeatures + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures 10 0 4200 From e1820b54d1813051d7efe40508a05431296c729a Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 30 Jun 2017 15:54:42 -0400 Subject: [PATCH 051/135] ENH: Improve modifiers for method arguments Remove references for constant intrinsic variables. Add const modifier for arguments not modified. --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 16 ++++++++-------- .../itkCoocurrenceTextureFeaturesImageFilter.hxx | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 578ecf12695..accf52f4fdb 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -212,16 +212,16 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - ComputeFeatures(vnl_matrix & hist, - const unsigned int & totalNumberOfFreq, + ComputeFeatures(const vnl_matrix & hist, + const unsigned int totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel); void - ComputeMeansAndVariances(vnl_matrix & hist, - const unsigned int & totalNumberOfFreq, - double & pixelMean, - double & marginalMean, - double & marginalDevSquared, - double & pixelVariance); + ComputeMeansAndVariances(const vnl_matrix & hist, + const unsigned int totalNumberOfFreq, + double & pixelMean, + double & marginalMean, + double & marginalDevSquared, + double & pixelVariance); virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 845d652a9c9..95403abea5f 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -305,8 +305,8 @@ CoocurrenceTextureFeaturesImageFilter::IsInsideNeighb template void CoocurrenceTextureFeaturesImageFilter::ComputeFeatures( - vnl_matrix & hist, - const unsigned int & totalNumberOfFreq, + const vnl_matrix & hist, + const unsigned int totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel) { // Now get the various means and variances. This is takes two passes @@ -378,12 +378,12 @@ CoocurrenceTextureFeaturesImageFilter::ComputeFeature template void CoocurrenceTextureFeaturesImageFilter::ComputeMeansAndVariances( - vnl_matrix & hist, - const unsigned int & totalNumberOfFreq, - double & pixelMean, - double & marginalMean, - double & marginalDevSquared, - double & pixelVariance) + const vnl_matrix & hist, + const unsigned int totalNumberOfFreq, + double & pixelMean, + double & marginalMean, + double & marginalDevSquared, + double & pixelVariance) { // This function takes two passes through the histogram and two passes through // an array of the same length as a histogram axis. This could probably be From 57adecf21e8800bd74108c054932ce36d6cb9c60 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 30 Jun 2017 15:56:06 -0400 Subject: [PATCH 052/135] ENH: Remove unneeded const_cast --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 95403abea5f..916bf015ccf 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -73,7 +73,7 @@ template void CoocurrenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() { - InputImageType * maskPointer = const_cast(this->GetMaskImage()); + const InputImageType * maskPointer = this->GetMaskImage(); this->m_DigitalisedInputImageg = InputImageType::New(); this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); @@ -404,7 +404,6 @@ CoocurrenceTextureFeaturesImageFilter::ComputeMeansAn { for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) { - int k = hist[a][b]; float frequency = hist[a][b] / (float)totalNumberOfFreq; pixelMean += a * frequency; marginalSums[a] += frequency; From 3bcb886ab01208da5920bb65c75a9cdf7b5c5aa0 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 30 Jun 2017 15:56:24 -0400 Subject: [PATCH 053/135] ENH: prefer vnl_matrix::fill over loop. --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 916bf015ccf..5dca899f3a7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -177,13 +177,8 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera continue; } // Initialisation of the histogram - for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) - { - for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) - { - hist[a][b] = 0; - } - } + hist.fill(0); + totalNumberOfFreq = 0; // Iteration over all the offsets for (offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); ++offsets) From b34a38d11950db9fd8d557440b0bf32eb37bdfdd Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 3 Jul 2017 12:20:46 -0400 Subject: [PATCH 054/135] ENH: Use BinaryFunctor for "digitializing" input image Use a thread filter to perform digitizing and masking of the input image into histograms bins. Created a class scoped functor to perform the per-pixel operation. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 62 ++++++++++++++++++- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 51 +++++++-------- 2 files changed, 85 insertions(+), 28 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index accf52f4fdb..8e3e4e662a4 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -100,8 +100,11 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; + typedef TInputImage MaskImageType; + typedef TInputImage DigitalisedImageType; typedef typename InputImageType::PixelType PixelType; + typedef typename MaskImageType::PixelType MaskPixelType; typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::PointType PointType; @@ -234,7 +237,8 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo UpdateOutputInformation() ITK_OVERRIDE; private: - typename InputImageType::Pointer m_DigitalisedInputImageg; + typename DigitalisedImageType::Pointer m_DigitalisedInputImageg; + NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; unsigned int m_NumberOfBinsPerAxis; @@ -243,6 +247,62 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo PixelType m_InsidePixelValue; typename TInputImage::SpacingType m_Spacing; bool m_Normalize; + + + struct PreProcessingFunctor + { + PreProcessingFunctor() + : m_NumberOfBinsPerAxis(256) + , m_MaskValue(1) + , m_Min(NumericTraits::min()) + , m_Max(NumericTraits::max()) + {} + + PreProcessingFunctor(unsigned int numberOfBinsPerAxis, PixelType maskValue, PixelType min, PixelType max) + : m_NumberOfBinsPerAxis(numberOfBinsPerAxis) + , m_MaskValue(maskValue) + , m_Min(min) + , m_Max(max) + {} + + ~PreProcessingFunctor() {} + + bool + operator!=(const PreProcessingFunctor & other) const + { + return (m_NumberOfBinsPerAxis != other.m_NumberOfBinsPerAxis) || (m_MaskValue != other.m_MaskValue) || + (m_Min != other.m_Min) || (m_Max != other.m_Max); + } + + bool + operator==(const PreProcessingFunctor & other) const + { + return !(*this != other); + } + + inline typename DigitalisedImageType::PixelType + operator()(const MaskPixelType & maskPixel, const PixelType & inputPixel) const + { + if (maskPixel != m_MaskValue) + { + return this->m_Min - 10; + } + else if (inputPixel < this->m_Min || inputPixel >= m_Max) + { + return m_Min - 1; + } + else + { + return (inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis); + } + } + + unsigned int m_NumberOfBinsPerAxis; + + PixelType m_MaskValue; + PixelType m_Min; + PixelType m_Max; + }; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 5dca899f3a7..952a7766aa0 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -21,6 +21,7 @@ #include "itkCoocurrenceTextureFeaturesImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" +#include "itkBinaryFunctorImageFilter.h" namespace itk { @@ -73,35 +74,31 @@ template void CoocurrenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() { - const InputImageType * maskPointer = this->GetMaskImage(); - this->m_DigitalisedInputImageg = InputImageType::New(); - this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); - this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); - this->m_DigitalisedInputImageg->Allocate(); - typedef itk::ImageRegionIterator IteratorType; - IteratorType digitIt(this->m_DigitalisedInputImageg, this->m_DigitalisedInputImageg->GetLargestPossibleRegion()); - typedef itk::ImageRegionConstIterator ConstIteratorType; - ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); - unsigned int binNumber; - while (!inputIt.IsAtEnd()) + + typename TInputImage::Pointer input = InputImageType::New(); + input->Graft(const_cast(this->GetInput())); + + typedef PreProcessingFunctor PPFType; + PPFType ppf(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_Min, m_Max); + + typedef BinaryFunctorImageFilter BinaryFunctorType; + typename BinaryFunctorType::Pointer functorF = BinaryFunctorType::New(); + if (this->GetMaskImage() != ITK_NULLPTR) { - if (maskPointer && maskPointer->GetPixel(inputIt.GetIndex()) != this->m_InsidePixelValue) - { - digitIt.Set(this->m_Min - 10); - } - else if (inputIt.Get() < this->m_Min || inputIt.Get() >= this->m_Max) - { - digitIt.Set(this->m_Min - 1); - } - else - { - binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis); - digitIt.Set(binNumber); - } - ++inputIt; - ++digitIt; + typename TInputImage::Pointer mask = MaskImageType::New(); + mask->Graft(const_cast(this->GetMaskImage())); + functorF->SetInput1(mask); } - m_Spacing = this->GetInput()->GetSpacing(); + else + { + functorF->SetConstant1(m_InsidePixelValue); + } + functorF->SetInput2(input); + functorF->SetFunctor(ppf); + functorF->SetNumberOfThreads(this->GetNumberOfThreads()); + + functorF->Update(); + m_DigitalisedInputImageg = functorF->GetOutput(); // Support VectorImages by setting number of components on output. OutputImageType * outputPtr = this->GetOutput(); From 0e8828b4c9254dff54f7a0dae85353c94c6edaeb Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 3 Jul 2017 12:24:18 -0400 Subject: [PATCH 055/135] BUG: Free digitized image after filter execution --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 ++ .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 8e3e4e662a4..5205bd14a99 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -232,6 +232,8 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo virtual void BeforeThreadedGenerateData() ITK_OVERRIDE; virtual void + AfterThreadedGenerateData() ITK_OVERRIDE; + virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; virtual void UpdateOutputInformation() ITK_OVERRIDE; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 952a7766aa0..0d45269fa5f 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -110,6 +110,15 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded outputPtr->Allocate(); } +template +void +CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() +{ + // free internal image + this->m_DigitalisedInputImageg = ITK_NULLPTR; +} + + template void CoocurrenceTextureFeaturesImageFilter::ThreadedGenerateData( From 2f815bf3048a05f9370727fea5c63f0ff245dfe0 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 3 Jul 2017 13:22:57 -0400 Subject: [PATCH 056/135] BUG: Use proper GenerateOutputInformation method to set vector length The GernerateOutputInformation method is the correct method to overrride when specify image information and meta-data. Remove extraneous setting of the image's number of components. The filter will now throw an exception if the improper fixed number of components is set for the output image type. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 25 ++++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 5205bd14a99..0b009774058 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -236,7 +236,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; virtual void - UpdateOutputInformation() ITK_OVERRIDE; + GenerateOutputInformation() ITK_OVERRIDE; private: typename DigitalisedImageType::Pointer m_DigitalisedInputImageg; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 0d45269fa5f..671d3c30f22 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -99,15 +99,6 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded functorF->Update(); m_DigitalisedInputImageg = functorF->GetOutput(); - - // Support VectorImages by setting number of components on output. - OutputImageType * outputPtr = this->GetOutput(); - if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) - { - typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; - AccessorFunctorType::SetVectorLength(outputPtr, 8); - } - outputPtr->Allocate(); } template @@ -242,15 +233,19 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera template void -CoocurrenceTextureFeaturesImageFilter::UpdateOutputInformation() +CoocurrenceTextureFeaturesImageFilter::GenerateOutputInformation() { // Call superclass's version - Superclass::UpdateOutputInformation(); - - if (strcmp(this->GetOutput()->GetNameOfClass(), "VectorImage") == 0) + Superclass::GenerateOutputInformation(); + + OutputImageType * output = this->GetOutput(); + // If the output image type is a VectorImage the number of + // components will be properly sized if before allocation, if the + // output is a fixed width vector and the wrong number of + // components, then an exception will be thrown. + if (output->GetNumberOfComponentsPerPixel() != 8) { - typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; - AccessorFunctorType::SetVectorLength(this->GetOutput(), 8); + output->SetNumberOfComponentsPerPixel(8); } } From d96a92932aacff962ae5c5c4fe8acffadfe68943 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 3 Jul 2017 13:38:40 -0400 Subject: [PATCH 057/135] ENH: Make the MaskedInput image an optional named input Make use of the macros to set named input. This reuses the code in the macro. By making this input a named input it clarifies the information printed by the filter when printed. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 7 +++--- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 24 +++++-------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 0b009774058..750b144da6c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -128,12 +128,11 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); /** Method to set the mask image */ - void - SetMaskImage(const InputImageType * image); + itkSetInputMacro(MaskImage, InputImageType); /** Method to get the mask image */ - const InputImageType * - GetMaskImage() const; + itkGetInputMacro(MaskImage, InputImageType); + /** Specify the default number of bins per axis */ itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 671d3c30f22..49b9deac028 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -37,6 +37,12 @@ CoocurrenceTextureFeaturesImageFilter::CoocurrenceTex this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); + // Mark the "MaskImage" as an optional named input. First it has to + // be added to the list of named inputs then removed from the + // required list. + Self::AddRequiredInputName("MaskImage"); + Self::RemoveRequiredInputName("MaskImage"); + // Set the offset directions to their defaults: half of all the possible // directions 1 pixel away. (The other half is included by symmetry.) // We use a neighborhood iterator to calculate the appropriate offsets. @@ -249,24 +255,6 @@ CoocurrenceTextureFeaturesImageFilter::GenerateOutput } } -template -void -CoocurrenceTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) -{ - // Process object is not const-correct so the const_cast is required here - this->ProcessObject::SetNthInput(1, const_cast(image)); -} - -template -const TInputImage * -CoocurrenceTextureFeaturesImageFilter::GetMaskImage() const -{ - if (this->GetNumberOfInputs() < 2) - { - return ITK_NULLPTR; - } - return static_cast(this->ProcessObject::GetInput(1)); -} template void From 50fc78814633cf7d7934be6fa260aad1226aa6be Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Jun 2017 15:21:01 -0400 Subject: [PATCH 058/135] ENH: Import TextureMovingHistogramImageFilter from old repository This filter computes first order statistics (mean, min, max, variance, sigma, skewness, kurtosis, and entropy), on a sliding window with and efficient moving histogram based algorithm. --- .../include/itkTextureHistogram.h | 175 ++++++++++++ .../itkTextureMovingHistogramImageFilter.h | 114 ++++++++ .../TextureFeatures/itk-module.cmake | 1 + .../TextureFeatures/test/CMakeLists.txt | 27 +- .../TextureFeatures/test/CMakeLists.txt~ | 258 ++++++++++++++++++ ...kTextureMovingHistogramImageFilterTest.cxx | 101 +++++++ 6 files changed, 660 insertions(+), 16 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h create mode 100644 Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h create mode 100644 Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ create mode 100644 Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx diff --git a/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h new file mode 100644 index 00000000000..1d3aefd4f27 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h @@ -0,0 +1,175 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkTextureHistogram_h +#define itkTextureHistogram_h +#include "itkNumericTraits.h" + +namespace itk +{ +namespace Function +{ + +/* \class TextureHistogram + * + * + * + * \ingroup ITKTextureAnalysis + */ +template +class ITK_TEMPLATE_EXPORT TextureHistogram +{ +public: + TextureHistogram() { m_Count = 0; } + + // ~TextureHistogram() {} default is ok + + void + AddPixel(const TInputPixel & p) + { + m_Map[p]++; + ++m_Count; + } + + void + RemovePixel(const TInputPixel & p) + { + + // insert new item if one doesn't exist + typename MapType::iterator it = m_Map.find(p); + + assert(it != m_Map.end()); + + if (--(it->second) == 0) + { + m_Map.erase(it); + } + --m_Count; + } + + TOutputPixel + GetValue(const TInputPixel &) + { + TOutputPixel out; + NumericTraits::SetLength(out, 8); + + double sum = 0.0; + double sum2 = 0.0; + double sum3 = 0.0; + double sum4 = 0.0; + const size_t count = m_Count; + // double median = 0.0; + + double entropy = 0.0; + size_t curCount = 0; + // typename MapType::iterator medianIt = m_Map.end(); + for (typename MapType::iterator i = m_Map.begin(); i != m_Map.end(); ++i) + { + double t = double(i->first) * double(i->second); + sum += t; + sum2 += (t *= double(i->first)); + sum3 += (t *= double(i->first)); + sum4 += (t *= double(i->first)); + + curCount += i->second; + + const double p_x = double(i->second) / count; + entropy += -p_x * vcl_log(p_x); + + // // this is wrong! + // if ( curCount == count / 2 ) + // { + // median += i->first; + // medianIt = il + // // we have an even number so take the average + // if ( !(count % 2) ) + // { + // median *= 0.5; + // } + // } + } + + // curCount = 0; + // typename MapType::iterator fmedianIt = medianIt; + // typename MapType::iterator rmedianIt = medianIt; + // double mad = 0.0; + + // while (curCount < count/2 ) + // { + // if ( vcl_fabs( fmedianIt->first - median ) < vcl_fabs( rmedianIt->first - median ) ) + // { + // curCount += fmedianIt->second; + // ++fmedianIt; + // } + // else + // { + // curCount += rmedianIt->second; + // --rmedianIt; + // } + // } + + + const double icount = 1.0 / count; + const double mean = sum * icount; + + // unbiased estimate + const double variance = (sum2 - (sum * sum * icount)) / (count - 1); + const double sigma = vcl_sqrt(variance); + double skewness = 0.0; + double kurtosis = 0.0; + if (vcl_abs(variance * sigma) > itk::NumericTraits::min()) + { + + skewness = ((sum3 - 3.0 * mean * sum2) * icount + 2.0 * mean * mean * mean) / (variance * sigma); + } + if (vcl_abs(variance) > itk::NumericTraits::min()) + { + kurtosis = (sum4 * icount + mean * (-4.0 * sum3 * icount + mean * (6.0 * sum2 * icount - 3.0 * mean * mean))) / + (variance * variance) - + 3.0; + } + + unsigned int i = 0; + out[i++] = mean; + out[i++] = m_Map.begin()->first; + out[i++] = m_Map.rbegin()->first; + out[i++] = variance; + out[i++] = sigma; + out[i++] = skewness; + out[i++] = kurtosis; + out[i++] = entropy; + return out; + } + + void + AddBoundary() + {} + + void + RemoveBoundary() + {} + +private: + typedef typename std::map MapType; + + MapType m_Map; + size_t m_Count; +}; + +} // end namespace Function +} // end namespace itk +#endif diff --git a/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h new file mode 100644 index 00000000000..b6fb9860fb6 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h @@ -0,0 +1,114 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkTextureMovingHistogramImageFilter_h +#define itkTextureMovingHistogramImageFilter_h + +#include "itkMovingHistogramImageFilter.h" +#include "itkTextureHistogram.h" + +namespace itk +{ +/** + * \class TextureMovingHistogramImageFilter + * \brief Compute first order statistics in a neighborhood at each pixel + * + * \ingroup ITKTextureAnalysis + */ + +template +class ITK_TEMPLATE_EXPORT TextureMovingHistogramImageFilter + : public MovingHistogramImageFilter< + TInputImage, + TOutputImage, + TKernel, + typename Function::TextureHistogram> +{ +public: + /** Standard class typedefs. */ + typedef TextureMovingHistogramImageFilter Self; + typedef MovingHistogramImageFilter< + TInputImage, + TOutputImage, + TKernel, + typename Function::TextureHistogram> + Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Standard New method. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(TextureMovingHistogramImageFilter, MovingHistogramMorphologyImageFilter); + + /** Image related typedefs. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename TInputImage::RegionType RegionType; + typedef typename TInputImage::SizeType SizeType; + typedef typename TInputImage::IndexType IndexType; + typedef typename TInputImage::PixelType PixelType; + typedef typename TInputImage::OffsetType OffsetType; + typedef typename Superclass::OutputImageRegionType OutputImageRegionType; + typedef typename TOutputImage::PixelType OutputPixelType; + + /** Image related typedefs. */ + itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); + +protected: + unsigned int + GetNumberOfOutputComponents() + { + return 8; + } + + TextureMovingHistogramImageFilter() + { + // this->m_Boundary = NumericTraits< PixelType >::max(); + } + + void + GenerateOutputInformation() + { + // this methods is overloaded so that if the output image is a + // VectorImage then the correct number of components are set. + + Superclass::GenerateOutputInformation(); + OutputImageType * output = this->GetOutput(); + + if (!output) + { + return; + } + if (output->GetNumberOfComponentsPerPixel() != this->GetNumberOfOutputComponents()) + { + output->SetNumberOfComponentsPerPixel(this->GetNumberOfOutputComponents()); + } + } + + + ~TextureMovingHistogramImageFilter() {} + +private: + TextureMovingHistogramImageFilter(const Self &); // purposely not implemented + void + operator=(const Self &); // purposely not implemented +}; // end of class +} // end namespace itk + +#endif diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index 7e9b15e318d..3a56988f849 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -14,6 +14,7 @@ itk_module( ITKCommon ITKStatistics ITKImageGrid + ITKMathematicalMorphology COMPILE_DEPENDS ITKImageSources TEST_DEPENDS diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index ee6961e8297..b052a1746a0 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -14,22 +14,7 @@ set( ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx -) - -set( - TextureFeaturesTests - RunLengthTextureFeaturesImageFilterInstantiationTest.cxx - RunLengthTextureFeaturesImageFilterTest.cxx - RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx - RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx - RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx - RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx - CoocurrenceTextureFeaturesImageFilterTest.cxx - CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx - CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx - CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx - CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + itkTextureMovingHistogramImageFilterTest.cxx ) createtestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") @@ -501,3 +486,13 @@ itk_add_test( 4200 4 ) + +itk_add_test( + NAME itkTextureMovingHistogramImageFilterTest1 + COMMAND + TextureFeaturesTestDriver + itkTextureMovingHistogramImageFilterTest + DATA{${ITK_DATA_ROOT}/Input/cthead1.png} + ${ITK_TEST_OUTPUT_DIR}/itkTextureFeatureImageFilterTest1.mha + 5 +) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ new file mode 100644 index 00000000000..67c356ed206 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ @@ -0,0 +1,258 @@ +itk_module_test() + +set(TextureFeaturesTests ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx + ScalarImageToRunLengthFeaturesImageFilterTest.cxx + ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx + ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx + ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx + ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx + ScalarImageToTextureFeaturesImageFilterTest.cxx + ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx + ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx + ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx + ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + itkTextureMovingHistogramImageFilterTest.cxx) + +set(TextureFeaturesTests RunLengthTextureFeaturesImageFilterInstantiationTest.cxx + RunLengthTextureFeaturesImageFilterTest.cxx + RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx + RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx + RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx + RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx + CoocurrenceTextureFeaturesImageFilterTest.cxx + CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx + CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx + CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx) + +CreateTestDriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterInstantiationTest + COMMAND TextureFeaturesTestDriver + RunLengthTextureFeaturesImageFilterInstantiationTest + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd}) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWithoutMask1 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultTestWithoutMask1.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask1.nrrd + RunLengthTextureFeaturesImageFilterTestWithoutMask + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask1.nrrd 10 0 4200 0 0.7 2) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWithoutMask2 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultTestWithoutMask2.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask2.nrrd + RunLengthTextureFeaturesImageFilterTestWithoutMask + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask2.nrrd 10 0 4200 0 1.25 4) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWithoutMask3 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultTestWithoutMask3.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask3.nrrd + RunLengthTextureFeaturesImageFilterTestWithoutMask + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask3.nrrd 10 0 4200 0 1.8 6) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterVectorlImage1 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultPartialImage1.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage1.nrrd + RunLengthTextureFeaturesImageFilterTestWithVectorImage + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage1.nrrd 10 0 4200 0 0.7 2) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterVectorImage2 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultPartialImage2.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage2.nrrd + RunLengthTextureFeaturesImageFilterTestWithVectorImage + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage2.nrrd 10 0 4200 0 1.25 4) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterPartialImage1 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultPartialImage1.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage1.nrrd + RunLengthTextureFeaturesImageFilterTest + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage1.nrrd 10 0 4200 0 0.7 2) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterPartialImage2 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultPartialImage2.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage2.nrrd + RunLengthTextureFeaturesImageFilterTest + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage2.nrrd 10 0 4200 0 1.25 4) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWholeImage + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultWholeImage.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultWholeImage.nrrd + RunLengthTextureFeaturesImageFilterTest + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultWholeImage.nrrd 10 0 4200 0 0.7 2) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestSeparateFeatures + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultSeparateFeatures_1.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_1.nrrd + --compare DATA{Baseline/resultSeparateFeatures_2.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_2.nrrd + --compare DATA{Baseline/resultSeparateFeatures_3.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_3.nrrd + --compare DATA{Baseline/resultSeparateFeatures_4.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_4.nrrd + --compare DATA{Baseline/resultSeparateFeatures_5.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_5.nrrd + --compare DATA{Baseline/resultSeparateFeatures_6.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_6.nrrd + --compare DATA{Baseline/resultSeparateFeatures_7.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_7.nrrd + --compare DATA{Baseline/resultSeparateFeatures_8.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_8.nrrd + --compare DATA{Baseline/resultSeparateFeatures_9.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_9.nrrd + --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_0.nrrd + RunLengthTextureFeaturesImageFilterTestSeparateFeatures + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures 10 0 4200 0 1.25 4) + +itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultSeparateFeatures_1.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_1.nrrd + --compare DATA{Baseline/resultSeparateFeatures_2.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_2.nrrd + --compare DATA{Baseline/resultSeparateFeatures_3.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_3.nrrd + --compare DATA{Baseline/resultSeparateFeatures_4.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_4.nrrd + --compare DATA{Baseline/resultSeparateFeatures_5.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_5.nrrd + --compare DATA{Baseline/resultSeparateFeatures_6.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_6.nrrd + --compare DATA{Baseline/resultSeparateFeatures_7.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_7.nrrd + --compare DATA{Baseline/resultSeparateFeatures_8.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_8.nrrd + --compare DATA{Baseline/resultSeparateFeatures_9.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_9.nrrd + --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_0.nrrd + RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures 10 0 4200 0 1.25 4) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterInstantiationTest + COMMAND TextureFeaturesTestDriver + CoocurrenceTextureFeaturesImageFilterInstantiationTest + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd}) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask1 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultTestWithoutMask4.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask4.nrrd + CoocurrenceTextureFeaturesImageFilterTestWithoutMask + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask4.nrrd 10 0 4200 2) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask2 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultTestWithoutMask5.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask5.nrrd + CoocurrenceTextureFeaturesImageFilterTestWithoutMask + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask5.nrrd 10 0 4200 4) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask3 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultTestWithoutMask6.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask6.nrrd + CoocurrenceTextureFeaturesImageFilterTestWithoutMask + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask6.nrrd 10 0 4200 6) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterVectorlImage1 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultPartialImage3.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage3.nrrd + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage3.nrrd 10 0 4200 2) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterVectorImage2 + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultPartialImage4.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImage4.nrrd + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage4.nrrd 10 0 4200 4) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterPartialImage1 +COMMAND TextureFeaturesTestDriver +--compare DATA{Baseline/resultPartialImage3.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage3.nrrd + CoocurrenceTextureFeaturesImageFilterTest + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage3.nrrd 10 0 4200 2) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterPartialImage2 +COMMAND TextureFeaturesTestDriver +--compare DATA{Baseline/resultPartialImage4.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultPartialImage4.nrrd + CoocurrenceTextureFeaturesImageFilterTest + DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage4.nrrd 10 0 4200 4) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWholeImage + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultWholeImage2.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultWholeImage2.nrrd + CoocurrenceTextureFeaturesImageFilterTest + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultWholeImage2.nrrd 10 0 4200 2) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultSeparateFeatures_11.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_11.nrrd + --compare DATA{Baseline/resultSeparateFeatures_12.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_12.nrrd + --compare DATA{Baseline/resultSeparateFeatures_13.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_13.nrrd + --compare DATA{Baseline/resultSeparateFeatures_14.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_14.nrrd + --compare DATA{Baseline/resultSeparateFeatures_15.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_15.nrrd + --compare DATA{Baseline/resultSeparateFeatures_16.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_16.nrrd + --compare DATA{Baseline/resultSeparateFeatures_17.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_17.nrrd + --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_18.nrrd + CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures 10 0 4200 4) + +itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures + COMMAND TextureFeaturesTestDriver + --compare DATA{Baseline/resultSeparateFeatures_11.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_11.nrrd + --compare DATA{Baseline/resultSeparateFeatures_12.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_12.nrrd + --compare DATA{Baseline/resultSeparateFeatures_13.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_13.nrrd + --compare DATA{Baseline/resultSeparateFeatures_14.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_14.nrrd + --compare DATA{Baseline/resultSeparateFeatures_15.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_15.nrrd + --compare DATA{Baseline/resultSeparateFeatures_16.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_16.nrrd + --compare DATA{Baseline/resultSeparateFeatures_17.nrrd} + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_17.nrrd + --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} +<<<<<<< HEAD + ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_18.nrrd + CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures 10 0 4200 4) +======= + ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd + ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures + DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures 10 0 4200 4) + + +itk_add_test(NAME itkTextureMovingHistogramImageFilterTest1 + COMMAND TextureFeaturesTestDriver itkTextureMovingHistogramImageFilterTest + DATA{${ITK_DATA_ROOT}/Input/cthead1.png} + ${TEMP}/itkTextureFeatureImageFilterTest1.mha + 5 + ) +>>>>>>> ENH: Import TextureMovingHistogramImageFilter from old repository diff --git a/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx new file mode 100644 index 00000000000..c5589402fa5 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx @@ -0,0 +1,101 @@ +/*========================================================================= + * + * Copyright Bradley Lowekamp + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkTextureMovingHistogramImageFilter.h" +#include "itkFlatStructuringElement.h" +#include "itkImage.h" +#include "itkImageFileReader.h" +#include "itkImageFileWriter.h" + + +static void +Test1(const std::string & inFileName, const std::string & outFileName) +{ + const unsigned int ImageDimension = 3; + typedef itk::Image ImageType; + typedef itk::Image, ImageDimension> OImageType; + typedef itk::FlatStructuringElement KernelType; + typedef itk::TextureMovingHistogramImageFilter TextureFilterType; + + + typedef itk::ImageFileReader ReaderType; + + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(inFileName); + reader->UpdateLargestPossibleRegion(); + + KernelType::SizeType radius; + radius.Fill(5); + KernelType kernel = KernelType::Box(radius); + TextureFilterType::Pointer filter = TextureFilterType::New(); + filter->SetKernel(kernel); + filter->SetInput(reader->GetOutput()); + filter->UpdateLargestPossibleRegion(); + + typedef itk::ImageFileWriter WriterType; + + WriterType::Pointer writer = WriterType::New(); + writer->SetFileName(outFileName); + writer->SetInput(filter->GetOutput()); + writer->Update(); +} + + +static void +Test2(std::string inFileName) +{ + const unsigned int ImageDimension = 3; + typedef itk::Image ImageType; + typedef itk::VectorImage OImageType; + typedef itk::FlatStructuringElement KernelType; + typedef itk::TextureMovingHistogramImageFilter TextureFilterType; + + + typedef itk::ImageFileReader ReaderType; + + ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(inFileName); + reader->UpdateLargestPossibleRegion(); + + KernelType::SizeType radius; + radius.Fill(5); + KernelType kernel = KernelType::Box(radius); + TextureFilterType::Pointer filter = TextureFilterType::New(); + filter->SetKernel(kernel); + filter->SetInput(reader->GetOutput()); + filter->UpdateLargestPossibleRegion(); + + std::cout << "filter..." << std::endl; +} + +int +itkTextureMovingHistogramImageFilterTest(int argc, char * argv[]) +{ + + if (argc < 2) + { + std::cerr << "Usage: " << std::endl; + std::cerr << argv[0] << " inputImageFile outputImageFile" << std::endl; + return EXIT_FAILURE; + } + + + Test1(argv[1], argv[2]); + Test2(argv[1]); + + return EXIT_SUCCESS; +} From 6e3aed7ea59f0d9c5fb376e194affabc0e89717f Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 22 Jun 2017 15:46:05 -0400 Subject: [PATCH 059/135] ENH: Adding more documentation and cleaning code Remove commented out code, fix indentation, fix style issue in test, etc.. --- .../include/itkTextureHistogram.h | 54 +--- .../itkTextureMovingHistogramImageFilter.h | 20 +- .../TextureFeatures/test/CMakeLists.txt | 16 ++ .../TextureFeatures/test/CMakeLists.txt~ | 258 ------------------ ...kTextureMovingHistogramImageFilterTest.cxx | 20 +- 5 files changed, 53 insertions(+), 315 deletions(-) delete mode 100644 Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ diff --git a/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h index 1d3aefd4f27..ac497218690 100644 --- a/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h @@ -17,7 +17,9 @@ *=========================================================================*/ #ifndef itkTextureHistogram_h #define itkTextureHistogram_h + #include "itkNumericTraits.h" +#include namespace itk { @@ -26,9 +28,12 @@ namespace Function /* \class TextureHistogram * + * An implementation of the "MovingHistogram" interface for the + * MovingHistogramImageFilter class. This implementation maintains a + * std::map based "histogram" during iteration and computes first + * order statistics from the histogram. * - * - * \ingroup ITKTextureAnalysis + * \ingroup ITKTextureFeatures */ template class ITK_TEMPLATE_EXPORT TextureHistogram @@ -36,8 +41,6 @@ class ITK_TEMPLATE_EXPORT TextureHistogram public: TextureHistogram() { m_Count = 0; } - // ~TextureHistogram() {} default is ok - void AddPixel(const TInputPixel & p) { @@ -72,11 +75,10 @@ class ITK_TEMPLATE_EXPORT TextureHistogram double sum3 = 0.0; double sum4 = 0.0; const size_t count = m_Count; - // double median = 0.0; double entropy = 0.0; size_t curCount = 0; - // typename MapType::iterator medianIt = m_Map.end(); + for (typename MapType::iterator i = m_Map.begin(); i != m_Map.end(); ++i) { double t = double(i->first) * double(i->second); @@ -88,55 +90,23 @@ class ITK_TEMPLATE_EXPORT TextureHistogram curCount += i->second; const double p_x = double(i->second) / count; - entropy += -p_x * vcl_log(p_x); - - // // this is wrong! - // if ( curCount == count / 2 ) - // { - // median += i->first; - // medianIt = il - // // we have an even number so take the average - // if ( !(count % 2) ) - // { - // median *= 0.5; - // } - // } + entropy += -p_x * std::log(p_x); } - // curCount = 0; - // typename MapType::iterator fmedianIt = medianIt; - // typename MapType::iterator rmedianIt = medianIt; - // double mad = 0.0; - - // while (curCount < count/2 ) - // { - // if ( vcl_fabs( fmedianIt->first - median ) < vcl_fabs( rmedianIt->first - median ) ) - // { - // curCount += fmedianIt->second; - // ++fmedianIt; - // } - // else - // { - // curCount += rmedianIt->second; - // --rmedianIt; - // } - // } - - const double icount = 1.0 / count; const double mean = sum * icount; // unbiased estimate const double variance = (sum2 - (sum * sum * icount)) / (count - 1); - const double sigma = vcl_sqrt(variance); + const double sigma = std::sqrt(variance); double skewness = 0.0; double kurtosis = 0.0; - if (vcl_abs(variance * sigma) > itk::NumericTraits::min()) + if (std::abs(variance * sigma) > itk::NumericTraits::min()) { skewness = ((sum3 - 3.0 * mean * sum2) * icount + 2.0 * mean * mean * mean) / (variance * sigma); } - if (vcl_abs(variance) > itk::NumericTraits::min()) + if (std::abs(variance) > itk::NumericTraits::min()) { kurtosis = (sum4 * icount + mean * (-4.0 * sum3 * icount + mean * (6.0 * sum2 * icount - 3.0 * mean * mean))) / (variance * variance) - diff --git a/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h index b6fb9860fb6..b8ed1517055 100644 --- a/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h @@ -25,9 +25,20 @@ namespace itk { /** * \class TextureMovingHistogramImageFilter - * \brief Compute first order statistics in a neighborhood at each pixel + * \brief Compute first order statistics in a neighborhood for each + * pixel. * - * \ingroup ITKTextureAnalysis + * The output of this filter is a multi-component image where each + * pixel is the mean, minimum, maximum, variance, standard deviation + * (sigma), skewness, kurtosis, and entropy. These first order + * statistics are computed based on a define neighborhood or kernel + * which defaults to a hyper-cube. + * + * The boundary is handle by only considering the pixel in the image, + * so that the boundary pixel have lets data to compute the + * statistics. + * + * \ingroup ITKTextureFeatures */ template @@ -77,10 +88,7 @@ class ITK_TEMPLATE_EXPORT TextureMovingHistogramImageFilter return 8; } - TextureMovingHistogramImageFilter() - { - // this->m_Boundary = NumericTraits< PixelType >::max(); - } + TextureMovingHistogramImageFilter() {} void GenerateOutputInformation() diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index b052a1746a0..b0a90221c53 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -14,6 +14,22 @@ set( ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +) + +set( + TextureFeaturesTests + RunLengthTextureFeaturesImageFilterInstantiationTest.cxx + RunLengthTextureFeaturesImageFilterTest.cxx + RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx + RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx + RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx + RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx + CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx + CoocurrenceTextureFeaturesImageFilterTest.cxx + CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx + CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx + CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx + CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx itkTextureMovingHistogramImageFilterTest.cxx ) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ deleted file mode 100644 index 67c356ed206..00000000000 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt~ +++ /dev/null @@ -1,258 +0,0 @@ -itk_module_test() - -set(TextureFeaturesTests ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx - ScalarImageToRunLengthFeaturesImageFilterTest.cxx - ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx - ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx - ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx - ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx - ScalarImageToTextureFeaturesImageFilterTest.cxx - ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx - ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx - ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - itkTextureMovingHistogramImageFilterTest.cxx) - -set(TextureFeaturesTests RunLengthTextureFeaturesImageFilterInstantiationTest.cxx - RunLengthTextureFeaturesImageFilterTest.cxx - RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx - RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx - RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx - RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx - CoocurrenceTextureFeaturesImageFilterTest.cxx - CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx - CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx - CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx - CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx) - -CreateTestDriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterInstantiationTest - COMMAND TextureFeaturesTestDriver - RunLengthTextureFeaturesImageFilterInstantiationTest - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd}) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWithoutMask1 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultTestWithoutMask1.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask1.nrrd - RunLengthTextureFeaturesImageFilterTestWithoutMask - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask1.nrrd 10 0 4200 0 0.7 2) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWithoutMask2 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultTestWithoutMask2.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask2.nrrd - RunLengthTextureFeaturesImageFilterTestWithoutMask - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask2.nrrd 10 0 4200 0 1.25 4) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWithoutMask3 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultTestWithoutMask3.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask3.nrrd - RunLengthTextureFeaturesImageFilterTestWithoutMask - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask3.nrrd 10 0 4200 0 1.8 6) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterVectorlImage1 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultPartialImage1.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImage1.nrrd - RunLengthTextureFeaturesImageFilterTestWithVectorImage - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage1.nrrd 10 0 4200 0 0.7 2) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterVectorImage2 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultPartialImage2.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImage2.nrrd - RunLengthTextureFeaturesImageFilterTestWithVectorImage - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage2.nrrd 10 0 4200 0 1.25 4) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterPartialImage1 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultPartialImage1.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultPartialImage1.nrrd - RunLengthTextureFeaturesImageFilterTest - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage1.nrrd 10 0 4200 0 0.7 2) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterPartialImage2 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultPartialImage2.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultPartialImage2.nrrd - RunLengthTextureFeaturesImageFilterTest - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage2.nrrd 10 0 4200 0 1.25 4) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestWholeImage - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultWholeImage.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultWholeImage.nrrd - RunLengthTextureFeaturesImageFilterTest - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultWholeImage.nrrd 10 0 4200 0 0.7 2) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestSeparateFeatures - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultSeparateFeatures_1.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_1.nrrd - --compare DATA{Baseline/resultSeparateFeatures_2.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_2.nrrd - --compare DATA{Baseline/resultSeparateFeatures_3.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_3.nrrd - --compare DATA{Baseline/resultSeparateFeatures_4.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_4.nrrd - --compare DATA{Baseline/resultSeparateFeatures_5.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_5.nrrd - --compare DATA{Baseline/resultSeparateFeatures_6.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_6.nrrd - --compare DATA{Baseline/resultSeparateFeatures_7.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_7.nrrd - --compare DATA{Baseline/resultSeparateFeatures_8.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_8.nrrd - --compare DATA{Baseline/resultSeparateFeatures_9.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_9.nrrd - --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_0.nrrd - RunLengthTextureFeaturesImageFilterTestSeparateFeatures - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures 10 0 4200 0 1.25 4) - -itk_add_test(NAME RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultSeparateFeatures_1.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_1.nrrd - --compare DATA{Baseline/resultSeparateFeatures_2.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_2.nrrd - --compare DATA{Baseline/resultSeparateFeatures_3.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_3.nrrd - --compare DATA{Baseline/resultSeparateFeatures_4.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_4.nrrd - --compare DATA{Baseline/resultSeparateFeatures_5.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_5.nrrd - --compare DATA{Baseline/resultSeparateFeatures_6.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_6.nrrd - --compare DATA{Baseline/resultSeparateFeatures_7.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_7.nrrd - --compare DATA{Baseline/resultSeparateFeatures_8.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_8.nrrd - --compare DATA{Baseline/resultSeparateFeatures_9.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_9.nrrd - --compare DATA{Baseline/resultSeparateFeatures_0.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_0.nrrd - RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures 10 0 4200 0 1.25 4) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterInstantiationTest - COMMAND TextureFeaturesTestDriver - CoocurrenceTextureFeaturesImageFilterInstantiationTest - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd}) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask1 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultTestWithoutMask4.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask4.nrrd - CoocurrenceTextureFeaturesImageFilterTestWithoutMask - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask4.nrrd 10 0 4200 2) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask2 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultTestWithoutMask5.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask5.nrrd - CoocurrenceTextureFeaturesImageFilterTestWithoutMask - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask5.nrrd 10 0 4200 4) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWithoutMask3 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultTestWithoutMask6.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask6.nrrd - CoocurrenceTextureFeaturesImageFilterTestWithoutMask - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultTestWithoutMask6.nrrd 10 0 4200 6) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterVectorlImage1 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultPartialImage3.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImage3.nrrd - CoocurrenceTextureFeaturesImageFilterTestWithVectorImage - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage3.nrrd 10 0 4200 2) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterVectorImage2 - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultPartialImage4.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImage4.nrrd - CoocurrenceTextureFeaturesImageFilterTestWithVectorImage - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImage4.nrrd 10 0 4200 4) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterPartialImage1 -COMMAND TextureFeaturesTestDriver ---compare DATA{Baseline/resultPartialImage3.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultPartialImage3.nrrd - CoocurrenceTextureFeaturesImageFilterTest - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage3.nrrd 10 0 4200 2) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterPartialImage2 -COMMAND TextureFeaturesTestDriver ---compare DATA{Baseline/resultPartialImage4.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultPartialImage4.nrrd - CoocurrenceTextureFeaturesImageFilterTest - DATA{Input/Scan_CBCT_13R_D1_crop.nrrd} DATA{Input/SegmC_CBCT_13R_D1_crop.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultPartialImage4.nrrd 10 0 4200 4) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestWholeImage - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultWholeImage2.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultWholeImage2.nrrd - CoocurrenceTextureFeaturesImageFilterTest - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultWholeImage2.nrrd 10 0 4200 2) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultSeparateFeatures_11.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_11.nrrd - --compare DATA{Baseline/resultSeparateFeatures_12.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_12.nrrd - --compare DATA{Baseline/resultSeparateFeatures_13.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_13.nrrd - --compare DATA{Baseline/resultSeparateFeatures_14.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_14.nrrd - --compare DATA{Baseline/resultSeparateFeatures_15.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_15.nrrd - --compare DATA{Baseline/resultSeparateFeatures_16.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_16.nrrd - --compare DATA{Baseline/resultSeparateFeatures_17.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_17.nrrd - --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures_18.nrrd - CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultSeparateFeatures 10 0 4200 4) - -itk_add_test(NAME CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures - COMMAND TextureFeaturesTestDriver - --compare DATA{Baseline/resultSeparateFeatures_11.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_11.nrrd - --compare DATA{Baseline/resultSeparateFeatures_12.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_12.nrrd - --compare DATA{Baseline/resultSeparateFeatures_13.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_13.nrrd - --compare DATA{Baseline/resultSeparateFeatures_14.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_14.nrrd - --compare DATA{Baseline/resultSeparateFeatures_15.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_15.nrrd - --compare DATA{Baseline/resultSeparateFeatures_16.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_16.nrrd - --compare DATA{Baseline/resultSeparateFeatures_17.nrrd} - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_17.nrrd - --compare DATA{Baseline/resultSeparateFeatures_18.nrrd} -<<<<<<< HEAD - ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures_18.nrrd - CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${ITK_TEST_OUTPUT_DIR}/resultVectorImageSeparateFeatures 10 0 4200 4) -======= - ${TEMP}/resultVectorImageSeparateFeatures_18.nrrd - ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures - DATA{Input/Scan_CBCT_13R.nrrd} DATA{Input/SegmC_CBCT_13R.nrrd} ${TEMP}/resultVectorImageSeparateFeatures 10 0 4200 4) - - -itk_add_test(NAME itkTextureMovingHistogramImageFilterTest1 - COMMAND TextureFeaturesTestDriver itkTextureMovingHistogramImageFilterTest - DATA{${ITK_DATA_ROOT}/Input/cthead1.png} - ${TEMP}/itkTextureFeatureImageFilterTest1.mha - 5 - ) ->>>>>>> ENH: Import TextureMovingHistogramImageFilter from old repository diff --git a/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx index c5589402fa5..4d1d4d7df81 100644 --- a/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx @@ -1,6 +1,6 @@ /*========================================================================= * - * Copyright Bradley Lowekamp + * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,11 @@ static void Test1(const std::string & inFileName, const std::string & outFileName) { - const unsigned int ImageDimension = 3; - typedef itk::Image ImageType; - typedef itk::Image, ImageDimension> OImageType; - typedef itk::FlatStructuringElement KernelType; + const unsigned int ImageDimension = 3; + typedef itk::Image ImageType; + typedef itk::Image, ImageDimension> OImageType; + typedef itk::FlatStructuringElement KernelType; + typedef itk::TextureMovingHistogramImageFilter TextureFilterType; @@ -58,10 +59,11 @@ Test1(const std::string & inFileName, const std::string & outFileName) static void Test2(std::string inFileName) { - const unsigned int ImageDimension = 3; - typedef itk::Image ImageType; - typedef itk::VectorImage OImageType; - typedef itk::FlatStructuringElement KernelType; + const unsigned int ImageDimension = 3; + typedef itk::Image ImageType; + typedef itk::VectorImage OImageType; + typedef itk::FlatStructuringElement KernelType; + typedef itk::TextureMovingHistogramImageFilter TextureFilterType; From b13dcd6b9c0704178969cf1a5efdc213cc3c6a41 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 3 Jul 2017 15:19:47 -0400 Subject: [PATCH 060/135] STYLE: Rename filter to FirstOrderTextureFeaturesImageFilter The utility histogram class is similarly renamed to FirstOrderTextureHistogram. --- ...itkFirstOrderTextureFeaturesImageFilter.h} | 24 +++++++++---------- ...gram.h => itkFirstOrderTextureHistogram.h} | 10 ++++---- .../TextureFeatures/test/CMakeLists.txt | 7 +++--- ...stOrderTextureFeaturesImageFilterTest.cxx} | 8 +++---- 4 files changed, 24 insertions(+), 25 deletions(-) rename Modules/Filtering/TextureFeatures/include/{itkTextureMovingHistogramImageFilter.h => itkFirstOrderTextureFeaturesImageFilter.h} (80%) rename Modules/Filtering/TextureFeatures/include/{itkTextureHistogram.h => itkFirstOrderTextureHistogram.h} (94%) rename Modules/Filtering/TextureFeatures/test/{itkTextureMovingHistogramImageFilterTest.cxx => itkFirstOrderTextureFeaturesImageFilterTest.cxx} (90%) diff --git a/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h similarity index 80% rename from Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h rename to Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index b8ed1517055..208f4f14c55 100644 --- a/Modules/Filtering/TextureFeatures/include/itkTextureMovingHistogramImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -15,16 +15,16 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkTextureMovingHistogramImageFilter_h -#define itkTextureMovingHistogramImageFilter_h +#ifndef itkFirstOrderTextureFeaturesImageFilter_h +#define itkFirstOrderTextureFeaturesImageFilter_h #include "itkMovingHistogramImageFilter.h" -#include "itkTextureHistogram.h" +#include "itkFirstOrderTextureHistogram.h" namespace itk { /** - * \class TextureMovingHistogramImageFilter + * \class FirstOrderTextureFeaturesImageFilter * \brief Compute first order statistics in a neighborhood for each * pixel. * @@ -42,21 +42,21 @@ namespace itk */ template -class ITK_TEMPLATE_EXPORT TextureMovingHistogramImageFilter +class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter : public MovingHistogramImageFilter< TInputImage, TOutputImage, TKernel, - typename Function::TextureHistogram> + typename Function::FirstOrderTextureHistogram> { public: /** Standard class typedefs. */ - typedef TextureMovingHistogramImageFilter Self; + typedef FirstOrderTextureFeaturesImageFilter Self; typedef MovingHistogramImageFilter< TInputImage, TOutputImage, TKernel, - typename Function::TextureHistogram> + typename Function::FirstOrderTextureHistogram> Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; @@ -65,7 +65,7 @@ class ITK_TEMPLATE_EXPORT TextureMovingHistogramImageFilter itkNewMacro(Self); /** Runtime information support. */ - itkTypeMacro(TextureMovingHistogramImageFilter, MovingHistogramMorphologyImageFilter); + itkTypeMacro(FirstOrderTextureFeaturesImageFilter, MovingHistogramMorphologyImageFilter); /** Image related typedefs. */ typedef TInputImage InputImageType; @@ -88,7 +88,7 @@ class ITK_TEMPLATE_EXPORT TextureMovingHistogramImageFilter return 8; } - TextureMovingHistogramImageFilter() {} + FirstOrderTextureFeaturesImageFilter() {} void GenerateOutputInformation() @@ -110,10 +110,10 @@ class ITK_TEMPLATE_EXPORT TextureMovingHistogramImageFilter } - ~TextureMovingHistogramImageFilter() {} + ~FirstOrderTextureFeaturesImageFilter() {} private: - TextureMovingHistogramImageFilter(const Self &); // purposely not implemented + FirstOrderTextureFeaturesImageFilter(const Self &); // purposely not implemented void operator=(const Self &); // purposely not implemented }; // end of class diff --git a/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h similarity index 94% rename from Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h rename to Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index ac497218690..c4194d91881 100644 --- a/Modules/Filtering/TextureFeatures/include/itkTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -15,8 +15,8 @@ * limitations under the License. * *=========================================================================*/ -#ifndef itkTextureHistogram_h -#define itkTextureHistogram_h +#ifndef itkFirstOrderTextureHistogram_h +#define itkFirstOrderTextureHistogram_h #include "itkNumericTraits.h" #include @@ -26,7 +26,7 @@ namespace itk namespace Function { -/* \class TextureHistogram +/* \class FirstOrderTextureHistogram * * An implementation of the "MovingHistogram" interface for the * MovingHistogramImageFilter class. This implementation maintains a @@ -36,10 +36,10 @@ namespace Function * \ingroup ITKTextureFeatures */ template -class ITK_TEMPLATE_EXPORT TextureHistogram +class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram { public: - TextureHistogram() { m_Count = 0; } + FirstOrderTextureHistogram() { m_Count = 0; } void AddPixel(const TInputPixel & p) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index b0a90221c53..3bec6f8d842 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -13,7 +13,6 @@ set( ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx - ScalarImageToTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx ) set( @@ -30,7 +29,7 @@ set( CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - itkTextureMovingHistogramImageFilterTest.cxx + itkFirstOrderTextureFeaturesImageFilterTest.cxx ) createtestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesTests}") @@ -504,10 +503,10 @@ itk_add_test( ) itk_add_test( - NAME itkTextureMovingHistogramImageFilterTest1 + NAME itkFirstOrderTextureFeaturesImageFilterTest1 COMMAND TextureFeaturesTestDriver - itkTextureMovingHistogramImageFilterTest + itkFirstOrderTextureFeaturesImageFilterTest DATA{${ITK_DATA_ROOT}/Input/cthead1.png} ${ITK_TEST_OUTPUT_DIR}/itkTextureFeatureImageFilterTest1.mha 5 diff --git a/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx similarity index 90% rename from Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx rename to Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx index 4d1d4d7df81..3d2003fbfbe 100644 --- a/Modules/Filtering/TextureFeatures/test/itkTextureMovingHistogramImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx @@ -15,7 +15,7 @@ * limitations under the License. * *=========================================================================*/ -#include "itkTextureMovingHistogramImageFilter.h" +#include "itkFirstOrderTextureFeaturesImageFilter.h" #include "itkFlatStructuringElement.h" #include "itkImage.h" #include "itkImageFileReader.h" @@ -30,7 +30,7 @@ Test1(const std::string & inFileName, const std::string & outFileName) typedef itk::Image, ImageDimension> OImageType; typedef itk::FlatStructuringElement KernelType; - typedef itk::TextureMovingHistogramImageFilter TextureFilterType; + typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; typedef itk::ImageFileReader ReaderType; @@ -64,7 +64,7 @@ Test2(std::string inFileName) typedef itk::VectorImage OImageType; typedef itk::FlatStructuringElement KernelType; - typedef itk::TextureMovingHistogramImageFilter TextureFilterType; + typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; typedef itk::ImageFileReader ReaderType; @@ -85,7 +85,7 @@ Test2(std::string inFileName) } int -itkTextureMovingHistogramImageFilterTest(int argc, char * argv[]) +itkFirstOrderTextureFeaturesImageFilterTest(int argc, char * argv[]) { if (argc < 2) From ed12f5e4e230032c55f56d8f179a344493e76af1 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 26 Jun 2017 13:22:37 -0400 Subject: [PATCH 061/135] DOC: enumerate the output pixels components --- .../itkFirstOrderTextureFeaturesImageFilter.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 208f4f14c55..0205d220bea 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -29,10 +29,17 @@ namespace itk * pixel. * * The output of this filter is a multi-component image where each - * pixel is the mean, minimum, maximum, variance, standard deviation - * (sigma), skewness, kurtosis, and entropy. These first order - * statistics are computed based on a define neighborhood or kernel - * which defaults to a hyper-cube. + * pixel is: + * -# mean + * -# minimum + * -# maximum + * -# variance + * -# standard deviation (sigma) + * -# skewness + * -# kurtosis + * -# entropy. + * These first order statistics are computed based on a define + * neighborhood or kernel such as FlatStructuringElement::Box. * * The boundary is handle by only considering the pixel in the image, * so that the boundary pixel have lets data to compute the From 738bc5e6ea9765e0a7cda0fb3919ca99f6e13bab Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 26 Jun 2017 13:31:44 -0400 Subject: [PATCH 062/135] ENH: Add test from Gaussian distributed samples Added new test, which uses Google Test, that runs the first order feature filter on a generated Gaussian sample. This enables validation of the results based on the expected values from a Gaussian sample. To compute the tolerance, numpy was used to generate 10,000 Gaussian distributions, where the distribution of the statistics where examined. The expected entropy values is computed from expected 101^2 unique samples. A fix seed is used to ensure a repeatable distribution is generated. --- .../include/itkFirstOrderTextureHistogram.h | 2 +- .../TextureFeatures/itk-module.cmake | 4 +- .../TextureFeatures/test/CMakeLists.txt | 4 + ...stOrderTextureFeaturesImageFilterGTest.cxx | 181 ++++++++++++++++++ 4 files changed, 188 insertions(+), 3 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index c4194d91881..129d1b84c61 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -90,7 +90,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram curCount += i->second; const double p_x = double(i->second) / count; - entropy += -p_x * std::log(p_x); + entropy += -p_x * std::log(p_x) / itk::Math::ln2; } const double icount = 1.0 / count; diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index 3a56988f849..b026d4072e2 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -15,12 +15,12 @@ itk_module( ITKStatistics ITKImageGrid ITKMathematicalMorphology - COMPILE_DEPENDS - ITKImageSources TEST_DEPENDS ITKTestKernel ITKMetaIO ITKImageIntensity + ITKImageNoise + ITKGoogleTest DESCRIPTION "Module ingested from upstream." EXCLUDE_FROM_DEFAULT ) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 3bec6f8d842..731cb9c3457 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -511,3 +511,7 @@ itk_add_test( ${ITK_TEST_OUTPUT_DIR}/itkTextureFeatureImageFilterTest1.mha 5 ) + +set(TextureFeaturesGTests itkFirstOrderTextureFeaturesImageFilterGTest.cxx) + +creategoogletestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesGTests}") diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx new file mode 100644 index 00000000000..83920148380 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx @@ -0,0 +1,181 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkFirstOrderTextureFeaturesImageFilter.h" +#include "itkFlatStructuringElement.h" +#include "itkAdditiveGaussianNoiseImageFilter.h" +#include "itkFilterWatcher.h" + +#include "gtest/gtest.h" + +namespace +{ + +template +void +print_feature(const T & p, std::ostream & out = std::cout) +{ + out << "mean: " << p[0] << std::endl; + out << "minimum: " << p[1] << std::endl; + out << "maximum: " << p[2] << std::endl; + out << "variance: " << p[3] << std::endl; + out << "standard deviation: " << p[4] << std::endl; + out << "skewness: " << p[5] << std::endl; + out << "kurtosis: " << p[6] << std::endl; + out << "entropy: " << p[7] << std::endl; +} + +} // namespace + +TEST(TextTureFeatures, FirstOrder_Test1) +{ + const unsigned int ImageDimension = 2; + typedef itk::Image ImageType; + typedef itk::Image, ImageDimension> OImageType; + typedef itk::FlatStructuringElement KernelType; + + + unsigned int r = 50u; + unsigned int d = r * 2 + 1; + ImageType::SizeType imageSize = { d, d }; + ImageType::SpacingValueType imageSpacing[] = { 1.0f, 1.0f }; + + ImageType::Pointer image = ImageType::New(); + + image->SetRegions(ImageType::RegionType(imageSize)); + image->SetSpacing(imageSpacing); + image->Allocate(); + image->FillBuffer(0); + + + typedef itk::AdditiveGaussianNoiseImageFilter ImageNoiseType; + ImageNoiseType::Pointer noiseFilter = ImageNoiseType::New(); + noiseFilter->SetSeed(124); + noiseFilter->SetMean(0.0); + noiseFilter->SetStandardDeviation(.1); + noiseFilter->SetInput(image); + + typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; + + KernelType::SizeType radius; + radius.Fill(r); + KernelType kernel = KernelType::Box(radius); + TextureFilterType::Pointer filter = TextureFilterType::New(); + filter->SetKernel(kernel); + filter->SetInput(noiseFilter->GetOutput()); + + FilterWatcher watcher(filter, "filter"); + + + ImageType::SizeType requestSize = { 10, 10 }; + ImageType::IndexType requestIndex = { 45, 45 }; + ImageType::RegionType request(requestIndex, requestSize); + filter->GetOutput()->SetRequestedRegion(request); + filter->Update(); + + OImageType::ConstPointer output = filter->GetOutput(); + + { + ImageType::IndexType idx = { r, r }; + const OImageType::PixelType & p = output->GetPixel(idx); + + print_feature(p); + + // The following is for a Gaussian sample with std dev of .1 + // The expected value was analytically computed, while the + // tolerances were estimated based on 10,000 different sample set + // distributions in numpy. + EXPECT_NEAR(0.0, p[0], 0.002) << "mean"; + EXPECT_GT(-.3, p[1]) << "min"; + EXPECT_LT(.3, p[2]) << "max"; + EXPECT_NEAR(0.01, p[3], .001) << "variance"; + EXPECT_NEAR(0.1, p[4], .01) << "standard deviation"; + EXPECT_NEAR(0, p[5], .1) << "skewness"; + EXPECT_NEAR(0, p[6], .2) << "kurtosis"; + EXPECT_NEAR(13.3, p[7], .1) << "entropy"; + } +} + + +TEST(TextTureFeatures, FirstOrder_Test2) +{ + const unsigned int ImageDimension = 2; + typedef itk::Image ImageType; + typedef itk::Image, ImageDimension> OImageType; + typedef itk::FlatStructuringElement KernelType; + + + unsigned int r = 50u; + unsigned int d = r * 2 + 1; + ImageType::SizeType imageSize = { d, d }; + ImageType::SpacingValueType imageSpacing[] = { 1.0f, 1.0f }; + + ImageType::Pointer image = ImageType::New(); + + image->SetRegions(ImageType::RegionType(imageSize)); + image->SetSpacing(imageSpacing); + image->Allocate(); + image->FillBuffer(0); + + + typedef itk::AdditiveGaussianNoiseImageFilter ImageNoiseType; + ImageNoiseType::Pointer noiseFilter = ImageNoiseType::New(); + noiseFilter->SetSeed(124); + noiseFilter->SetMean(100.0); + noiseFilter->SetStandardDeviation(1); + noiseFilter->SetInput(image); + + typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; + + KernelType::SizeType radius; + radius.Fill(r); + KernelType kernel = KernelType::Box(radius); + TextureFilterType::Pointer filter = TextureFilterType::New(); + filter->SetKernel(kernel); + filter->SetInput(noiseFilter->GetOutput()); + + FilterWatcher watcher(filter, "filter"); + + + ImageType::SizeType requestSize = { 10, 10 }; + ImageType::IndexType requestIndex = { 45, 45 }; + ImageType::RegionType request(requestIndex, requestSize); + filter->GetOutput()->SetRequestedRegion(request); + filter->Update(); + + OImageType::ConstPointer output = filter->GetOutput(); + + { + ImageType::IndexType idx = { r, r }; + const OImageType::PixelType & p = output->GetPixel(idx); + + print_feature(p); + + // The following is for a Gaussian sample with std dev of .1 + // The expected value was analytically computed, while the + // tolerances were estimated based on 10,000 different sample set + // distributions in numpy. + EXPECT_NEAR(100, p[0], 0.02) << "mean"; + EXPECT_GT(97, p[1]) << "min"; + EXPECT_LT(103, p[2]) << "max"; + EXPECT_NEAR(1, p[3], .1) << "variance"; + EXPECT_NEAR(1, p[4], .1) << "standard deviation"; + EXPECT_NEAR(0, p[5], .1) << "skewness"; + EXPECT_NEAR(0, p[6], .2) << "kurtosis"; + EXPECT_NEAR(13.3, p[7], .2) << "entropy"; + } +} From e01d104d69ba20db2adf59a7da2bfe0b49ff1a89 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Fri, 30 Jun 2017 15:39:18 -0400 Subject: [PATCH 063/135] ENH: Prefer explicit division of cached inverse. The save inverse forces the precision to that of double, while explicitly dividing may provide better numeric results. --- .../include/itkFirstOrderTextureHistogram.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index 129d1b84c61..ffb052f69cf 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -93,22 +93,21 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram entropy += -p_x * std::log(p_x) / itk::Math::ln2; } - const double icount = 1.0 / count; - const double mean = sum * icount; + const double mean = sum / count; // unbiased estimate - const double variance = (sum2 - (sum * sum * icount)) / (count - 1); + const double variance = (sum2 - (sum * sum) / count) / (count - 1); const double sigma = std::sqrt(variance); double skewness = 0.0; double kurtosis = 0.0; if (std::abs(variance * sigma) > itk::NumericTraits::min()) { - skewness = ((sum3 - 3.0 * mean * sum2) * icount + 2.0 * mean * mean * mean) / (variance * sigma); + skewness = ((sum3 - 3.0 * mean * sum2) / count + 2.0 * mean * mean * mean) / (variance * sigma); } if (std::abs(variance) > itk::NumericTraits::min()) { - kurtosis = (sum4 * icount + mean * (-4.0 * sum3 * icount + mean * (6.0 * sum2 * icount - 3.0 * mean * mean))) / + kurtosis = (sum4 / count + mean * (-4.0 * sum3 / count + mean * (6.0 * sum2 / count - 3.0 * mean * mean))) / (variance * variance) - 3.0; } From 16c4df33b340596ff8d4a15e13dd20c4bcbf24c5 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 3 Jul 2017 13:55:08 -0400 Subject: [PATCH 064/135] ENH: add cthead1.png data to local module Referring to ITK_DATA_ROOT does not work when module is built outside the ITK repository. --- Modules/Filtering/TextureFeatures/test/CMakeLists.txt | 2 +- Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 | 1 + Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 create mode 100644 Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 731cb9c3457..202a0b3950d 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -507,7 +507,7 @@ itk_add_test( COMMAND TextureFeaturesTestDriver itkFirstOrderTextureFeaturesImageFilterTest - DATA{${ITK_DATA_ROOT}/Input/cthead1.png} + DATA{Input/cthead1.png} ${ITK_TEST_OUTPUT_DIR}/itkTextureFeatureImageFilterTest1.mha 5 ) diff --git a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 new file mode 100644 index 00000000000..90ab0f6f2b9 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 @@ -0,0 +1 @@ +e395391caad7463c8231bd5f2ce9d61b diff --git a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 new file mode 100644 index 00000000000..68f07f886ad --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 @@ -0,0 +1 @@ +32d5c12cd02f537c901ee48ad2f438fcf5399f7292bf9c0abfb8da91b74fc2e0c4983e9650283db3462d22f05f05a8637a6c3b8188159e4bbd6dc68804a84870 From 25189f5380f5a0c39592848217bf3a8e4c065490 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Wed, 5 Jul 2017 10:27:23 -0400 Subject: [PATCH 065/135] COMP: Add missing itkMath header --- .../TextureFeatures/include/itkFirstOrderTextureHistogram.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index ffb052f69cf..73c96df71cf 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -19,6 +19,7 @@ #define itkFirstOrderTextureHistogram_h #include "itkNumericTraits.h" +#include "itkMath.h" #include namespace itk From 9730fedca43f0b207cab2f633dc5075bc4cb6f87 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Wed, 5 Jul 2017 10:36:50 -0400 Subject: [PATCH 066/135] COMP: address warnings about bracket initialization Addresses warning of the following type: itkFirstOrderTextureFeaturesImageFilterGTest.cxx:92:31: warning: suggest braces around initialization of subobject [-Wmissing-braces] ImageType::IndexType idx = {r,r}; --- ...FirstOrderTextureFeaturesImageFilterGTest.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index 83920148380..04c09d851ce 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx @@ -51,7 +51,7 @@ TEST(TextTureFeatures, FirstOrder_Test1) unsigned int r = 50u; unsigned int d = r * 2 + 1; - ImageType::SizeType imageSize = { d, d }; + ImageType::SizeType imageSize = { { d, d } }; ImageType::SpacingValueType imageSpacing[] = { 1.0f, 1.0f }; ImageType::Pointer image = ImageType::New(); @@ -81,8 +81,8 @@ TEST(TextTureFeatures, FirstOrder_Test1) FilterWatcher watcher(filter, "filter"); - ImageType::SizeType requestSize = { 10, 10 }; - ImageType::IndexType requestIndex = { 45, 45 }; + ImageType::SizeType requestSize = { { 10, 10 } }; + ImageType::IndexType requestIndex = { { 45, 45 } }; ImageType::RegionType request(requestIndex, requestSize); filter->GetOutput()->SetRequestedRegion(request); filter->Update(); @@ -90,7 +90,7 @@ TEST(TextTureFeatures, FirstOrder_Test1) OImageType::ConstPointer output = filter->GetOutput(); { - ImageType::IndexType idx = { r, r }; + ImageType::IndexType idx = { { r, r } }; const OImageType::PixelType & p = output->GetPixel(idx); print_feature(p); @@ -121,7 +121,7 @@ TEST(TextTureFeatures, FirstOrder_Test2) unsigned int r = 50u; unsigned int d = r * 2 + 1; - ImageType::SizeType imageSize = { d, d }; + ImageType::SizeType imageSize = { { d, d } }; ImageType::SpacingValueType imageSpacing[] = { 1.0f, 1.0f }; ImageType::Pointer image = ImageType::New(); @@ -151,8 +151,8 @@ TEST(TextTureFeatures, FirstOrder_Test2) FilterWatcher watcher(filter, "filter"); - ImageType::SizeType requestSize = { 10, 10 }; - ImageType::IndexType requestIndex = { 45, 45 }; + ImageType::SizeType requestSize = { { 10, 10 } }; + ImageType::IndexType requestIndex = { { 45, 45 } }; ImageType::RegionType request(requestIndex, requestSize); filter->GetOutput()->SetRequestedRegion(request); filter->Update(); @@ -160,7 +160,7 @@ TEST(TextTureFeatures, FirstOrder_Test2) OImageType::ConstPointer output = filter->GetOutput(); { - ImageType::IndexType idx = { r, r }; + ImageType::IndexType idx = { { r, r } }; const OImageType::PixelType & p = output->GetPixel(idx); print_feature(p); From bfd3e94bb202ee155a728e61c8b994614cbd6836 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Wed, 5 Jul 2017 10:37:54 -0400 Subject: [PATCH 067/135] ENH: Disable Google dependency and tests with ITK version <4.12 --- Modules/Filtering/TextureFeatures/itk-module.cmake | 6 +++++- Modules/Filtering/TextureFeatures/test/CMakeLists.txt | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index b026d4072e2..e27ed831092 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -7,6 +7,10 @@ # By convention those modules outside of ITK are not prefixed with # ITK. +if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.12") + set(_GoogleTest_DEPENDS ITKGoogleTest) +endif() + # define the dependencies of the include module and the tests itk_module( TextureFeatures @@ -20,7 +24,7 @@ itk_module( ITKMetaIO ITKImageIntensity ITKImageNoise - ITKGoogleTest + ${_GoogleTest_DEPENDS} DESCRIPTION "Module ingested from upstream." EXCLUDE_FROM_DEFAULT ) diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 202a0b3950d..59bf6833a15 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -512,6 +512,8 @@ itk_add_test( 5 ) -set(TextureFeaturesGTests itkFirstOrderTextureFeaturesImageFilterGTest.cxx) +if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.12") + set(TextureFeaturesGTests itkFirstOrderTextureFeaturesImageFilterGTest.cxx) -creategoogletestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesGTests}") + creategoogletestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesGTests}") +endif() From 65530a25963edcb73d6438d91ac9a602c9444a2e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Fri, 14 Jul 2017 14:34:10 -0400 Subject: [PATCH 068/135] BUG: Correction of the binarisation the binarisation is now working with m_Min > 0 --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 7 ++++--- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 6 +++--- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 9 ++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 750b144da6c..0636c783cce 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -284,17 +284,18 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo inline typename DigitalisedImageType::PixelType operator()(const MaskPixelType & maskPixel, const PixelType & inputPixel) const { + if (maskPixel != m_MaskValue) { - return this->m_Min - 10; + return -10; } else if (inputPixel < this->m_Min || inputPixel >= m_Max) { - return m_Min - 1; + return -1; } else { - return (inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis); + return ((inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis)); } } diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 49b9deac028..e74d4eac71b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -172,7 +172,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera while (!inputNIt.IsAtEnd()) { // If the voxel is outside of the mask, don't treat it - if (inputNIt.GetCenterPixel() < (this->m_Min - 5)) // the pixel is outside of the mask + if (inputNIt.GetCenterPixel() < (-5)) // the pixel is outside of the mask { progress.CompletedPixel(); ++inputNIt; @@ -192,7 +192,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera { // Test if the curent voxel is in the mask and is the range of the image intensity sepcified curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); - if (curentInNeighborhoodPixelIntensity < this->m_Min) + if (curentInNeighborhoodPixelIntensity < 0) { continue; } @@ -216,7 +216,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Test if the pointed voxel is in the mask and is the range of the image intensity sepcified pixelIntensity = inputNIt.GetPixel(tempOffset); - if (pixelIntensity < this->m_Min) + if (pixelIntensity < 0) { continue; } diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 1022f759e8c..e03d24f7dff 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -88,11 +88,11 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe { if (maskPointer && maskPointer->GetPixel(inputIt.GetIndex()) != this->m_InsidePixelValue) { - digitIt.Set(this->m_Min - 10); + digitIt.Set(-10); } else if (inputIt.Get() < this->m_Min || inputIt.Get() >= this->m_Max) { - digitIt.Set(this->m_Min - 1); + digitIt.Set(-1); } else { @@ -192,7 +192,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate while (!inputNIt.IsAtEnd()) { // If the voxel is outside of the mask, don't treat it - if (inputNIt.GetCenterPixel() < (this->m_Min - 5)) // the pixel is outside of the mask + if (inputNIt.GetCenterPixel() < (-5)) // the pixel is outside of the mask { progress.CompletedPixel(); ++inputNIt; @@ -220,8 +220,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); tempOffset = inputNIt.GetOffset(nb); // Cecking if the value is out-of-bounds or is outside the mask. - if (curentInNeighborhoodPixelIntensity < - this->m_Min || // the pixel is outside of the mask or outside of bounds + if (curentInNeighborhoodPixelIntensity < 0 || // the pixel is outside of the mask or outside of bounds alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + tempOffset)) { continue; From 661f61b0043f6f2677fe398857e5ef1b456d001c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 24 Jul 2017 13:56:39 -0400 Subject: [PATCH 069/135] COMP: Address typename outside of template warnings. These occur with recent clang. For example: /home/matt/src/ITKTextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx:48:30: warning: 'typename' occurs outside of a template [-Wc++11-extensions] typedef itk::Neighborhood< typename InputImageType::PixelType, ^~~~~~~~~ Also address result unused warning: In file included from /home/matt/src/ITKTextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx:18: In file included from /home/matt/src/ITK/Modules/Remote/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h:261: /home/matt/src/ITK/Modules/Remote/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx:189:9: warning: expression result unused [-Wunused-value] for ( fit; fit != faceList.end(); ++fit ) ^~~ --- ...urrenceTextureFeaturesImageFilterInstantiationTest.cxx | 8 ++++---- .../test/CoocurrenceTextureFeaturesImageFilterTest.cxx | 8 ++++---- ...enceTextureFeaturesImageFilterTestSeparateFeatures.cxx | 8 ++++---- ...FeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 8 ++++---- ...renceTextureFeaturesImageFilterTestWithVectorImage.cxx | 8 ++++---- ...ocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx | 8 ++++---- ...nLengthTextureFeaturesImageFilterInstantiationTest.cxx | 8 ++++---- .../test/RunLengthTextureFeaturesImageFilterTest.cxx | 8 ++++---- ...ngthTextureFeaturesImageFilterTestSeparateFeatures.cxx | 8 ++++---- ...FeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 8 ++++---- ...engthTextureFeaturesImageFilterTestWithVectorImage.cxx | 8 ++++---- ...RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx | 8 ++++---- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 8891419cdad..23e3aa5cf37 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -41,10 +41,10 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 555693f4106..0ba9498f8ef 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -43,10 +43,10 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 6268b229020..ffa8d7c2db4 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -49,10 +49,10 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 506a7cd71bc..8cefca35988 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -50,10 +50,10 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c typedef int InputPixelType; typedef float OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index c6b8c281374..b2ac9dbc3a3 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -46,10 +46,10 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] typedef int InputPixelType; typedef float OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 8decaffefcd..21d5a294508 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -47,10 +47,10 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index 74d4c2473b1..4a263601844 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -41,10 +41,10 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 73eb201b8d3..fab1dd66616 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -50,10 +50,10 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index a49b33409d7..f6762aca0fc 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -51,10 +51,10 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 4fd4d19f6f8..5b62d6a8138 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -53,10 +53,10 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index d20f47d24f1..9578857cb86 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -48,10 +48,10 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) typedef int InputPixelType; typedef float OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::VectorImage OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index 83ade0e9dc6..f09227fe654 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -49,10 +49,10 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + typedef itk::Image InputImageType; + typedef itk::Image OutputImageType; + typedef itk::ImageFileReader ReaderType; + typedef itk::Neighborhood NeighborhoodType; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); From f9fa48beeb5a34492cf35d5ead3fa239f327dd5c Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 25 Jul 2017 09:50:08 -0400 Subject: [PATCH 070/135] COMP: RunLength signed / unsigned comparison To address: c:\jenkins\workspace\itkgerritwindows\itk-src\modules\remote\texturefeatures\include\itkRunLengthTextureFeaturesImageFilter.hxx(404): warning C4018: '<': signed/unsigned mismatch --- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index e03d24f7dff..5f53e83a618 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -387,10 +387,10 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra } offsetDistance = std::sqrt(offsetDistance); - int offsetDistanceBin = (int)((offsetDistance * pixelDistance - m_MinDistance) / - ((m_MaxDistance - m_MinDistance) / (float)m_NumberOfBinsPerAxis)); + int offsetDistanceBin = static_cast((offsetDistance * pixelDistance - m_MinDistance) / + ((m_MaxDistance - m_MinDistance) / (float)m_NumberOfBinsPerAxis)); - if (offsetDistanceBin < m_NumberOfBinsPerAxis) + if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis)) { totalNumberOfRuns++; hist[curentInNeighborhoodPixelIntensity][offsetDistanceBin]++; From 756ebecfc86f60ecc2c93bf2a5577f18c2efc43a Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 25 Jul 2017 10:02:51 -0400 Subject: [PATCH 071/135] BUG: Spelling Histograme -> Histogram --- .../include/itkRunLengthTextureFeaturesImageFilter.h | 10 +++++----- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 8b15a1a515d..da47c6d6615 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -234,11 +234,11 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - IncreaseHistograme(unsigned int ** hist, - unsigned int & totalNumberOfRuns, - const PixelType & curentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance); + IncreaseHistogram(unsigned int ** hist, + unsigned int & totalNumberOfRuns, + const PixelType & curentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance); void ComputeFeatures(unsigned int ** hist, const unsigned int & totalNumberOfRuns, diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 5f53e83a618..4f2d0ddc294 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -260,7 +260,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } } // Increase the coresponding bin in the histogram - this->IncreaseHistograme(hist, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); + this->IncreaseHistogram(hist, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); } } // Compute the run lenght features @@ -373,7 +373,7 @@ RunLengthTextureFeaturesImageFilter::IsInsideNeighbor template void -RunLengthTextureFeaturesImageFilter::IncreaseHistograme( +RunLengthTextureFeaturesImageFilter::IncreaseHistogram( unsigned int ** hist, unsigned int & totalNumberOfRuns, const PixelType & curentInNeighborhoodPixelIntensity, From 0e154279131356ecb81c9a918f44b17a294880a6 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Wed, 26 Jul 2017 08:54:29 +0200 Subject: [PATCH 072/135] BUG: Fix build warnings. Fix build warnings reported in gerrit when adding the module as a remote to ITK: http://review.source.kitware.com/#/c/22531/ --- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 4f2d0ddc294..eb45dbc20b8 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -182,7 +182,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate bool insideNeighborhood; /// ***** Non-boundary Region ***** - for (fit; fit != faceList.end(); ++fit) + for (; fit != faceList.end(); ++fit) { NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit); typedef itk::ImageRegionIterator IteratorType; From 1145dc477372490bf59dd5215511e87043b0c7d0 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Wed, 26 Jul 2017 09:21:33 +0200 Subject: [PATCH 073/135] DOC: Fix spelling, capitalization mistakes in comments. Fix spelling (e.g. usefull : useful, etc.) and capitalization mistakes in code comments. --- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 26 +++++++------- ...itkRunLengthTextureFeaturesImageFilter.hxx | 36 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index e74d4eac71b..0b99608ecce 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -50,8 +50,8 @@ CoocurrenceTextureFeaturesImageFilter::CoocurrenceTex NeighborhoodType hood; hood.SetRadius(1); - // select all "previous" neighbors that are face+edge+vertex - // connected to the iterated pixel. do not include the curentInNeighborhood pixel. + // Select all "previous" neighbors that are face+edge+vertex + // connected to the iterated pixel. Do not include the curentInNeighborhood pixel. unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); OffsetVectorPointer offsets = OffsetVector::New(); for (unsigned int d = 0; d < centerIndex; d++) @@ -111,7 +111,7 @@ template void CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() { - // free internal image + // Free internal image this->m_DigitalisedInputImageg = ITK_NULLPTR; } @@ -130,14 +130,14 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Creation of the output pixel type typename TOutputImage::PixelType outputPixel; - // Separation of the non-boundery region that will be processed in a different way + // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = boundaryFacesCalculator(this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); - // Declaration of the variables usefull to iterate over the all image region + // Declaration of the variables useful to iterate over the all image region bool isInImage; IndexType firstIndex; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) @@ -147,17 +147,17 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera outputPixel = outputPtr->GetPixel(firstIndex); typename OffsetVector::ConstIterator offsets; - // Declaration of the variables usefull to iterate over the all the offsets + // Declaration of the variables useful to iterate over the all the offsets OffsetType offset; unsigned int totalNumberOfFreq; vnl_matrix hist(m_NumberOfBinsPerAxis, m_NumberOfBinsPerAxis); - // Declaration of the variables usefull to iterate over the all neighborhood region + // Declaration of the variables useful to iterate over the all neighborhood region PixelType curentInNeighborhoodPixelIntensity; - // Declaration of the variables usefull to iterate over the run + // Declaration of the variables useful to iterate over the run PixelType pixelIntensity(NumericTraits::ZeroValue()); OffsetType tempOffset; @@ -190,7 +190,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Iteration over the all neighborhood region for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { - // Test if the curent voxel is in the mask and is the range of the image intensity sepcified + // Test if the curent voxel is in the mask and is the range of the image intensity specified curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); if (curentInNeighborhoodPixelIntensity < 0) { @@ -214,19 +214,19 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera } } - // Test if the pointed voxel is in the mask and is the range of the image intensity sepcified + // Test if the pointed voxel is in the mask and is the range of the image intensity specified pixelIntensity = inputNIt.GetPixel(tempOffset); if (pixelIntensity < 0) { continue; } - // Increase the coresponding bin in the histogram + // Increase the corresponding bin in the histogram totalNumberOfFreq++; hist[curentInNeighborhoodPixelIntensity][pixelIntensity]++; } } - // Compute the run lenght features + // Compute the run length features this->ComputeFeatures(hist, totalNumberOfFreq, outputPixel); outputIt.Set(outputPixel); @@ -302,7 +302,7 @@ CoocurrenceTextureFeaturesImageFilter::ComputeFeature this->ComputeMeansAndVariances(hist, totalNumberOfFreq, pixelMean, marginalMean, marginalDevSquared, pixelVariance); - // Finally compute the texture features. Another one pass. + // Finally compute the texture features. Another pass. MeasurementType energy = NumericTraits::ZeroValue(); MeasurementType entropy = NumericTraits::ZeroValue(); MeasurementType correlation = NumericTraits::ZeroValue(); diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 4f2d0ddc294..e3433cbe70d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -45,8 +45,8 @@ RunLengthTextureFeaturesImageFilter::RunLengthTexture NeighborhoodType hood; hood.SetRadius(1); - // select all "previous" neighbors that are face+edge+vertex - // connected to the iterated pixel. do not include the curentInNeighborhood pixel. + // Select all "previous" neighbors that are face+edge+vertex + // connected to the iterated pixel. Do not include the curentInNeighborhood pixel. unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); OffsetVectorPointer offsets = OffsetVector::New(); for (unsigned int d = 0; d < centerIndex; d++) @@ -104,7 +104,7 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe } m_Spacing = this->GetInput()->GetSpacing(); - // Support VectorImages by setting number of components on output. + // Support VectorImages by setting the number of components on the output. typename TOutputImage::Pointer outputPtr = TOutputImage::New(); outputPtr = this->GetOutput(); if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) @@ -121,7 +121,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { - // Recuperation of the different inputs/outputs + // Get the inputs/outputs typename TOutputImage::Pointer outputPtr = TOutputImage::New(); outputPtr = this->GetOutput(); @@ -130,8 +130,8 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate // Creation of the output pixel type typename TOutputImage::PixelType outputPixel; - // Creation of a region with the same size than the neighborhood, this region - // will be used to check if each voxel has already been visited + // Creation of a region with the same size as the neighborhood. This region + // will be used to check if each voxel has already been visited. InputRegionType boolRegion; typename InputRegionType::IndexType boolStart; typename InputRegionType::SizeType boolSize; @@ -150,19 +150,19 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate alreadyVisitedImage->SetRegions(boolRegion); alreadyVisitedImage->Allocate(); - // Separation of the non-boundery region that will be processed in a different way + // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = boundaryFacesCalculator(this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); - // Declaration of the variables usefull to iterate over the all image region + // Declaration of the variables useful to iterate over the all image region bool isInImage; outputPixel = outputPtr->GetPixel(boolCurentInNeighborhoodIndex); typename OffsetVector::ConstIterator offsets; - // Declaration of the variables usefull to iterate over the all the offsets + // Declaration of the variables useful to iterate over the all the offsets OffsetType offset; unsigned int totalNumberOfRuns; unsigned int ** hist = new unsigned int *[m_NumberOfBinsPerAxis]; @@ -171,10 +171,10 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate hist[a] = new unsigned int[m_NumberOfBinsPerAxis]; } - // Declaration of the variables usefull to iterate over the all neighborhood region + // Declaration of the variables useful to iterate over the all neighborhood region PixelType curentInNeighborhoodPixelIntensity; - // Declaration of the variables usefull to iterate over the run + // Declaration of the variables useful to iterate over the run PixelType pixelIntensity(NumericTraits::ZeroValue()); OffsetType iteratedOffset; OffsetType tempOffset; @@ -219,13 +219,13 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate { curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); tempOffset = inputNIt.GetOffset(nb); - // Cecking if the value is out-of-bounds or is outside the mask. - if (curentInNeighborhoodPixelIntensity < 0 || // the pixel is outside of the mask or outside of bounds + // Checking if the value is out-of-bounds or is outside the mask. + if (curentInNeighborhoodPixelIntensity < 0 || // The pixel is outside of the mask or outside of bounds alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + tempOffset)) { continue; } - // Initialisation of the variables usefull to iterate over the run + // Initialisation of the variables useful to iterate over the run iteratedOffset = tempOffset + offset; pixelDistance = 0; insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); @@ -259,11 +259,11 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate break; } } - // Increase the coresponding bin in the histogram + // Increase the corresponding bin in the histogram this->IncreaseHistogram(hist, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); } } - // Compute the run lenght features + // Compute the run length features this->ComputeFeatures(hist, totalNumberOfRuns, outputPixel); outputIt.Set(outputPixel); @@ -438,11 +438,11 @@ RunLengthTextureFeaturesImageFilter::ComputeFeatures( greyLevelNonuniformityVector[a] += frequency; runLengthNonuniformityVector[b] += frequency; - // measures from Chu et al. + // Measures from Chu et al. lowGreyLevelRunEmphasis += (frequency / i2); highGreyLevelRunEmphasis += (frequency * i2); - // measures from Dasarathy and Holder + // Measures from Dasarathy and Holder shortRunLowGreyLevelEmphasis += (frequency / (i2 * j2)); shortRunHighGreyLevelEmphasis += (frequency * i2 / j2); longRunLowGreyLevelEmphasis += (frequency * j2 / i2); From 52454347db26106ee9633742b9a2e6a5cc711737 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 26 Jul 2017 15:55:20 -0400 Subject: [PATCH 074/135] BUG: Initialize m_Spacing in RunLengthTextureFeatures To address the valgrind error: 1 ==19980== Conditional jump or move depends on uninitialised value(s) 2 ==19980== at 0x5D466C8: __printf_fp_l (printf_fp.c:381) 3 ==19980== by 0x5D450B8: vfprintf (vfprintf.c:1631) 4 ==19980== by 0x5D6CA48: vsnprintf (vsnprintf.c:114) 5 ==19980== by 0x5832F5B: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21) 6 ==19980== by 0x5861A56: std::ostreambuf_iterator > std::num_put > >::_M_insert_float(std::ostreambuf_iterator >, std::ios_base&, char, char, double) const (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21) 7 ==19980== by 0x5861D6F: std::num_put > >::do_put(std::o streambuf_iterator >, std::ios_base&, char, double) const (in /usr/lib/x86_64-linux-gnu/l ibstdc++.so.6.0.21) 8 ==19980== by 0x586DFC4: std::ostream& std::ostream::_M_insert(double) (in /usr/lib/x86_64-linux-gnu/libstdc ++.so.6.0.21) 9 ==19980== by 0x50D4F9: operator<< (ostream:221) 10 ==19980== by 0x50D4F9: std::ostream& itk::operator<< (std::ostream&, itk::Point const&) (it kPoint.hxx:312) 11 ==19980== by 0x50DC86: itk::Statistics::RunLengthTextureFeaturesImageFilter, itk::Image, 3u> >::PrintSelf(std::ostream&, itk::Indent) const (itkRunLengthTextureFeaturesImageFilter.hxx:530) 12 ==19980== by 0x4EEB8F1: itk::LightObject::Print(std::ostream&, itk::Indent) const (in /home/matt/bin/ITK3-GCC-RelWi thDebInfo/lib/libITKCommon-4.13.so.1) 13 ==19980== by 0x501042: RunLengthTextureFeaturesImageFilterInstantiationTest(int, char**) (RunLengthTextureFeaturesI mageFilterInstantiationTest.cxx:66) 14 ==19980== by 0x47E0B3: main (TextureFeaturesTestDriver.cxx:191) 15 = --- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 6e15c4777d8..c44c2b410a1 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -34,6 +34,7 @@ RunLengthTextureFeaturesImageFilter::RunLengthTexture , m_MinDistance(NumericTraits::ZeroValue()) , m_MaxDistance(NumericTraits::max()) , m_InsidePixelValue(NumericTraits::OneValue()) + , m_Spacing(1.0) { this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); From 7f6da810a201edf26596766b0f4b05e8db494b52 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 26 Jul 2017 15:57:12 -0400 Subject: [PATCH 075/135] STYLE: Add colons / spacing when printing out values --- ...itkRunLengthTextureFeaturesImageFilter.hxx | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index c44c2b410a1..6be4fad5201 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -488,20 +488,23 @@ RunLengthTextureFeaturesImageFilter::PrintSelf(std::o itkPrintSelfObjectMacro(DigitalisedInputImageg); - os << indent << "NeighborhoodRadius" + os << indent << "NeighborhoodRadius: " << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; itkPrintSelfObjectMacro(Offsets); - os << indent << "NumberOfBinsPerAxis" << m_NumberOfBinsPerAxis << std::endl; - os << indent << "Min" << static_cast::PrintType>(m_Min) << std::endl; - os << indent << "Max" << static_cast::PrintType>(m_Max) << std::endl; - os << indent << "MinDistance" << static_cast::PrintType>(m_MinDistance) << std::endl; - os << indent << "MaxDistance" << static_cast::PrintType>(m_MaxDistance) << std::endl; - os << indent << "InsidePixelValue" << static_cast::PrintType>(m_InsidePixelValue) + os << indent << "NumberOfBinsPerAxis: " << m_NumberOfBinsPerAxis << std::endl; + os << indent << "Min: " << static_cast::PrintType>(m_Min) << std::endl; + os << indent << "Max: " << static_cast::PrintType>(m_Max) << std::endl; + os << indent << "MinDistance: " << static_cast::PrintType>(m_MinDistance) + << std::endl; + os << indent << "MaxDistance: " << static_cast::PrintType>(m_MaxDistance) + << std::endl; + os << indent << "InsidePixelValue: " << static_cast::PrintType>(m_InsidePixelValue) + << std::endl; + os << indent + << "Spacing: " << static_cast::PrintType>(m_Spacing) << std::endl; - os << indent << "Spacing" - << static_cast::PrintType>(m_Spacing) << std::endl; } } // end of namespace Statistics } // end of namespace itk From d5dfbf2976cf0b3e619f13d118036dc98f1595be Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 26 Jul 2017 16:10:55 -0400 Subject: [PATCH 076/135] BUG: Address RunLengthTextureFeatures histogram memory leak --- ...itkRunLengthTextureFeaturesImageFilter.hxx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 6be4fad5201..857e01b452c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -166,10 +166,10 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate // Declaration of the variables useful to iterate over the all the offsets OffsetType offset; unsigned int totalNumberOfRuns; - unsigned int ** hist = new unsigned int *[m_NumberOfBinsPerAxis]; - for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + unsigned int ** histogram = new unsigned int *[m_NumberOfBinsPerAxis]; + for (unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis) { - hist[a] = new unsigned int[m_NumberOfBinsPerAxis]; + histogram[axis] = new unsigned int[m_NumberOfBinsPerAxis]; } // Declaration of the variables useful to iterate over the all neighborhood region @@ -205,7 +205,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate { for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) { - hist[a][b] = 0; + histogram[a][b] = 0; } } totalNumberOfRuns = 0; @@ -261,11 +261,12 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } } // Increase the corresponding bin in the histogram - this->IncreaseHistogram(hist, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); + this->IncreaseHistogram( + histogram, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); } } // Compute the run length features - this->ComputeFeatures(hist, totalNumberOfRuns, outputPixel); + this->ComputeFeatures(histogram, totalNumberOfRuns, outputPixel); outputIt.Set(outputPixel); progress.CompletedPixel(); @@ -273,6 +274,12 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate ++outputIt; } } + + for (unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis) + { + delete histogram[axis]; + } + delete histogram; } template @@ -375,7 +382,7 @@ RunLengthTextureFeaturesImageFilter::IsInsideNeighbor template void RunLengthTextureFeaturesImageFilter::IncreaseHistogram( - unsigned int ** hist, + unsigned int ** histogram, unsigned int & totalNumberOfRuns, const PixelType & curentInNeighborhoodPixelIntensity, const OffsetType & offset, @@ -394,14 +401,14 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis)) { totalNumberOfRuns++; - hist[curentInNeighborhoodPixelIntensity][offsetDistanceBin]++; + histogram[curentInNeighborhoodPixelIntensity][offsetDistanceBin]++; } } template void RunLengthTextureFeaturesImageFilter::ComputeFeatures( - unsigned int ** hist, + unsigned int ** histogram, const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel) { @@ -423,7 +430,7 @@ RunLengthTextureFeaturesImageFilter::ComputeFeatures( { for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) { - OutputRealType frequency = hist[a][b]; + OutputRealType frequency = histogram[a][b]; if (Math::ExactlyEquals(frequency, NumericTraits::ZeroValue())) { continue; From 0c23f7d73d2a456ca94f408458b0ac1acf6e267b Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 26 Jul 2017 16:12:16 -0400 Subject: [PATCH 077/135] BUG: Spelling: curent -> current --- .../itkCoocurrenceTextureFeaturesImageFilter.hxx | 14 +++++++------- .../itkRunLengthTextureFeaturesImageFilter.h | 2 +- .../itkRunLengthTextureFeaturesImageFilter.hxx | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 0b99608ecce..9b8c33fb60c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -51,7 +51,7 @@ CoocurrenceTextureFeaturesImageFilter::CoocurrenceTex hood.SetRadius(1); // Select all "previous" neighbors that are face+edge+vertex - // connected to the iterated pixel. Do not include the curentInNeighborhood pixel. + // connected to the iterated pixel. Do not include the currentInNeighborhood pixel. unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); OffsetVectorPointer offsets = OffsetVector::New(); for (unsigned int d = 0; d < centerIndex; d++) @@ -155,7 +155,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera vnl_matrix hist(m_NumberOfBinsPerAxis, m_NumberOfBinsPerAxis); // Declaration of the variables useful to iterate over the all neighborhood region - PixelType curentInNeighborhoodPixelIntensity; + PixelType currentInNeighborhoodPixelIntensity; // Declaration of the variables useful to iterate over the run PixelType pixelIntensity(NumericTraits::ZeroValue()); @@ -190,14 +190,14 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Iteration over the all neighborhood region for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { - // Test if the curent voxel is in the mask and is the range of the image intensity specified - curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); - if (curentInNeighborhoodPixelIntensity < 0) + // Test if the current voxel is in the mask and is the range of the image intensity specified + currentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + if (currentInNeighborhoodPixelIntensity < 0) { continue; } - // Test if the curent offset is still pointing to a voxel inside th neighborhood + // Test if the current offset is still pointing to a voxel inside th neighborhood tempOffset = inputNIt.GetOffset(nb) + offset; if (!(this->IsInsideNeighborhood(tempOffset))) { @@ -223,7 +223,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Increase the corresponding bin in the histogram totalNumberOfFreq++; - hist[curentInNeighborhoodPixelIntensity][pixelIntensity]++; + hist[currentInNeighborhoodPixelIntensity][pixelIntensity]++; } } // Compute the run length features diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index da47c6d6615..932c0fd3812 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -236,7 +236,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm void IncreaseHistogram(unsigned int ** hist, unsigned int & totalNumberOfRuns, - const PixelType & curentInNeighborhoodPixelIntensity, + const PixelType & currentInNeighborhoodPixelIntensity, const OffsetType & offset, const unsigned int & pixelDistance); void diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 857e01b452c..cb6b6647ee3 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -47,7 +47,7 @@ RunLengthTextureFeaturesImageFilter::RunLengthTexture hood.SetRadius(1); // Select all "previous" neighbors that are face+edge+vertex - // connected to the iterated pixel. Do not include the curentInNeighborhood pixel. + // connected to the iterated pixel. Do not include the currentInNeighborhood pixel. unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); OffsetVectorPointer offsets = OffsetVector::New(); for (unsigned int d = 0; d < centerIndex; d++) @@ -173,7 +173,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } // Declaration of the variables useful to iterate over the all neighborhood region - PixelType curentInNeighborhoodPixelIntensity; + PixelType currentInNeighborhoodPixelIntensity; // Declaration of the variables useful to iterate over the run PixelType pixelIntensity(NumericTraits::ZeroValue()); @@ -218,10 +218,10 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate // Iteration over the all neighborhood region for (NeighborIndexType nb = 0; nb < inputNIt.Size(); ++nb) { - curentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); + currentInNeighborhoodPixelIntensity = inputNIt.GetPixel(nb); tempOffset = inputNIt.GetOffset(nb); // Checking if the value is out-of-bounds or is outside the mask. - if (curentInNeighborhoodPixelIntensity < 0 || // The pixel is outside of the mask or outside of bounds + if (currentInNeighborhoodPixelIntensity < 0 || // The pixel is outside of the mask or outside of bounds alreadyVisitedImage->GetPixel(boolCurentInNeighborhoodIndex + tempOffset)) { continue; @@ -248,7 +248,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate // Special attention paid to boundaries of bins. // For the last bin, it is left close and right close (following the previous // gerrit patch). For all other bins, the bin is left close and right open. - if (pixelIntensity == curentInNeighborhoodPixelIntensity) + if (pixelIntensity == currentInNeighborhoodPixelIntensity) { alreadyVisitedImage->SetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); pixelDistance++; @@ -262,7 +262,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } // Increase the corresponding bin in the histogram this->IncreaseHistogram( - histogram, totalNumberOfRuns, curentInNeighborhoodPixelIntensity, offset, pixelDistance); + histogram, totalNumberOfRuns, currentInNeighborhoodPixelIntensity, offset, pixelDistance); } } // Compute the run length features @@ -384,7 +384,7 @@ void RunLengthTextureFeaturesImageFilter::IncreaseHistogram( unsigned int ** histogram, unsigned int & totalNumberOfRuns, - const PixelType & curentInNeighborhoodPixelIntensity, + const PixelType & currentInNeighborhoodPixelIntensity, const OffsetType & offset, const unsigned int & pixelDistance) { @@ -401,7 +401,7 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis)) { totalNumberOfRuns++; - histogram[curentInNeighborhoodPixelIntensity][offsetDistanceBin]++; + histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin]++; } } From acc760e987e26255a671fe1b1ae2caf50a1d0826 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 26 Jul 2017 16:21:03 -0400 Subject: [PATCH 078/135] BUG: Spelling: DigitalisedInputImageg --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- ...tkCoocurrenceTextureFeaturesImageFilter.hxx | 10 +++++----- .../itkRunLengthTextureFeaturesImageFilter.h | 2 +- .../itkRunLengthTextureFeaturesImageFilter.hxx | 18 +++++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 0636c783cce..a079f0fc8dd 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -238,7 +238,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo GenerateOutputInformation() ITK_OVERRIDE; private: - typename DigitalisedImageType::Pointer m_DigitalisedInputImageg; + typename DigitalisedImageType::Pointer m_DigitalizedInputImage; NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 9b8c33fb60c..d700dca294b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -104,7 +104,7 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded functorF->SetNumberOfThreads(this->GetNumberOfThreads()); functorF->Update(); - m_DigitalisedInputImageg = functorF->GetOutput(); + m_DigitalizedInputImage = functorF->GetOutput(); } template @@ -112,7 +112,7 @@ void CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() { // Free internal image - this->m_DigitalisedInputImageg = ITK_NULLPTR; + this->m_DigitalizedInputImage = ITK_NULLPTR; } @@ -133,7 +133,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - boundaryFacesCalculator(this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(this->m_DigitalizedInputImage, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); @@ -164,7 +164,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalizedInputImage, *fit); typedef itk::ImageRegionIterator IteratorType; IteratorType outputIt(outputPtr, *fit); @@ -442,7 +442,7 @@ CoocurrenceTextureFeaturesImageFilter::PrintSelf(std: Superclass::PrintSelf(os, indent); - itkPrintSelfObjectMacro(DigitalisedInputImageg); + itkPrintSelfObjectMacro(DigitalizedInputImage); os << indent << "NeighborhoodRadius" << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 932c0fd3812..6bda4231cc5 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -255,7 +255,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm UpdateOutputInformation() ITK_OVERRIDE; private: - typename InputImageType::Pointer m_DigitalisedInputImageg; + typename InputImageType::Pointer m_DigitalizedInputImage; NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; unsigned int m_NumberOfBinsPerAxis; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index cb6b6647ee3..e4e30a8284d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -76,12 +76,12 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe { typename TInputImage::Pointer maskPointer = TInputImage::New(); maskPointer = const_cast(this->GetMaskImage()); - this->m_DigitalisedInputImageg = InputImageType::New(); - this->m_DigitalisedInputImageg->SetRegions(this->GetInput()->GetRequestedRegion()); - this->m_DigitalisedInputImageg->CopyInformation(this->GetInput()); - this->m_DigitalisedInputImageg->Allocate(); + this->m_DigitalizedInputImage = InputImageType::New(); + this->m_DigitalizedInputImage->SetRegions(this->GetInput()->GetRequestedRegion()); + this->m_DigitalizedInputImage->CopyInformation(this->GetInput()); + this->m_DigitalizedInputImage->Allocate(); typedef itk::ImageRegionIterator IteratorType; - IteratorType digitIt(this->m_DigitalisedInputImageg, this->m_DigitalisedInputImageg->GetLargestPossibleRegion()); + IteratorType digitIt(this->m_DigitalizedInputImage, this->m_DigitalizedInputImage->GetLargestPossibleRegion()); typedef itk::ImageRegionConstIterator ConstIteratorType; ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); unsigned int binNumber; @@ -147,14 +147,14 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } boolRegion.SetIndex(boolStart); boolRegion.SetSize(boolSize); - alreadyVisitedImage->CopyInformation(this->m_DigitalisedInputImageg); + alreadyVisitedImage->CopyInformation(this->m_DigitalizedInputImage); alreadyVisitedImage->SetRegions(boolRegion); alreadyVisitedImage->Allocate(); // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - boundaryFacesCalculator(this->m_DigitalisedInputImageg, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(this->m_DigitalizedInputImage, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); @@ -185,7 +185,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalisedInputImageg, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalizedInputImage, *fit); typedef itk::ImageRegionIterator IteratorType; IteratorType outputIt(outputPtr, *fit); @@ -493,7 +493,7 @@ RunLengthTextureFeaturesImageFilter::PrintSelf(std::o { Superclass::PrintSelf(os, indent); - itkPrintSelfObjectMacro(DigitalisedInputImageg); + itkPrintSelfObjectMacro(DigitalizedInputImage); os << indent << "NeighborhoodRadius: " << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; From 9d30f07e06150392a33f3e9beacf7ea41a7e4302 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 27 Jul 2017 14:34:01 -0400 Subject: [PATCH 079/135] BUG: Suppretion of unused variable Suppression of m_Spacing that is useless in coocurrenceTextureFeatures and causing memory access problems --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 15 +++++++-------- .../itkCoocurrenceTextureFeaturesImageFilter.hxx | 14 ++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index a079f0fc8dd..70008293ee5 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -240,14 +240,13 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo private: typename DigitalisedImageType::Pointer m_DigitalizedInputImage; - NeighborhoodRadiusType m_NeighborhoodRadius; - OffsetVectorPointer m_Offsets; - unsigned int m_NumberOfBinsPerAxis; - PixelType m_Min; - PixelType m_Max; - PixelType m_InsidePixelValue; - typename TInputImage::SpacingType m_Spacing; - bool m_Normalize; + NeighborhoodRadiusType m_NeighborhoodRadius; + OffsetVectorPointer m_Offsets; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_Min; + PixelType m_Max; + PixelType m_InsidePixelValue; + bool m_Normalize; struct PreProcessingFunctor diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index d700dca294b..8a400805343 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -444,19 +444,17 @@ CoocurrenceTextureFeaturesImageFilter::PrintSelf(std: itkPrintSelfObjectMacro(DigitalizedInputImage); - os << indent << "NeighborhoodRadius" + os << indent << "NeighborhoodRadius: " << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; itkPrintSelfObjectMacro(Offsets); - os << indent << "NumberOfBinsPerAxis" << m_NumberOfBinsPerAxis << std::endl; - os << indent << "Min" << static_cast::PrintType>(m_Min) << std::endl; - os << indent << "Max" << static_cast::PrintType>(m_Max) << std::endl; - os << indent << "InsidePixelValue" << static_cast::PrintType>(m_InsidePixelValue) + os << indent << "NumberOfBinsPerAxis: " << m_NumberOfBinsPerAxis << std::endl; + os << indent << "Min: " << static_cast::PrintType>(m_Min) << std::endl; + os << indent << "Max: " << static_cast::PrintType>(m_Max) << std::endl; + os << indent << "InsidePixelValue: " << static_cast::PrintType>(m_InsidePixelValue) << std::endl; - os << indent << "Spacing" - << static_cast::PrintType>(m_Spacing) << std::endl; - os << indent << "Normalize" << m_Normalize << std::endl; + os << indent << "Normalize: " << m_Normalize << std::endl; } } // end of namespace Statistics } // end of namespace itk From b3473e622eba88b2f2989b5d0eeaa1fcf7d62416 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 27 Jul 2017 14:57:59 -0400 Subject: [PATCH 080/135] COMP: Run time improvement --- ...tkCoocurrenceTextureFeaturesImageFilter.hxx | 12 ++++++------ .../itkRunLengthTextureFeaturesImageFilter.hxx | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 8a400805343..d7a07ba4ee5 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -54,7 +54,7 @@ CoocurrenceTextureFeaturesImageFilter::CoocurrenceTex // connected to the iterated pixel. Do not include the currentInNeighborhood pixel. unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); OffsetVectorPointer offsets = OffsetVector::New(); - for (unsigned int d = 0; d < centerIndex; d++) + for (unsigned int d = 0; d < centerIndex; ++d) { OffsetType offset = hood.GetOffset(d); offsets->push_back(offset); @@ -140,7 +140,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Declaration of the variables useful to iterate over the all image region bool isInImage; IndexType firstIndex; - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) { firstIndex[i] = 0; } @@ -222,8 +222,8 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera } // Increase the corresponding bin in the histogram - totalNumberOfFreq++; - hist[currentInNeighborhoodPixelIntensity][pixelIntensity]++; + ++totalNumberOfFreq; + ++hist[currentInNeighborhoodPixelIntensity][pixelIntensity]; } } // Compute the run length features @@ -325,9 +325,9 @@ CoocurrenceTextureFeaturesImageFilter::ComputeFeature } const double log2 = std::log(2.0); - for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; ++a) { - for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; ++b) { float frequency = hist[a][b] / (float)totalNumberOfFreq; if (Math::AlmostEquals(frequency, NumericTraits::ZeroValue())) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index e4e30a8284d..2c7d6bfb10f 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -50,7 +50,7 @@ RunLengthTextureFeaturesImageFilter::RunLengthTexture // connected to the iterated pixel. Do not include the currentInNeighborhood pixel. unsigned int centerIndex = hood.GetCenterNeighborhoodIndex(); OffsetVectorPointer offsets = OffsetVector::New(); - for (unsigned int d = 0; d < centerIndex; d++) + for (unsigned int d = 0; d < centerIndex; ++d) { OffsetType offset = hood.GetOffset(d); offsets->push_back(offset); @@ -139,7 +139,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate IndexType boolCurentInNeighborhoodIndex; typedef Image BoolImageType; typename BoolImageType::Pointer alreadyVisitedImage = BoolImageType::New(); - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; i++) + for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) { boolSize[i] = this->m_NeighborhoodRadius[i] * 2 + 1; boolStart[i] = 0; @@ -201,9 +201,9 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate continue; } // Initialisation of the histogram - for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; ++a) { - for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; ++b) { histogram[a][b] = 0; } @@ -251,7 +251,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate if (pixelIntensity == currentInNeighborhoodPixelIntensity) { alreadyVisitedImage->SetPixel(boolCurentInNeighborhoodIndex + iteratedOffset, true); - pixelDistance++; + ++pixelDistance; iteratedOffset += offset; insideNeighborhood = this->IsInsideNeighborhood(iteratedOffset); } @@ -400,8 +400,8 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis)) { - totalNumberOfRuns++; - histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin]++; + ++totalNumberOfRuns; + ++histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin]; } } @@ -426,9 +426,9 @@ RunLengthTextureFeaturesImageFilter::ComputeFeatures( vnl_vector greyLevelNonuniformityVector(m_NumberOfBinsPerAxis, 0.0); vnl_vector runLengthNonuniformityVector(m_NumberOfBinsPerAxis, 0.0); - for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; a++) + for (unsigned int a = 0; a < m_NumberOfBinsPerAxis; ++a) { - for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; b++) + for (unsigned int b = 0; b < m_NumberOfBinsPerAxis; ++b) { OutputRealType frequency = histogram[a][b]; if (Math::ExactlyEquals(frequency, NumericTraits::ZeroValue())) From 9a8312245eb557d0ed79c0734cb7276d90f1c417 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Thu, 27 Jul 2017 15:57:38 -0400 Subject: [PATCH 081/135] BUG: Adding of a missing condition in order to remove the run smaller than the minimum run length specified by the user --- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 2c7d6bfb10f..1bb287a996c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -261,6 +261,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } } // Increase the corresponding bin in the histogram + this->IncreaseHistogram( histogram, totalNumberOfRuns, currentInNeighborhoodPixelIntensity, offset, pixelDistance); } @@ -277,9 +278,9 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate for (unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis) { - delete histogram[axis]; + delete[] histogram[axis]; } - delete histogram; + delete[] histogram; } template @@ -394,11 +395,9 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra offsetDistance += (offset[i] * m_Spacing[i]) * (offset[i] * m_Spacing[i]); } offsetDistance = std::sqrt(offsetDistance); - int offsetDistanceBin = static_cast((offsetDistance * pixelDistance - m_MinDistance) / ((m_MaxDistance - m_MinDistance) / (float)m_NumberOfBinsPerAxis)); - - if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis)) + if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis) && offsetDistanceBin >= 0) { ++totalNumberOfRuns; ++histogram[currentInNeighborhoodPixelIntensity][offsetDistanceBin]; From 76f0635f86cefd83bb0e319f3b07c523de4cada7 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 31 Jul 2017 13:23:07 -0400 Subject: [PATCH 082/135] BUG: Use GTest for ITK>=4.13 Google test was just added during ITK 4.13 development. The logic is corrected. --- Modules/Filtering/TextureFeatures/itk-module.cmake | 2 +- Modules/Filtering/TextureFeatures/test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index e27ed831092..810c4267fe2 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -7,7 +7,7 @@ # By convention those modules outside of ITK are not prefixed with # ITK. -if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.12") +if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.13") set(_GoogleTest_DEPENDS ITKGoogleTest) endif() diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index 59bf6833a15..a3aee6269db 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -512,7 +512,7 @@ itk_add_test( 5 ) -if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.12") +if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.13") set(TextureFeaturesGTests itkFirstOrderTextureFeaturesImageFilterGTest.cxx) creategoogletestdriver(TextureFeatures "${TextureFeatures-Test_LIBRARIES}" "${TextureFeaturesGTests}") From d01ef9e3bb111e38a28c551eb87644966ba6a810 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 31 Jul 2017 13:24:58 -0400 Subject: [PATCH 083/135] BUG: Fix typeo for Google Test test case name --- .../test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index 04c09d851ce..252014f6c5c 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx @@ -41,7 +41,7 @@ print_feature(const T & p, std::ostream & out = std::cout) } // namespace -TEST(TextTureFeatures, FirstOrder_Test1) +TEST(TextureFeatures, FirstOrder_Test1) { const unsigned int ImageDimension = 2; typedef itk::Image ImageType; @@ -111,7 +111,7 @@ TEST(TextTureFeatures, FirstOrder_Test1) } -TEST(TextTureFeatures, FirstOrder_Test2) +TEST(TextureFeatures, FirstOrder_Test2) { const unsigned int ImageDimension = 2; typedef itk::Image ImageType; From 916d3c583d3b0fc360e81d992892ce4e673b4124 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 31 Jul 2017 15:11:54 -0400 Subject: [PATCH 084/135] BUG: Filling the output image even for voxels outside of the mask This fix prevents the failure of tests 18 to 21 on windows: https://open.cdash.org/viewTest.php?onlyfailed&buildid=4995219 --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 2 ++ .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index d7a07ba4ee5..6257e6bb476 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -174,6 +174,8 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // If the voxel is outside of the mask, don't treat it if (inputNIt.GetCenterPixel() < (-5)) // the pixel is outside of the mask { + outputPixel.Fill(0); + outputIt.Set(outputPixel); progress.CompletedPixel(); ++inputNIt; ++outputIt; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 1bb287a996c..e80fb041fe7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -195,6 +195,8 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate // If the voxel is outside of the mask, don't treat it if (inputNIt.GetCenterPixel() < (-5)) // the pixel is outside of the mask { + outputPixel.Fill(0); + outputIt.Set(outputPixel); progress.CompletedPixel(); ++inputNIt; ++outputIt; From ebd271a0efbeca6aaec09345ced8b92100782679 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 31 Aug 2017 10:01:49 -0400 Subject: [PATCH 085/135] BUG: Rename and replace min/max setter with separate setter methods For CoocurrenceTextureFeaturesImageFilter: m_Min->m_HistogramMaximum respectfully in the and similarly for the maximum. For RunLengthTextureFeaturesImageFilter: m_Min -> m_HistogramValueMinimum m_MinDistance -> m_HistogramDistanceMinimum and similarly for the maximum. Add the properly named Set and Get accessors methods according to ITK convention. ITK standards are for each parameter or ivar to have a separate set method. The exists methods which set a min/max pair now call the standard macro based set methods. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 23 +++---- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 23 ++----- .../itkRunLengthTextureFeaturesImageFilter.h | 65 +++++++++---------- ...itkRunLengthTextureFeaturesImageFilter.hxx | 54 +++++---------- ...reFeaturesImageFilterInstantiationTest.cxx | 7 +- ...currenceTextureFeaturesImageFilterTest.cxx | 3 +- ...eaturesImageFilterTestSeparateFeatures.cxx | 8 ++- ...eFilterTestVectorImageSeparateFeatures.cxx | 3 +- ...FeaturesImageFilterTestWithVectorImage.cxx | 3 +- ...tureFeaturesImageFilterTestWithoutMask.cxx | 3 +- ...reFeaturesImageFilterInstantiationTest.cxx | 14 ++-- ...unLengthTextureFeaturesImageFilterTest.cxx | 14 ++-- ...eaturesImageFilterTestSeparateFeatures.cxx | 7 +- ...eFilterTestVectorImageSeparateFeatures.cxx | 6 +- ...FeaturesImageFilterTestWithVectorImage.cxx | 7 +- ...tureFeaturesImageFilterTestWithoutMask.cxx | 6 +- 16 files changed, 115 insertions(+), 131 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 70008293ee5..89d2ae09444 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -45,8 +45,8 @@ namespace Statistics * * Template Parameters: * -# The input image type: a N dimensional image where the pixel type MUST be integer. - * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or an - * ImageVector. + * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or a + * VectorImage. * * Inputs and parameters: * -# An image @@ -171,18 +171,13 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo /** Get number of histogram bins along each axis */ itkGetConstMacro(NumberOfBinsPerAxis, unsigned int); - /** - * Set the min and max (inclusive) pixel value that will be used in - * generating the histogram. - */ - void - SetPixelValueMinMax(PixelType min, PixelType max); + /** Get the max pixel value defining one dimension of the joint histogram. */ + itkGetConstMacro(HistogramMaximum, PixelType); + itkSetMacro(HistogramMaximum, PixelType); /** Get the min pixel value defining one dimension of the joint histogram. */ - itkGetConstMacro(Min, PixelType); - - /** Get the max pixel value defining one dimension of the joint histogram. */ - itkGetConstMacro(Max, PixelType); + itkGetConstMacro(HistogramMinimum, PixelType); + itkSetMacro(HistogramMinimum, PixelType); /** * Set the pixel value of the mask that should be considered "inside" the @@ -243,8 +238,8 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; unsigned int m_NumberOfBinsPerAxis; - PixelType m_Min; - PixelType m_Max; + PixelType m_HistogramMinimum; + PixelType m_HistogramMaximum; PixelType m_InsidePixelValue; bool m_Normalize; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 6257e6bb476..e0d7e7ed21f 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -30,8 +30,8 @@ namespace Statistics template CoocurrenceTextureFeaturesImageFilter::CoocurrenceTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) - , m_Min(NumericTraits::NonpositiveMin()) - , m_Max(NumericTraits::max()) + , m_HistogramMinimum(NumericTraits::NonpositiveMin()) + , m_HistogramMaximum(NumericTraits::max()) , m_InsidePixelValue(NumericTraits::OneValue()) { this->SetNumberOfRequiredInputs(1); @@ -85,7 +85,7 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded input->Graft(const_cast(this->GetInput())); typedef PreProcessingFunctor PPFType; - PPFType ppf(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_Min, m_Max); + PPFType ppf(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramMinimum, m_HistogramMaximum); typedef BinaryFunctorImageFilter BinaryFunctorType; typename BinaryFunctorType::Pointer functorF = BinaryFunctorType::New(); @@ -257,19 +257,6 @@ CoocurrenceTextureFeaturesImageFilter::GenerateOutput } } - -template -void -CoocurrenceTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) -{ - if (this->m_Min != min || this->m_Max != max) - { - this->m_Min = min; - this->m_Max = max; - this->Modified(); - } -} - template bool CoocurrenceTextureFeaturesImageFilter::IsInsideNeighborhood( @@ -452,8 +439,8 @@ CoocurrenceTextureFeaturesImageFilter::PrintSelf(std: itkPrintSelfObjectMacro(Offsets); os << indent << "NumberOfBinsPerAxis: " << m_NumberOfBinsPerAxis << std::endl; - os << indent << "Min: " << static_cast::PrintType>(m_Min) << std::endl; - os << indent << "Max: " << static_cast::PrintType>(m_Max) << std::endl; + os << indent << "Min: " << static_cast::PrintType>(m_HistogramMinimum) << std::endl; + os << indent << "Max: " << static_cast::PrintType>(m_HistogramMaximum) << std::endl; os << indent << "InsidePixelValue: " << static_cast::PrintType>(m_InsidePixelValue) << std::endl; os << indent << "Normalize: " << m_Normalize << std::endl; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 6bda4231cc5..87440df7085 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -34,8 +34,10 @@ namespace Statistics * This filter computes a N-D image where each voxel will contain * a vector of up to 10 scalars representing the run length features * (of the specified neighborhood) from a N-D scalar image. - * The run length features are computed for each spatial - * direction and averaged afterward. + * The run length features are computed from joint histograms of + * pixel intensities and distance (run length) per spatial direction + * then averaged afterward. + * * The result obtained is a possible texture description. See the following references. * M. M. Galloway. Texture analysis using gray level run lengths. Computer * Graphics and Image Processing, 4:172-179, 1975. @@ -50,8 +52,8 @@ namespace Statistics * * Template Parameters: * -# The input image type: a N dimensional image where the pixel type MUST be integer. - * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or an - * ImageVector. + * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or a + * VectorImage. * * Inputs and parameters: * -# An image @@ -63,10 +65,12 @@ namespace Statistics * -# The set of directions (offsets) to average across. (Optional, defaults to * {(-1, 0), (-1, -1), (0, -1), (1, -1)} for 2D images and scales analogously * for ND images.) - * -# The pixel intensity range over which the features will be calculated. - * (Optional, defaults to the full dynamic range of the pixel type.) - * -# The distance range over which the features will be calculated. - * (Optional, defaults to the full dynamic range of double type.) + * -# The pixel intensity range for the joint histogram over which the + * features will be calculated. (Optional, defaults to the full + * dynamic range of the pixel type.) + * -# The distance range for the joint histogram over which the + * features will be calculated. (Optional, defaults to the full + * dynamic range of double type.) * -# The size of the neighborhood radius. (Optional, defaults to 2.) * * Recommendations: @@ -178,35 +182,30 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm /** Get number of histogram bins along each axis */ itkGetConstMacro(NumberOfBinsPerAxis, unsigned int); - /** - * Set the min and max (inclusive) pixel value that will be used in - * generating the histogram. - */ - void - SetPixelValueMinMax(PixelType min, PixelType max); - - /** Get the min pixel value defining one dimension of the joint histogram. */ - itkGetConstMacro(Min, PixelType); + /** Set/Get the minimum (inclusive) pixel value defining one dimension of the joint + * value distance histogram. */ + itkGetConstMacro(HistogramValueMinimum, PixelType); + itkSetMacro(HistogramValueMinimum, PixelType); - /** Get the max pixel value defining one dimension of the joint histogram. */ - itkGetConstMacro(Max, PixelType); + /** Set/Get the maximum pixel value defining one dimension of the joint + * value distance histogram. */ + itkGetConstMacro(HistogramValueMaximum, PixelType); + itkSetMacro(HistogramValueMaximum, PixelType); - /** - * Set the min and max (inclusive) pixel value that will be used in - * generating the histogram. - */ - void - SetDistanceValueMinMax(RealType min, RealType max); /** - * Get the min distance value defining one dimension of the joint histogram. + * Set/Get the minimum (inclusive) run length distance in physical + * space that will be used in generating the joint value distance histogram. */ - itkGetConstMacro(MinDistance, RealType); + itkGetConstMacro(HistogramDistanceMinimum, RealType); + itkSetMacro(HistogramDistanceMinimum, RealType); /** - * Get the max distance value defining one dimension of the joint histogram. + * Set/Get the maximum run length distance in physical + * space that will be used in generating the joint value distance histogram. */ - itkGetConstMacro(MaxDistance, RealType); + itkGetConstMacro(HistogramDistanceMaximum, RealType); + itkSetMacro(HistogramDistanceMaximum, RealType); /** * Set the pixel value of the mask that should be considered "inside" the @@ -259,10 +258,10 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; unsigned int m_NumberOfBinsPerAxis; - PixelType m_Min; - PixelType m_Max; - RealType m_MinDistance; - RealType m_MaxDistance; + PixelType m_HistogramValueMinimum; + PixelType m_HistogramValueMaximum; + RealType m_HistogramDistanceMinimum; + RealType m_HistogramDistanceMaximum; PixelType m_InsidePixelValue; typename TInputImage::SpacingType m_Spacing; }; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index e80fb041fe7..ea214bf1fff 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -29,10 +29,10 @@ namespace Statistics template RunLengthTextureFeaturesImageFilter::RunLengthTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) - , m_Min(NumericTraits::NonpositiveMin()) - , m_Max(NumericTraits::max()) - , m_MinDistance(NumericTraits::ZeroValue()) - , m_MaxDistance(NumericTraits::max()) + , m_HistogramValueMinimum(NumericTraits::NonpositiveMin()) + , m_HistogramValueMaximum(NumericTraits::max()) + , m_HistogramDistanceMinimum(NumericTraits::ZeroValue()) + , m_HistogramDistanceMaximum(NumericTraits::max()) , m_InsidePixelValue(NumericTraits::OneValue()) , m_Spacing(1.0) { @@ -91,13 +91,14 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe { digitIt.Set(-10); } - else if (inputIt.Get() < this->m_Min || inputIt.Get() >= this->m_Max) + else if (inputIt.Get() < this->m_HistogramValueMinimum || inputIt.Get() >= this->m_HistogramValueMinimum) { digitIt.Set(-1); } else { - binNumber = (inputIt.Get() - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis); + binNumber = (inputIt.Get() - m_HistogramValueMinimum) / + ((m_HistogramValueMaximum - m_HistogramValueMinimum) / (float)m_NumberOfBinsPerAxis); digitIt.Set(binNumber); } ++inputIt; @@ -318,30 +319,6 @@ RunLengthTextureFeaturesImageFilter::GetMaskImage() c return static_cast(this->ProcessObject::GetInput(1)); } -template -void -RunLengthTextureFeaturesImageFilter::SetPixelValueMinMax(PixelType min, PixelType max) -{ - if (this->m_Min != min || this->m_Max != max) - { - this->m_Min = min; - this->m_Max = max; - this->Modified(); - } -} - -template -void -RunLengthTextureFeaturesImageFilter::SetDistanceValueMinMax(RealType min, RealType max) -{ - if (Math::NotExactlyEquals(this->m_MinDistance, min) || Math::NotExactlyEquals(this->m_MaxDistance, max)) - { - this->m_MinDistance = min; - this->m_MaxDistance = max; - this->Modified(); - } -} - template void RunLengthTextureFeaturesImageFilter::NormalizeOffsetDirection(OffsetType & offset) @@ -397,8 +374,9 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra offsetDistance += (offset[i] * m_Spacing[i]) * (offset[i] * m_Spacing[i]); } offsetDistance = std::sqrt(offsetDistance); - int offsetDistanceBin = static_cast((offsetDistance * pixelDistance - m_MinDistance) / - ((m_MaxDistance - m_MinDistance) / (float)m_NumberOfBinsPerAxis)); + int offsetDistanceBin = + static_cast((offsetDistance * pixelDistance - m_HistogramDistanceMinimum) / + ((m_HistogramDistanceMaximum - m_HistogramDistanceMinimum) / (float)m_NumberOfBinsPerAxis)); if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis) && offsetDistanceBin >= 0) { ++totalNumberOfRuns; @@ -502,11 +480,15 @@ RunLengthTextureFeaturesImageFilter::PrintSelf(std::o itkPrintSelfObjectMacro(Offsets); os << indent << "NumberOfBinsPerAxis: " << m_NumberOfBinsPerAxis << std::endl; - os << indent << "Min: " << static_cast::PrintType>(m_Min) << std::endl; - os << indent << "Max: " << static_cast::PrintType>(m_Max) << std::endl; - os << indent << "MinDistance: " << static_cast::PrintType>(m_MinDistance) + os << indent << "Min: " << static_cast::PrintType>(m_HistogramValueMinimum) << std::endl; - os << indent << "MaxDistance: " << static_cast::PrintType>(m_MaxDistance) + os << indent << "Max: " << static_cast::PrintType>(m_HistogramValueMaximum) + << std::endl; + os << indent + << "MinDistance: " << static_cast::PrintType>(m_HistogramDistanceMinimum) + << std::endl; + os << indent + << "MaxDistance: " << static_cast::PrintType>(m_HistogramDistanceMaximum) << std::endl; os << indent << "InsidePixelValue: " << static_cast::PrintType>(m_InsidePixelValue) << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 23e3aa5cf37..cd9a1ed0ece 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -75,9 +75,10 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) FilterType::PixelType min = -62; FilterType::PixelType max = 2456; - filter->SetPixelValueMinMax(min, max); - TEST_SET_GET_VALUE(min, filter->GetMin()); - TEST_SET_GET_VALUE(max, filter->GetMax()); + filter->SetHistogramMinimum(min); + filter->SetHistogramMaximum(max); + TEST_SET_GET_VALUE(min, filter->GetHistogramMinimum()); + TEST_SET_GET_VALUE(max, filter->GetHistogramMaximum()); NeighborhoodType::SizeValueType neighborhoodRadius = 3; NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 0ba9498f8ef..eb934bdc4a6 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -70,7 +70,8 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramMinimum(pixelValueMin); + filter->SetHistogramMaximum(pixelValueMax); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index ffa8d7c2db4..8e8be218350 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -75,9 +75,11 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType min = std::atof(argv[5]); - FilterType::PixelType max = std::atof(argv[6]); - filter->SetPixelValueMinMax(min, max); + FilterType::PixelType pixelValueMin = std::atof(argv[5]); + FilterType::PixelType pixelValueMax = std::atof(argv[6]); + filter->SetHistogramMinimum(pixelValueMin); + filter->SetHistogramMaximum(pixelValueMax); + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 8cefca35988..975c9729785 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -77,7 +77,8 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramMinimum(pixelValueMin); + filter->SetHistogramMaximum(pixelValueMax); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index b2ac9dbc3a3..3e5305eb8b1 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -76,7 +76,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramMinimum(pixelValueMin); + filter->SetHistogramMaximum(pixelValueMax); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 21d5a294508..d49792940f0 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -69,7 +69,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) FilterType::PixelType pixelValueMin = std::atof(argv[4]); FilterType::PixelType pixelValueMax = std::atof(argv[5]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramMinimum(pixelValueMin); + filter->SetHistogramMaximum(pixelValueMax); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[6]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index 4a263601844..82cc23892ca 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -74,15 +74,17 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) FilterType::PixelType pixelValueMin = -62; FilterType::PixelType pixelValueMax = 2456; - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); - TEST_SET_GET_VALUE(pixelValueMin, filter->GetMin()); - TEST_SET_GET_VALUE(pixelValueMax, filter->GetMax()); + filter->SetHistogramValueMinimum(pixelValueMin); + filter->SetHistogramValueMaximum(pixelValueMax); + TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); + TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); FilterType::RealType minDistance = 0.15; FilterType::RealType maxDistance = 1.5; - filter->SetDistanceValueMinMax(minDistance, maxDistance); - TEST_SET_GET_VALUE(minDistance, filter->GetMinDistance()); - TEST_SET_GET_VALUE(maxDistance, filter->GetMaxDistance()); + filter->SetHistogramDistanceMinimum(minDistance); + filter->SetHistogramDistanceMaximum(maxDistance); + TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); + TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); NeighborhoodType::SizeValueType neighborhoodRadius = 3; NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index fab1dd66616..4753a9335d6 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -83,15 +83,17 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); - TEST_SET_GET_VALUE(pixelValueMin, filter->GetMin()); - TEST_SET_GET_VALUE(pixelValueMax, filter->GetMax()); + filter->SetHistogramValueMinimum(pixelValueMin); + filter->SetHistogramValueMaximum(pixelValueMax); + TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); + TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); FilterType::RealType minDistance = std::atof(argv[7]); FilterType::RealType maxDistance = std::atof(argv[8]); - filter->SetDistanceValueMinMax(minDistance, maxDistance); - TEST_SET_GET_VALUE(minDistance, filter->GetMinDistance()); - TEST_SET_GET_VALUE(maxDistance, filter->GetMaxDistance()); + filter->SetHistogramDistanceMinimum(minDistance); + filter->SetHistogramDistanceMaximum(maxDistance); + TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); + TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index f6762aca0fc..8564676d73f 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -79,11 +79,14 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramValueMinimum(pixelValueMin); + filter->SetHistogramValueMaximum(pixelValueMax); FilterType::RealType minDistance = std::atof(argv[7]); FilterType::RealType maxDistance = std::atof(argv[8]); - filter->SetDistanceValueMinMax(minDistance, maxDistance); + filter->SetHistogramDistanceMinimum(minDistance); + filter->SetHistogramDistanceMaximum(maxDistance); + NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 5b62d6a8138..c8d8526b89c 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -80,11 +80,13 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramValueMinimum(pixelValueMin); + filter->SetHistogramValueMaximum(pixelValueMax); FilterType::RealType minDistance = std::atof(argv[7]); FilterType::RealType maxDistance = std::atof(argv[8]); - filter->SetDistanceValueMinMax(minDistance, maxDistance); + filter->SetHistogramDistanceMinimum(minDistance); + filter->SetHistogramDistanceMaximum(maxDistance); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index 9578857cb86..d8b1b781fae 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -78,11 +78,14 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) FilterType::PixelType pixelValueMin = std::atof(argv[5]); FilterType::PixelType pixelValueMax = std::atof(argv[6]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramValueMinimum(pixelValueMin); + filter->SetHistogramValueMaximum(pixelValueMax); + FilterType::RealType minDistance = std::atof(argv[7]); FilterType::RealType maxDistance = std::atof(argv[8]); - filter->SetDistanceValueMinMax(minDistance, maxDistance); + filter->SetHistogramDistanceMinimum(minDistance); + filter->SetHistogramDistanceMaximum(maxDistance); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); NeighborhoodType hood; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index f09227fe654..1bcd2efc5b5 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -72,11 +72,13 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) FilterType::PixelType pixelValueMin = std::atof(argv[4]); FilterType::PixelType pixelValueMax = std::atof(argv[5]); - filter->SetPixelValueMinMax(pixelValueMin, pixelValueMax); + filter->SetHistogramValueMinimum(pixelValueMin); + filter->SetHistogramValueMaximum(pixelValueMax); FilterType::RealType minDistance = std::atof(argv[6]); FilterType::RealType maxDistance = std::atof(argv[7]); - filter->SetDistanceValueMinMax(minDistance, maxDistance); + filter->SetHistogramDistanceMinimum(minDistance); + filter->SetHistogramDistanceMaximum(maxDistance); NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[8]); NeighborhoodType hood; From c61064bbab1544e6c88e9d9a193115401d34fe3c Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 13:57:04 -0400 Subject: [PATCH 086/135] ENH: Make Masked input image an optional named input Make use of the macros to set named input. This reuses the code in the macro. By making this input a named input it clarifies the information printed by the filter when printed. --- .../itkRunLengthTextureFeaturesImageFilter.h | 7 +++--- ...itkRunLengthTextureFeaturesImageFilter.hxx | 25 +++++-------------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 87440df7085..80d0a9c3a13 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -138,12 +138,11 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); /** Method to set the mask image */ - void - SetMaskImage(const InputImageType * image); + itkSetInputMacro(MaskImage, InputImageType); /** Method to get the mask image */ - const InputImageType * - GetMaskImage() const; + itkGetInputMacro(MaskImage, InputImageType); + /** Specify the default number of bins per axis */ itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index ea214bf1fff..b3bab591c05 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -39,6 +39,12 @@ RunLengthTextureFeaturesImageFilter::RunLengthTexture this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); + // Mark the "MaskImage" as an optional named input. First it has to + // be added to the list of named inputs then removed from the + // required list. + Self::AddRequiredInputName("MaskImage"); + Self::RemoveRequiredInputName("MaskImage"); + // Set the offset directions to their defaults: half of all the possible // directions 1 pixel away. (The other half is included by symmetry.) // We use a neighborhood iterator to calculate the appropriate offsets. @@ -300,25 +306,6 @@ RunLengthTextureFeaturesImageFilter::UpdateOutputInfo } } -template -void -RunLengthTextureFeaturesImageFilter::SetMaskImage(const InputImageType * image) -{ - // Process object is not const-correct so the const_cast is required here - this->ProcessObject::SetNthInput(1, const_cast(image)); -} - -template -const TInputImage * -RunLengthTextureFeaturesImageFilter::GetMaskImage() const -{ - if (this->GetNumberOfInputs() < 2) - { - return ITK_NULLPTR; - } - return static_cast(this->ProcessObject::GetInput(1)); -} - template void RunLengthTextureFeaturesImageFilter::NormalizeOffsetDirection(OffsetType & offset) From d5a25ac92fe32a75c3d5f571757473e9dd1c72cb Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 15:07:25 -0400 Subject: [PATCH 087/135] ENH: Move PreProcessingFunctor to separate file as Digitizer functor This will enable reuse of this functor between classes. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 57 ------------ ...kCoocurrenceTextureFeaturesImageFilter.hxx | 24 ++--- .../include/itkDigitizerFunctor.h | 91 +++++++++++++++++++ 3 files changed, 104 insertions(+), 68 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 89d2ae09444..d1be4a1bee2 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -242,63 +242,6 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo PixelType m_HistogramMaximum; PixelType m_InsidePixelValue; bool m_Normalize; - - - struct PreProcessingFunctor - { - PreProcessingFunctor() - : m_NumberOfBinsPerAxis(256) - , m_MaskValue(1) - , m_Min(NumericTraits::min()) - , m_Max(NumericTraits::max()) - {} - - PreProcessingFunctor(unsigned int numberOfBinsPerAxis, PixelType maskValue, PixelType min, PixelType max) - : m_NumberOfBinsPerAxis(numberOfBinsPerAxis) - , m_MaskValue(maskValue) - , m_Min(min) - , m_Max(max) - {} - - ~PreProcessingFunctor() {} - - bool - operator!=(const PreProcessingFunctor & other) const - { - return (m_NumberOfBinsPerAxis != other.m_NumberOfBinsPerAxis) || (m_MaskValue != other.m_MaskValue) || - (m_Min != other.m_Min) || (m_Max != other.m_Max); - } - - bool - operator==(const PreProcessingFunctor & other) const - { - return !(*this != other); - } - - inline typename DigitalisedImageType::PixelType - operator()(const MaskPixelType & maskPixel, const PixelType & inputPixel) const - { - - if (maskPixel != m_MaskValue) - { - return -10; - } - else if (inputPixel < this->m_Min || inputPixel >= m_Max) - { - return -1; - } - else - { - return ((inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis)); - } - } - - unsigned int m_NumberOfBinsPerAxis; - - PixelType m_MaskValue; - PixelType m_Min; - PixelType m_Max; - }; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index e0d7e7ed21f..23a68002697 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -22,6 +22,7 @@ #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" #include "itkBinaryFunctorImageFilter.h" +#include "itkDigitizerFunctor.h" namespace itk { @@ -84,27 +85,28 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded typename TInputImage::Pointer input = InputImageType::New(); input->Graft(const_cast(this->GetInput())); - typedef PreProcessingFunctor PPFType; - PPFType ppf(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramMinimum, m_HistogramMaximum); + typedef Digitizer DigitizerFunctorType; - typedef BinaryFunctorImageFilter BinaryFunctorType; - typename BinaryFunctorType::Pointer functorF = BinaryFunctorType::New(); + DigitizerFunctorType digitalizer(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramMinimum, m_HistogramMaximum); + + typedef BinaryFunctorImageFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != ITK_NULLPTR) { typename TInputImage::Pointer mask = MaskImageType::New(); mask->Graft(const_cast(this->GetMaskImage())); - functorF->SetInput1(mask); + filter->SetInput1(mask); } else { - functorF->SetConstant1(m_InsidePixelValue); + filter->SetConstant1(m_InsidePixelValue); } - functorF->SetInput2(input); - functorF->SetFunctor(ppf); - functorF->SetNumberOfThreads(this->GetNumberOfThreads()); + filter->SetInput2(input); + filter->SetFunctor(digitalizer); + filter->SetNumberOfThreads(this->GetNumberOfThreads()); - functorF->Update(); - m_DigitalizedInputImage = functorF->GetOutput(); + filter->Update(); + m_DigitalizedInputImage = filter->GetOutput(); } template diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h new file mode 100644 index 00000000000..18665e39334 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -0,0 +1,91 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef itkDigitizerFunctor_h +#define itkDigitizerFunctor_h + +namespace itk +{ +namespace Statistics +{ + +template +class Digitizer +{ +public: + typedef TInput2 PixelType; + typedef TInput1 MaskPixelType; + + Digitizer() + : m_NumberOfBinsPerAxis(256) + , m_MaskValue(1) + , m_Min(NumericTraits::min()) + , m_Max(NumericTraits::max()) + {} + + Digitizer(unsigned int numberOfBinsPerAxis, MaskPixelType maskValue, PixelType min, PixelType max) + : m_NumberOfBinsPerAxis(numberOfBinsPerAxis) + , m_MaskValue(maskValue) + , m_Min(min) + , m_Max(max) + {} + + ~Digitizer() {} + + bool + operator!=(const Digitizer & other) const + { + return (m_NumberOfBinsPerAxis != other.m_NumberOfBinsPerAxis) || (m_MaskValue != other.m_MaskValue) || + (m_Min != other.m_Min) || (m_Max != other.m_Max); + } + + bool + operator==(const Digitizer & other) const + { + return !(*this != other); + } + + inline TOutput + operator()(const MaskPixelType & maskPixel, const PixelType & inputPixel) const + { + + if (maskPixel != m_MaskValue) + { + return -10; + } + else if (inputPixel < this->m_Min || inputPixel >= m_Max) + { + return -1; + } + else + { + return ((inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis)); + } + } + + unsigned int m_NumberOfBinsPerAxis; + + MaskPixelType m_MaskValue; + + PixelType m_Min; + PixelType m_Max; +}; + +} // namespace Statistics +} // namespace itk + +#endif From 1b7f20f8cbdf841ce898e06ecae9ee5c7cee9250 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 15:24:27 -0400 Subject: [PATCH 088/135] BUG: Free digitized image after threaded execution --- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 ++ .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 80d0a9c3a13..4f5213486b4 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -248,6 +248,8 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm virtual void BeforeThreadedGenerateData() ITK_OVERRIDE; virtual void + AfterThreadedGenerateData() ITK_OVERRIDE; + virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; virtual void UpdateOutputInformation() ITK_OVERRIDE; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index b3bab591c05..c521d0aea4e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -123,6 +123,16 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe outputPtr->Allocate(); } + +template +void +RunLengthTextureFeaturesImageFilter::AfterThreadedGenerateData() +{ + // free internal image + this->m_DigitalizedInputImage = ITK_NULLPTR; +} + + template void RunLengthTextureFeaturesImageFilter::ThreadedGenerateData( From f433afeed8a94ac029d2a2f4254f70b71d433e16 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 15:26:34 -0400 Subject: [PATCH 089/135] BUG: Correct spelling to "Digitized" --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 4 ++-- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 12 +++++------ .../itkRunLengthTextureFeaturesImageFilter.h | 2 +- ...itkRunLengthTextureFeaturesImageFilter.hxx | 20 +++++++++---------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index d1be4a1bee2..a8bfe442014 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -101,7 +101,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; typedef TInputImage MaskImageType; - typedef TInputImage DigitalisedImageType; + typedef TInputImage DigitizedImageType; typedef typename InputImageType::PixelType PixelType; typedef typename MaskImageType::PixelType MaskPixelType; @@ -233,7 +233,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo GenerateOutputInformation() ITK_OVERRIDE; private: - typename DigitalisedImageType::Pointer m_DigitalizedInputImage; + typename DigitizedImageType::Pointer m_DigitalizedInputImage; NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 23a68002697..1badf258405 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -85,7 +85,7 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded typename TInputImage::Pointer input = InputImageType::New(); input->Graft(const_cast(this->GetInput())); - typedef Digitizer DigitizerFunctorType; + typedef Digitizer DigitizerFunctorType; DigitizerFunctorType digitalizer(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramMinimum, m_HistogramMaximum); @@ -106,7 +106,7 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded filter->SetNumberOfThreads(this->GetNumberOfThreads()); filter->Update(); - m_DigitalizedInputImage = filter->GetOutput(); + m_DigitizedInputImage = filter->GetOutput(); } template @@ -114,7 +114,7 @@ void CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() { // Free internal image - this->m_DigitalizedInputImage = ITK_NULLPTR; + this->m_DigitizedInputImage = ITK_NULLPTR; } @@ -135,7 +135,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - boundaryFacesCalculator(this->m_DigitalizedInputImage, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(this->m_DigitizedInputImage, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); @@ -166,7 +166,7 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalizedInputImage, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitizedInputImage, *fit); typedef itk::ImageRegionIterator IteratorType; IteratorType outputIt(outputPtr, *fit); @@ -433,7 +433,7 @@ CoocurrenceTextureFeaturesImageFilter::PrintSelf(std: Superclass::PrintSelf(os, indent); - itkPrintSelfObjectMacro(DigitalizedInputImage); + itkPrintSelfObjectMacro(DigitizedInputImage); os << indent << "NeighborhoodRadius: " << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 4f5213486b4..a7fbce106de 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -255,7 +255,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm UpdateOutputInformation() ITK_OVERRIDE; private: - typename InputImageType::Pointer m_DigitalizedInputImage; + typename InputImageType::Pointer m_DigitizedInputImage; NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; unsigned int m_NumberOfBinsPerAxis; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index c521d0aea4e..f15712afd36 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -82,12 +82,12 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe { typename TInputImage::Pointer maskPointer = TInputImage::New(); maskPointer = const_cast(this->GetMaskImage()); - this->m_DigitalizedInputImage = InputImageType::New(); - this->m_DigitalizedInputImage->SetRegions(this->GetInput()->GetRequestedRegion()); - this->m_DigitalizedInputImage->CopyInformation(this->GetInput()); - this->m_DigitalizedInputImage->Allocate(); + this->m_DigitizedInputImage = InputImageType::New(); + this->m_DigitizedInputImage->SetRegions(this->GetInput()->GetRequestedRegion()); + this->m_DigitizedInputImage->CopyInformation(this->GetInput()); + this->m_DigitizedInputImage->Allocate(); typedef itk::ImageRegionIterator IteratorType; - IteratorType digitIt(this->m_DigitalizedInputImage, this->m_DigitalizedInputImage->GetLargestPossibleRegion()); + IteratorType digitIt(this->m_DigitizedInputImage, this->m_DigitalizedInputImage->GetLargestPossibleRegion()); typedef itk::ImageRegionConstIterator ConstIteratorType; ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); unsigned int binNumber; @@ -129,7 +129,7 @@ void RunLengthTextureFeaturesImageFilter::AfterThreadedGenerateData() { // free internal image - this->m_DigitalizedInputImage = ITK_NULLPTR; + this->m_DigitizedInputImage = ITK_NULLPTR; } @@ -164,14 +164,14 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } boolRegion.SetIndex(boolStart); boolRegion.SetSize(boolSize); - alreadyVisitedImage->CopyInformation(this->m_DigitalizedInputImage); + alreadyVisitedImage->CopyInformation(this->m_DigitizedInputImage); alreadyVisitedImage->SetRegions(boolRegion); alreadyVisitedImage->Allocate(); // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = - boundaryFacesCalculator(this->m_DigitalizedInputImage, outputRegionForThread, m_NeighborhoodRadius); + boundaryFacesCalculator(this->m_DigitizedInputImage, outputRegionForThread, m_NeighborhoodRadius); typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); @@ -202,7 +202,7 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitalizedInputImage, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitizedInputImage, *fit); typedef itk::ImageRegionIterator IteratorType; IteratorType outputIt(outputPtr, *fit); @@ -469,7 +469,7 @@ RunLengthTextureFeaturesImageFilter::PrintSelf(std::o { Superclass::PrintSelf(os, indent); - itkPrintSelfObjectMacro(DigitalizedInputImage); + itkPrintSelfObjectMacro(DigitizedInputImage); os << indent << "NeighborhoodRadius: " << static_cast::PrintType>(m_NeighborhoodRadius) << std::endl; From 5f25e0f2bd0a1e34587ae979c86b0e33485b18b1 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 15:35:49 -0400 Subject: [PATCH 090/135] BUG: Use proper GenerateOutputInformation method to set vector length The GernerateOutputInformation method is the correct method to overrride when specifying image information and meta-data. Remove extraneous setting of the image's number of components. The filter will now throw an exception if the improper fixed number of components is set for the output image type. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../itkRunLengthTextureFeaturesImageFilter.h | 2 +- ...itkRunLengthTextureFeaturesImageFilter.hxx | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index a8bfe442014..7c7c077524e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -233,7 +233,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo GenerateOutputInformation() ITK_OVERRIDE; private: - typename DigitizedImageType::Pointer m_DigitalizedInputImage; + typename DigitizedImageType::Pointer m_DigitizedInputImage; NeighborhoodRadiusType m_NeighborhoodRadius; OffsetVectorPointer m_Offsets; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index a7fbce106de..e9c294f7c19 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -252,7 +252,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm virtual void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; virtual void - UpdateOutputInformation() ITK_OVERRIDE; + GenerateOutputInformation() ITK_OVERRIDE; private: typename InputImageType::Pointer m_DigitizedInputImage; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index f15712afd36..e27a570ad68 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -87,7 +87,7 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe this->m_DigitizedInputImage->CopyInformation(this->GetInput()); this->m_DigitizedInputImage->Allocate(); typedef itk::ImageRegionIterator IteratorType; - IteratorType digitIt(this->m_DigitizedInputImage, this->m_DigitalizedInputImage->GetLargestPossibleRegion()); + IteratorType digitIt(this->m_DigitizedInputImage, this->m_DigitizedInputImage->GetLargestPossibleRegion()); typedef itk::ImageRegionConstIterator ConstIteratorType; ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); unsigned int binNumber; @@ -304,15 +304,18 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate template void -RunLengthTextureFeaturesImageFilter::UpdateOutputInformation() +RunLengthTextureFeaturesImageFilter::GenerateOutputInformation() { - // Call superclass's version - Superclass::UpdateOutputInformation(); - - if (strcmp(this->GetOutput()->GetNameOfClass(), "VectorImage") == 0) + Superclass::GenerateOutputInformation(); + + OutputImageType * output = this->GetOutput(); + // If the output image type is a VectorImage the number of + // components will be properly sized if before allocation, if the + // output is a fixed width vector and the wrong number of + // components, then an exception will be thrown. + if (output->GetNumberOfComponentsPerPixel() != 10) { - typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; - AccessorFunctorType::SetVectorLength(this->GetOutput(), 10); + output->SetNumberOfComponentsPerPixel(10); } } From d0205c42d6535ac515efdf5c9377c5bb149229d6 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 16:41:16 -0400 Subject: [PATCH 091/135] ENH: Use BinaryFunctor for "digitializing" input image Use a threaded filter to perform digitizing and masking of the input image into histograms bins. Reuse the Digitizer functor. --- .../itkRunLengthTextureFeaturesImageFilter.h | 2 + ...itkRunLengthTextureFeaturesImageFilter.hxx | 64 ++++++++----------- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index e9c294f7c19..069412b6dee 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -113,6 +113,8 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; + typedef TInputImage MaskImageType; + typedef TInputImage DigitizedImageType; typedef typename InputImageType::PixelType PixelType; typedef typename InputImageType::IndexType IndexType; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index e27a570ad68..e8e054ced7b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -21,6 +21,8 @@ #include "itkRunLengthTextureFeaturesImageFilter.h" #include "itkRegionOfInterestImageFilter.h" #include "itkNeighborhoodAlgorithm.h" +#include "itkBinaryFunctorImageFilter.h" +#include "itkDigitizerFunctor.h" namespace itk { @@ -80,47 +82,35 @@ template void RunLengthTextureFeaturesImageFilter::BeforeThreadedGenerateData() { - typename TInputImage::Pointer maskPointer = TInputImage::New(); - maskPointer = const_cast(this->GetMaskImage()); - this->m_DigitizedInputImage = InputImageType::New(); - this->m_DigitizedInputImage->SetRegions(this->GetInput()->GetRequestedRegion()); - this->m_DigitizedInputImage->CopyInformation(this->GetInput()); - this->m_DigitizedInputImage->Allocate(); - typedef itk::ImageRegionIterator IteratorType; - IteratorType digitIt(this->m_DigitizedInputImage, this->m_DigitizedInputImage->GetLargestPossibleRegion()); - typedef itk::ImageRegionConstIterator ConstIteratorType; - ConstIteratorType inputIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion()); - unsigned int binNumber; - while (!inputIt.IsAtEnd()) + + typename TInputImage::Pointer input = InputImageType::New(); + input->Graft(const_cast(this->GetInput())); + + typedef Digitizer DigitizerFunctorType; + + DigitizerFunctorType digitalizer( + m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramValueMinimum, m_HistogramValueMaximum); + + typedef BinaryFunctorImageFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); + if (this->GetMaskImage() != ITK_NULLPTR) { - if (maskPointer && maskPointer->GetPixel(inputIt.GetIndex()) != this->m_InsidePixelValue) - { - digitIt.Set(-10); - } - else if (inputIt.Get() < this->m_HistogramValueMinimum || inputIt.Get() >= this->m_HistogramValueMinimum) - { - digitIt.Set(-1); - } - else - { - binNumber = (inputIt.Get() - m_HistogramValueMinimum) / - ((m_HistogramValueMaximum - m_HistogramValueMinimum) / (float)m_NumberOfBinsPerAxis); - digitIt.Set(binNumber); - } - ++inputIt; - ++digitIt; + typename TInputImage::Pointer mask = MaskImageType::New(); + mask->Graft(const_cast(this->GetMaskImage())); + filter->SetInput1(mask); } - m_Spacing = this->GetInput()->GetSpacing(); - - // Support VectorImages by setting the number of components on the output. - typename TOutputImage::Pointer outputPtr = TOutputImage::New(); - outputPtr = this->GetOutput(); - if (strcmp(outputPtr->GetNameOfClass(), "VectorImage") == 0) + else { - typedef typename TOutputImage::AccessorFunctorType AccessorFunctorType; - AccessorFunctorType::SetVectorLength(outputPtr, 10); + filter->SetConstant1(m_InsidePixelValue); } - outputPtr->Allocate(); + filter->SetInput2(input); + filter->SetFunctor(digitalizer); + filter->SetNumberOfThreads(this->GetNumberOfThreads()); + + filter->Update(); + m_DigitizedInputImage = filter->GetOutput(); + + m_Spacing = this->GetInput()->GetSpacing(); } From 3672d60b1fabe9a9b0c7eda95433d3afdae8607f Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Thu, 7 Sep 2017 16:59:51 -0400 Subject: [PATCH 092/135] ENH: use vnl_matrix over nested array allocation The single allocation should provide coherent memory allocation add improve efficiency with coherent memory access. Using the vnl_matrix over a raw arrays enable the class to automatically free the memory and follows resource acquisition is initialization (RAII) best practices. --- .../itkRunLengthTextureFeaturesImageFilter.h | 12 ++++---- ...itkRunLengthTextureFeaturesImageFilter.hxx | 30 +++++++------------ 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 069412b6dee..a9ed25df078 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -234,13 +234,13 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm bool IsInsideNeighborhood(const OffsetType & iteratedOffset); void - IncreaseHistogram(unsigned int ** hist, - unsigned int & totalNumberOfRuns, - const PixelType & currentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance); + IncreaseHistogram(vnl_matrix & hist, + unsigned int & totalNumberOfRuns, + const PixelType & currentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance); void - ComputeFeatures(unsigned int ** hist, + ComputeFeatures(vnl_matrix & hist, const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel); virtual void diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index e8e054ced7b..2626ed4fb03 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -171,13 +171,11 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate typename OffsetVector::ConstIterator offsets; // Declaration of the variables useful to iterate over the all the offsets - OffsetType offset; - unsigned int totalNumberOfRuns; - unsigned int ** histogram = new unsigned int *[m_NumberOfBinsPerAxis]; - for (unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis) - { - histogram[axis] = new unsigned int[m_NumberOfBinsPerAxis]; - } + OffsetType offset; + unsigned int totalNumberOfRuns; + + vnl_matrix histogram(m_NumberOfBinsPerAxis, m_NumberOfBinsPerAxis); + // Declaration of the variables useful to iterate over the all neighborhood region PixelType currentInNeighborhoodPixelIntensity; @@ -284,12 +282,6 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate ++outputIt; } } - - for (unsigned int axis = 0; axis < m_NumberOfBinsPerAxis; ++axis) - { - delete[] histogram[axis]; - } - delete[] histogram; } template @@ -352,11 +344,11 @@ RunLengthTextureFeaturesImageFilter::IsInsideNeighbor template void RunLengthTextureFeaturesImageFilter::IncreaseHistogram( - unsigned int ** histogram, - unsigned int & totalNumberOfRuns, - const PixelType & currentInNeighborhoodPixelIntensity, - const OffsetType & offset, - const unsigned int & pixelDistance) + vnl_matrix & histogram, + unsigned int & totalNumberOfRuns, + const PixelType & currentInNeighborhoodPixelIntensity, + const OffsetType & offset, + const unsigned int & pixelDistance) { float offsetDistance = 0; for (unsigned int i = 0; i < offset.GetOffsetDimension(); ++i) @@ -377,7 +369,7 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra template void RunLengthTextureFeaturesImageFilter::ComputeFeatures( - unsigned int ** histogram, + vnl_matrix & histogram, const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel) { From a95c5bb64bd264451f771a86f6eaa89cf277b4f0 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Tue, 12 Sep 2017 15:10:08 -0400 Subject: [PATCH 093/135] ENH: Add template parameter to specify the mask image type Add 3rd template argument to the CoocurrenceTextureFeaturesImageFilter and the RunLengthTextureFeaturesImageFilter to allow the specification of the Mask image type. Because the mask image essentially contains boolean values using an unsigned byte type, maybe more memory efficient if the primary input image is a larger pixel type. Also it is sometime a convention to only use unsigned byte pixel for mask images. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 14 ++--- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 47 ++++++++-------- .../itkRunLengthTextureFeaturesImageFilter.h | 15 +++--- ...itkRunLengthTextureFeaturesImageFilter.hxx | 53 ++++++++++--------- ...reFeaturesImageFilterInstantiationTest.cxx | 10 ++-- ...reFeaturesImageFilterInstantiationTest.cxx | 10 ++-- 6 files changed, 81 insertions(+), 68 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 7c7c077524e..bb5377db409 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -82,7 +82,7 @@ namespace Statistics * \ingroup TextureFeatures **/ -template +template class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageToImageFilter { public: @@ -100,7 +100,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; - typedef TInputImage MaskImageType; + typedef TMaskImage MaskImageType; typedef TInputImage DigitizedImageType; typedef typename InputImageType::PixelType PixelType; @@ -128,10 +128,10 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); /** Method to set the mask image */ - itkSetInputMacro(MaskImage, InputImageType); + itkSetInputMacro(MaskImage, MaskImageType); /** Method to get the mask image */ - itkGetInputMacro(MaskImage, InputImageType); + itkGetInputMacro(MaskImage, MaskImageType); /** Specify the default number of bins per axis */ @@ -183,8 +183,8 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo * Set the pixel value of the mask that should be considered "inside" the * object. Defaults to 1. */ - itkSetMacro(InsidePixelValue, PixelType); - itkGetConstMacro(InsidePixelValue, PixelType); + itkSetMacro(InsidePixelValue, MaskPixelType); + itkGetConstMacro(InsidePixelValue, MaskPixelType); /** Set the calculator to normalize the histogram (divide all bins by the total frequency). Normalization is off by default. */ @@ -240,7 +240,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo unsigned int m_NumberOfBinsPerAxis; PixelType m_HistogramMinimum; PixelType m_HistogramMaximum; - PixelType m_InsidePixelValue; + MaskPixelType m_InsidePixelValue; bool m_Normalize; }; } // end of namespace Statistics diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 1badf258405..a13a044f8ab 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -28,12 +28,12 @@ namespace itk { namespace Statistics { -template -CoocurrenceTextureFeaturesImageFilter::CoocurrenceTextureFeaturesImageFilter() +template +CoocurrenceTextureFeaturesImageFilter::CoocurrenceTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_HistogramMinimum(NumericTraits::NonpositiveMin()) , m_HistogramMaximum(NumericTraits::max()) - , m_InsidePixelValue(NumericTraits::OneValue()) + , m_InsidePixelValue(NumericTraits::OneValue()) { this->SetNumberOfRequiredInputs(1); this->SetNumberOfRequiredOutputs(1); @@ -68,18 +68,18 @@ CoocurrenceTextureFeaturesImageFilter::CoocurrenceTex this->m_Normalize = false; } -template +template void -CoocurrenceTextureFeaturesImageFilter::SetOffset(const OffsetType offset) +CoocurrenceTextureFeaturesImageFilter::SetOffset(const OffsetType offset) { OffsetVectorPointer offsetVector = OffsetVector::New(); offsetVector->push_back(offset); this->SetOffsets(offsetVector); } -template +template void -CoocurrenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() +CoocurrenceTextureFeaturesImageFilter::BeforeThreadedGenerateData() { typename TInputImage::Pointer input = InputImageType::New(); @@ -93,8 +93,8 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != ITK_NULLPTR) { - typename TInputImage::Pointer mask = MaskImageType::New(); - mask->Graft(const_cast(this->GetMaskImage())); + typename TMaskImage::Pointer mask = MaskImageType::New(); + mask->Graft(const_cast(this->GetMaskImage())); filter->SetInput1(mask); } else @@ -109,18 +109,18 @@ CoocurrenceTextureFeaturesImageFilter::BeforeThreaded m_DigitizedInputImage = filter->GetOutput(); } -template +template void -CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() +CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() { // Free internal image this->m_DigitizedInputImage = ITK_NULLPTR; } -template +template void -CoocurrenceTextureFeaturesImageFilter::ThreadedGenerateData( +CoocurrenceTextureFeaturesImageFilter::ThreadedGenerateData( const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { @@ -241,9 +241,9 @@ CoocurrenceTextureFeaturesImageFilter::ThreadedGenera } } -template +template void -CoocurrenceTextureFeaturesImageFilter::GenerateOutputInformation() +CoocurrenceTextureFeaturesImageFilter::GenerateOutputInformation() { // Call superclass's version Superclass::GenerateOutputInformation(); @@ -259,9 +259,9 @@ CoocurrenceTextureFeaturesImageFilter::GenerateOutput } } -template +template bool -CoocurrenceTextureFeaturesImageFilter::IsInsideNeighborhood( +CoocurrenceTextureFeaturesImageFilter::IsInsideNeighborhood( const OffsetType & iteratedOffset) { bool insideNeighborhood = true; @@ -277,9 +277,9 @@ CoocurrenceTextureFeaturesImageFilter::IsInsideNeighb return insideNeighborhood; } -template +template void -CoocurrenceTextureFeaturesImageFilter::ComputeFeatures( +CoocurrenceTextureFeaturesImageFilter::ComputeFeatures( const vnl_matrix & hist, const unsigned int totalNumberOfFreq, typename TOutputImage::PixelType & outputPixel) @@ -350,9 +350,9 @@ CoocurrenceTextureFeaturesImageFilter::ComputeFeature outputPixel[7] = haralickCorrelation; } -template +template void -CoocurrenceTextureFeaturesImageFilter::ComputeMeansAndVariances( +CoocurrenceTextureFeaturesImageFilter::ComputeMeansAndVariances( const vnl_matrix & hist, const unsigned int totalNumberOfFreq, double & pixelMean, @@ -426,9 +426,10 @@ CoocurrenceTextureFeaturesImageFilter::ComputeMeansAn delete[] marginalSums; } -template +template void -CoocurrenceTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +CoocurrenceTextureFeaturesImageFilter::PrintSelf(std::ostream & os, + Indent indent) const { Superclass::PrintSelf(os, indent); diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index a9ed25df078..a457aed023a 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -95,7 +95,7 @@ namespace Statistics * \ingroup TextureFeatures */ -template +template class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToImageFilter { public: @@ -113,10 +113,11 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; - typedef TInputImage MaskImageType; + typedef TMaskImage MaskImageType; typedef TInputImage DigitizedImageType; typedef typename InputImageType::PixelType PixelType; + typedef typename MaskImageType::PixelType MaskPixelType; typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::PointType PointType; @@ -140,10 +141,10 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm itkGetConstMacro(NeighborhoodRadius, NeighborhoodRadiusType); /** Method to set the mask image */ - itkSetInputMacro(MaskImage, InputImageType); + itkSetInputMacro(MaskImage, MaskImageType); /** Method to get the mask image */ - itkGetInputMacro(MaskImage, InputImageType); + itkGetInputMacro(MaskImage, MaskImageType); /** Specify the default number of bins per axis */ @@ -212,8 +213,8 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm * Set the pixel value of the mask that should be considered "inside" the * object. Defaults to 1. */ - itkSetMacro(InsidePixelValue, PixelType); - itkGetConstMacro(InsidePixelValue, PixelType); + itkSetMacro(InsidePixelValue, MaskPixelType); + itkGetConstMacro(InsidePixelValue, MaskPixelType); typedef typename OutputImageType::PixelType OutputPixelType; typedef typename NumericTraits::ScalarRealType OutputRealType; @@ -265,7 +266,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm PixelType m_HistogramValueMaximum; RealType m_HistogramDistanceMinimum; RealType m_HistogramDistanceMaximum; - PixelType m_InsidePixelValue; + MaskPixelType m_InsidePixelValue; typename TInputImage::SpacingType m_Spacing; }; } // end of namespace Statistics diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 2626ed4fb03..479c7509949 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -28,14 +28,14 @@ namespace itk { namespace Statistics { -template -RunLengthTextureFeaturesImageFilter::RunLengthTextureFeaturesImageFilter() +template +RunLengthTextureFeaturesImageFilter::RunLengthTextureFeaturesImageFilter() : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) , m_HistogramValueMinimum(NumericTraits::NonpositiveMin()) , m_HistogramValueMaximum(NumericTraits::max()) , m_HistogramDistanceMinimum(NumericTraits::ZeroValue()) , m_HistogramDistanceMaximum(NumericTraits::max()) - , m_InsidePixelValue(NumericTraits::OneValue()) + , m_InsidePixelValue(NumericTraits::OneValue()) , m_Spacing(1.0) { this->SetNumberOfRequiredInputs(1); @@ -69,18 +69,18 @@ RunLengthTextureFeaturesImageFilter::RunLengthTexture this->m_NeighborhoodRadius = nhood.GetRadius(); } -template +template void -RunLengthTextureFeaturesImageFilter::SetOffset(const OffsetType offset) +RunLengthTextureFeaturesImageFilter::SetOffset(const OffsetType offset) { OffsetVectorPointer offsetVector = OffsetVector::New(); offsetVector->push_back(offset); this->SetOffsets(offsetVector); } -template +template void -RunLengthTextureFeaturesImageFilter::BeforeThreadedGenerateData() +RunLengthTextureFeaturesImageFilter::BeforeThreadedGenerateData() { typename TInputImage::Pointer input = InputImageType::New(); @@ -95,8 +95,8 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != ITK_NULLPTR) { - typename TInputImage::Pointer mask = MaskImageType::New(); - mask->Graft(const_cast(this->GetMaskImage())); + typename TMaskImage::Pointer mask = MaskImageType::New(); + mask->Graft(const_cast(this->GetMaskImage())); filter->SetInput1(mask); } else @@ -114,18 +114,18 @@ RunLengthTextureFeaturesImageFilter::BeforeThreadedGe } -template +template void -RunLengthTextureFeaturesImageFilter::AfterThreadedGenerateData() +RunLengthTextureFeaturesImageFilter::AfterThreadedGenerateData() { // free internal image this->m_DigitizedInputImage = ITK_NULLPTR; } -template +template void -RunLengthTextureFeaturesImageFilter::ThreadedGenerateData( +RunLengthTextureFeaturesImageFilter::ThreadedGenerateData( const OutputRegionType & outputRegionForThread, ThreadIdType threadId) { @@ -284,9 +284,9 @@ RunLengthTextureFeaturesImageFilter::ThreadedGenerate } } -template +template void -RunLengthTextureFeaturesImageFilter::GenerateOutputInformation() +RunLengthTextureFeaturesImageFilter::GenerateOutputInformation() { Superclass::GenerateOutputInformation(); @@ -301,9 +301,10 @@ RunLengthTextureFeaturesImageFilter::GenerateOutputIn } } -template +template void -RunLengthTextureFeaturesImageFilter::NormalizeOffsetDirection(OffsetType & offset) +RunLengthTextureFeaturesImageFilter::NormalizeOffsetDirection( + OffsetType & offset) { itkDebugMacro("old offset = " << offset << std::endl); int sign = 1; @@ -324,9 +325,10 @@ RunLengthTextureFeaturesImageFilter::NormalizeOffsetD itkDebugMacro("new offset = " << offset << std::endl); } -template +template bool -RunLengthTextureFeaturesImageFilter::IsInsideNeighborhood(const OffsetType & iteratedOffset) +RunLengthTextureFeaturesImageFilter::IsInsideNeighborhood( + const OffsetType & iteratedOffset) { bool insideNeighborhood = true; for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) @@ -341,9 +343,9 @@ RunLengthTextureFeaturesImageFilter::IsInsideNeighbor return insideNeighborhood; } -template +template void -RunLengthTextureFeaturesImageFilter::IncreaseHistogram( +RunLengthTextureFeaturesImageFilter::IncreaseHistogram( vnl_matrix & histogram, unsigned int & totalNumberOfRuns, const PixelType & currentInNeighborhoodPixelIntensity, @@ -366,9 +368,9 @@ RunLengthTextureFeaturesImageFilter::IncreaseHistogra } } -template +template void -RunLengthTextureFeaturesImageFilter::ComputeFeatures( +RunLengthTextureFeaturesImageFilter::ComputeFeatures( vnl_matrix & histogram, const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel) @@ -448,9 +450,10 @@ RunLengthTextureFeaturesImageFilter::ComputeFeatures( outputPixel[9] = longRunHighGreyLevelEmphasis; } -template +template void -RunLengthTextureFeaturesImageFilter::PrintSelf(std::ostream & os, Indent indent) const +RunLengthTextureFeaturesImageFilter::PrintSelf(std::ostream & os, + Indent indent) const { Superclass::PrintSelf(os, indent); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index cd9a1ed0ece..c0aabc06051 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -38,12 +38,15 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) // Declare types typedef int InputPixelType; + typedef unsigned char MaskPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; typedef itk::Image InputImageType; + typedef itk::Image MaskImageType; typedef itk::Image OutputImageType; typedef itk::ImageFileReader ReaderType; + typedef itk::ImageFileReader MaskReaderType; typedef itk::Neighborhood NeighborhoodType; @@ -53,11 +56,12 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) reader->SetFileName(argv[1]); // Create and set up a maskReader - ReaderType::Pointer maskReader = ReaderType::New(); + MaskReaderType::Pointer maskReader = MaskReaderType::New(); maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); @@ -86,7 +90,7 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); - FilterType::PixelType insidePixelValue = 0; + FilterType::MaskPixelType insidePixelValue = 0; filter->SetInsidePixelValue(insidePixelValue); TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index 82cc23892ca..b5b85f294af 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -38,12 +38,15 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) // Declare types typedef int InputPixelType; + typedef unsigned char MaskPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; typedef itk::Image InputImageType; + typedef itk::Image MaskImageType; typedef itk::Image OutputImageType; typedef itk::ImageFileReader ReaderType; + typedef itk::ImageFileReader MaskReaderType; typedef itk::Neighborhood NeighborhoodType; @@ -52,11 +55,12 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) reader->SetFileName(argv[1]); // Create and set up a maskReader - ReaderType::Pointer maskReader = ReaderType::New(); + MaskReaderType::Pointer maskReader = MaskReaderType::New(); maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); @@ -92,7 +96,7 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); - FilterType::PixelType insidePixelValue = 0; + FilterType::MaskPixelType insidePixelValue = 0; filter->SetInsidePixelValue(insidePixelValue); TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); From e7ccb05eb5198ff5c62066839ba17d3c461eb3b6 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Wed, 13 Sep 2017 10:00:50 -0400 Subject: [PATCH 094/135] ENH: Change default mask template type to be of unsigned char pixel type --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 4 +++- .../include/itkRunLengthTextureFeaturesImageFilter.h | 4 +++- ...CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx | 3 +-- .../test/CoocurrenceTextureFeaturesImageFilterTest.cxx | 3 ++- ...currenceTextureFeaturesImageFilterTestSeparateFeatures.cxx | 3 ++- ...tureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 3 ++- ...ocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx | 3 ++- .../RunLengthTextureFeaturesImageFilterInstantiationTest.cxx | 3 +-- .../test/RunLengthTextureFeaturesImageFilterTest.cxx | 3 ++- ...unLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx | 3 ++- ...tureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 3 ++- ...RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx | 3 ++- 12 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index bb5377db409..b2568daf806 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -82,7 +82,9 @@ namespace Statistics * \ingroup TextureFeatures **/ -template +template > class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageToImageFilter { public: diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index a457aed023a..c98071d3c52 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -95,7 +95,9 @@ namespace Statistics * \ingroup TextureFeatures */ -template +template > class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToImageFilter { public: diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index c0aabc06051..64548dad736 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -60,8 +60,7 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter - FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index eb934bdc4a6..fbb497d0c94 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -57,7 +57,8 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 8e8be218350..50547f7cecf 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -64,7 +64,8 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 975c9729785..d9dd8841912 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -64,7 +64,8 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 3e5305eb8b1..fd4029e3808 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -60,7 +60,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index b5b85f294af..a1e47a8a357 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -59,8 +59,7 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter - FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 4753a9335d6..2540a615a21 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -64,7 +64,8 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index 8564676d73f..83c8c0d52ea 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -66,7 +66,8 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index c8d8526b89c..9f7c4cc30a8 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -67,7 +67,8 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index d8b1b781fae..6c9d1312642 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -62,7 +62,8 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + typedef itk::Statistics::RunLengthTextureFeaturesImageFilter + FilterType; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); From 74a19fcb3df1883f767a31a240cc84ff0b2658c3 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 18 Sep 2017 11:36:48 -0400 Subject: [PATCH 095/135] BUG: Remove duplicate wrapping of itk::ImageIOBase --- .../wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap | 2 -- .../wrapping/itkRunLengthTextureFeaturesImageFilter.wrap | 2 -- 2 files changed, 4 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap index 6ca8222e22d..9c8fe762d54 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap @@ -35,8 +35,6 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() -itk_wrap_simple_class("itk::ImageIOBase" ) - itk_wrap_class("itk::ImageFileReader" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap index 86a77048287..9a653c69dbb 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap @@ -35,8 +35,6 @@ foreach(d ${ITK_WRAP_IMAGE_DIMS}) endforeach() itk_end_wrap_class() -itk_wrap_simple_class("itk::ImageIOBase") - itk_wrap_class("itk::ImageFileReader" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) itk_wrap_template("IV${ITKM_F}${OutputVectorDim}${d}" From b494fbd1d370b40f0af73ebea9f2f853befcc3b8 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Mon, 18 Sep 2017 11:38:09 -0400 Subject: [PATCH 096/135] COMP: Add missing NumericTraits header to itkDigitizerFunctor Addresses: /home/matt/src/ITKTextureFeatures/include/itkDigitizerFunctor.h:36:13: error: use of undeclared identifier 'NumericTraits' m_Min(NumericTraits::min()), --- Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index 18665e39334..56d3d7154f7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -18,6 +18,8 @@ #ifndef itkDigitizerFunctor_h #define itkDigitizerFunctor_h +#include "itkNumericTraits.h" + namespace itk { namespace Statistics From f417f21b0f58688b13996b1fdde61a88b6029686 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Tue, 24 Oct 2017 09:26:29 -0400 Subject: [PATCH 097/135] ENH: Allowing the usage of float as input image --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 12 ++++--- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 14 ++++---- .../include/itkDigitizerFunctor.h | 2 +- .../itkRunLengthTextureFeaturesImageFilter.h | 33 ++++++++++--------- ...itkRunLengthTextureFeaturesImageFilter.hxx | 22 ++++++------- ...currenceTextureFeaturesImageFilterTest.cxx | 2 +- ...eFilterTestVectorImageSeparateFeatures.cxx | 2 +- ...tureFeaturesImageFilterTestWithoutMask.cxx | 2 +- ...unLengthTextureFeaturesImageFilterTest.cxx | 2 +- ...eaturesImageFilterTestSeparateFeatures.cxx | 2 +- ...tureFeaturesImageFilterTestWithoutMask.cxx | 2 +- ...CoocurrenceTextureFeaturesImageFilter.wrap | 4 +-- ...tkRunLengthTextureFeaturesImageFilter.wrap | 4 +-- 13 files changed, 53 insertions(+), 50 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index b2568daf806..958c33d93b3 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -103,13 +103,16 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; typedef TMaskImage MaskImageType; - typedef TInputImage DigitizedImageType; typedef typename InputImageType::PixelType PixelType; typedef typename MaskImageType::PixelType MaskPixelType; typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::PointType PointType; + + typedef int HistogramIndexType; + typedef itk::Image DigitizedImageType; + typedef typename InputImageType::OffsetType OffsetType; typedef VectorContainer OffsetVector; typedef typename OffsetVector::Pointer OffsetVectorPointer; @@ -118,9 +121,9 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef typename InputImageType::RegionType InputRegionType; typedef typename OutputImageType::RegionType OutputRegionType; - typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; - typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; + typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; + typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; typedef typename NumericTraits::RealType MeasurementType; typedef typename NumericTraits::RealType RealType; @@ -199,7 +202,6 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking - itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); // End concept checking #endif diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index a13a044f8ab..1a92d618fd3 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -89,7 +89,7 @@ CoocurrenceTextureFeaturesImageFilter::Be DigitizerFunctorType digitalizer(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramMinimum, m_HistogramMaximum); - typedef BinaryFunctorImageFilter FilterType; + typedef BinaryFunctorImageFilter FilterType; typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != ITK_NULLPTR) { @@ -133,10 +133,10 @@ CoocurrenceTextureFeaturesImageFilter::Th typename TOutputImage::PixelType outputPixel; // Separation of the non-boundary region that will be processed in a different way - NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; - typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = + NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = boundaryFacesCalculator(this->m_DigitizedInputImage, outputRegionForThread, m_NeighborhoodRadius); - typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); // Declaration of the variables useful to iterate over the all image region @@ -157,11 +157,11 @@ CoocurrenceTextureFeaturesImageFilter::Th vnl_matrix hist(m_NumberOfBinsPerAxis, m_NumberOfBinsPerAxis); // Declaration of the variables useful to iterate over the all neighborhood region - PixelType currentInNeighborhoodPixelIntensity; + HistogramIndexType currentInNeighborhoodPixelIntensity; // Declaration of the variables useful to iterate over the run - PixelType pixelIntensity(NumericTraits::ZeroValue()); - OffsetType tempOffset; + HistogramIndexType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType tempOffset; /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index 56d3d7154f7..c888e04bb88 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -75,7 +75,7 @@ class Digitizer } else { - return ((inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis)); + return Math::Floor((inputPixel - m_Min) / ((m_Max - m_Min) / (float)m_NumberOfBinsPerAxis)); } } diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index c98071d3c52..7a64dc50027 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -116,13 +116,15 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef TInputImage InputImageType; typedef TOutputImage OutputImageType; typedef TMaskImage MaskImageType; - typedef TInputImage DigitizedImageType; typedef typename InputImageType::PixelType PixelType; typedef typename MaskImageType::PixelType MaskPixelType; typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::PointType PointType; + typedef int HistogramIndexType; + typedef itk::Image DigitizedImageType; + typedef typename InputImageType::OffsetType OffsetType; typedef VectorContainer OffsetVector; typedef typename OffsetVector::Pointer OffsetVectorPointer; @@ -131,9 +133,9 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef typename InputImageType::RegionType InputRegionType; typedef typename OutputImageType::RegionType OutputRegionType; - typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; - typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; + typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; + typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; typedef typename NumericTraits::RealType MeasurementType; typedef typename NumericTraits::RealType RealType; @@ -223,7 +225,6 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking - itkConceptMacro(InputPixelTypeCheck, (Concept::IsInteger)); itkConceptMacro(OutputPixelTypeCheck, (Concept::IsFloatingPoint)); // End concept checking #endif @@ -239,7 +240,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm void IncreaseHistogram(vnl_matrix & hist, unsigned int & totalNumberOfRuns, - const PixelType & currentInNeighborhoodPixelIntensity, + const HistogramIndexType & currentInNeighborhoodPixelIntensity, const OffsetType & offset, const unsigned int & pixelDistance); void @@ -260,16 +261,16 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm GenerateOutputInformation() ITK_OVERRIDE; private: - typename InputImageType::Pointer m_DigitizedInputImage; - NeighborhoodRadiusType m_NeighborhoodRadius; - OffsetVectorPointer m_Offsets; - unsigned int m_NumberOfBinsPerAxis; - PixelType m_HistogramValueMinimum; - PixelType m_HistogramValueMaximum; - RealType m_HistogramDistanceMinimum; - RealType m_HistogramDistanceMaximum; - MaskPixelType m_InsidePixelValue; - typename TInputImage::SpacingType m_Spacing; + typename DigitizedImageType::Pointer m_DigitizedInputImage; + NeighborhoodRadiusType m_NeighborhoodRadius; + OffsetVectorPointer m_Offsets; + unsigned int m_NumberOfBinsPerAxis; + PixelType m_HistogramValueMinimum; + PixelType m_HistogramValueMaximum; + RealType m_HistogramDistanceMinimum; + RealType m_HistogramDistanceMaximum; + MaskPixelType m_InsidePixelValue; + typename TInputImage::SpacingType m_Spacing; }; } // end of namespace Statistics } // end of namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 479c7509949..ab17ea08d3d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -91,7 +91,7 @@ RunLengthTextureFeaturesImageFilter::Befo DigitizerFunctorType digitalizer( m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramValueMinimum, m_HistogramValueMaximum); - typedef BinaryFunctorImageFilter FilterType; + typedef BinaryFunctorImageFilter FilterType; typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != ITK_NULLPTR) { @@ -159,10 +159,10 @@ RunLengthTextureFeaturesImageFilter::Thre alreadyVisitedImage->Allocate(); // Separation of the non-boundary region that will be processed in a different way - NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; - typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = + NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = boundaryFacesCalculator(this->m_DigitizedInputImage, outputRegionForThread, m_NeighborhoodRadius); - typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = + typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = faceList.begin(); // Declaration of the variables useful to iterate over the all image region @@ -178,14 +178,14 @@ RunLengthTextureFeaturesImageFilter::Thre // Declaration of the variables useful to iterate over the all neighborhood region - PixelType currentInNeighborhoodPixelIntensity; + HistogramIndexType currentInNeighborhoodPixelIntensity; // Declaration of the variables useful to iterate over the run - PixelType pixelIntensity(NumericTraits::ZeroValue()); - OffsetType iteratedOffset; - OffsetType tempOffset; - unsigned int pixelDistance; - bool insideNeighborhood; + HistogramIndexType pixelIntensity(NumericTraits::ZeroValue()); + OffsetType iteratedOffset; + OffsetType tempOffset; + unsigned int pixelDistance; + bool insideNeighborhood; /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) @@ -348,7 +348,7 @@ void RunLengthTextureFeaturesImageFilter::IncreaseHistogram( vnl_matrix & histogram, unsigned int & totalNumberOfRuns, - const PixelType & currentInNeighborhoodPixelIntensity, + const HistogramIndexType & currentInNeighborhoodPixelIntensity, const OffsetType & offset, const unsigned int & pixelDistance) { diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index fbb497d0c94..f6d48275e49 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -39,7 +39,7 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) const unsigned int VectorComponentDimension = 8; // Declare types - typedef int InputPixelType; + typedef float InputPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index d9dd8841912..b1c72f78ad0 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -47,7 +47,7 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c const unsigned int VectorComponentDimension = 8; // Declare types - typedef int InputPixelType; + typedef float InputPixelType; typedef float OutputPixelType; typedef itk::Image InputImageType; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index d49792940f0..2b774b16835 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -43,7 +43,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) const unsigned int VectorComponentDimension = 8; // Declare types - typedef int InputPixelType; + typedef float InputPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 2540a615a21..e90710075fd 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -46,7 +46,7 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef int InputPixelType; + typedef float InputPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index 83c8c0d52ea..d15d3fb4b29 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -47,7 +47,7 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef int InputPixelType; + typedef float InputPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index 1bcd2efc5b5..6f28eea222f 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -45,7 +45,7 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef int InputPixelType; + typedef float InputPixelType; typedef float OutputPixelComponentType; typedef itk::Vector OutputPixelType; diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap index 9c8fe762d54..4089114db20 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap @@ -27,7 +27,7 @@ itk_end_wrap_class() itk_wrap_class("itk::ImageToImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) - foreach(t ${WRAP_ITK_INT}) + foreach(t ${WRAP_ITK_SCALAR}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" "${ITKT_I${t}${d}}, itk::Image,${d}>" ) @@ -53,7 +53,7 @@ itk_end_wrap_class() itk_wrap_class("itk::Statistics::CoocurrenceTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) - foreach(t ${WRAP_ITK_INT}) + foreach(t ${WRAP_ITK_SCALAR}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" "${ITKT_I${t}${d}}, itk::Image,${d}>" ) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap index 9a653c69dbb..bfed04fbc35 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap @@ -27,7 +27,7 @@ itk_end_wrap_class() itk_wrap_class("itk::ImageToImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) - foreach(t ${WRAP_ITK_INT}) + foreach(t ${WRAP_ITK_SCALAR}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" "${ITKT_I${t}${d}}, itk::Image,${d}>" ) @@ -53,7 +53,7 @@ itk_end_wrap_class() itk_wrap_class("itk::Statistics::RunLengthTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) - foreach(t ${WRAP_ITK_INT}) + foreach(t ${WRAP_ITK_SCALAR}) itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" "${ITKT_I${t}${d}}, itk::Image,${d}>" ) From 07b53a408aa13cb13456115a9e869d3b2ddfccc2 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste VIMORT Date: Mon, 30 Oct 2017 15:29:08 -0400 Subject: [PATCH 098/135] ENH: Modification of the internal typedef to protected for a better API backword compatibility --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 13 ++++++------- .../itkRunLengthTextureFeaturesImageFilter.h | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 958c33d93b3..3e95adf4626 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -109,10 +109,6 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::PointType PointType; - - typedef int HistogramIndexType; - typedef itk::Image DigitizedImageType; - typedef typename InputImageType::OffsetType OffsetType; typedef VectorContainer OffsetVector; typedef typename OffsetVector::Pointer OffsetVectorPointer; @@ -121,9 +117,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef typename InputImageType::RegionType InputRegionType; typedef typename OutputImageType::RegionType OutputRegionType; - typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; - typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + typedef typename itk::ConstNeighborhoodIterator::RadiusType NeighborhoodRadiusType; typedef typename NumericTraits::RealType MeasurementType; typedef typename NumericTraits::RealType RealType; @@ -207,6 +201,11 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo #endif protected: + typedef int HistogramIndexType; + typedef itk::Image DigitizedImageType; + typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; + typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + CoocurrenceTextureFeaturesImageFilter(); virtual ~CoocurrenceTextureFeaturesImageFilter() {} diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 7a64dc50027..607584578c4 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -122,9 +122,6 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::PointType PointType; - typedef int HistogramIndexType; - typedef itk::Image DigitizedImageType; - typedef typename InputImageType::OffsetType OffsetType; typedef VectorContainer OffsetVector; typedef typename OffsetVector::Pointer OffsetVectorPointer; @@ -133,9 +130,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef typename InputImageType::RegionType InputRegionType; typedef typename OutputImageType::RegionType OutputRegionType; - typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::RadiusType NeighborhoodRadiusType; - typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + typedef typename itk::ConstNeighborhoodIterator::RadiusType NeighborhoodRadiusType; typedef typename NumericTraits::RealType MeasurementType; typedef typename NumericTraits::RealType RealType; @@ -230,6 +225,11 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm #endif protected: + typedef int HistogramIndexType; + typedef itk::Image DigitizedImageType; + typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; + typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + RunLengthTextureFeaturesImageFilter(); virtual ~RunLengthTextureFeaturesImageFilter() {} From 5ca1d463387ffc5ed3a8780530dc22aa536b867f Mon Sep 17 00:00:00 2001 From: Francois Budin Date: Mon, 6 Nov 2017 21:35:53 -0500 Subject: [PATCH 099/135] BUG: Missing itkMath.h include Without this patch, the following error happens: include/itkDigitizerFunctor.h:79:16: error: use of undeclared identifier 'Math' return Math::Floor< TOutput >((inputPixel - m_Min)/((m_Max-m_Min)/ \ (float)m_NumberOfBinsPerAxis)); --- Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index c888e04bb88..e3dc35b9d5d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -19,6 +19,7 @@ #define itkDigitizerFunctor_h #include "itkNumericTraits.h" +#include "itkMath.h" namespace itk { From 181b8cf8f8b4263b936128d21166569c3532d68c Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 19:17:21 -0600 Subject: [PATCH 100/135] 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. --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 12 ++++++------ .../itkFirstOrderTextureFeaturesImageFilter.h | 4 ++-- .../include/itkRunLengthTextureFeaturesImageFilter.h | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 3e95adf4626..25c5abefdfb 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -207,7 +207,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; CoocurrenceTextureFeaturesImageFilter(); - virtual ~CoocurrenceTextureFeaturesImageFilter() {} + ~CoocurrenceTextureFeaturesImageFilter() ITK_OVERRIDE {} bool IsInsideNeighborhood(const OffsetType & iteratedOffset); @@ -222,17 +222,17 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo double & marginalMean, double & marginalDevSquared, double & pixelVariance); - virtual void + void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void + void AfterThreadedGenerateData() ITK_OVERRIDE; - virtual void + void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; - virtual void + void GenerateOutputInformation() ITK_OVERRIDE; private: diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 0205d220bea..3ce44106521 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -98,7 +98,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter FirstOrderTextureFeaturesImageFilter() {} void - GenerateOutputInformation() + GenerateOutputInformation() ITK_OVERRIDE { // this methods is overloaded so that if the output image is a // VectorImage then the correct number of components are set. @@ -117,7 +117,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter } - ~FirstOrderTextureFeaturesImageFilter() {} + ~FirstOrderTextureFeaturesImageFilter() ITK_OVERRIDE {} private: FirstOrderTextureFeaturesImageFilter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 607584578c4..d194ef0420e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -231,7 +231,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; RunLengthTextureFeaturesImageFilter(); - virtual ~RunLengthTextureFeaturesImageFilter() {} + ~RunLengthTextureFeaturesImageFilter() ITK_OVERRIDE {} void NormalizeOffsetDirection(OffsetType & offset); @@ -247,17 +247,17 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm ComputeFeatures(vnl_matrix & hist, const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel); - virtual void + void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void + void BeforeThreadedGenerateData() ITK_OVERRIDE; - virtual void + void AfterThreadedGenerateData() ITK_OVERRIDE; - virtual void + void ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; - virtual void + void GenerateOutputInformation() ITK_OVERRIDE; private: From c3bf76c1056d013a27d5133f127456860e34a636 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 19:36:27 -0600 Subject: [PATCH 101/135] 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" --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 12 ++++++------ .../itkFirstOrderTextureFeaturesImageFilter.h | 4 ++-- .../include/itkRunLengthTextureFeaturesImageFilter.h | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 25c5abefdfb..72a764243d1 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -207,7 +207,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; CoocurrenceTextureFeaturesImageFilter(); - ~CoocurrenceTextureFeaturesImageFilter() ITK_OVERRIDE {} + ~CoocurrenceTextureFeaturesImageFilter() override {} bool IsInsideNeighborhood(const OffsetType & iteratedOffset); @@ -223,17 +223,17 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo double & marginalDevSquared, double & pixelVariance); void - PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + PrintSelf(std::ostream & os, Indent indent) const override; /** This method causes the filter to generate its output. */ void - BeforeThreadedGenerateData() ITK_OVERRIDE; + BeforeThreadedGenerateData() override; void - AfterThreadedGenerateData() ITK_OVERRIDE; + AfterThreadedGenerateData() override; void - ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; + ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) override; void - GenerateOutputInformation() ITK_OVERRIDE; + GenerateOutputInformation() override; private: typename DigitizedImageType::Pointer m_DigitizedInputImage; diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 3ce44106521..f9f0d81e20e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -98,7 +98,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter FirstOrderTextureFeaturesImageFilter() {} void - GenerateOutputInformation() ITK_OVERRIDE + GenerateOutputInformation() override { // this methods is overloaded so that if the output image is a // VectorImage then the correct number of components are set. @@ -117,7 +117,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter } - ~FirstOrderTextureFeaturesImageFilter() ITK_OVERRIDE {} + ~FirstOrderTextureFeaturesImageFilter() override {} private: FirstOrderTextureFeaturesImageFilter(const Self &); // purposely not implemented diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index d194ef0420e..7d3b7cf414a 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -231,7 +231,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; RunLengthTextureFeaturesImageFilter(); - ~RunLengthTextureFeaturesImageFilter() ITK_OVERRIDE {} + ~RunLengthTextureFeaturesImageFilter() override {} void NormalizeOffsetDirection(OffsetType & offset); @@ -248,17 +248,17 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm const unsigned int & totalNumberOfRuns, typename TOutputImage::PixelType & outputPixel); void - PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + PrintSelf(std::ostream & os, Indent indent) const override; /** This method causes the filter to generate its output. */ void - BeforeThreadedGenerateData() ITK_OVERRIDE; + BeforeThreadedGenerateData() override; void - AfterThreadedGenerateData() ITK_OVERRIDE; + AfterThreadedGenerateData() override; void - ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE; + ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) override; void - GenerateOutputInformation() ITK_OVERRIDE; + GenerateOutputInformation() override; private: typename DigitizedImageType::Pointer m_DigitizedInputImage; From b86542c12ecfe1f97308b39cbadb0b822d618bc2 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 16 Dec 2017 20:10:45 -0600 Subject: [PATCH 102/135] COMP: Use C++11 nullptr directly git grep -l "ITK_NULLPTR" | fgrep -v itk_compiler_detection.h | fgrep -v CMakeLists.txt |fgrep -v .cmake | xargs sed -i '' -e "s/ITK_NULLPTR/nullptr/g" --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 4 ++-- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 1a92d618fd3..c9d7a737307 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -91,7 +91,7 @@ CoocurrenceTextureFeaturesImageFilter::Be typedef BinaryFunctorImageFilter FilterType; typename FilterType::Pointer filter = FilterType::New(); - if (this->GetMaskImage() != ITK_NULLPTR) + if (this->GetMaskImage() != nullptr) { typename TMaskImage::Pointer mask = MaskImageType::New(); mask->Graft(const_cast(this->GetMaskImage())); @@ -114,7 +114,7 @@ void CoocurrenceTextureFeaturesImageFilter::AfterThreadedGenerateData() { // Free internal image - this->m_DigitizedInputImage = ITK_NULLPTR; + this->m_DigitizedInputImage = nullptr; } diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index ab17ea08d3d..789f9f8e1d2 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -93,7 +93,7 @@ RunLengthTextureFeaturesImageFilter::Befo typedef BinaryFunctorImageFilter FilterType; typename FilterType::Pointer filter = FilterType::New(); - if (this->GetMaskImage() != ITK_NULLPTR) + if (this->GetMaskImage() != nullptr) { typename TMaskImage::Pointer mask = MaskImageType::New(); mask->Graft(const_cast(this->GetMaskImage())); @@ -119,7 +119,7 @@ void RunLengthTextureFeaturesImageFilter::AfterThreadedGenerateData() { // free internal image - this->m_DigitizedInputImage = ITK_NULLPTR; + this->m_DigitizedInputImage = nullptr; } From eb1150fb6972b152c5933c89a3c09f73e3dc0107 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 15:27:16 -0600 Subject: [PATCH 103/135] 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/itkCoocurrenceTextureFeaturesImageFilter.hxx | 5 ++--- .../include/itkFirstOrderTextureHistogram.h | 4 ++-- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 9 ++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index c9d7a737307..143c3306b1e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -136,8 +136,7 @@ CoocurrenceTextureFeaturesImageFilter::Th NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = boundaryFacesCalculator(this->m_DigitizedInputImage, outputRegionForThread, m_NeighborhoodRadius); - typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = - faceList.begin(); + auto fit = faceList.begin(); // Declaration of the variables useful to iterate over the all image region bool isInImage; @@ -365,7 +364,7 @@ CoocurrenceTextureFeaturesImageFilter::Co // cleverly compressed to one pass, but it's not clear that that's necessary. // Initialize everything - double * marginalSums = new double[m_NumberOfBinsPerAxis]; + auto * marginalSums = new double[m_NumberOfBinsPerAxis]; for (double * ms_It = marginalSums; ms_It < marginalSums + m_NumberOfBinsPerAxis; ms_It++) { diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index 73c96df71cf..7ff8e273859 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -54,7 +54,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram { // insert new item if one doesn't exist - typename MapType::iterator it = m_Map.find(p); + auto it = m_Map.find(p); assert(it != m_Map.end()); @@ -80,7 +80,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram double entropy = 0.0; size_t curCount = 0; - for (typename MapType::iterator i = m_Map.begin(); i != m_Map.end(); ++i) + for (auto i = m_Map.begin(); i != m_Map.end(); ++i) { double t = double(i->first) * double(i->second); sum += t; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 789f9f8e1d2..fa745e968f9 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -162,8 +162,7 @@ RunLengthTextureFeaturesImageFilter::Thre NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType faceList = boundaryFacesCalculator(this->m_DigitizedInputImage, outputRegionForThread, m_NeighborhoodRadius); - typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType::iterator fit = - faceList.begin(); + auto fit = faceList.begin(); // Declaration of the variables useful to iterate over the all image region bool isInImage; @@ -358,7 +357,7 @@ RunLengthTextureFeaturesImageFilter::Incr offsetDistance += (offset[i] * m_Spacing[i]) * (offset[i] * m_Spacing[i]); } offsetDistance = std::sqrt(offsetDistance); - int offsetDistanceBin = + auto offsetDistanceBin = static_cast((offsetDistance * pixelDistance - m_HistogramDistanceMinimum) / ((m_HistogramDistanceMaximum - m_HistogramDistanceMinimum) / (float)m_NumberOfBinsPerAxis)); if (offsetDistanceBin < static_cast(m_NumberOfBinsPerAxis) && offsetDistanceBin >= 0) @@ -399,8 +398,8 @@ RunLengthTextureFeaturesImageFilter::Comp continue; } - double i2 = static_cast((a + 1) * (a + 1)); - double j2 = static_cast((b + 1) * (b + 1)); + auto i2 = static_cast((a + 1) * (a + 1)); + auto j2 = static_cast((b + 1) * (b + 1)); // Traditional measures shortRunEmphasis += (frequency / j2); From e1a8f9763a7413c6d14d9451354c694d50321a81 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 21:06:56 -0600 Subject: [PATCH 104/135] STYLE: Replace itkStaticConstMacro with static constexpr Use static constexpr directly now that C++11 conformance is required by all compilers. :%s/itkStaticConstMacro *( *\([^,]*\),[ \_s]*\([^,]*\),\_s*\([^)]*\)) */static constexpr \2 \1 = \3/ge --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../include/itkFirstOrderTextureFeaturesImageFilter.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 72a764243d1..e715992c889 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -134,7 +134,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo /** Specify the default number of bins per axis */ - itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); + static constexpr unsigned int DefaultBinsPerAxis = 256; /** * Set the offsets over which the intensities pairs will be computed. diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index f9f0d81e20e..1bb634bc286 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -86,7 +86,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter typedef typename TOutputImage::PixelType OutputPixelType; /** Image related typedefs. */ - itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension); + static constexpr unsigned int ImageDimension = TInputImage::ImageDimension; protected: unsigned int diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 7d3b7cf414a..557965dd0ba 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -147,7 +147,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm /** Specify the default number of bins per axis */ - itkStaticConstMacro(DefaultBinsPerAxis, unsigned int, 256); + static constexpr unsigned int DefaultBinsPerAxis = 256; /** * Set the offsets over which the intensity/distance pairs will be computed. From 8ff45e05b410c3a0cfbb34946f0324ffea5e96e5 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 12 Feb 2018 23:31:34 -0600 Subject: [PATCH 105/135] 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. --- ...itkCoocurrenceTextureFeaturesImageFilter.h | 54 +++++++++---------- ...kCoocurrenceTextureFeaturesImageFilter.hxx | 14 ++--- .../include/itkDigitizerFunctor.h | 4 +- .../itkFirstOrderTextureFeaturesImageFilter.h | 37 +++++++------ .../include/itkFirstOrderTextureHistogram.h | 2 +- .../itkRunLengthTextureFeaturesImageFilter.h | 54 +++++++++---------- ...itkRunLengthTextureFeaturesImageFilter.hxx | 26 ++++----- ...reFeaturesImageFilterInstantiationTest.cxx | 22 ++++---- ...currenceTextureFeaturesImageFilterTest.cxx | 22 ++++---- ...eaturesImageFilterTestSeparateFeatures.cxx | 30 +++++------ ...eFilterTestVectorImageSeparateFeatures.cxx | 28 +++++----- ...FeaturesImageFilterTestWithVectorImage.cxx | 20 +++---- ...tureFeaturesImageFilterTestWithoutMask.cxx | 20 +++---- ...reFeaturesImageFilterInstantiationTest.cxx | 22 ++++---- ...unLengthTextureFeaturesImageFilterTest.cxx | 22 ++++---- ...eaturesImageFilterTestSeparateFeatures.cxx | 30 +++++------ ...eFilterTestVectorImageSeparateFeatures.cxx | 30 +++++------ ...FeaturesImageFilterTestWithVectorImage.cxx | 20 +++---- ...tureFeaturesImageFilterTestWithoutMask.cxx | 20 +++---- ...stOrderTextureFeaturesImageFilterGTest.cxx | 28 +++++----- ...rstOrderTextureFeaturesImageFilterTest.cxx | 26 ++++----- 21 files changed, 265 insertions(+), 266 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index e715992c889..21ca074812e 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -88,11 +88,11 @@ template { public: - /** Standard typedefs */ - typedef CoocurrenceTextureFeaturesImageFilter Self; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + /** Standard type alias */ + using Self = CoocurrenceTextureFeaturesImageFilter; + using Superclass = ImageToImageFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); @@ -100,27 +100,27 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo /** standard New() method support */ itkNewMacro(Self); - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef TMaskImage MaskImageType; + using InputImageType = TInputImage; + using OutputImageType = TOutputImage; + using MaskImageType = TMaskImage; - typedef typename InputImageType::PixelType PixelType; - typedef typename MaskImageType::PixelType MaskPixelType; - typedef typename InputImageType::IndexType IndexType; - typedef typename InputImageType::PointType PointType; + using PixelType = typename InputImageType::PixelType; + using MaskPixelType = typename MaskImageType::PixelType; + using IndexType = typename InputImageType::IndexType; + using PointType = typename InputImageType::PointType; - typedef typename InputImageType::OffsetType OffsetType; - typedef VectorContainer OffsetVector; - typedef typename OffsetVector::Pointer OffsetVectorPointer; - typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; + using OffsetType = typename InputImageType::OffsetType; + using OffsetVector = VectorContainer; + using OffsetVectorPointer = typename OffsetVector::Pointer; + using OffsetVectorConstPointer = typename OffsetVector::ConstPointer; - typedef typename InputImageType::RegionType InputRegionType; - typedef typename OutputImageType::RegionType OutputRegionType; + using InputRegionType = typename InputImageType::RegionType; + using OutputRegionType = typename OutputImageType::RegionType; - typedef typename itk::ConstNeighborhoodIterator::RadiusType NeighborhoodRadiusType; + using NeighborhoodRadiusType = typename itk::ConstNeighborhoodIterator::RadiusType; - typedef typename NumericTraits::RealType MeasurementType; - typedef typename NumericTraits::RealType RealType; + using MeasurementType = typename NumericTraits::RealType; + using RealType = typename NumericTraits::RealType; /** Method to set/get the Neighborhood radius */ itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); @@ -191,8 +191,8 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo itkGetConstMacro(Normalize, bool); itkBooleanMacro(Normalize); - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename NumericTraits::ScalarRealType OutputRealType; + using OutputPixelType = typename OutputImageType::PixelType; + using OutputRealType = typename NumericTraits::ScalarRealType; #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking @@ -201,10 +201,10 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo #endif protected: - typedef int HistogramIndexType; - typedef itk::Image DigitizedImageType; - typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + using HistogramIndexType = int; + using DigitizedImageType = itk::Image; + using NeighborhoodIteratorType = typename itk::ConstNeighborhoodIterator; + using NeighborIndexType = typename NeighborhoodIteratorType::NeighborIndexType; CoocurrenceTextureFeaturesImageFilter(); ~CoocurrenceTextureFeaturesImageFilter() override {} diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 143c3306b1e..bd0cd93f5ac 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -47,8 +47,8 @@ CoocurrenceTextureFeaturesImageFilter::Co // Set the offset directions to their defaults: half of all the possible // directions 1 pixel away. (The other half is included by symmetry.) // We use a neighborhood iterator to calculate the appropriate offsets. - typedef Neighborhood NeighborhoodType; - NeighborhoodType hood; + using NeighborhoodType = Neighborhood; + NeighborhoodType hood; hood.SetRadius(1); // Select all "previous" neighbors that are face+edge+vertex @@ -85,11 +85,11 @@ CoocurrenceTextureFeaturesImageFilter::Be typename TInputImage::Pointer input = InputImageType::New(); input->Graft(const_cast(this->GetInput())); - typedef Digitizer DigitizerFunctorType; + using DigitizerFunctorType = Digitizer; DigitizerFunctorType digitalizer(m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramMinimum, m_HistogramMaximum); - typedef BinaryFunctorImageFilter FilterType; + using FilterType = BinaryFunctorImageFilter; typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != nullptr) { @@ -165,9 +165,9 @@ CoocurrenceTextureFeaturesImageFilter::Th /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitizedInputImage, *fit); - typedef itk::ImageRegionIterator IteratorType; - IteratorType outputIt(outputPtr, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitizedInputImage, *fit); + using IteratorType = itk::ImageRegionIterator; + IteratorType outputIt(outputPtr, *fit); // Iteration over the all image region while (!inputNIt.IsAtEnd()) diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index e3dc35b9d5d..7ae0bc2b1af 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -30,8 +30,8 @@ template > { public: - /** Standard class typedefs. */ - typedef FirstOrderTextureFeaturesImageFilter Self; - typedef MovingHistogramImageFilter< + /** Standard class type alias. */ + using Self = FirstOrderTextureFeaturesImageFilter; + using Superclass = MovingHistogramImageFilter< TInputImage, TOutputImage, TKernel, - typename Function::FirstOrderTextureHistogram> - Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + typename Function::FirstOrderTextureHistogram>; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Standard New method. */ itkNewMacro(Self); @@ -74,18 +73,18 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter /** Runtime information support. */ itkTypeMacro(FirstOrderTextureFeaturesImageFilter, MovingHistogramMorphologyImageFilter); - /** Image related typedefs. */ - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef typename TInputImage::RegionType RegionType; - typedef typename TInputImage::SizeType SizeType; - typedef typename TInputImage::IndexType IndexType; - typedef typename TInputImage::PixelType PixelType; - typedef typename TInputImage::OffsetType OffsetType; - typedef typename Superclass::OutputImageRegionType OutputImageRegionType; - typedef typename TOutputImage::PixelType OutputPixelType; - - /** Image related typedefs. */ + /** Image related type alias. */ + using InputImageType = TInputImage; + using OutputImageType = TOutputImage; + using RegionType = typename TInputImage::RegionType; + using SizeType = typename TInputImage::SizeType; + using IndexType = typename TInputImage::IndexType; + using PixelType = typename TInputImage::PixelType; + using OffsetType = typename TInputImage::OffsetType; + using OutputImageRegionType = typename Superclass::OutputImageRegionType; + using OutputPixelType = typename TOutputImage::PixelType; + + /** Image related type alias. */ static constexpr unsigned int ImageDimension = TInputImage::ImageDimension; protected: diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index 7ff8e273859..d054184f1ab 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -134,7 +134,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram {} private: - typedef typename std::map MapType; + using MapType = typename std::map; MapType m_Map; size_t m_Count; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 557965dd0ba..5e161245376 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -101,11 +101,11 @@ template { public: - /** Standard typedefs */ - typedef RunLengthTextureFeaturesImageFilter Self; - typedef ImageToImageFilter Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + /** Standard type alias */ + using Self = RunLengthTextureFeaturesImageFilter; + using Superclass = ImageToImageFilter; + using Pointer = SmartPointer; + using ConstPointer = SmartPointer; /** Run-time type information (and related methods). */ itkTypeMacro(RunLengthTextureFeaturesImageFilter, ImageToImageFilter); @@ -113,27 +113,27 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm /** standard New() method support */ itkNewMacro(Self); - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - typedef TMaskImage MaskImageType; + using InputImageType = TInputImage; + using OutputImageType = TOutputImage; + using MaskImageType = TMaskImage; - typedef typename InputImageType::PixelType PixelType; - typedef typename MaskImageType::PixelType MaskPixelType; - typedef typename InputImageType::IndexType IndexType; - typedef typename InputImageType::PointType PointType; + using PixelType = typename InputImageType::PixelType; + using MaskPixelType = typename MaskImageType::PixelType; + using IndexType = typename InputImageType::IndexType; + using PointType = typename InputImageType::PointType; - typedef typename InputImageType::OffsetType OffsetType; - typedef VectorContainer OffsetVector; - typedef typename OffsetVector::Pointer OffsetVectorPointer; - typedef typename OffsetVector::ConstPointer OffsetVectorConstPointer; + using OffsetType = typename InputImageType::OffsetType; + using OffsetVector = VectorContainer; + using OffsetVectorPointer = typename OffsetVector::Pointer; + using OffsetVectorConstPointer = typename OffsetVector::ConstPointer; - typedef typename InputImageType::RegionType InputRegionType; - typedef typename OutputImageType::RegionType OutputRegionType; + using InputRegionType = typename InputImageType::RegionType; + using OutputRegionType = typename OutputImageType::RegionType; - typedef typename itk::ConstNeighborhoodIterator::RadiusType NeighborhoodRadiusType; + using NeighborhoodRadiusType = typename itk::ConstNeighborhoodIterator::RadiusType; - typedef typename NumericTraits::RealType MeasurementType; - typedef typename NumericTraits::RealType RealType; + using MeasurementType = typename NumericTraits::RealType; + using RealType = typename NumericTraits::RealType; /** Method to set/get the Neighborhood radius */ itkSetMacro(NeighborhoodRadius, NeighborhoodRadiusType); @@ -215,8 +215,8 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm itkSetMacro(InsidePixelValue, MaskPixelType); itkGetConstMacro(InsidePixelValue, MaskPixelType); - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename NumericTraits::ScalarRealType OutputRealType; + using OutputPixelType = typename OutputImageType::PixelType; + using OutputRealType = typename NumericTraits::ScalarRealType; #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking @@ -225,10 +225,10 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm #endif protected: - typedef int HistogramIndexType; - typedef itk::Image DigitizedImageType; - typedef typename itk::ConstNeighborhoodIterator NeighborhoodIteratorType; - typedef typename NeighborhoodIteratorType::NeighborIndexType NeighborIndexType; + using HistogramIndexType = int; + using DigitizedImageType = itk::Image; + using NeighborhoodIteratorType = typename itk::ConstNeighborhoodIterator; + using NeighborIndexType = typename NeighborhoodIteratorType::NeighborIndexType; RunLengthTextureFeaturesImageFilter(); ~RunLengthTextureFeaturesImageFilter() override {} diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index fa745e968f9..eda5ecdb605 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -50,8 +50,8 @@ RunLengthTextureFeaturesImageFilter::RunL // Set the offset directions to their defaults: half of all the possible // directions 1 pixel away. (The other half is included by symmetry.) // We use a neighborhood iterator to calculate the appropriate offsets. - typedef Neighborhood NeighborhoodType; - NeighborhoodType hood; + using NeighborhoodType = Neighborhood; + NeighborhoodType hood; hood.SetRadius(1); // Select all "previous" neighbors that are face+edge+vertex @@ -86,12 +86,12 @@ RunLengthTextureFeaturesImageFilter::Befo typename TInputImage::Pointer input = InputImageType::New(); input->Graft(const_cast(this->GetInput())); - typedef Digitizer DigitizerFunctorType; + using DigitizerFunctorType = Digitizer; DigitizerFunctorType digitalizer( m_NumberOfBinsPerAxis, m_InsidePixelValue, m_HistogramValueMinimum, m_HistogramValueMaximum); - typedef BinaryFunctorImageFilter FilterType; + using FilterType = BinaryFunctorImageFilter; typename FilterType::Pointer filter = FilterType::New(); if (this->GetMaskImage() != nullptr) { @@ -140,12 +140,12 @@ RunLengthTextureFeaturesImageFilter::Thre // Creation of a region with the same size as the neighborhood. This region // will be used to check if each voxel has already been visited. - InputRegionType boolRegion; - typename InputRegionType::IndexType boolStart; - typename InputRegionType::SizeType boolSize; - IndexType boolCurentInNeighborhoodIndex; - typedef Image BoolImageType; - typename BoolImageType::Pointer alreadyVisitedImage = BoolImageType::New(); + InputRegionType boolRegion; + typename InputRegionType::IndexType boolStart; + typename InputRegionType::SizeType boolSize; + IndexType boolCurentInNeighborhoodIndex; + using BoolImageType = Image; + typename BoolImageType::Pointer alreadyVisitedImage = BoolImageType::New(); for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) { boolSize[i] = this->m_NeighborhoodRadius[i] * 2 + 1; @@ -189,9 +189,9 @@ RunLengthTextureFeaturesImageFilter::Thre /// ***** Non-boundary Region ***** for (; fit != faceList.end(); ++fit) { - NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitizedInputImage, *fit); - typedef itk::ImageRegionIterator IteratorType; - IteratorType outputIt(outputPtr, *fit); + NeighborhoodIteratorType inputNIt(m_NeighborhoodRadius, this->m_DigitizedInputImage, *fit); + using IteratorType = itk::ImageRegionIterator; + IteratorType outputIt(outputPtr, *fit); // Iteration over the all image region while (!inputNIt.IsAtEnd()) diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 64548dad736..672abfd1cdd 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -37,17 +37,17 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) const unsigned int VectorComponentDimension = 8; // Declare types - typedef int InputPixelType; - typedef unsigned char MaskPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = int; + using MaskPixelType = unsigned char; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image MaskImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::ImageFileReader MaskReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using MaskImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using MaskReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader @@ -60,7 +60,7 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + using FilterType = itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index f6d48275e49..590a076c5b0 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -39,14 +39,14 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) const unsigned int VectorComponentDimension = 8; // Declare types - typedef float InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = float; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -57,8 +57,8 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -83,8 +83,8 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 50547f7cecf..7ca0be11262 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -45,14 +45,14 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ const unsigned int VectorComponentDimension = 8; // Declare types - typedef int InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = int; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -64,8 +64,8 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -91,8 +91,8 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ TRY_EXPECT_NO_EXCEPTION(filter->Update()); - typedef itk::Image FeatureImageType; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + using FeatureImageType = itk::Image; + using IndexSelectionType = itk::VectorIndexSelectionCastImageFilter; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); @@ -101,10 +101,10 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ indexSelectionFilter->SetIndex(i); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i + 1; std::string s = ss.str(); writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index b1c72f78ad0..3fa297b719d 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -47,13 +47,13 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c const unsigned int VectorComponentDimension = 8; // Declare types - typedef float InputPixelType; - typedef float OutputPixelType; + using InputPixelType = float; + using OutputPixelType = float; - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::VectorImage; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -64,8 +64,8 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -90,8 +90,8 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c TRY_EXPECT_NO_EXCEPTION(filter->Update()); - typedef itk::Image FeatureImageType; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + using FeatureImageType = itk::Image; + using IndexSelectionType = itk::VectorIndexSelectionCastImageFilter; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); @@ -100,10 +100,10 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c indexSelectionFilter->SetIndex(i); // Create and setup a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i + 1; std::string s = ss.str(); writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index fd4029e3808..3c55cd56ac8 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -43,13 +43,13 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] const unsigned int ImageDimension = 3; // Declare types - typedef int InputPixelType; - typedef float OutputPixelType; + using InputPixelType = int; + using OutputPixelType = float; - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::VectorImage; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -60,8 +60,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); @@ -89,8 +89,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 2b774b16835..33d4574db5a 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -43,21 +43,21 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) const unsigned int VectorComponentDimension = 8; // Declare types - typedef float InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = float; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); // Create the filter - typedef itk::Statistics::CoocurrenceTextureFeaturesImageFilter FilterType; + using FilterType = itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -81,8 +81,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index a1e47a8a357..b9cea7dd99f 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -37,17 +37,17 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef int InputPixelType; - typedef unsigned char MaskPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = int; + using MaskPixelType = unsigned char; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image MaskImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::ImageFileReader MaskReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using MaskImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using MaskReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader @@ -59,7 +59,7 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + using FilterType = itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index e90710075fd..9768e8516a2 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -46,14 +46,14 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef float InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = float; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -64,8 +64,8 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); @@ -106,8 +106,8 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index d15d3fb4b29..ec2ca2c65d4 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -47,14 +47,14 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef float InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = float; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader @@ -66,8 +66,8 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -98,8 +98,8 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) TRY_EXPECT_NO_EXCEPTION(filter->Update()); - typedef itk::Image FeatureImageType; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + using FeatureImageType = itk::Image; + using IndexSelectionType = itk::VectorIndexSelectionCastImageFilter; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); @@ -108,10 +108,10 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) indexSelectionFilter->SetIndex(i); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i; std::string s = ss.str(); writer->SetFileName(outputFilename + "_" + s + ".nrrd"); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 9f7c4cc30a8..59df523f8fe 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -49,14 +49,14 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha const unsigned int VectorComponentDimension = 10; // Declare types - typedef int InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = int; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -67,8 +67,8 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -98,8 +98,8 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha TRY_EXPECT_NO_EXCEPTION(filter->Update()); - typedef itk::Image FeatureImageType; - typedef itk::VectorIndexSelectionCastImageFilter IndexSelectionType; + using FeatureImageType = itk::Image; + using IndexSelectionType = itk::VectorIndexSelectionCastImageFilter; IndexSelectionType::Pointer indexSelectionFilter = IndexSelectionType::New(); indexSelectionFilter->SetInput(filter->GetOutput()); @@ -108,10 +108,10 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha indexSelectionFilter->SetIndex(i); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); - std::string outputFilename = argv[3]; - std::ostringstream ss; + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); + std::string outputFilename = argv[3]; + std::ostringstream ss; ss << i; std::string s = ss.str(); writer->SetFileName(outputFilename + "_" + s + ".nrrd"); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index 6c9d1312642..7ca8865ebc1 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -45,13 +45,13 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) const unsigned int ImageDimension = 3; // Declare types - typedef int InputPixelType; - typedef float OutputPixelType; + using InputPixelType = int; + using OutputPixelType = float; - typedef itk::Image InputImageType; - typedef itk::VectorImage OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::VectorImage; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -62,8 +62,8 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) maskReader->SetFileName(argv[2]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter - FilterType; + using FilterType = + itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); @@ -97,8 +97,8 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index 6f28eea222f..d73c185ce7c 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -45,14 +45,14 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) const unsigned int VectorComponentDimension = 10; // Declare types - typedef float InputPixelType; - typedef float OutputPixelComponentType; - typedef itk::Vector OutputPixelType; + using InputPixelType = float; + using OutputPixelComponentType = float; + using OutputPixelType = itk::Vector; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::ImageFileReader ReaderType; - typedef itk::Neighborhood NeighborhoodType; + using InputImageType = itk::Image; + using OutputImageType = itk::Image; + using ReaderType = itk::ImageFileReader; + using NeighborhoodType = itk::Neighborhood; // Create and set up a reader ReaderType::Pointer reader = ReaderType::New(); @@ -60,7 +60,7 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) reader->SetFileName(argv[1]); // Create the filter - typedef itk::Statistics::RunLengthTextureFeaturesImageFilter FilterType; + using FilterType = itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); filter->SetInput(reader->GetOutput()); @@ -89,8 +89,8 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer - typedef itk::ImageFileWriter WriterType; - WriterType::Pointer writer = WriterType::New(); + using WriterType = itk::ImageFileWriter; + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); writer->SetInput(filter->GetOutput()); diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index 252014f6c5c..faad3acd2cf 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx @@ -43,10 +43,10 @@ print_feature(const T & p, std::ostream & out = std::cout) TEST(TextureFeatures, FirstOrder_Test1) { - const unsigned int ImageDimension = 2; - typedef itk::Image ImageType; - typedef itk::Image, ImageDimension> OImageType; - typedef itk::FlatStructuringElement KernelType; + const unsigned int ImageDimension = 2; + using ImageType = itk::Image; + using OImageType = itk::Image, ImageDimension>; + using KernelType = itk::FlatStructuringElement; unsigned int r = 50u; @@ -62,14 +62,14 @@ TEST(TextureFeatures, FirstOrder_Test1) image->FillBuffer(0); - typedef itk::AdditiveGaussianNoiseImageFilter ImageNoiseType; - ImageNoiseType::Pointer noiseFilter = ImageNoiseType::New(); + using ImageNoiseType = itk::AdditiveGaussianNoiseImageFilter; + ImageNoiseType::Pointer noiseFilter = ImageNoiseType::New(); noiseFilter->SetSeed(124); noiseFilter->SetMean(0.0); noiseFilter->SetStandardDeviation(.1); noiseFilter->SetInput(image); - typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; + using TextureFilterType = itk::FirstOrderTextureFeaturesImageFilter; KernelType::SizeType radius; radius.Fill(r); @@ -113,10 +113,10 @@ TEST(TextureFeatures, FirstOrder_Test1) TEST(TextureFeatures, FirstOrder_Test2) { - const unsigned int ImageDimension = 2; - typedef itk::Image ImageType; - typedef itk::Image, ImageDimension> OImageType; - typedef itk::FlatStructuringElement KernelType; + const unsigned int ImageDimension = 2; + using ImageType = itk::Image; + using OImageType = itk::Image, ImageDimension>; + using KernelType = itk::FlatStructuringElement; unsigned int r = 50u; @@ -132,14 +132,14 @@ TEST(TextureFeatures, FirstOrder_Test2) image->FillBuffer(0); - typedef itk::AdditiveGaussianNoiseImageFilter ImageNoiseType; - ImageNoiseType::Pointer noiseFilter = ImageNoiseType::New(); + using ImageNoiseType = itk::AdditiveGaussianNoiseImageFilter; + ImageNoiseType::Pointer noiseFilter = ImageNoiseType::New(); noiseFilter->SetSeed(124); noiseFilter->SetMean(100.0); noiseFilter->SetStandardDeviation(1); noiseFilter->SetInput(image); - typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; + using TextureFilterType = itk::FirstOrderTextureFeaturesImageFilter; KernelType::SizeType radius; radius.Fill(r); diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx index 3d2003fbfbe..6924da03f08 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx @@ -25,15 +25,15 @@ static void Test1(const std::string & inFileName, const std::string & outFileName) { - const unsigned int ImageDimension = 3; - typedef itk::Image ImageType; - typedef itk::Image, ImageDimension> OImageType; - typedef itk::FlatStructuringElement KernelType; + const unsigned int ImageDimension = 3; + using ImageType = itk::Image; + using OImageType = itk::Image, ImageDimension>; + using KernelType = itk::FlatStructuringElement; - typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; + using TextureFilterType = itk::FirstOrderTextureFeaturesImageFilter; - typedef itk::ImageFileReader ReaderType; + using ReaderType = itk::ImageFileReader; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inFileName); @@ -47,7 +47,7 @@ Test1(const std::string & inFileName, const std::string & outFileName) filter->SetInput(reader->GetOutput()); filter->UpdateLargestPossibleRegion(); - typedef itk::ImageFileWriter WriterType; + using WriterType = itk::ImageFileWriter; WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outFileName); @@ -59,15 +59,15 @@ Test1(const std::string & inFileName, const std::string & outFileName) static void Test2(std::string inFileName) { - const unsigned int ImageDimension = 3; - typedef itk::Image ImageType; - typedef itk::VectorImage OImageType; - typedef itk::FlatStructuringElement KernelType; + const unsigned int ImageDimension = 3; + using ImageType = itk::Image; + using OImageType = itk::VectorImage; + using KernelType = itk::FlatStructuringElement; - typedef itk::FirstOrderTextureFeaturesImageFilter TextureFilterType; + using TextureFilterType = itk::FirstOrderTextureFeaturesImageFilter; - typedef itk::ImageFileReader ReaderType; + using ReaderType = itk::ImageFileReader; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inFileName); From 34570afc6caf79302d13d3aa4701a2b960467abc Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 13 Feb 2018 08:25:59 -0600 Subject: [PATCH 106/135] STYLE: Prefer constexpr for const numeric literals Use constexpr for constant numeric literals. --- ...CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx | 4 ++-- .../test/CoocurrenceTextureFeaturesImageFilterTest.cxx | 4 ++-- ...currenceTextureFeaturesImageFilterTestSeparateFeatures.cxx | 4 ++-- ...tureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 4 ++-- ...ocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx | 2 +- .../CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx | 4 ++-- .../RunLengthTextureFeaturesImageFilterInstantiationTest.cxx | 4 ++-- .../test/RunLengthTextureFeaturesImageFilterTest.cxx | 4 ++-- ...unLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx | 4 ++-- ...tureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 4 ++-- ...RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx | 2 +- .../RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx | 4 ++-- .../test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx | 4 ++-- .../test/itkFirstOrderTextureFeaturesImageFilterTest.cxx | 4 ++-- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 672abfd1cdd..01882723d78 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -33,8 +33,8 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 8; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 8; // Declare types using InputPixelType = int; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 590a076c5b0..2ed2dd4690d 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -35,8 +35,8 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 8; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 8; // Declare types using InputPixelType = float; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 7ca0be11262..4965fabe623 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -41,8 +41,8 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 8; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 8; // Declare types using InputPixelType = int; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 3fa297b719d..84f3c1aef43 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -43,8 +43,8 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 8; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 8; // Declare types using InputPixelType = float; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 3c55cd56ac8..98753b9039b 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -40,7 +40,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; + constexpr unsigned int ImageDimension = 3; // Declare types using InputPixelType = int; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 33d4574db5a..1a43d01e6c3 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -39,8 +39,8 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 8; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 8; // Declare types using InputPixelType = float; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index b9cea7dd99f..95bccd21faa 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -33,8 +33,8 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 10; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 10; // Declare types using InputPixelType = int; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 9768e8516a2..3bfc92bc1b6 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -42,8 +42,8 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 10; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 10; // Declare types using InputPixelType = float; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index ec2ca2c65d4..cb91957c441 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -43,8 +43,8 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 10; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 10; // Declare types using InputPixelType = float; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 59df523f8fe..350e18d2189 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -45,8 +45,8 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 10; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 10; // Declare types using InputPixelType = int; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index 7ca8865ebc1..f3c77a67e94 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -42,7 +42,7 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; + constexpr unsigned int ImageDimension = 3; // Declare types using InputPixelType = int; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index d73c185ce7c..8ca2a9a0e80 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -41,8 +41,8 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) return EXIT_FAILURE; } - const unsigned int ImageDimension = 3; - const unsigned int VectorComponentDimension = 10; + constexpr unsigned int ImageDimension = 3; + constexpr unsigned int VectorComponentDimension = 10; // Declare types using InputPixelType = float; diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index faad3acd2cf..40f81ba0c26 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx @@ -43,7 +43,7 @@ print_feature(const T & p, std::ostream & out = std::cout) TEST(TextureFeatures, FirstOrder_Test1) { - const unsigned int ImageDimension = 2; + constexpr unsigned int ImageDimension = 2; using ImageType = itk::Image; using OImageType = itk::Image, ImageDimension>; using KernelType = itk::FlatStructuringElement; @@ -113,7 +113,7 @@ TEST(TextureFeatures, FirstOrder_Test1) TEST(TextureFeatures, FirstOrder_Test2) { - const unsigned int ImageDimension = 2; + constexpr unsigned int ImageDimension = 2; using ImageType = itk::Image; using OImageType = itk::Image, ImageDimension>; using KernelType = itk::FlatStructuringElement; diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx index 6924da03f08..2d6fe2717de 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx @@ -25,7 +25,7 @@ static void Test1(const std::string & inFileName, const std::string & outFileName) { - const unsigned int ImageDimension = 3; + constexpr unsigned int ImageDimension = 3; using ImageType = itk::Image; using OImageType = itk::Image, ImageDimension>; using KernelType = itk::FlatStructuringElement; @@ -59,7 +59,7 @@ Test1(const std::string & inFileName, const std::string & outFileName) static void Test2(std::string inFileName) { - const unsigned int ImageDimension = 3; + constexpr unsigned int ImageDimension = 3; using ImageType = itk::Image; using OImageType = itk::VectorImage; using KernelType = itk::FlatStructuringElement; From d5a12728d006e53ca792e4ad46f3ec0ac41b8e14 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 26 Feb 2018 14:16:28 -0500 Subject: [PATCH 107/135] STYLE: Use raw pointer inside pipeline methods --- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index ab17ea08d3d..f0121c4dc2c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -130,8 +130,7 @@ RunLengthTextureFeaturesImageFilter::Thre ThreadIdType threadId) { // Get the inputs/outputs - typename TOutputImage::Pointer outputPtr = TOutputImage::New(); - outputPtr = this->GetOutput(); + TOutputImage * outputPtr = this->GetOutput(); ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); From a4307541ff3727b49cd26da2dc0e49adc987de34 Mon Sep 17 00:00:00 2001 From: Bradley Lowekamp Date: Mon, 26 Feb 2018 14:16:57 -0500 Subject: [PATCH 108/135] BUG: Manually create pixel of proper length Use the generalized NumericTraits::SetLength method to create a output pixel type of the proper length. The prior approach was producing a segmentation fault with the RLE filter when used with VectorImages and an image with dimension 64x64x1 due to the neighborhood operator exceeding the size of the image in the z-direction. Additionally, this usage in complicated with the C++11 implementation using a "move" assignment/constructor, where the vector may be pointing to the same pixel in the output buffer for the duration of the method. --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 9 ++------- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 1a92d618fd3..8bc891bc1b0 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -131,6 +131,7 @@ CoocurrenceTextureFeaturesImageFilter::Th // Creation of the output pixel type typename TOutputImage::PixelType outputPixel; + NumericTraits::SetLength(outputPixel, outputPtr->GetNumberOfComponentsPerPixel()); // Separation of the non-boundary region that will be processed in a different way NeighborhoodAlgorithm::ImageBoundaryFacesCalculator boundaryFacesCalculator; @@ -140,13 +141,7 @@ CoocurrenceTextureFeaturesImageFilter::Th faceList.begin(); // Declaration of the variables useful to iterate over the all image region - bool isInImage; - IndexType firstIndex; - for (unsigned int i = 0; i < this->m_NeighborhoodRadius.Dimension; ++i) - { - firstIndex[i] = 0; - } - outputPixel = outputPtr->GetPixel(firstIndex); + bool isInImage; typename OffsetVector::ConstIterator offsets; // Declaration of the variables useful to iterate over the all the offsets diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index f0121c4dc2c..676b6b01149 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -136,6 +136,7 @@ RunLengthTextureFeaturesImageFilter::Thre // Creation of the output pixel type typename TOutputImage::PixelType outputPixel; + NumericTraits::SetLength(outputPixel, outputPtr->GetNumberOfComponentsPerPixel()); // Creation of a region with the same size as the neighborhood. This region // will be used to check if each voxel has already been visited. @@ -165,8 +166,7 @@ RunLengthTextureFeaturesImageFilter::Thre faceList.begin(); // Declaration of the variables useful to iterate over the all image region - bool isInImage; - outputPixel = outputPtr->GetPixel(boolCurentInNeighborhoodIndex); + bool isInImage; typename OffsetVector::ConstIterator offsets; // Declaration of the variables useful to iterate over the all the offsets From d6606d51c4926536bb215c044e6921fa208b5e32 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Sat, 14 Apr 2018 19:33:15 +0200 Subject: [PATCH 109/135] 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/itkFirstOrderTextureFeaturesImageFilter.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index b1c80f6852b..7cf051fd849 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -57,6 +57,8 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter typename Function::FirstOrderTextureHistogram> { public: + ITK_DISALLOW_COPY_AND_ASSIGN(FirstOrderTextureFeaturesImageFilter); + /** Standard class type alias. */ using Self = FirstOrderTextureFeaturesImageFilter; using Superclass = MovingHistogramImageFilter< @@ -117,12 +119,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter ~FirstOrderTextureFeaturesImageFilter() override {} - -private: - FirstOrderTextureFeaturesImageFilter(const Self &); // purposely not implemented - void - operator=(const Self &); // purposely not implemented -}; // end of class +}; } // end namespace itk #endif From c34170e926c1a09932b081e40d2e474926aecf09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Mon, 14 May 2018 13:32:18 +0200 Subject: [PATCH 110/135] BUG: Use itk::SimpleFilterWatcher instead of itk::FilterWatcher. Use itk::SimpleFilterWatcher instead of itk::FilterWatcher. The itk::FilterWatcher class was removed in favour of itk::SimpleFilterWatcher (and thus, its header file named itkFilterWatcher.h was deleted) in this gerrit topic: http://review.source.kitware.com/#/c/23415/ This bug was identified thanks to the following gerrit topic: http://review.source.kitware.com/#/c/23428/ --- .../test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index 40f81ba0c26..29f489f2c67 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx @@ -18,7 +18,7 @@ #include "itkFirstOrderTextureFeaturesImageFilter.h" #include "itkFlatStructuringElement.h" #include "itkAdditiveGaussianNoiseImageFilter.h" -#include "itkFilterWatcher.h" +#include "itkSimpleFilterWatcher.h" #include "gtest/gtest.h" @@ -78,7 +78,7 @@ TEST(TextureFeatures, FirstOrder_Test1) filter->SetKernel(kernel); filter->SetInput(noiseFilter->GetOutput()); - FilterWatcher watcher(filter, "filter"); + itk::SimpleFilterWatcher watcher(filter, "filter"); ImageType::SizeType requestSize = { { 10, 10 } }; @@ -148,7 +148,7 @@ TEST(TextureFeatures, FirstOrder_Test2) filter->SetKernel(kernel); filter->SetInput(noiseFilter->GetOutput()); - FilterWatcher watcher(filter, "filter"); + itk::SimpleFilterWatcher watcher(filter, "filter"); ImageType::SizeType requestSize = { { 10, 10 } }; From d30337eeb6be524db8a0b564b258fc28f97ed646 Mon Sep 17 00:00:00 2001 From: Jon Haitz Legarreta Date: Wed, 16 May 2018 20:45:57 +0200 Subject: [PATCH 111/135] BUG: Fix test errors stemming from the new multi-threading mechanism. Fix errors stemming from the use of the new `itk::MultiThreaderBase` class for multi-threading. The solution adopted in this patch set was based on the discussion in: http://review.source.kitware.com/#/c/23434/ --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../itkCoocurrenceTextureFeaturesImageFilter.hxx | 10 +++------- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 10 +++------- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 21ca074812e..ef18412863d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -231,7 +231,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo void AfterThreadedGenerateData() override; void - ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) override; + DynamicThreadedGenerateData(const OutputRegionType & outputRegionForThread) override; void GenerateOutputInformation() override; diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 0681e508b2d..43ef62a4d98 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -66,6 +66,7 @@ CoocurrenceTextureFeaturesImageFilter::Co this->m_NeighborhoodRadius = nhood.GetRadius(); this->m_Normalize = false; + this->DynamicMultiThreadingOn(); } template @@ -120,15 +121,12 @@ CoocurrenceTextureFeaturesImageFilter::Af template void -CoocurrenceTextureFeaturesImageFilter::ThreadedGenerateData( - const OutputRegionType & outputRegionForThread, - ThreadIdType threadId) +CoocurrenceTextureFeaturesImageFilter::DynamicThreadedGenerateData( + const OutputRegionType & outputRegionForThread) { // Recuperation of the different inputs/outputs OutputImageType * outputPtr = this->GetOutput(); - ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); - // Creation of the output pixel type typename TOutputImage::PixelType outputPixel; NumericTraits::SetLength(outputPixel, outputPtr->GetNumberOfComponentsPerPixel()); @@ -172,7 +170,6 @@ CoocurrenceTextureFeaturesImageFilter::Th { outputPixel.Fill(0); outputIt.Set(outputPixel); - progress.CompletedPixel(); ++inputNIt; ++outputIt; continue; @@ -228,7 +225,6 @@ CoocurrenceTextureFeaturesImageFilter::Th this->ComputeFeatures(hist, totalNumberOfFreq, outputPixel); outputIt.Set(outputPixel); - progress.CompletedPixel(); ++inputNIt; ++outputIt; } diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 5e161245376..899f4865581 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -256,7 +256,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm void AfterThreadedGenerateData() override; void - ThreadedGenerateData(const OutputRegionType & outputRegionForThread, ThreadIdType threadId) override; + DynamicThreadedGenerateData(const OutputRegionType & outputRegionForThread) override; void GenerateOutputInformation() override; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 079780fefa2..79e90af6049 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -67,6 +67,7 @@ RunLengthTextureFeaturesImageFilter::RunL NeighborhoodType nhood; nhood.SetRadius(2); this->m_NeighborhoodRadius = nhood.GetRadius(); + this->DynamicMultiThreadingOn(); } template @@ -125,15 +126,12 @@ RunLengthTextureFeaturesImageFilter::Afte template void -RunLengthTextureFeaturesImageFilter::ThreadedGenerateData( - const OutputRegionType & outputRegionForThread, - ThreadIdType threadId) +RunLengthTextureFeaturesImageFilter::DynamicThreadedGenerateData( + const OutputRegionType & outputRegionForThread) { // Get the inputs/outputs TOutputImage * outputPtr = this->GetOutput(); - ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); - // Creation of the output pixel type typename TOutputImage::PixelType outputPixel; NumericTraits::SetLength(outputPixel, outputPtr->GetNumberOfComponentsPerPixel()); @@ -200,7 +198,6 @@ RunLengthTextureFeaturesImageFilter::Thre { outputPixel.Fill(0); outputIt.Set(outputPixel); - progress.CompletedPixel(); ++inputNIt; ++outputIt; continue; @@ -275,7 +272,6 @@ RunLengthTextureFeaturesImageFilter::Thre this->ComputeFeatures(histogram, totalNumberOfRuns, outputPixel); outputIt.Set(outputPixel); - progress.CompletedPixel(); ++inputNIt; ++outputIt; } From d11752602feb669ff9d8022033e7b9197dfb8ce1 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 16 Sep 2018 23:12:37 -0400 Subject: [PATCH 112/135] ENH: Wrap VectorImage before Image of Vector There is better wrapping support in other classes for VectorImage. --- .../wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap | 6 +++--- .../wrapping/itkRunLengthTextureFeaturesImageFilter.wrap | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap index 4089114db20..6325bfd67e1 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap @@ -54,12 +54,12 @@ itk_end_wrap_class() itk_wrap_class("itk::Statistics::CoocurrenceTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_SCALAR}) - itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" - "${ITKT_I${t}${d}}, itk::Image,${d}>" - ) itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}" "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" ) + itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" + "${ITKT_I${t}${d}}, itk::Image,${d}>" + ) endforeach() endforeach() itk_end_wrap_class() diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap index bfed04fbc35..e6a3f8fb9b9 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap @@ -54,12 +54,12 @@ itk_end_wrap_class() itk_wrap_class("itk::Statistics::RunLengthTextureFeaturesImageFilter" POINTER) foreach(d ${ITK_WRAP_IMAGE_DIMS}) foreach(t ${WRAP_ITK_SCALAR}) - itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" - "${ITKT_I${t}${d}}, itk::Image,${d}>" - ) itk_wrap_template("${ITKM_I${t}${d}}${ITKM_VI${ITKM_F}${d}}" "${ITKT_I${t}${d}}, ${ITKT_VI${ITKM_F}${d}}" ) + itk_wrap_template("${ITKM_I${t}${d}}IV${ITKM_F}${OutputVectorDim}${d}" + "${ITKT_I${t}${d}}, itk::Image,${d}>" + ) endforeach() endforeach() itk_end_wrap_class() From a0dbadb167e4977cc79f846169a5a31a33e6bda7 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Sun, 16 Sep 2018 23:30:25 -0400 Subject: [PATCH 113/135] COMP: NumberOfThreads -> NumberOfWorkUnits --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 43ef62a4d98..37c96e735dc 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -104,7 +104,7 @@ CoocurrenceTextureFeaturesImageFilter::Be } filter->SetInput2(input); filter->SetFunctor(digitalizer); - filter->SetNumberOfThreads(this->GetNumberOfThreads()); + filter->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); filter->Update(); m_DigitizedInputImage = filter->GetOutput(); diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 79e90af6049..a851ebab888 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -106,7 +106,7 @@ RunLengthTextureFeaturesImageFilter::Befo } filter->SetInput2(input); filter->SetFunctor(digitalizer); - filter->SetNumberOfThreads(this->GetNumberOfThreads()); + filter->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits()); filter->Update(); m_DigitizedInputImage = filter->GetOutput(); From 6ac09c16acb4477e2d47bec8f7b806c636977ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Thu, 1 Nov 2018 23:20:46 -0400 Subject: [PATCH 114/135] STYLE: Prefer error checked std::sto[id] over ato[if]. The `ato[if]` functions do not provide mechanisms for distinguishing between `0` and the error condition where the input can not be converted. `std::sto[id]` provides exception handling and detects when an invalid string attempts to be converted to an [integer|double]. `ato[if]()` - **Con**: No error handling. - **Con**: Handle neither hexadecimal nor octal. The use of `ato[if]` in code can cause it to be subtly broken. `ato[if]` makes two very big assumptions indeed: - The string represents an integer/floating point value. - The integer can fit into an int. In agreement with: http://review.source.kitware.com/#/c/23738/ --- .../CoocurrenceTextureFeaturesImageFilterTest.cxx | 8 ++++---- ...extureFeaturesImageFilterTestSeparateFeatures.cxx | 8 ++++---- ...resImageFilterTestVectorImageSeparateFeatures.cxx | 8 ++++---- ...TextureFeaturesImageFilterTestWithVectorImage.cxx | 8 ++++---- ...enceTextureFeaturesImageFilterTestWithoutMask.cxx | 8 ++++---- .../test/RunLengthTextureFeaturesImageFilterTest.cxx | 12 ++++++------ ...extureFeaturesImageFilterTestSeparateFeatures.cxx | 12 ++++++------ ...resImageFilterTestVectorImageSeparateFeatures.cxx | 12 ++++++------ ...TextureFeaturesImageFilterTestWithVectorImage.cxx | 12 ++++++------ ...ngthTextureFeaturesImageFilterTestWithoutMask.cxx | 12 ++++++------ 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 2ed2dd4690d..937bdfb9a56 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -66,15 +66,15 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramMinimum(pixelValueMin); filter->SetHistogramMaximum(pixelValueMax); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[7]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 4965fabe623..44736069070 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -73,16 +73,16 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramMinimum(pixelValueMin); filter->SetHistogramMaximum(pixelValueMax); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[7]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 84f3c1aef43..7057a290178 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -73,15 +73,15 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramMinimum(pixelValueMin); filter->SetHistogramMaximum(pixelValueMax); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[7]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 98753b9039b..6cb052d2b2b 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -72,15 +72,15 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramMinimum(pixelValueMin); filter->SetHistogramMaximum(pixelValueMax); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[7]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[7]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 1a43d01e6c3..24820254383 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -64,15 +64,15 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) if (argc >= 4) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[3]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[3]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[4]); - FilterType::PixelType pixelValueMax = std::atof(argv[5]); + FilterType::PixelType pixelValueMin = std::stod(argv[4]); + FilterType::PixelType pixelValueMax = std::stod(argv[5]); filter->SetHistogramMinimum(pixelValueMin); filter->SetHistogramMaximum(pixelValueMax); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[6]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[6]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 3bfc92bc1b6..81d4286e0ad 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -78,25 +78,25 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); - FilterType::RealType minDistance = std::atof(argv[7]); - FilterType::RealType maxDistance = std::atof(argv[8]); + FilterType::RealType minDistance = std::stod(argv[7]); + FilterType::RealType maxDistance = std::stod(argv[8]); filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[9]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index cb91957c441..0244705eccb 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -75,21 +75,21 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); - FilterType::RealType minDistance = std::atof(argv[7]); - FilterType::RealType maxDistance = std::atof(argv[8]); + FilterType::RealType minDistance = std::stod(argv[7]); + FilterType::RealType maxDistance = std::stod(argv[8]); filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[9]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 350e18d2189..c17ccab29bb 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -76,20 +76,20 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); - FilterType::RealType minDistance = std::atof(argv[7]); - FilterType::RealType maxDistance = std::atof(argv[8]); + FilterType::RealType minDistance = std::stod(argv[7]); + FilterType::RealType maxDistance = std::stod(argv[8]); filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[9]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index f3c77a67e94..04844fcb3f7 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -74,21 +74,21 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) if (argc >= 5) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[4]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[5]); - FilterType::PixelType pixelValueMax = std::atof(argv[6]); + FilterType::PixelType pixelValueMin = std::stod(argv[5]); + FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); - FilterType::RealType minDistance = std::atof(argv[7]); - FilterType::RealType maxDistance = std::atof(argv[8]); + FilterType::RealType minDistance = std::stod(argv[7]); + FilterType::RealType maxDistance = std::stod(argv[8]); filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[9]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[9]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index 8ca2a9a0e80..f9d94bce789 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -67,20 +67,20 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) if (argc >= 4) { - unsigned int numberOfBinsPerAxis = std::atoi(argv[3]); + unsigned int numberOfBinsPerAxis = std::stoi(argv[3]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - FilterType::PixelType pixelValueMin = std::atof(argv[4]); - FilterType::PixelType pixelValueMax = std::atof(argv[5]); + FilterType::PixelType pixelValueMin = std::stod(argv[4]); + FilterType::PixelType pixelValueMax = std::stod(argv[5]); filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); - FilterType::RealType minDistance = std::atof(argv[6]); - FilterType::RealType maxDistance = std::atof(argv[7]); + FilterType::RealType minDistance = std::stod(argv[6]); + FilterType::RealType maxDistance = std::stod(argv[7]); filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); - NeighborhoodType::SizeValueType neighborhoodRadius = std::atoi(argv[8]); + NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[8]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); From 366cbee2db4cb986905820238c77ec318d7eb4be Mon Sep 17 00:00:00 2001 From: maekclena Date: Mon, 4 Mar 2019 18:16:09 +0100 Subject: [PATCH 115/135] BUG: Skip single pixel textures fixes #68 --- .../itkCoocurrenceTextureFeaturesImageFilter.hxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 37c96e735dc..67df6de4f02 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -221,9 +221,14 @@ CoocurrenceTextureFeaturesImageFilter::Dy ++hist[currentInNeighborhoodPixelIntensity][pixelIntensity]; } } - // Compute the run length features - this->ComputeFeatures(hist, totalNumberOfFreq, outputPixel); - outputIt.Set(outputPixel); + + // No coocurrences means we are computing the texture of a single pixel, which is undefined + if (totalNumberOfFreq != 0) + { + // Compute the run length features + this->ComputeFeatures(hist, totalNumberOfFreq, outputPixel); + outputIt.Set(outputPixel); + } ++inputNIt; ++outputIt; From 0ad5e685f6eee41ec5d20167a9cc79cb555b576e Mon Sep 17 00:00:00 2001 From: maekclena Date: Mon, 11 Mar 2019 18:01:59 +0100 Subject: [PATCH 116/135] BUG: Avoid histogram range overflow fixes #71 --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 7 +++++++ .../TextureFeatures/include/itkDigitizerFunctor.h | 4 ++-- .../include/itkRunLengthTextureFeaturesImageFilter.h | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index ef18412863d..87c435fa30c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -74,6 +74,13 @@ namespace Statistics * intensity range. For example they could be the minimum and maximum intensity of the image, or 0 and * the maximum intensity (if the negative values are considered as noise). * + * WARNING: This probably won't work for pixels of double or long-double type + * unless you set the histogram min and max manually. This is because the largest + * histogram bin by default has max value of the largest possible pixel value + * plus 1. For double and long-double types, whose "RealType" as defined by the + * NumericTraits class is the same, and thus cannot hold any larger values, + * this would cause a float overflow. + * * \sa HistogramToTextureFeaturesFilter * \sa ScalarImageToCooccurrenceMatrixFilte * \sa ScalarImageToTextureFeaturesFilter diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index 7ae0bc2b1af..72bee4fb93f 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -84,8 +84,8 @@ class Digitizer MaskPixelType m_MaskValue; - PixelType m_Min; - PixelType m_Max; + typename NumericTraits::RealType m_Min; + typename NumericTraits::RealType m_Max; }; } // namespace Statistics diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 899f4865581..9f27e957dc8 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -87,6 +87,13 @@ namespace Statistics * -# Distance range: For better results the distance range should be adapted to the spacing of the input image * and the size of the neighborhood. * + * WARNING: This probably won't work for pixels of double or long-double type + * unless you set the histogram min and max manually. This is because the largest + * histogram bin by default has max value of the largest possible pixel value + * plus 1. For double and long-double types, whose "RealType" as defined by the + * NumericTraits class is the same, and thus cannot hold any larger values, + * this would cause a float overflow. + * * \sa ScalarImageToRunLengthFeaturesFilter * \sa ScalarImageToRunLengthMatrixFilter * \sa HistogramToRunLengthFeaturesFilter From d0ebe4ddd68bf3584b91b2458e8502f27e71d757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Fri, 14 Jun 2019 20:29:38 -0400 Subject: [PATCH 117/135] STYLE: Add ITK prefix to testing macros --- ...reFeaturesImageFilterInstantiationTest.cxx | 20 ++++++++-------- ...currenceTextureFeaturesImageFilterTest.cxx | 4 ++-- ...eaturesImageFilterTestSeparateFeatures.cxx | 4 ++-- ...eFilterTestVectorImageSeparateFeatures.cxx | 4 ++-- ...FeaturesImageFilterTestWithVectorImage.cxx | 6 ++--- ...tureFeaturesImageFilterTestWithoutMask.cxx | 4 ++-- ...reFeaturesImageFilterInstantiationTest.cxx | 24 +++++++++---------- ...unLengthTextureFeaturesImageFilterTest.cxx | 20 ++++++++-------- ...eaturesImageFilterTestSeparateFeatures.cxx | 4 ++-- ...eFilterTestVectorImageSeparateFeatures.cxx | 4 ++-- ...FeaturesImageFilterTestWithVectorImage.cxx | 6 ++--- ...tureFeaturesImageFilterTestWithoutMask.cxx | 4 ++-- 12 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 01882723d78..f99325f8de6 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx @@ -63,47 +63,47 @@ CoocurrenceTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) using FilterType = itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); + ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); - TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); + ITK_TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); unsigned int numberOfBinsPerAxis = 15; filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); + ITK_TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); FilterType::PixelType min = -62; FilterType::PixelType max = 2456; filter->SetHistogramMinimum(min); filter->SetHistogramMaximum(max); - TEST_SET_GET_VALUE(min, filter->GetHistogramMinimum()); - TEST_SET_GET_VALUE(max, filter->GetHistogramMaximum()); + ITK_TEST_SET_GET_VALUE(min, filter->GetHistogramMinimum()); + ITK_TEST_SET_GET_VALUE(max, filter->GetHistogramMaximum()); NeighborhoodType::SizeValueType neighborhoodRadius = 3; NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); - TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); + ITK_TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); FilterType::MaskPixelType insidePixelValue = 0; filter->SetInsidePixelValue(insidePixelValue); - TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); + ITK_TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); FilterType::OffsetType offset = { { -1, 0, 1 } }; FilterType::OffsetVector::Pointer offsetVector = FilterType::OffsetVector::New(); offsetVector->push_back(offset); filter->SetOffsets(offsetVector); - TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + ITK_TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); filter->SetOffsets(offsetVector); - TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + ITK_TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 937bdfb9a56..2809ecc5c18 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx @@ -80,7 +80,7 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer using WriterType = itk::ImageFileWriter; @@ -88,7 +88,7 @@ CoocurrenceTextureFeaturesImageFilterTest(int argc, char * argv[]) writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index 44736069070..fecb85b0a08 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -88,7 +88,7 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); using FeatureImageType = itk::Image; @@ -110,7 +110,7 @@ CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[ writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); } diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 7057a290178..29aa509cb82 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -87,7 +87,7 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); using FeatureImageType = itk::Image; @@ -109,7 +109,7 @@ CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, c writer->SetFileName(outputFilename + "_1" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); } diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 6cb052d2b2b..0df50bb6ab3 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -64,7 +64,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] itk::Statistics::CoocurrenceTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); + ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); @@ -86,7 +86,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer using WriterType = itk::ImageFileWriter; @@ -94,7 +94,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[] writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 24820254383..07b8eb4b1f7 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx @@ -78,7 +78,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer using WriterType = itk::ImageFileWriter; @@ -86,7 +86,7 @@ CoocurrenceTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) writer->SetFileName(argv[2]); writer->SetInput(filter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index 95bccd21faa..4631c63ad33 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx @@ -63,53 +63,53 @@ RunLengthTextureFeaturesImageFilterInstantiationTest(int argc, char * argv[]) FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); + ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); - TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); + ITK_TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); unsigned int numberOfBinsPerAxis = 15; filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); + ITK_TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); FilterType::PixelType pixelValueMin = -62; FilterType::PixelType pixelValueMax = 2456; filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); - TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); - TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); + ITK_TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); + ITK_TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); FilterType::RealType minDistance = 0.15; FilterType::RealType maxDistance = 1.5; filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); - TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); - TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); + ITK_TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); + ITK_TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); NeighborhoodType::SizeValueType neighborhoodRadius = 3; NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); - TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); + ITK_TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); FilterType::MaskPixelType insidePixelValue = 0; filter->SetInsidePixelValue(insidePixelValue); - TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); + ITK_TEST_SET_GET_VALUE(insidePixelValue, filter->GetInsidePixelValue()); FilterType::OffsetType offset = { { -1, 0, 1 } }; FilterType::OffsetVector::Pointer offsetVector = FilterType::OffsetVector::New(); offsetVector->push_back(offset); filter->SetOffsets(offsetVector); - TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + ITK_TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); filter->SetOffsets(offsetVector); - TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); + ITK_TEST_SET_GET_VALUE(offsetVector, filter->GetOffsets()); - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 81d4286e0ad..004bda3f29d 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx @@ -69,41 +69,41 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); + ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); filter->SetMaskImage(maskReader->GetOutput()); - TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); + ITK_TEST_SET_GET_VALUE(maskReader->GetOutput(), filter->GetMaskImage()); if (argc >= 5) { unsigned int numberOfBinsPerAxis = std::stoi(argv[4]); filter->SetNumberOfBinsPerAxis(numberOfBinsPerAxis); - TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); + ITK_TEST_SET_GET_VALUE(numberOfBinsPerAxis, filter->GetNumberOfBinsPerAxis()); FilterType::PixelType pixelValueMin = std::stod(argv[5]); FilterType::PixelType pixelValueMax = std::stod(argv[6]); filter->SetHistogramValueMinimum(pixelValueMin); filter->SetHistogramValueMaximum(pixelValueMax); - TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); - TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); + ITK_TEST_SET_GET_VALUE(pixelValueMin, filter->GetHistogramValueMinimum()); + ITK_TEST_SET_GET_VALUE(pixelValueMax, filter->GetHistogramValueMaximum()); FilterType::RealType minDistance = std::stod(argv[7]); FilterType::RealType maxDistance = std::stod(argv[8]); filter->SetHistogramDistanceMinimum(minDistance); filter->SetHistogramDistanceMaximum(maxDistance); - TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); - TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); + ITK_TEST_SET_GET_VALUE(minDistance, filter->GetHistogramDistanceMinimum()); + ITK_TEST_SET_GET_VALUE(maxDistance, filter->GetHistogramDistanceMaximum()); NeighborhoodType::SizeValueType neighborhoodRadius = std::stoi(argv[9]); NeighborhoodType hood; hood.SetRadius(neighborhoodRadius); filter->SetNeighborhoodRadius(hood.GetRadius()); - TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); + ITK_TEST_SET_GET_VALUE(hood.GetRadius(), filter->GetNeighborhoodRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer using WriterType = itk::ImageFileWriter; @@ -111,7 +111,7 @@ RunLengthTextureFeaturesImageFilterTest(int argc, char * argv[]) writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index 0244705eccb..f03d16bd8a2 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx @@ -95,7 +95,7 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); using FeatureImageType = itk::Image; @@ -117,7 +117,7 @@ RunLengthTextureFeaturesImageFilterTestSeparateFeatures(int argc, char * argv[]) writer->SetFileName(outputFilename + "_" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); } diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index c17ccab29bb..f1dd164a86f 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx @@ -95,7 +95,7 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); using FeatureImageType = itk::Image; @@ -117,7 +117,7 @@ RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures(int argc, cha writer->SetFileName(outputFilename + "_" + s + ".nrrd"); writer->SetInput(indexSelectionFilter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); } diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index 04844fcb3f7..907cfc970d0 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx @@ -66,7 +66,7 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) itk::Statistics::RunLengthTextureFeaturesImageFilter; FilterType::Pointer filter = FilterType::New(); - EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); + ITK_EXERCISE_BASIC_OBJECT_METHODS(filter, RunLengthTextureFeaturesImageFilter, ImageToImageFilter); filter->SetInput(reader->GetOutput()); @@ -94,7 +94,7 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer using WriterType = itk::ImageFileWriter; @@ -102,7 +102,7 @@ RunLengthTextureFeaturesImageFilterTestWithVectorImage(int argc, char * argv[]) writer->SetFileName(argv[3]); writer->SetInput(filter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); std::cout << "Test finished." << std::endl; diff --git a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index f9d94bce789..cd40ab15f63 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx @@ -86,7 +86,7 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) filter->SetNeighborhoodRadius(hood.GetRadius()); } - TRY_EXPECT_NO_EXCEPTION(filter->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(filter->Update()); // Create and set up a writer using WriterType = itk::ImageFileWriter; @@ -94,7 +94,7 @@ RunLengthTextureFeaturesImageFilterTestWithoutMask(int argc, char * argv[]) writer->SetFileName(argv[2]); writer->SetInput(filter->GetOutput()); - TRY_EXPECT_NO_EXCEPTION(writer->Update()); + ITK_TRY_EXPECT_NO_EXCEPTION(writer->Update()); std::cout << "Test finished." << std::endl; From 907aa24bb1925cd5949f1da669cfe9d15eee99d8 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Wed, 19 Feb 2020 17:31:13 -0600 Subject: [PATCH 118/135] 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.. ``` --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 87c435fa30c..b49ccfc725d 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -46,7 +46,7 @@ namespace Statistics * Template Parameters: * -# The input image type: a N dimensional image where the pixel type MUST be integer. * -# The output image type: a N dimensional image where the pixel type MUST be a vector of floating points or a - * VectorImage. + *VectorImage. * * Inputs and parameters: * -# An image From 3152a8c54a47b78ddb94fc5a59bdd3d8a6167063 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 14:29:59 -0600 Subject: [PATCH 119/135] 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. --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../Filtering/TextureFeatures/include/itkDigitizerFunctor.h | 2 +- .../include/itkFirstOrderTextureFeaturesImageFilter.h | 4 ++-- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index b49ccfc725d..de4e5f73897 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -214,7 +214,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo using NeighborIndexType = typename NeighborhoodIteratorType::NeighborIndexType; CoocurrenceTextureFeaturesImageFilter(); - ~CoocurrenceTextureFeaturesImageFilter() override {} + ~CoocurrenceTextureFeaturesImageFilter() override = default; bool IsInsideNeighborhood(const OffsetType & iteratedOffset); diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index 72bee4fb93f..f44e8bf4385 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -47,7 +47,7 @@ class Digitizer , m_Max(max) {} - ~Digitizer() {} + ~Digitizer() = default; bool operator!=(const Digitizer & other) const diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 7cf051fd849..7de60ad02f0 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -96,7 +96,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter return 8; } - FirstOrderTextureFeaturesImageFilter() {} + FirstOrderTextureFeaturesImageFilter() = default; void GenerateOutputInformation() override @@ -118,7 +118,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter } - ~FirstOrderTextureFeaturesImageFilter() override {} + ~FirstOrderTextureFeaturesImageFilter() override = default; }; } // end namespace itk diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 9f27e957dc8..8aed099d104 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -238,7 +238,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm using NeighborIndexType = typename NeighborhoodIteratorType::NeighborIndexType; RunLengthTextureFeaturesImageFilter(); - ~RunLengthTextureFeaturesImageFilter() override {} + ~RunLengthTextureFeaturesImageFilter() override = default; void NormalizeOffsetDirection(OffsetType & offset); From 6933cd617929c5466ad080c8c5b2757922ca9e5f Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Mon, 17 Feb 2020 15:50:22 -0600 Subject: [PATCH 120/135] STYLE: Use default member initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converts a default constructor’s member initializers into the new default member initializers in C++11. Other member initializers that match the default member initializer are removed. This can reduce repeated code or allow use of ‘= default’. --- .../Filtering/TextureFeatures/include/itkDigitizerFunctor.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index f44e8bf4385..3e0e8ba0c1b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h @@ -34,8 +34,7 @@ class Digitizer using MaskPixelType = TInput1; Digitizer() - : m_NumberOfBinsPerAxis(256) - , m_MaskValue(1) + : m_MaskValue(1) , m_Min(NumericTraits::min()) , m_Max(NumericTraits::max()) {} @@ -80,7 +79,7 @@ class Digitizer } } - unsigned int m_NumberOfBinsPerAxis; + unsigned int m_NumberOfBinsPerAxis{ 256 }; MaskPixelType m_MaskValue; From 0cefe1b644c14c99c2e2ecda7c16c2fcf510831e Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Wed, 19 Feb 2020 10:45:27 -0600 Subject: [PATCH 121/135] 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/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 2 +- Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h | 2 +- .../include/itkFirstOrderTextureFeaturesImageFilter.h | 2 +- .../TextureFeatures/include/itkFirstOrderTextureHistogram.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 2 +- .../CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx | 2 +- .../test/CoocurrenceTextureFeaturesImageFilterTest.cxx | 2 +- ...oocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx | 2 +- ...extureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 2 +- ...CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx | 2 +- .../CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx | 2 +- .../RunLengthTextureFeaturesImageFilterInstantiationTest.cxx | 2 +- .../test/RunLengthTextureFeaturesImageFilterTest.cxx | 2 +- .../RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx | 2 +- ...extureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 2 +- .../RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx | 2 +- .../test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx | 2 +- .../test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx | 2 +- .../test/itkFirstOrderTextureFeaturesImageFilterTest.cxx | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index de4e5f73897..85bdaf9bbe6 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.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/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 67df6de4f02..886fbf415d4 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -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/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index 3e0e8ba0c1b..510af50ac58 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.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/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 7de60ad02f0..3bbe89b477b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.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/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index d054184f1ab..5c7672bdb28 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.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/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 8aed099d104..57b587e03b7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.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/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index a851ebab888..9c93825f3c6 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index f99325f8de6..1b3630112ea 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index 2809ecc5c18..c10e06b5967 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index fecb85b0a08..ff81f1bae07 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 29aa509cb82..c6362895224 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index 0df50bb6ab3..c08ff016bb3 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index 07b8eb4b1f7..f69c0eac759 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index 4631c63ad33..c56674cad2c 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 004bda3f29d..0cc3d90edb7 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index f03d16bd8a2..1d61a5bdc8e 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index f1dd164a86f..6a1c3dd10db 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index 907cfc970d0..f73ce73b6d1 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index cd40ab15f63..f3a25d718c5 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.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/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index 29f489f2c67..17071112bbb 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.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/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx index 2d6fe2717de..b18003b13a8 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.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 a13868ddd94e17b2dd147fde6dc3e15a06056f13 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 1 Mar 2020 15:01:30 -0600 Subject: [PATCH 122/135] ENH: This code no longer supports ITK 4.13 --- Modules/Filtering/TextureFeatures/itk-module.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index 810c4267fe2..b026d4072e2 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -7,10 +7,6 @@ # By convention those modules outside of ITK are not prefixed with # ITK. -if(NOT "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}" VERSION_LESS "4.13") - set(_GoogleTest_DEPENDS ITKGoogleTest) -endif() - # define the dependencies of the include module and the tests itk_module( TextureFeatures @@ -24,7 +20,7 @@ itk_module( ITKMetaIO ITKImageIntensity ITKImageNoise - ${_GoogleTest_DEPENDS} + ITKGoogleTest DESCRIPTION "Module ingested from upstream." EXCLUDE_FROM_DEFAULT ) From a2db191649fdaa34bfc660b95d36414759d179c4 Mon Sep 17 00:00:00 2001 From: Mathew Seng Date: Fri, 16 Oct 2020 09:58:10 -0500 Subject: [PATCH 123/135] 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/itkFirstOrderTextureFeaturesImageFilter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 3bbe89b477b..8984288d2b6 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -57,7 +57,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter typename Function::FirstOrderTextureHistogram> { public: - ITK_DISALLOW_COPY_AND_ASSIGN(FirstOrderTextureFeaturesImageFilter); + ITK_DISALLOW_COPY_AND_MOVE(FirstOrderTextureFeaturesImageFilter); /** Standard class type alias. */ using Self = FirstOrderTextureFeaturesImageFilter; From 2fb171991853b558963bed2d1850edf0777e93f2 Mon Sep 17 00:00:00 2001 From: Tom Birdsong Date: Tue, 31 May 2022 13:40:41 -0400 Subject: [PATCH 124/135] ENH: Bump ITK and change http to https --- Modules/Filtering/TextureFeatures/LICENSE | 4 ++-- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 2 +- .../Filtering/TextureFeatures/include/itkDigitizerFunctor.h | 2 +- .../include/itkFirstOrderTextureFeaturesImageFilter.h | 2 +- .../TextureFeatures/include/itkFirstOrderTextureHistogram.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 2 +- ...CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx | 2 +- .../test/CoocurrenceTextureFeaturesImageFilterTest.cxx | 2 +- ...currenceTextureFeaturesImageFilterTestSeparateFeatures.cxx | 2 +- ...tureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 2 +- ...ocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx | 2 +- .../CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx | 2 +- .../RunLengthTextureFeaturesImageFilterInstantiationTest.cxx | 2 +- .../test/RunLengthTextureFeaturesImageFilterTest.cxx | 2 +- ...unLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx | 2 +- ...tureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx | 2 +- ...RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx | 2 +- .../RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx | 2 +- .../test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx | 2 +- .../test/itkFirstOrderTextureFeaturesImageFilterTest.cxx | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/LICENSE b/Modules/Filtering/TextureFeatures/LICENSE index d6456956733..62589edd12a 100644 --- a/Modules/Filtering/TextureFeatures/LICENSE +++ b/Modules/Filtering/TextureFeatures/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/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 85bdaf9bbe6..f06a020152c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.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/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 886fbf415d4..5e3e810014b 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h index 510af50ac58..7967cc6e399 100644 --- a/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.h +++ b/Modules/Filtering/TextureFeatures/include/itkDigitizerFunctor.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/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 8984288d2b6..010a756d984 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.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/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index 5c7672bdb28..06bc90caced 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.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/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index 57b587e03b7..e80ac6fde9a 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.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/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index 9c93825f3c6..e4c32fd5cf1 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -6,7 +6,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0.txt + * https://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx index 1b3630112ea..6a008241bad 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterInstantiationTest.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx index c10e06b5967..12da59f5bab 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTest.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx index ff81f1bae07..a1c8031692a 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index c6362895224..bd324338369 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestVectorImageSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx index c08ff016bb3..74f1a1239d2 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithVectorImage.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/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx index f69c0eac759..cca95730159 100644 --- a/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/CoocurrenceTextureFeaturesImageFilterTestWithoutMask.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx index c56674cad2c..24abcd21020 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterInstantiationTest.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx index 0cc3d90edb7..2c6eb197a35 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTest.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx index 1d61a5bdc8e..6b0026e2507 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx index 6a1c3dd10db..2e8c852c36c 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestVectorImageSeparateFeatures.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx index f73ce73b6d1..55292813fe8 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithVectorImage.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/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx index f3a25d718c5..621b282b037 100644 --- a/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.cxx +++ b/Modules/Filtering/TextureFeatures/test/RunLengthTextureFeaturesImageFilterTestWithoutMask.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/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx index 17071112bbb..58177d693b6 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterGTest.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/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx index b18003b13a8..a9b86a1b59e 100644 --- a/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.cxx +++ b/Modules/Filtering/TextureFeatures/test/itkFirstOrderTextureFeaturesImageFilterTest.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 af65ff3dfca604e53f719c3f989552dbb8a85d7f Mon Sep 17 00:00:00 2001 From: Pranjal Sahu Date: Mon, 2 Jan 2023 22:35:27 -0500 Subject: [PATCH 125/135] ENH: Remove unused FixedArray wrapping --- .../wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap | 3 --- .../wrapping/itkRunLengthTextureFeaturesImageFilter.wrap | 3 --- 2 files changed, 6 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap index 6325bfd67e1..94f5b26aa7e 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkCoocurrenceTextureFeaturesImageFilter.wrap @@ -1,7 +1,4 @@ set(OutputVectorDim 8) -itk_wrap_class("itk::FixedArray") -itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") -itk_end_wrap_class() itk_wrap_class("itk::Vector") itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") diff --git a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap index e6a3f8fb9b9..3aeac481842 100644 --- a/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap +++ b/Modules/Filtering/TextureFeatures/wrapping/itkRunLengthTextureFeaturesImageFilter.wrap @@ -1,7 +1,4 @@ set(OutputVectorDim 10) -itk_wrap_class("itk::FixedArray") -itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") -itk_end_wrap_class() itk_wrap_class("itk::Vector") itk_wrap_template("${ITKM_F}${OutputVectorDim}" "${ITKT_F},${OutputVectorDim}") From 86442f6b5ed4ced737152a7efdb00da603fc3765 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 26 Jan 2025 09:02:10 -0600 Subject: [PATCH 126/135] STYLE: Add itkVirtualGetNameOfClassMacro + itkOverrideGetNameOfClassMacro Added two new macro's, intended to replace the old 'itkTypeMacro' and 'itkTypeMacroNoParent'. The main aim is to be clearer about what those macro's do: add a virtual 'GetNameOfClass()' member function and override it. Unlike 'itkTypeMacro', 'itkOverrideGetNameOfClassMacro' does not have a 'superclass' parameter, as it was not used anyway. Note that originally 'itkTypeMacro' did not use its 'superclass' parameter either, looking at commit 699b66cb04d410e555656828e8892107add38ccb, Will Schroeder, June 27, 2001: https://github.com/InsightSoftwareConsortium/ITK/blob/699b66cb04d410e555656828e8892107add38ccb/Code/Common/itkMacro.h#L331-L337 --- .../include/itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../include/itkFirstOrderTextureFeaturesImageFilter.h | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index f06a020152c..03c11a2b913 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -102,7 +102,7 @@ class ITK_TEMPLATE_EXPORT CoocurrenceTextureFeaturesImageFilter : public ImageTo using ConstPointer = SmartPointer; /** Run-time type information (and related methods). */ - itkTypeMacro(CoocurrenceTextureFeaturesImageFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(CoocurrenceTextureFeaturesImageFilter); /** standard New() method support */ itkNewMacro(Self); diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 010a756d984..97b75bbd641 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -73,7 +73,7 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureFeaturesImageFilter itkNewMacro(Self); /** Runtime information support. */ - itkTypeMacro(FirstOrderTextureFeaturesImageFilter, MovingHistogramMorphologyImageFilter); + itkOverrideGetNameOfClassMacro(FirstOrderTextureFeaturesImageFilter); /** Image related type alias. */ using InputImageType = TInputImage; diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h index e80ac6fde9a..6c9253fd6be 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.h @@ -115,7 +115,7 @@ class ITK_TEMPLATE_EXPORT RunLengthTextureFeaturesImageFilter : public ImageToIm using ConstPointer = SmartPointer; /** Run-time type information (and related methods). */ - itkTypeMacro(RunLengthTextureFeaturesImageFilter, ImageToImageFilter); + itkOverrideGetNameOfClassMacro(RunLengthTextureFeaturesImageFilter); /** standard New() method support */ itkNewMacro(Self); From ee3f831618b101826b07c9d9c3507abfe0f5e0da Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 26 Jan 2025 10:55:50 -0600 Subject: [PATCH 127/135] STYLE: Replace itkStaticConstMacro with static constexpr Use static constexpr directly now that C++11 conformance is required by all compilers. :%s/itkStaticConstMacro *( *\([^,]*\),[ \_s]*\([^,]*\),\_s*\([^)]*\)) */static constexpr \2 \1 = \3/ge 'itkStaticConstMacro(name, type, value)' became unconditionally identical to 'static constexpr type name = value' with ITK commit aec95193ab00e1322039911e1032da00f3a103b6 "ENH: Update compiler macros (#810)", maekclena, 7 May 2019. 'itkGetStaticConstMacro(name)' became unconditionally identical to '(Self::name)' with ITK commit 84e490b81e3f3c2b0edb89ae7b9de53bfc52f2b2 "Removing some outdated compiler conditionals", Hans Johnson, 31 July 2010. Most 'itkStaticConstMacro' calls were removed by ITK commit 5c14741e1e063a132ea7e7ee69c5bd0a4e49af74 --- .../include/itkCoocurrenceTextureFeaturesImageFilter.hxx | 2 +- .../include/itkRunLengthTextureFeaturesImageFilter.hxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 5e3e810014b..8e15df4e5c7 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -30,7 +30,7 @@ namespace Statistics { template CoocurrenceTextureFeaturesImageFilter::CoocurrenceTextureFeaturesImageFilter() - : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) + : m_NumberOfBinsPerAxis(Self::DefaultBinsPerAxis) , m_HistogramMinimum(NumericTraits::NonpositiveMin()) , m_HistogramMaximum(NumericTraits::max()) , m_InsidePixelValue(NumericTraits::OneValue()) diff --git a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx index e4c32fd5cf1..d366f0406af 100644 --- a/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkRunLengthTextureFeaturesImageFilter.hxx @@ -30,7 +30,7 @@ namespace Statistics { template RunLengthTextureFeaturesImageFilter::RunLengthTextureFeaturesImageFilter() - : m_NumberOfBinsPerAxis(itkGetStaticConstMacro(DefaultBinsPerAxis)) + : m_NumberOfBinsPerAxis(Self::DefaultBinsPerAxis) , m_HistogramValueMinimum(NumericTraits::NonpositiveMin()) , m_HistogramValueMaximum(NumericTraits::max()) , m_HistogramDistanceMinimum(NumericTraits::ZeroValue()) From 8ad923ccc6cc20c270e903d0045cd0a4f7d2ba75 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 22 Apr 2026 18:55:06 -0500 Subject: [PATCH 128/135] ENH: Convert from md5 to .cid tags. --- .../TextureFeatures/test/Baseline/resultPartialImage1.nrrd.cid | 1 + .../test/Baseline/resultPartialImage1.nrrd.sha512 | 1 - .../TextureFeatures/test/Baseline/resultPartialImage2.nrrd.cid | 1 + .../test/Baseline/resultPartialImage2.nrrd.sha512 | 1 - .../TextureFeatures/test/Baseline/resultPartialImage3.nrrd.cid | 1 + .../test/Baseline/resultPartialImage3.nrrd.sha512 | 1 - .../TextureFeatures/test/Baseline/resultPartialImage4.nrrd.cid | 1 + .../test/Baseline/resultPartialImage4.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_0.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_0.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_1.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_1.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_11.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_11.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_12.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_12.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_13.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_13.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_14.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_14.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_15.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_15.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_16.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_16.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_17.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_17.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_18.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_18.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_2.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_2.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_3.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_3.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_4.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_4.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_5.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_5.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_6.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_6.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_7.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_7.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_8.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_8.nrrd.sha512 | 1 - .../test/Baseline/resultSeparateFeatures_9.nrrd.cid | 1 + .../test/Baseline/resultSeparateFeatures_9.nrrd.sha512 | 1 - .../test/Baseline/resultTestWithoutMask1.nrrd.cid | 1 + .../test/Baseline/resultTestWithoutMask1.nrrd.sha512 | 1 - .../test/Baseline/resultTestWithoutMask2.nrrd.cid | 1 + .../test/Baseline/resultTestWithoutMask2.nrrd.sha512 | 1 - .../test/Baseline/resultTestWithoutMask3.nrrd.cid | 1 + .../test/Baseline/resultTestWithoutMask3.nrrd.sha512 | 1 - .../test/Baseline/resultTestWithoutMask4.nrrd.cid | 1 + .../test/Baseline/resultTestWithoutMask4.nrrd.sha512 | 1 - .../test/Baseline/resultTestWithoutMask5.nrrd.cid | 1 + .../test/Baseline/resultTestWithoutMask5.nrrd.sha512 | 1 - .../test/Baseline/resultTestWithoutMask6.nrrd.cid | 1 + .../test/Baseline/resultTestWithoutMask6.nrrd.sha512 | 1 - .../TextureFeatures/test/Baseline/resultWholeImage.nrrd.cid | 1 + .../TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 | 1 - .../TextureFeatures/test/Baseline/resultWholeImage2.nrrd.cid | 1 + .../TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 | 1 - .../Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.cid | 1 + .../TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 | 1 - .../TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.cid | 1 + .../TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 | 1 - .../Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.cid | 1 + .../TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 | 1 - .../TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.cid | 1 + .../test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 | 1 - Modules/Filtering/TextureFeatures/test/Input/cthead1.png.cid | 1 + Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 | 1 - Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 | 1 - 71 files changed, 35 insertions(+), 36 deletions(-) create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 create mode 100644 Modules/Filtering/TextureFeatures/test/Input/cthead1.png.cid delete mode 100644 Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 delete mode 100644 Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.cid new file mode 100644 index 00000000000..ea4fb3bb5e3 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.cid @@ -0,0 +1 @@ +bafkreieqoy6zuybqpukawjye3d2gpsqupoiaocysx67yh3cutazoyx33be diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.sha512 deleted file mode 100644 index 375da115e85..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage1.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -8c70b43e107ee5fd21549ed9865eb1c75969b1e52aa1694ba2026556f39df9120a5375611565652501830c0a7d3cc8b5b9af92e453e30a476187f869bb02d8d5 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.cid new file mode 100644 index 00000000000..d92f49112d7 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.cid @@ -0,0 +1 @@ +bafkreigidvq27ucb3n66nm6bylexqcjjkco3urjq76cqxgtspde3iotk6m diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.sha512 deleted file mode 100644 index 4d243c4d436..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage2.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -8932e5c79a498fcd8dbf7eb947431cf5a9c0f4fc9be4f73d4df884f76d94b01d6461278b98c30a3a700885fdc94097b4c42c322bf5a9743230289e3fa8f4949e \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.cid new file mode 100644 index 00000000000..d5128394753 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.cid @@ -0,0 +1 @@ +bafkreidjnd3kqczulc2lpe4g2m63bjd2angxghrwzjycukypombolvywei diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.sha512 deleted file mode 100644 index 88935cb6fa2..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage3.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -678389c0a5434f2786688f5bcaf36d994e06c2f5025456251b948ec2e8f46e1b0535b947833351340f63bbda1fe2b2d85fbae4e74ce7f112cf0b24c42b3d8538 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.cid new file mode 100644 index 00000000000..30fe3ec2057 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.cid @@ -0,0 +1 @@ +bafkreih6vvesdbheduxukuo6bof5ecnvjubyya2325mkbdemvdzitggd7m diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.sha512 deleted file mode 100644 index 926a79b05ba..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultPartialImage4.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -a1fc063ca220eef5bc9f973550ce3b25818809e5348a9fd202b166cdcdf72f18bfed27ed3e2c48ebecef9abf51ce1d5032dd0e7daec127f0a6debca4ea24c42a \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.cid new file mode 100644 index 00000000000..ef63bfdbbe3 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.cid @@ -0,0 +1 @@ +bafkreigiu6nyc6uuxily7w6epxsse24zjmq4wd24lub5igaweycxa3pqrq diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.sha512 deleted file mode 100644 index a523f0cc02a..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_0.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -93e24c141eafa6695a39ddd6576a0525421a4f785d348c1ef4e448114bc3dc04892851dce1d75254db3af8bfa176fd53b3f1389623eb08368dbf97651658fdc9 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.cid new file mode 100644 index 00000000000..3257fecbbe7 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.cid @@ -0,0 +1 @@ +bafkreihi57ay4th7ge6vgs2nu33mnn7g5ys3asg6zyodfv52k7vax5qp3m diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.sha512 deleted file mode 100644 index 77b6325328a..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_1.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -bb7b2358b4fbc0e3760380873aaacfee5f1f77239655f2723328df1c57a8a2c7de877557da04405dded6c3305d85f6c0a98cd0b324b3b77c3627c1c85d2630cb \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.cid new file mode 100644 index 00000000000..9ba7e46c05c --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.cid @@ -0,0 +1 @@ +bafkreibwfa2yxnhgzetzd5fao7b5ptofgc7givdsqgiwm5s6ksrw5adiie diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.sha512 deleted file mode 100644 index e4d5a55d244..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_11.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -f654bcc438a39619134eb003d119c2aa4d59a92c5a77a95391fd5fa73e5841fc7a158c40d36dfee8b7e4083ac2d6b96e046aac580d1f5797c43ccb393dbc2454 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.cid new file mode 100644 index 00000000000..81ec47a8816 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.cid @@ -0,0 +1 @@ +bafkreieaz4f4pw3xfzmauzp2uveaaku6v4rjpcpszffmubt4dwdxb7b4yy diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.sha512 deleted file mode 100644 index 7c3bfd27787..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_12.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -f6aa157c18a57e5ff73f149f884dd55911465d6fa0b848a69d92bc0fff445f73d822e302d41a5fa0006dbff3c533ef31783b32ebfaf97ad206be4c71a6707f03 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.cid new file mode 100644 index 00000000000..40f7c26bcca --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.cid @@ -0,0 +1 @@ +bafkreia4lyk5q6t734mdwe55ydevyvhod4p7l4ukkdmcvfakxkcufod6qm diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.sha512 deleted file mode 100644 index fa8a44a9498..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_13.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -583b3efa528829dfe682776b128eb0d15295de20f1f75879cc49febb4f0bbfd052bf68346b984f34b8756ce71344bca23643268fd44c39259b5c6e18202a52e1 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.cid new file mode 100644 index 00000000000..27b50db2c45 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.cid @@ -0,0 +1 @@ +bafkreifju6wt7gckka7kfwcot5nqal65jt5lisoajhwjdxiym77hz75vpe diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.sha512 deleted file mode 100644 index 4a598e9f0c1..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_14.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -266fd05a257d104fe0093c8082813d81fd5132ab2ba88a141ef1e83bc3a1195a80235a87ecdffbb28cc8a80b6e1788205f735e8ffbe1e51d79203b01fc66eee3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.cid new file mode 100644 index 00000000000..9626a125d42 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.cid @@ -0,0 +1 @@ +bafkreig3q4efde4i2hbxsg5tz224kgmp37tyi2o6qxmnvlmqkw265qmhmu diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.sha512 deleted file mode 100644 index 07ae7715f7f..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_15.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -0ff74662a7de30f4817f6304455ab6bbdbe0872dba61c6791b5f1e954ed381619744dc2a76613d1b3470714a9e5a3d20e0e0c4aecf106db88ab3fe4deea381f9 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.cid new file mode 100644 index 00000000000..ccd3602610c --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.cid @@ -0,0 +1 @@ +bafkreih5yz7h5lodawb7bsyvipb3f3yv77gclqikiov4xrdc3p3xbmq7b4 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.sha512 deleted file mode 100644 index 745e5c6e511..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_16.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -80f4edc5ccc766df5053eb549050e89400072678a65b106a19e0eef271491ae8ad8afad2c9ab2fae783aad11b2bbfedf28ffa72f108b8936f07e9694b373c25c \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.cid new file mode 100644 index 00000000000..380c4d9e40c --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.cid @@ -0,0 +1 @@ +bafkreiclviqbaoqapce5fesanfccwdsxq6ky2cuvjzfp2antw74upktcki diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.sha512 deleted file mode 100644 index 872ae1eec2b..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_17.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -6a37df8d4f3c360d0029edde5973a68edba69a3ab504437db9173f87afb6aff16ee31f48084d021abf03b3ea3bfe6314c0a0589f6895ac1947ba63214ce881db \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.cid new file mode 100644 index 00000000000..15b72984319 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.cid @@ -0,0 +1 @@ +bafkreibkydefzskqsjyxgnuf5l6zwfbrr36dfy7jwd5zgh2mrfknfzcx44 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.sha512 deleted file mode 100644 index f7dcbde08a5..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_18.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -e876e3b86c5e3591522ee7b6f6d8986c992e51f175d7105bd27b54bef366f97839b96e52139138067bd8db822f022e86d90d6d41b63703b7145c5e1cbdd97b3a \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.cid new file mode 100644 index 00000000000..07c3a64ae68 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.cid @@ -0,0 +1 @@ +bafkreibcxzft3pj57wv7jonbkuikte7mhvhzs3xrerogarigoujqmzof5e diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.sha512 deleted file mode 100644 index 950ebb1fb98..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_2.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -0f81d5019786648bd25c3c66b9246c3e8b0d8e408f1a0cc7c1cc1c6a63a4362e3c4067ffdd9e3a9770cdc553dba89ac617add0af9ca424a88943170dee18fb73 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.cid new file mode 100644 index 00000000000..6ad4920342a --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.cid @@ -0,0 +1 @@ +bafkreihz4frhrl2l5lj2kanzijvmhpic325qpznj5tvfik3fadwjugbydi diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.sha512 deleted file mode 100644 index 6f1d0f5d377..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_3.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -e236783b1dacb95f20d24a51bf1c9cec07cb4443ed8229e53c8b02f84e873542a062d14263af50f33a8f3e3fa067e2f2f6816a8bf04209f990490c489da111f8 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.cid new file mode 100644 index 00000000000..62f24831b27 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.cid @@ -0,0 +1 @@ +bafkreicir2u4nyg4iqhq4riwpz4y36vuyti7gsboi72kphf5rlk4gtfpoi diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.sha512 deleted file mode 100644 index 6f4f89003f6..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_4.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -45368c67b67d4e015f3bd1924921bbe560116e48c7a1c3807358efee80bbf55ae86f48cddca20cefc08838eac3932504d7fb0a0aedd53a9a63380c771a0991a7 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.cid new file mode 100644 index 00000000000..f08572721de --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.cid @@ -0,0 +1 @@ +bafkreiaxnk5a5i6iujizpkludyyp7jepyublr7mnc4tmzh4it55xmg7p5e diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.sha512 deleted file mode 100644 index 77b34c4aef9..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_5.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -cb93020a468ba4732d5dc247811a34ba5029c47120a3a5a354c129975682264350dffca7529f665f358e1448cbaa6f7311966d8b76c036966d6ab07dc6a69d4d \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.cid new file mode 100644 index 00000000000..3e1a815b329 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.cid @@ -0,0 +1 @@ +bafkreihnlgnqswqytbhokkkwg2au3byusqrlxr4z2agqjyn5wfjumbt5du diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.sha512 deleted file mode 100644 index 8f6499e69f2..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_6.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -2ab51fd7bdcba5e7556260b22af076e678428b7b07b6a2e436547d40eb519fdd4ad4a9e535d3bd0a5fb19bc0fde25e17d88ae0ea033aad91d2af2ed248f6c440 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.cid new file mode 100644 index 00000000000..b5c0800014b --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.cid @@ -0,0 +1 @@ +bafkreibid3omq626ubiphod2qc2v3k6higegt64xfb3d7iognybclx7mjm diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.sha512 deleted file mode 100644 index 33045afc176..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_7.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -bba2452afe4e93a14f937d4e45a818d68877966c75cac4793d79c3a8a59646477ee7828a9b5fb89c6bc80c4a0c34f7af3d683dfec07c4dad5d0ceb071117c03f \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.cid new file mode 100644 index 00000000000..459d618a439 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.cid @@ -0,0 +1 @@ +bafkreib5nvhzsu4uuk4scjqc5x6a3ux36d6lmctihoyskthsmqr4evix3a diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.sha512 deleted file mode 100644 index c282f2afafe..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_8.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -4720691961c132f0e859feb37b4cba1c3fbab39cf52dd2d5ede82e3b427097aad677872f14c1053d6eb2edcad7815d748e0a17b89eb82407ce252b7055e5d4ca \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.cid new file mode 100644 index 00000000000..59bb35760a3 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.cid @@ -0,0 +1 @@ +bafkreigdnxtoiwvqqbdrwh3i3lkvk7th5ieck5rcdf6caszeuo4ic3posm diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.sha512 deleted file mode 100644 index 8a211a47c14..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultSeparateFeatures_9.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -eddafd8685feb10c672458b1785c40bcb854b04739af7e0bb83c59bc0f5a10f153ef4f9a35e9dc075118c6888d36fd1f131f3be5fb7b59c9d2013dc446c0e0d3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.cid new file mode 100644 index 00000000000..3e44784a4e4 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.cid @@ -0,0 +1 @@ +bafkreidgeywjxwcvcy7lsjezicpqjnqous7mnwnc4or6axok4im422fjfy diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.sha512 deleted file mode 100644 index 75f26f04214..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask1.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -703536a733bf6b0b3363a7fcdb7815f39eec979af46831f6e667a95e56970a4303e2848b6377364b01d42c360bf757672d0af279c7fa816b170fcd3f82a5a2e3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.cid new file mode 100644 index 00000000000..d1812a394e4 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.cid @@ -0,0 +1 @@ +bafkreiexanvvgdzwax535bq7ug2gs3t4xbvummid4hlx7aj6qhlghkwea4 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.sha512 deleted file mode 100644 index 4cc72d9def4..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask2.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -c22139d6fc5ad86b46eb56f01d1add99d3f42d323a9e06ab1c31c3cb818bd6d8fc32f5780eb7a77ab7f62621b54aa4df66d1b55ef6c4082027bad1a3de3b1d5f \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.cid new file mode 100644 index 00000000000..1ade7983152 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.cid @@ -0,0 +1 @@ +bafkreia67vny4sjg4qtejp2yaefkyqetivjor7rheaxgdyqnxdgdolno5e diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.sha512 deleted file mode 100644 index 8603179ae45..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask3.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -bec921ec2279d8fad501058a24050ea3b88ebd06edb32f37cfb79a5eccaa690598adeb09604394855aa2ef2a8f9dc7691ceb1adc18be3df74c37a45924543618 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.cid new file mode 100644 index 00000000000..c5116229649 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.cid @@ -0,0 +1 @@ +bafkreig7fct5rdfv7f37hocqpowwltt7fhy2qnq66u5wlfnn4fk2dm7t44 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.sha512 deleted file mode 100644 index cbc84d618f3..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask4.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -abaa5d133f43b29e75223b4929fc5f2933fc930b25089fac4dd56e5e4bbb1f4d77b505c9c7609bdddc8d2afc843aab64b5d7881bd4ee61938c3a99fe0a53ff30 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.cid new file mode 100644 index 00000000000..a4ab68bf01d --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.cid @@ -0,0 +1 @@ +bafkreicyneybl2xbnoft7i5ithlx3belf3azztjjk5s652kzy63aqx7y24 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.sha512 deleted file mode 100644 index b26c2a6b59f..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask5.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -01cfaf271b9c4acf9211e2ab6684e8ef0869b8c3e76e93e2f28f39e5902ddf3b7e7effc6cc64fea99441243a665db91649403e69bafe357161dfe851b0f10773 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.cid new file mode 100644 index 00000000000..0f15f133092 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.cid @@ -0,0 +1 @@ +bafkreicbuqzfy2nqcpfvoqf4gucysfl52mzmcvab2ufevmwkpc6idjgufi diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.sha512 deleted file mode 100644 index 21b849b272f..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultTestWithoutMask6.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -5bcaf5d18e8e9e15e108da7dc8165b491b43b624a55ead9b12b5b411598cb993194a459685cf3f2cb9103ee583c29d244eacf64ac57b2617e5eaf9044594de80 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.cid new file mode 100644 index 00000000000..2945fe7e761 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.cid @@ -0,0 +1 @@ +bafkreihfxf2ofq2jlcuq3s2ploditkh7sx4q56e7euy33p6yaowjh3tfp4 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 deleted file mode 100644 index 93942e15070..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -a53485703dec98137203d2f7beb22e364a56f088096464192f77964d101006c1225fc261d70b78945f40667f17f9b8fb44f124d785a65dd0d0c06601d976ed63 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.cid new file mode 100644 index 00000000000..da315109369 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.cid @@ -0,0 +1 @@ +bafkreidmhhresse5jrsz3t2ep4fplmwdtez3bw2t4n7du7kxeb7mnu62j4 diff --git a/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 deleted file mode 100644 index f4fedaf4a7a..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Baseline/resultWholeImage2.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -e0545eda598ec24d1a66d580a8796c98015897e638879f8c42cbfb6e644e011cdf1b8d2d4a1012a647a210bd924c582a79746a833a7b6c3d92cd4baee26d399b \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.cid new file mode 100644 index 00000000000..5b9dae5e334 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.cid @@ -0,0 +1 @@ +bafkreid4rlyt3wo75vmo2gtvjlafeurrosreelglyuzao4y4iogfosfm5i diff --git a/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 deleted file mode 100644 index d0997ab78c4..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -51021537bf300d3c919ca231341ec7c8c68a067ee72bf37a3929fa6f1aa1dd282c9b850c4f84baf104a4bc167b4b5739eee3868e58fc41a24006db975e7655d3 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.cid new file mode 100644 index 00000000000..10f944714e9 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.cid @@ -0,0 +1 @@ +bafkreidfez4stfcamwt7xwm4imamlxamdp5guyzbqglctmwahcnqfik2xu diff --git a/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 deleted file mode 100644 index d380c93b32f..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Input/Scan_CBCT_13R_D1_crop.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -001283114ac0cac8ac7185b857eaa6321632e1c1f6af9a84165e58d093265857bc356cd71e76d012d7f118bafd1e8450a2396118b2fcfd84329d3a4e22bcb761 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.cid new file mode 100644 index 00000000000..b9ab2b62d24 --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.cid @@ -0,0 +1 @@ +bafkreict23shcetpoj22obkpg3ke3ltlqyymp7m2wzgndkmdoh6liq3yne diff --git a/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 deleted file mode 100644 index 7f087e8f9fa..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -ee3ee74d47e22850be988fe756d3aec0f2d8b6925bc4610c8d2746ad3f64aaf427e18467454e398ebfe13aa026913f89b3c40feac9971f985954fd7eb7c8fad5 \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.cid b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.cid new file mode 100644 index 00000000000..e4488d33abe --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.cid @@ -0,0 +1 @@ +bafkreifwpvyouggt2shr3vajozfp33h2eglcanvntk7ofw2fj4drrnlulq diff --git a/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 b/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 deleted file mode 100644 index b125a4c0734..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Input/SegmC_CBCT_13R_D1_crop.nrrd.sha512 +++ /dev/null @@ -1 +0,0 @@ -a5109db5d6071d239d0770e225a85ff4022c1680a4aab4e51fb2583535fc458081f8eea753223a8d9b6c84c2da867f2d8e66faf1aa4fd23b1b65a175bacd494b \ No newline at end of file diff --git a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.cid b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.cid new file mode 100644 index 00000000000..fed459e534a --- /dev/null +++ b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.cid @@ -0,0 +1 @@ +bafkreieilrgrns7xcna5yle2yw3q2wxkl3wn7lp22k4d4pwjhlhwc3ed4u diff --git a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 deleted file mode 100644 index 90ab0f6f2b9..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.md5 +++ /dev/null @@ -1 +0,0 @@ -e395391caad7463c8231bd5f2ce9d61b diff --git a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 b/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 deleted file mode 100644 index 68f07f886ad..00000000000 --- a/Modules/Filtering/TextureFeatures/test/Input/cthead1.png.sha512 +++ /dev/null @@ -1 +0,0 @@ -32d5c12cd02f537c901ee48ad2f438fcf5399f7292bf9c0abfb8da91b74fc2e0c4983e9650283db3462d22f05f05a8637a6c3b8188159e4bbd6dc68804a84870 From ecb5ea8b2a1d62ae0791e9292b69ee5c2c5fa94b Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 8 May 2026 10:09:40 -0500 Subject: [PATCH 129/135] ENH: Add v4 whitelist for TextureFeatures ingest --- .../whitelists/TextureFeatures.list | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Utilities/Maintenance/RemoteModuleIngest/whitelists/TextureFeatures.list diff --git a/Utilities/Maintenance/RemoteModuleIngest/whitelists/TextureFeatures.list b/Utilities/Maintenance/RemoteModuleIngest/whitelists/TextureFeatures.list new file mode 100644 index 00000000000..ec6877ac997 --- /dev/null +++ b/Utilities/Maintenance/RemoteModuleIngest/whitelists/TextureFeatures.list @@ -0,0 +1,23 @@ +# TextureFeatures — files that migrate into ITK at +# Modules/Filtering/TextureFeatures/ +# +# Format: one path per line, relative to the upstream repo root. +# Globs supported via filter-repo --paths-from-file (treated as +# path prefixes; trailing /** matches everything beneath the dir). +# Lines starting with '#' are comments; blank lines ignored. + +# Public headers +include + +# Tests + fixtures +test + +# Python wrapping +wrapping + +# CMake / module metadata +CMakeLists.txt +itk-module.cmake + +# License (always migrates with the code) +LICENSE From 99dd89a838c8bc9c423ad9b7580382ee65ceff3d Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 8 May 2026 10:11:55 -0500 Subject: [PATCH 130/135] DOC: Add TextureFeatures README pointing at upstream --- Modules/Filtering/TextureFeatures/README.md | 31 +++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Modules/Filtering/TextureFeatures/README.md diff --git a/Modules/Filtering/TextureFeatures/README.md b/Modules/Filtering/TextureFeatures/README.md new file mode 100644 index 00000000000..9157aa2392d --- /dev/null +++ b/Modules/Filtering/TextureFeatures/README.md @@ -0,0 +1,31 @@ +# TextureFeatures + +In-tree ITK module providing N-dimensional textural feature image +filters. The flagship classes compute first-order, run-length, and +co-occurrence (GLCM) texture features over a sliding window for each +voxel of an input image, producing per-feature output maps suitable +for radiomics and computer-vision pipelines. + +The flagship filters are +`itk::CoocurrenceTextureFeaturesImageFilter`, +`itk::FirstOrderTextureFeaturesImageFilter`, and +`itk::RunLengthTextureFeaturesImageFilter`, with supporting +`itk::DigitizerFunctor` and `itk::FirstOrderTextureHistogram` building +blocks. + +## Origin + +Ingested from the standalone remote module +[**InsightSoftwareConsortium/ITKTextureFeatures**](https://github.com/InsightSoftwareConsortium/ITKTextureFeatures) +on 2026-05-08, following the v4 ingestion guidelines defined in +InsightSoftwareConsortium/ITK#6204. The upstream repository will be +archived read-only after this PR merges; it remains reachable at the +URL above for historical reference (notably the `doc/` and `example/` +directories, which were intentionally left in the upstream archive). + +## References + +- Vimort J., McCormick M., Budin F., Paniagua B. + *Computing Textural Feature Maps for N-Dimensional images.* + The Insight Journal. January-December. 2017. + From 9755347bc1d77a58faf20f0824729b5f6a205b3a Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 8 May 2026 10:11:57 -0500 Subject: [PATCH 131/135] COMP: Remove TextureFeatures .remote.cmake (in-tree) --- Modules/Remote/TextureFeatures.remote.cmake | 61 --------------------- 1 file changed, 61 deletions(-) delete mode 100644 Modules/Remote/TextureFeatures.remote.cmake diff --git a/Modules/Remote/TextureFeatures.remote.cmake b/Modules/Remote/TextureFeatures.remote.cmake deleted file mode 100644 index 10a9785d83e..00000000000 --- a/Modules/Remote/TextureFeatures.remote.cmake +++ /dev/null @@ -1,61 +0,0 @@ -#-- # Grading Level Criteria Report -#-- EVALUATION DATE: 2020-03-01 -#-- EVALUATORS: [<>,<>] -#-- -#-- ## Compliance level 5 star (AKA ITK main modules, or remote modules that could become core modules) -#-- - [ ] Widespread community dependance -#-- - [ ] Above 90% code coverage -#-- - [ ] CI dashboards and testing monitored rigorously -#-- - [ ] Key API features are exposed in wrapping interface -#-- - [ ] All requirements of Levels 4,3,2,1 -#-- -#-- ## Compliance Level 4 star (Very high-quality code, perhaps small community dependance) -#-- - [ ] Meets all ITK code style standards -#-- - [ ] No external requirements beyond those needed by ITK proper -#-- - [ ] Builds and passes tests on all supported platforms within 1 month of each core tagged release -#-- - [ ] Windows Shared Library Build with Visual Studio -#-- - [ ] Mac with clang compiller -#-- - [ ] Linux with gcc compiler -#-- - [ ] Active developer community dedicated to maintaining code-base -#-- - [ ] 75% code coverage demonstrated for testing suite -#-- - [ ] Continuous integration testing performed -#-- - [ ] All requirements of Levels 3,2,1 -#-- -#-- ## Compliance Level 3 star (Quality beta code) -#-- - [ ] API | executable interface is considered mostly stable and feature complete -#-- - [ ] 10% C0-code coverage demonstrated for testing suite -#-- - [ ] Some tests exist and pass on at least some platform -#-- - [X] All requirements of Levels 2,1 -#-- -#-- ## Compliance Level 2 star (Alpha code feature API development or niche community/execution environment dependance ) -#-- - [X] Compiles for at least 1 niche set of execution envirionments, and perhaps others -#-- (may depend on specific external tools like a java environment, or specific external libraries to work ) -#-- - [X] All requirements of Levels 1 -#-- -#-- ## Compliance Level 1 star (Pre-alpha features under development and code of unknown quality) -#-- - [X] Code complies on at least 1 platform -#-- -#-- ## Compliance Level 0 star ( Code/Feature of known poor-quality or deprecated status ) -#-- - [ ] Code reviewed and explicitly identified as not recommended for use -#-- -#-- ### Please document here any justification for the criteria above -# Code style enforced by clang-format on 2020-02-19, and clang-tidy modernizations completed - -# Contact: Jean-Baptiste VIMORT -itk_fetch_module( - TextureFeatures - "Filters to estimate texture feature maps from N-dimensional grayscale -images. This includes first-order texture features, grey level co-occurrence -matrix (GLCM) features, and grey level run-length matrix (GLRLM) features. - -For more information, see: - - Vimort J., McCormick M., Budin F., Paniagua B. - Computing Textural Feature Maps for N-Dimensional images - The Insight Journal. January-December. 2017. - https://doi.org/10.54294/qy48ty -" - MODULE_COMPLIANCE_LEVEL 2 - GIT_REPOSITORY https://github.com/InsightSoftwareConsortium/ITKTextureFeatures.git - GIT_TAG 54e259e445905279a996cca9da92af68af3191f6 - ) From 0078c3799f16a66db1d0e476e32307c770bafe61 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 8 May 2026 10:11:59 -0500 Subject: [PATCH 132/135] ENH: Enable Module_TextureFeatures in configure-ci --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index c73ae38c83d..b35d46425a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,7 @@ cmd = '''cmake \ -DModule_MorphologicalContourInterpolation:BOOL=ON \ -DModule_RLEImage:BOOL=ON \ -DModule_SubdivisionQuadEdgeMeshFilter:BOOL=ON \ + -DModule_TextureFeatures:BOOL=ON \ -DITK_COMPUTER_MEMORY_SIZE:STRING=11 \ -DModule_StructuralSimilarity:BOOL=ON''' description = "Configure ITK for CI (with ccache compiler launcher)" From 8353852ddbc0dbae3b32df33b71bb7dd5dac3438 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 8 May 2026 13:16:23 -0500 Subject: [PATCH 133/135] COMP: Address TextureFeatures review concerns CMakeLists.txt: drop the standalone-build branch (if(NOT ITK_SOURCE_DIR) ... else()); only the ITK-embedded path is load-bearing in-tree. itk-module.cmake: replace the boilerplate-comments block with a DOCUMENTATION variable describing the module's purpose, and pass that variable through to DESCRIPTION. LICENSE: remove the per-module copy; ITK's root LICENSE applies. --- .../Filtering/TextureFeatures/CMakeLists.txt | 31 +-- Modules/Filtering/TextureFeatures/LICENSE | 202 ------------------ .../TextureFeatures/itk-module.cmake | 17 +- 3 files changed, 8 insertions(+), 242 deletions(-) delete mode 100644 Modules/Filtering/TextureFeatures/LICENSE diff --git a/Modules/Filtering/TextureFeatures/CMakeLists.txt b/Modules/Filtering/TextureFeatures/CMakeLists.txt index 1091a194e05..fcebd3f7af1 100644 --- a/Modules/Filtering/TextureFeatures/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/CMakeLists.txt @@ -1,32 +1,3 @@ project(TextureFeatures) -if(NOT ITK_SOURCE_DIR) - find_package(ITK 4.10 REQUIRED) - list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) - - if(SKBUILD) - set( - PY_SITE_PACKAGES_PATH - ${CMAKE_INSTALL_PREFIX} - CACHE PATH - "The install - prefix for python package contents" - ) - install( - CODE - " - unset(CMAKE_INSTALL_COMPONENT) - set(COMPONENT \"PythonWheelRuntimeLibraries\") - set(CMAKE_INSTALL_DO_STRIP 1) - include\(\"${PROJECT_BINARY_DIR}/cmake_install.cmake\") - unset(CMAKE_INSTALL_COMPONENT) - return() - " - ) - endif() - - include(ITKModuleExternal) - include_directories(${ITK_INCLUDE_DIRS}) -else() - itk_module_impl() -endif() +itk_module_impl() diff --git a/Modules/Filtering/TextureFeatures/LICENSE b/Modules/Filtering/TextureFeatures/LICENSE deleted file mode 100644 index 62589edd12a..00000000000 --- a/Modules/Filtering/TextureFeatures/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - https://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 - - 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, - 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. diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index b026d4072e2..9ea915bf8f8 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -1,13 +1,10 @@ -# the top-level README is used for describing this module, just -# re-used it for documentation here -# itk_module() defines the module dependencies in ModuleTemplate -# ModuleTemplate depends on ITKCommon -# The testing module in ModuleTemplate depends on ITKTestKernel -# and ITKMetaIO(besides ModuleTemplate and ITKCore) -# By convention those modules outside of ITK are not prefixed with -# ITK. +set( + DOCUMENTATION + "N-dimensional textural feature image filters: first-order, +run-length, and co-occurrence (GLCM) features computed over a +sliding window for radiomics and computer-vision pipelines." +) -# define the dependencies of the include module and the tests itk_module( TextureFeatures DEPENDS @@ -21,6 +18,6 @@ itk_module( ITKImageIntensity ITKImageNoise ITKGoogleTest - DESCRIPTION "Module ingested from upstream." + DESCRIPTION "${DOCUMENTATION}" EXCLUDE_FROM_DEFAULT ) From 813ee16a95ad2816acc4229e75727ace274556a8 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Fri, 8 May 2026 17:41:30 -0500 Subject: [PATCH 134/135] STYLE: Address Greptile review on TextureFeatures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit itkFirstOrderTextureHistogram.h: guard the unbiased-variance estimate on count > 1 so a single-pixel window no longer divides by zero and produces NaN skewness; correct the stale \ingroup tag. itkFirstOrderTextureFeaturesImageFilter.h: correct the stale \ingroup tag from ITKTextureFeatures (old remote-module name) to TextureFeatures. itkCoocurrenceTextureFeaturesImageFilter.h: drop the unrelated itkScalarImageToRunLengthMatrixFilter.h include — neither the .h nor .hxx uses any type from it. itkCoocurrenceTextureFeaturesImageFilter.hxx: write a zero output pixel on the totalNumberOfFreq == 0 branch so the output never contains uninitialized memory; replace raw new[]/delete[] of the marginal-sums buffer with std::vector for exception safety and zero-initialization. test/CMakeLists.txt: drop the dead first set(TextureFeaturesTests …) block — it listed nonexistent ScalarImageTo* sources and was immediately overwritten by the second definition. --- .../itkCoocurrenceTextureFeaturesImageFilter.h | 2 +- .../itkCoocurrenceTextureFeaturesImageFilter.hxx | 15 ++++++++------- .../itkFirstOrderTextureFeaturesImageFilter.h | 2 +- .../include/itkFirstOrderTextureHistogram.h | 6 +++--- .../Filtering/TextureFeatures/test/CMakeLists.txt | 15 --------------- 5 files changed, 13 insertions(+), 27 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h index 03c11a2b913..d57b371ab20 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.h @@ -19,8 +19,8 @@ #define itkCoocurrenceTextureFeaturesImageFilter_h #include "itkImageToImageFilter.h" -#include "itkScalarImageToRunLengthMatrixFilter.h" #include "itkConstNeighborhoodIterator.h" +#include "itkVectorContainer.h" namespace itk { diff --git a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx index 8e15df4e5c7..5d38ffb713c 100644 --- a/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx +++ b/Modules/Filtering/TextureFeatures/include/itkCoocurrenceTextureFeaturesImageFilter.hxx @@ -24,6 +24,8 @@ #include "itkBinaryFunctorImageFilter.h" #include "itkDigitizerFunctor.h" +#include + namespace itk { namespace Statistics @@ -229,6 +231,11 @@ CoocurrenceTextureFeaturesImageFilter::Dy this->ComputeFeatures(hist, totalNumberOfFreq, outputPixel); outputIt.Set(outputPixel); } + else + { + outputPixel.Fill(0); + outputIt.Set(outputPixel); + } ++inputNIt; ++outputIt; @@ -360,12 +367,8 @@ CoocurrenceTextureFeaturesImageFilter::Co // cleverly compressed to one pass, but it's not clear that that's necessary. // Initialize everything - auto * marginalSums = new double[m_NumberOfBinsPerAxis]; + std::vector marginalSums(m_NumberOfBinsPerAxis, 0.0); - for (double * ms_It = marginalSums; ms_It < marginalSums + m_NumberOfBinsPerAxis; ms_It++) - { - *ms_It = 0; - } pixelMean = 0; // Ok, now do the first pass through the histogram to get the marginal sums @@ -417,8 +420,6 @@ CoocurrenceTextureFeaturesImageFilter::Co pixelVariance += (a - pixelMean) * (a - pixelMean) * (frequency); } } - - delete[] marginalSums; } template diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h index 97b75bbd641..1ccac084521 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureFeaturesImageFilter.h @@ -45,7 +45,7 @@ namespace itk * so that the boundary pixel have lets data to compute the * statistics. * - * \ingroup ITKTextureFeatures + * \ingroup TextureFeatures */ template diff --git a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h index 06bc90caced..7451ee045b1 100644 --- a/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h +++ b/Modules/Filtering/TextureFeatures/include/itkFirstOrderTextureHistogram.h @@ -34,7 +34,7 @@ namespace Function * std::map based "histogram" during iteration and computes first * order statistics from the histogram. * - * \ingroup ITKTextureFeatures + * \ingroup TextureFeatures */ template class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram @@ -96,8 +96,8 @@ class ITK_TEMPLATE_EXPORT FirstOrderTextureHistogram const double mean = sum / count; - // unbiased estimate - const double variance = (sum2 - (sum * sum) / count) / (count - 1); + // unbiased estimate (requires at least 2 samples) + const double variance = (count > 1) ? (sum2 - (sum * sum) / count) / (count - 1) : 0.0; const double sigma = std::sqrt(variance); double skewness = 0.0; double kurtosis = 0.0; diff --git a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt index a3aee6269db..31d95c9f469 100644 --- a/Modules/Filtering/TextureFeatures/test/CMakeLists.txt +++ b/Modules/Filtering/TextureFeatures/test/CMakeLists.txt @@ -1,20 +1,5 @@ itk_module_test() -set( - TextureFeaturesTests - ScalarImageToRunLengthFeaturesImageFilterInstantiationTest.cxx - ScalarImageToRunLengthFeaturesImageFilterTest.cxx - ScalarImageToRunLengthFeaturesImageFilterTestSeparateFeatures.cxx - ScalarImageToRunLengthFeaturesImageFilterTestWithoutMask.cxx - ScalarImageToRunLengthFeaturesImageFilterTestWithVectorImage.cxx - ScalarImageToRunLengthFeaturesImageFilterTestVectorImageSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterInstantiationTest.cxx - ScalarImageToTextureFeaturesImageFilterTest.cxx - ScalarImageToTextureFeaturesImageFilterTestSeparateFeatures.cxx - ScalarImageToTextureFeaturesImageFilterTestWithoutMask.cxx - ScalarImageToTextureFeaturesImageFilterTestWithVectorImage.cxx -) - set( TextureFeaturesTests RunLengthTextureFeaturesImageFilterInstantiationTest.cxx From 9a16d9075dc172f52e548d11d06fdae9b00699ba Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sat, 9 May 2026 06:56:50 -0500 Subject: [PATCH 135/135] COMP: Inline static DESCRIPTION in itk-module.cmake Replace the set(DOCUMENTATION "...") + DESCRIPTION "${DOCUMENTATION}" indirection with a static one-liner literal. itk_module() is a CMake macro, so ${ARGN} re-tokenizes its arguments and list-splits any embedded ";". A future edit adding a semicolon or "[" to the DOCUMENTATION string would silently produce spurious "Unknown argument" AUTHOR_WARNINGs from CMake/ITKModuleMacros.cmake:111 on every configure (see PRs #6220, #6245). The v4 ingestion pipeline (PR #6204) enforces this via sanitize-history.py:patch_dynamic_description. --- Modules/Filtering/TextureFeatures/itk-module.cmake | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Modules/Filtering/TextureFeatures/itk-module.cmake b/Modules/Filtering/TextureFeatures/itk-module.cmake index 9ea915bf8f8..cec84ba8bc4 100644 --- a/Modules/Filtering/TextureFeatures/itk-module.cmake +++ b/Modules/Filtering/TextureFeatures/itk-module.cmake @@ -1,10 +1,3 @@ -set( - DOCUMENTATION - "N-dimensional textural feature image filters: first-order, -run-length, and co-occurrence (GLCM) features computed over a -sliding window for radiomics and computer-vision pipelines." -) - itk_module( TextureFeatures DEPENDS @@ -18,6 +11,7 @@ itk_module( ITKImageIntensity ITKImageNoise ITKGoogleTest - DESCRIPTION "${DOCUMENTATION}" + DESCRIPTION + "N-dimensional textural feature image filters: first-order, run-length, and co-occurrence (GLCM) features computed over a sliding window for radiomics and computer-vision pipelines." EXCLUDE_FROM_DEFAULT )