diff --git a/Documentation/ITK5MigrationGuide.md b/Documentation/ITK5MigrationGuide.md index 92f5b1d47f1..f30c907f356 100644 --- a/Documentation/ITK5MigrationGuide.md +++ b/Documentation/ITK5MigrationGuide.md @@ -405,6 +405,8 @@ Class changes [itk::FilterWatcher](../Modules/Core/TestKernel/include/itkFilterWatcher.h) was deleted. It should be replaced by [itk::SimpleFilterWatcher](../Modules/Core/Common/include/itkSimpleFilterWatcher.h). +`itksys::hash_map` has been removed. It should be replaced by `std::unordered_map`. + Since `itk::ProgressReporter` does not work well with the new threading model, it should be replaced by `itk::ProgressTransformer`. This only applies to classes which use `GenerateData()` method, and either diff --git a/Modules/Core/Common/include/itkEquivalencyTable.h b/Modules/Core/Common/include/itkEquivalencyTable.h index aa056ed04e6..ea1ab2764f4 100644 --- a/Modules/Core/Common/include/itkEquivalencyTable.h +++ b/Modules/Core/Common/include/itkEquivalencyTable.h @@ -20,7 +20,7 @@ #include "itkProcessObject.h" -#include "itksys/hash_map.hxx" +#include namespace itk { @@ -55,8 +55,8 @@ class ITKCommon_EXPORT EquivalencyTable:public DataObject itkTypeMacro(EquivalencyTable, DataObject); /** Define the container type for the table. */ - using HashTableType = itksys::hash_map< unsigned long, unsigned long, - itksys::hash< unsigned long > >; + using HashTableType = std::unordered_map< unsigned long, unsigned long, + std::hash< unsigned long > >; using Iterator = HashTableType::iterator; using ConstIterator = HashTableType::const_iterator; diff --git a/Modules/Core/Common/test/itkHashTableTest.cxx b/Modules/Core/Common/test/itkHashTableTest.cxx index 7e2bd45f2e3..693eb682314 100644 --- a/Modules/Core/Common/test/itkHashTableTest.cxx +++ b/Modules/Core/Common/test/itkHashTableTest.cxx @@ -16,8 +16,8 @@ * *=========================================================================*/ -#include "itksys/hash_set.hxx" -#include "itksys/hash_map.hxx" +#include +#include #include #include @@ -37,10 +37,10 @@ struct eqstr } }; -void lookup(const itksys::hash_set, eqstr>& Set, +void lookup(const std::unordered_set, eqstr>& Set, const char* word) { - itksys::hash_set, eqstr>::const_iterator it + std::unordered_set, eqstr>::const_iterator it = Set.find(word); std::cout << word << ": " << (it != Set.end() ? "present" : "not present") @@ -52,19 +52,19 @@ inline void println(const char *s) int itkHashTableTest(int, char* [] ) { - println("Testing itksys::hash"); - itksys::hash H; + println("Testing std::hash"); + std::hash H; std::cout << "foo -> " << H("foo") << std::endl; std::cout << "bar -> " << H("bar") << std::endl; - itksys::hash H1; + std::hash H1; std::cout << "1 -> " << H1(1) << std::endl; std::cout << "234 -> " << H1(234) << std::endl; - itksys::hash H2; + std::hash H2; std::cout << "a -> " << H2('a') << std::endl; std::cout << "Z -> " << H2('Z') << std::endl; - println("Testing itksys::hash_set"); - using HashSetType = itksys::hash_set, eqstr>; + println("Testing std::unordered_set"); + using HashSetType = std::unordered_set, eqstr>; HashSetType Set; Set.insert("kiwi"); Set.insert("plum"); @@ -85,7 +85,7 @@ int itkHashTableTest(int, char* [] ) // This is to prevent the user from calling empty() when they mean clear(). if (Set.empty()) std::cout << "Set is empty." << std::endl; Set.bucket_count(); - Set.resize(50); + Set.rehash(50); Set.insert("the horror"); Set.count("apple"); Set.find("kiwi"); @@ -95,8 +95,8 @@ int itkHashTableTest(int, char* [] ) HashSetType SetCopy; SetCopy = Set; - println("Testing itksys::hash_map"); - using HashMapType = itksys::hash_map, eqstr>; + println("Testing std::unordered_map"); + using HashMapType = std::unordered_map, eqstr>; HashMapType months; months["january"] = 31; @@ -125,7 +125,7 @@ int itkHashTableTest(int, char* [] ) // This is to prevent the user from calling empty() when they mean clear(). if (months.empty()) std::cout << "Set is empty." << std::endl; months.bucket_count(); - months.resize(50); + months.rehash(50); HashMapType::value_type p("psychotic break", 2); months.insert(p); months.count("january"); diff --git a/Modules/Core/Mesh/include/itkAutomaticTopologyMeshSource.h b/Modules/Core/Mesh/include/itkAutomaticTopologyMeshSource.h index d7fa6f744b2..67f871a0b66 100644 --- a/Modules/Core/Mesh/include/itkAutomaticTopologyMeshSource.h +++ b/Modules/Core/Mesh/include/itkAutomaticTopologyMeshSource.h @@ -20,7 +20,7 @@ #include "itkArray.h" #include "itkDefaultStaticMeshTraits.h" -#include "itksys/hash_map.hxx" +#include #include "itkHexahedronCell.h" #include "itkIntTypes.h" #include "itkMesh.h" @@ -145,7 +145,7 @@ class ITK_TEMPLATE_EXPORT AutomaticTopologyMeshSource:public MeshSource< TOutput /** hash_map type alias. */ - using PointHashMap = itksys::hash_map< + using PointHashMap = std::unordered_map< PointType, IdentifierType, StructHashFunction< PointHashType > >; @@ -388,7 +388,7 @@ class ITK_TEMPLATE_EXPORT AutomaticTopologyMeshSource:public MeshSource< TOutput // are controlled manually private: - using CellHashMap = itksys::hash_map< + using CellHashMap = std::unordered_map< Array< IdentifierType >, IdentifierType, IdentifierArrayHashFunction, diff --git a/Modules/Filtering/ImageStatistics/include/itkAdaptiveEqualizationHistogram.h b/Modules/Filtering/ImageStatistics/include/itkAdaptiveEqualizationHistogram.h index a3cff31b997..0ae888b6a5f 100644 --- a/Modules/Filtering/ImageStatistics/include/itkAdaptiveEqualizationHistogram.h +++ b/Modules/Filtering/ImageStatistics/include/itkAdaptiveEqualizationHistogram.h @@ -18,7 +18,7 @@ #ifndef itkAdaptiveEqualizationHistogram_h #define itkAdaptiveEqualizationHistogram_h -#include "itksys/hash_map.hxx" +#include #include "itkStructHashFunction.h" #include "itkMath.h" #include @@ -122,7 +122,7 @@ class AdaptiveEqualizationHistogram } private: - using MapType = typename itksys::hash_map< TInputPixel, + using MapType = typename std::unordered_map< TInputPixel, size_t, StructHashFunction< TInputPixel > >; diff --git a/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h b/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h index a3b7a8d99bd..95f56c9d040 100644 --- a/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h +++ b/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h @@ -21,7 +21,7 @@ #include "itkImageToImageFilter.h" #include "itkNumericTraits.h" -#include "itksys/hash_map.hxx" +#include namespace itk { @@ -116,7 +116,7 @@ class ITK_TEMPLATE_EXPORT LabelOverlapMeasuresImageFilter : }; /** Type of the map used to store data per label */ - using MapType = itksys::hash_map; + using MapType = std::unordered_map; using MapIterator = typename MapType::iterator; using MapConstIterator = typename MapType::const_iterator; diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.h b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.h index ebe873fb7a2..8489501c9be 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.h +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilter.h @@ -23,7 +23,7 @@ #include "itkConceptChecking.h" -#include "itksys/hash_map.hxx" +#include namespace itk { /** \class LaplacianDeformationQuadEdgeMeshFilter @@ -180,11 +180,11 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter: LaplacianDeformationQuadEdgeMeshFilter(); ~LaplacianDeformationQuadEdgeMeshFilter() override = default; - using OutputMapPointIdentifier = itksys::hash_map< OutputPointIdentifier, OutputPointIdentifier >; + using OutputMapPointIdentifier = std::unordered_map< OutputPointIdentifier, OutputPointIdentifier >; using OutputMapPointIdentifierIterator = typename OutputMapPointIdentifier::iterator; using OutputMapPointIdentifierConstIterator = typename OutputMapPointIdentifier::const_iterator; - using ConstraintMapType = itksys::hash_map< OutputPointIdentifier, OutputVectorType >; + using ConstraintMapType = std::unordered_map< OutputPointIdentifier, OutputVectorType >; using ConstraintMapConstIterator = typename ConstraintMapType::const_iterator; struct HashOutputQEPrimal @@ -195,13 +195,13 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter: } }; - using CoefficientMapType = itksys::hash_map< OutputQEPrimal*, OutputCoordRepType, HashOutputQEPrimal >; + using CoefficientMapType = std::unordered_map< OutputQEPrimal*, OutputCoordRepType, HashOutputQEPrimal >; using CoefficientMapConstIterator = typename CoefficientMapType::const_iterator; - using AreaMapType = itksys::hash_map< OutputPointIdentifier, OutputCoordRepType >; + using AreaMapType = std::unordered_map< OutputPointIdentifier, OutputCoordRepType >; using AreaMapConstIterator = typename AreaMapType::const_iterator; - using RowType = itksys::hash_map< OutputPointIdentifier, OutputCoordRepType >; + using RowType = std::unordered_map< OutputPointIdentifier, OutputCoordRepType >; using RowIterator = typename RowType::iterator; using RowConstIterator = typename RowType::const_iterator; diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.h b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.h index 15804debc09..a1b18059b68 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.h +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.h @@ -110,7 +110,7 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilterWithSoftConstrai OutputCoordRepType m_Lambda; OutputCoordRepType m_LambdaSquare; - itksys::hash_map< OutputPointIdentifier, OutputCoordRepType > m_LocalLambdaSquare; + std::unordered_map< OutputPointIdentifier, OutputCoordRepType > m_LocalLambdaSquare; }; } // end namespace itk diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.hxx b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.hxx index f4b80cc04cf..8c54b8ba5a3 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.hxx +++ b/Modules/Filtering/QuadEdgeMeshFiltering/include/itkLaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints.hxx @@ -154,7 +154,7 @@ LaplacianDeformationQuadEdgeMeshFilterWithSoftConstraints< TInputMesh, TOutputMe OutputCoordRepType l2 = m_LambdaSquare; - typename itksys::hash_map< OutputPointIdentifier, OutputCoordRepType >::const_iterator lambdaIt = this->m_LocalLambdaSquare.find( vId ); + typename std::unordered_map< OutputPointIdentifier, OutputCoordRepType >::const_iterator lambdaIt = this->m_LocalLambdaSquare.find( vId ); if( lambdaIt != this->m_LocalLambdaSquare.end() ) { l2 = lambdaIt->second; diff --git a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h index 554723cc38d..58659a98136 100644 --- a/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h +++ b/Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.h @@ -22,7 +22,7 @@ #include "itkNumericTraits.h" #include "itkArray.h" #include "itkSimpleDataObjectDecorator.h" -#include "itksys/hash_map.hxx" +#include #include #include "vnl/algo/vnl_symmetric_eigensystem.h" #include "vnl/vnl_det.h" @@ -245,9 +245,9 @@ class ITK_TEMPLATE_EXPORT LabelGeometryImageFilter: /** Type of the map used to store data per label */ // Map from the label to the class storing all of the geometry information. - using MapType = itksys::hash_map< LabelPixelType, LabelGeometry >; - using MapIterator = typename itksys::hash_map< LabelPixelType, LabelGeometry >::iterator; - using MapConstIterator = typename itksys::hash_map< LabelPixelType, LabelGeometry >::const_iterator; + using MapType = std::map< LabelPixelType, LabelGeometry >; + using MapIterator = typename std::map< LabelPixelType, LabelGeometry >::iterator; + using MapConstIterator = typename std::map< LabelPixelType, LabelGeometry >::const_iterator; // Macros for enabling the calculation of additional features. itkGetMacro(CalculatePixelIndices, bool); diff --git a/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h b/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h index d029a61ac96..d2f2514ea6f 100644 --- a/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h +++ b/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h @@ -19,7 +19,7 @@ #define itkKdTreeBasedKmeansEstimator_h #include -#include "itksys/hash_map.hxx" +#include #include "itkObject.h" #include "itkEuclideanDistanceMetric.h" @@ -152,7 +152,7 @@ class ITK_TEMPLATE_EXPORT KdTreeBasedKmeansEstimator: * of changes in centroid positions) */ void StartOptimization(); - using ClusterLabelsType = itksys::hash_map< InstanceIdentifier, unsigned int >; + using ClusterLabelsType = std::unordered_map< InstanceIdentifier, unsigned int >; itkSetMacro(UseClusterLabels, bool); itkGetConstMacro(UseClusterLabels, bool); diff --git a/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx b/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx index 6d4c6b580d1..cbd7f1260d9 100644 --- a/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx +++ b/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx @@ -404,7 +404,7 @@ KdTreeBasedKmeansEstimator< TKdTree > { m_GenerateClusterLabels = true; m_ClusterLabels.clear(); - m_ClusterLabels.resize( m_KdTree->GetSample()->Size() ); + m_ClusterLabels.rehash( m_KdTree->GetSample()->Size() ); for ( i = 0; i < (unsigned int)( m_Parameters.size() / m_MeasurementVectorSize ); i++ ) { validIndexes.push_back(i); diff --git a/Modules/Numerics/Statistics/include/itkMembershipSample.h b/Modules/Numerics/Statistics/include/itkMembershipSample.h index dc5e84fc48d..c50b3d4d406 100644 --- a/Modules/Numerics/Statistics/include/itkMembershipSample.h +++ b/Modules/Numerics/Statistics/include/itkMembershipSample.h @@ -18,7 +18,7 @@ #ifndef itkMembershipSample_h #define itkMembershipSample_h -#include "itksys/hash_map.hxx" +#include #include "itkSubsample.h" namespace itk @@ -86,7 +86,7 @@ class ITK_TEMPLATE_EXPORT MembershipSample:public DataObject /** Typedef for the storage that holds a class label for each instance. * The relationship between instances and class label is one-to-one */ - using ClassLabelHolderType = itksys::hash_map< InstanceIdentifier, ClassLabelType >; + using ClassLabelHolderType = std::unordered_map< InstanceIdentifier, ClassLabelType >; /** Typedef for each subsample that stores instance identifiers of instances * that belong to a class */ diff --git a/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx index 9551e29214c..f15e90e69d0 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx +++ b/Modules/Segmentation/ConnectedComponents/include/itkRelabelComponentImageFilter.hxx @@ -22,7 +22,6 @@ #include "itkImageRegionIterator.h" #include "itkNumericTraits.h" #include "itkProgressReporter.h" -#include "itksys/hash_map.hxx" #include namespace itk @@ -52,7 +51,7 @@ RelabelComponentImageFilter< TInputImage, TOutputImage > // Use a map to keep track of the size of each object. Object // number -> ObjectType (which has Object number and the two sizes) - using MapType = itksys::hash_map< LabelType, RelabelComponentObjectType >; + using MapType = std::map< LabelType, RelabelComponentObjectType >; MapType sizeMap; typename MapType::iterator mapIt; using MapValueType = typename MapType::value_type; diff --git a/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx index 022929b5d5f..b7d93607eb0 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkRelabelComponentImageFilterTest.cxx @@ -37,6 +37,7 @@ int itkRelabelComponentImageFilterTest(int argc, char* argv[] ) return EXIT_FAILURE; } + bool success = true; using InternalPixelType = unsigned short; using LabelPixelType = unsigned long; using WritePixelType = unsigned char; @@ -133,6 +134,7 @@ int itkRelabelComponentImageFilterTest(int argc, char* argv[] ) { std::cerr << "Exception caught !" << std::endl; std::cerr << excep << std::endl; + success = false; } @@ -149,6 +151,7 @@ int itkRelabelComponentImageFilterTest(int argc, char* argv[] ) std::cerr << "Exception caught during statistics calculation!" << std::endl; std::cerr << excep << std::endl; + success = false; } try { @@ -220,6 +223,7 @@ int itkRelabelComponentImageFilterTest(int argc, char* argv[] ) catch (...) { std::cerr << "Exception caught while printing statistics" << std::endl; + success = false; } // Check for the sizes of the 7 first labels which should be sorted by default @@ -230,7 +234,7 @@ int itkRelabelComponentImageFilterTest(int argc, char* argv[] ) { std::cerr << "Comparing label size to reference value." << std::endl; std::cerr << "Got " << relabel->GetSizeOfObjectsInPixels()[i] << ", expected " << ref1[i] << std::endl; - return EXIT_FAILURE; + success = false; } } @@ -239,16 +243,25 @@ int itkRelabelComponentImageFilterTest(int argc, char* argv[] ) relabel->Update(); // Check for the sizes of the 7 first labels which are no more sorted - unsigned long ref2 [7] = { 1491, 2, 1, 906, 3, 40, 1 }; - for ( int i=0; i<6; ++i ) + unsigned long ref2[7] = { 1491, 2, 1, 906, 3, 40, 1 }; + for ( int i=0; i<7; ++i ) { if ( relabel->GetSizeOfObjectsInPixels()[i] != ref2[i] ) { std::cerr << "Comparing label size to reference value." << std::endl; std::cerr << "Got " << relabel->GetSizeOfObjectsInPixels()[i] << ", expected " << ref2[i] << std::endl; - return EXIT_FAILURE; + success = false; } } - return EXIT_SUCCESS; + if (success) + { + std::cout << "Test PASSED!" << std::endl; + return EXIT_SUCCESS; + } + else + { + std::cout << "Test FAILED!" << std::endl; + return EXIT_FAILURE; + } } diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.h b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.h index 00d50409874..cd6878f342d 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.h +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermBase.h @@ -21,7 +21,7 @@ #include "itkObject.h" #include "itkHeavisideStepFunctionBase.h" -#include "itksys/hash_set.hxx" +#include namespace itk { @@ -129,7 +129,7 @@ class ITK_TEMPLATE_EXPORT LevelSetEquationTermBase : public Object /** Update the term parameter values at end of iteration */ virtual void Update() = 0; - using RequiredDataType = itksys::hash_set< std::string >; + using RequiredDataType = std::unordered_set< std::string >; const RequiredDataType & GetRequiredData() const; diff --git a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.h b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.h index 02b68bec3ce..5bef9a5c7cc 100644 --- a/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.h +++ b/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationTermContainer.h @@ -22,7 +22,7 @@ #include "itkLevelSetEquationTermBase.h" #include "itkObject.h" -#include "itksys/hash_map.hxx" +#include #include #include @@ -279,7 +279,7 @@ class ITK_TEMPLATE_EXPORT LevelSetEquationTermContainer : public Object InputImagePointer m_Input; - using HashMapStringTermContainerType = itksys::hash_map< std::string, TermPointer >; + using HashMapStringTermContainerType = std::unordered_map< std::string, TermPointer >; HashMapStringTermContainerType m_NameContainer; diff --git a/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h b/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h index 9ba0ba60836..25e0e5e6b90 100644 --- a/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h +++ b/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h @@ -20,7 +20,7 @@ #include "itkProcessObject.h" -#include "itksys/hash_map.hxx" +#include #include "ITKWatershedsExport.h" namespace itk @@ -57,8 +57,7 @@ class ITKWatersheds_EXPORT OneWayEquivalencyTable:public DataObject itkTypeMacro(OneWayEquivalencyTable, DataObject); /** Define the container type for this table */ - using HashTableType = itksys::hash_map< unsigned long, unsigned long, - itksys::hash< unsigned long > >; + using HashTableType = std::unordered_map< unsigned long, unsigned long >; using Iterator = HashTableType::iterator; using ConstIterator = HashTableType::const_iterator; diff --git a/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h b/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h index 57b4a7e0b7f..df6aa7ce0cd 100644 --- a/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h +++ b/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h @@ -23,7 +23,7 @@ #include #include "itkImage.h" #include "itkProcessObject.h" -#include "itksys/hash_map.hxx" +#include namespace itk { @@ -115,8 +115,7 @@ class ITK_TEMPLATE_EXPORT Boundary:public DataObject using face_t = Image< face_pixel_t, TDimension >; /** A hash table holding flat region data structures. */ - using flat_hash_t = itksys::hash_map< IdentifierType, flat_region_t, - itksys::hash< IdentifierType > >; + using flat_hash_t = std::unordered_map< IdentifierType, flat_region_t >; using FlatHashValueType = typename flat_hash_t::value_type; /** Itk type alias and macros defining smart pointer and type identification. diff --git a/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h b/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h index c60c81a5f93..f27eeaeb60f 100644 --- a/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h +++ b/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h @@ -90,12 +90,11 @@ class ITK_TEMPLATE_EXPORT SegmentTable:public DataObject }; /** Define the container type for the table */ - using HashMapType = itksys::hash_map< IdentifierType, segment_t, - itksys::hash< IdentifierType > >; + using HashMapType = std::unordered_map< IdentifierType, segment_t >; using Iterator = typename HashMapType::iterator; using ConstIterator = typename HashMapType::const_iterator; using ValueType = typename HashMapType::value_type; - using DataType = typename HashMapType::data_type; + using DataType = typename HashMapType::mapped_type; /** Inserts a segment into the table */ bool Add(IdentifierType a, const segment_t & t); diff --git a/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h b/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h index 34381d9152c..221ae48d8c1 100644 --- a/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h +++ b/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h @@ -219,8 +219,7 @@ class ITK_TEMPLATE_EXPORT SegmentTreeGenerator:public ProcessObject double m_FloodLevel{0.0}; bool m_ConsumeInput{false}; - using HashMapType = itksys::hash_map< IdentifierType, bool, - itksys::hash< IdentifierType > >; + using HashMapType = std::unordered_map< IdentifierType, bool >; OneWayEquivalencyTableType::Pointer m_MergedSegmentsTable; diff --git a/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h b/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h index 9a8b3fb64d1..f1c29ce66f3 100644 --- a/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h +++ b/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h @@ -244,7 +244,7 @@ class ITK_TEMPLATE_EXPORT Segmenter: }; /** Table for storing flat region information. */ - using flat_region_table_t = itksys::hash_map< IdentifierType, flat_region_t, itksys::hash< IdentifierType > >; + using flat_region_table_t = std::unordered_map< IdentifierType, flat_region_t >; struct connectivity_t { unsigned int size; @@ -256,9 +256,9 @@ class ITK_TEMPLATE_EXPORT Segmenter: * generating the segment table, even though the edge tables * are stored as ordered lists. An "edge" in this context * is synonymous with a segment "adjacency". */ - using edge_table_t = itksys::hash_map< IdentifierType, InputPixelType, itksys::hash< IdentifierType > >; + using edge_table_t = std::map< IdentifierType, InputPixelType >; - using edge_table_hash_t = itksys::hash_map< IdentifierType, edge_table_t, itksys::hash< IdentifierType > >; + using edge_table_hash_t = std::unordered_map< IdentifierType, edge_table_t >; Segmenter(); Segmenter(const Self &) {} diff --git a/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.md5 b/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.md5 index 45b63072d37..3799ff02f74 100644 --- a/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.md5 +++ b/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.md5 @@ -1 +1 @@ -b19ea6df9f910060bb62fa5e983c59f1 +ffa0ca2b5f46c024bc408c6a77b6453c diff --git a/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.sha512 b/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.sha512 index 178c84667e9..78cbb4b4052 100644 --- a/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.sha512 +++ b/Modules/Segmentation/Watersheds/test/Baseline/itkIsolatedWatershedImageFilterTest.png.sha512 @@ -1 +1 @@ -15fc65785e7054a10c6ad09f3e7c5add1a6cd54d7e2e1a8171a13efbc00c699f12edca296ffb541a77fe4d294682a1f3373733d37995fd83f06660b06eb1f8ac +dcb1e52034ab274e83b7502337ac2d22670c032a25530be41c828ade01315c014977d8ad79f4295639ff616b4df42b36cdf4007b48882410b9072a4c9a973707