diff --git a/Examples/RegistrationITKv4/ImageRegistrationHistogramPlotter.cxx b/Examples/RegistrationITKv4/ImageRegistrationHistogramPlotter.cxx index 9126f03f704..053b2618177 100644 --- a/Examples/RegistrationITKv4/ImageRegistrationHistogramPlotter.cxx +++ b/Examples/RegistrationITKv4/ImageRegistrationHistogramPlotter.cxx @@ -377,7 +377,6 @@ class HistogramWriter HistogramToImageFilterPointer m_Filter; HistogramFileWriterPointer m_HistogramFileWriter; // Software Guide : EndCodeSnippet - std::string m_OutputFile; }; // Command - observer invoked after every iteration of the optimizer diff --git a/Modules/Core/Common/test/itkFixedArrayTest.cxx b/Modules/Core/Common/test/itkFixedArrayTest.cxx index 723fd0501df..bd5d33ca247 100644 --- a/Modules/Core/Common/test/itkFixedArrayTest.cxx +++ b/Modules/Core/Common/test/itkFixedArrayTest.cxx @@ -31,7 +31,7 @@ Set_c_Array(int x[3]) } void -Print_Array(itk::FixedArray x, std::ostream & os) +Print_Array(const itk::FixedArray & x, std::ostream & os) { os << '{' << x[0] << ',' << x[1] << ',' << x[2] << '}' << std::endl; } @@ -43,7 +43,7 @@ Print_c_ArrayConst(const int x[3], std::ostream & os) } void -Print_Array5(itk::FixedArray x, std::ostream & os) +Print_Array5(const itk::FixedArray & x, std::ostream & os) { os << '{' << x[0] << ',' << x[1] << ',' << x[2] << ',' << x[3] << ',' << x[4] << '}' << std::endl; } diff --git a/Modules/Core/Common/test/itkMathRoundTest.cxx b/Modules/Core/Common/test/itkMathRoundTest.cxx index 8d081f6974e..d7773ab257b 100644 --- a/Modules/Core/Common/test/itkMathRoundTest.cxx +++ b/Modules/Core/Common/test/itkMathRoundTest.cxx @@ -17,10 +17,11 @@ *=========================================================================*/ #include +#include #include "itkIndex.h" bool -math_test_helper(std::string str, bool test) +math_test_helper(const std::string_view str, bool test) { if (!test) { diff --git a/Modules/Core/Mesh/test/itkCellInterfaceTest.cxx b/Modules/Core/Mesh/test/itkCellInterfaceTest.cxx index df097213b01..1dd3b555810 100644 --- a/Modules/Core/Mesh/test/itkCellInterfaceTest.cxx +++ b/Modules/Core/Mesh/test/itkCellInterfaceTest.cxx @@ -17,6 +17,7 @@ *=========================================================================*/ #include +#include #include "itkMesh.h" #include "itkPolyLineCell.h" @@ -44,7 +45,7 @@ using CellAutoPointer = CellType::CellAutoPointer; template int -TestCellInterface(std::string name, TCell * aCell) +TestCellInterface(const std::string_view name, TCell * aCell) { const CellAutoPointer cell(aCell, true); diff --git a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx index c0742e2cd62..143377cbef0 100644 --- a/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx +++ b/Modules/Core/QuadEdgeMesh/test/itkQuadEdgeMeshCellInterfaceTest.cxx @@ -17,6 +17,7 @@ *=========================================================================*/ #include +#include #include "itkQuadEdgeMesh.h" @@ -66,7 +67,7 @@ class CustomQEPolyVisitor // Test the cell interface template int -TestCellInterface(std::string name, TCell * aCell) +TestCellInterface(const std::string_view name, TCell * aCell) { const CellAutoPointer cell(aCell, true); @@ -174,7 +175,7 @@ TestCellInterface(std::string name, TCell * aCell) template int -TestQECellInterface(std::string name, TCell * aCell) +TestQECellInterface(const std::string_view name, TCell * aCell) { std::cout << "-------- " << name << '(' << aCell->GetNameOfClass() << ')' << std::endl; diff --git a/Modules/Core/TestKernel/include/itkTestDriverInclude.h b/Modules/Core/TestKernel/include/itkTestDriverInclude.h index 89fb5fdb5b2..7ec3254345e 100644 --- a/Modules/Core/TestKernel/include/itkTestDriverInclude.h +++ b/Modules/Core/TestKernel/include/itkTestDriverInclude.h @@ -66,7 +66,7 @@ RegressionTestImage(const char * testImageFilename, double directionTolerance = 1.0e-6); extern int -HashTestImage(const char * testImageFilename, const std::string md5hash); +HashTestImage(const char * testImageFilename, const std::string & md5hash); extern std::map diff --git a/Modules/Core/Transform/test/itkEuler2DTransformTest.cxx b/Modules/Core/Transform/test/itkEuler2DTransformTest.cxx index 4f6abe5b59a..7f87c14c79a 100644 --- a/Modules/Core/Transform/test/itkEuler2DTransformTest.cxx +++ b/Modules/Core/Transform/test/itkEuler2DTransformTest.cxx @@ -26,7 +26,7 @@ namespace { bool -CheckEqual(itk::Point p1, itk::Point p2) +CheckEqual(const itk::Point & p1, const itk::Point & p2) { constexpr double epsilon = 1e-5; diff --git a/Modules/Core/Transform/test/itkRigid2DTransformTest.cxx b/Modules/Core/Transform/test/itkRigid2DTransformTest.cxx index c9e1374e0ca..c57bcdb744a 100644 --- a/Modules/Core/Transform/test/itkRigid2DTransformTest.cxx +++ b/Modules/Core/Transform/test/itkRigid2DTransformTest.cxx @@ -23,7 +23,7 @@ namespace { bool -CheckEqual(itk::Point p1, itk::Point p2) +CheckEqual(const itk::Point & p1, const itk::Point & p2) { constexpr double epsilon = 1e-10; for (unsigned int i = 0; i < 2; ++i) diff --git a/Modules/Core/Transform/test/itkSimilarity2DTransformTest.cxx b/Modules/Core/Transform/test/itkSimilarity2DTransformTest.cxx index 7c22b8862d6..07874805deb 100644 --- a/Modules/Core/Transform/test/itkSimilarity2DTransformTest.cxx +++ b/Modules/Core/Transform/test/itkSimilarity2DTransformTest.cxx @@ -24,7 +24,7 @@ namespace { bool -CheckEqual(itk::Point p1, itk::Point p2) +CheckEqual(const itk::Point & p1, const itk::Point & p2) { constexpr double epsilon = 1e-10; diff --git a/Modules/Filtering/BiasCorrection/test/itkN4BiasFieldCorrectionImageFilterTest.cxx b/Modules/Filtering/BiasCorrection/test/itkN4BiasFieldCorrectionImageFilterTest.cxx index a73fc5af375..434b73ab127 100644 --- a/Modules/Filtering/BiasCorrection/test/itkN4BiasFieldCorrectionImageFilterTest.cxx +++ b/Modules/Filtering/BiasCorrection/test/itkN4BiasFieldCorrectionImageFilterTest.cxx @@ -75,7 +75,7 @@ Convert(std::string optionString) template std::vector -ConvertVector(std::string optionString) +ConvertVector(const std::string & optionString) { std::vector values; std::string::size_type crosspos = optionString.find('x', 0); diff --git a/Modules/Filtering/ImageIntensity/test/itkSymmetricEigenAnalysisImageFilterTest.cxx b/Modules/Filtering/ImageIntensity/test/itkSymmetricEigenAnalysisImageFilterTest.cxx index f417c9cb4c5..3fc17701a71 100644 --- a/Modules/Filtering/ImageIntensity/test/itkSymmetricEigenAnalysisImageFilterTest.cxx +++ b/Modules/Filtering/ImageIntensity/test/itkSymmetricEigenAnalysisImageFilterTest.cxx @@ -96,7 +96,7 @@ class SymmetricEigenAnalysisImageFilterHelper : public SymmetricEigenAnalysisIma itkNewMacro(Self); static int - Exercise(itk::EigenValueOrderEnum order, std::string outputFilename) + Exercise(itk::EigenValueOrderEnum order, const std::string & outputFilename) { using SymmetricEigenAnalysisImageFilterType = SymmetricEigenAnalysisImageFilter; @@ -202,7 +202,7 @@ class SymmetricEigenAnalysisFixedDimensionImageFilterHelper itkNewMacro(Self); static int - Exercise(itk::EigenValueOrderEnum order, std::string outputFilename) + Exercise(itk::EigenValueOrderEnum order, const std::string & outputFilename) { using SymmetricEigenAnalysisFixedDimensionImageFilterType = diff --git a/Modules/Filtering/Path/test/itkContourExtractor2DImageFilterTest.cxx b/Modules/Filtering/Path/test/itkContourExtractor2DImageFilterTest.cxx index af6a9f2299e..e505145f358 100644 --- a/Modules/Filtering/Path/test/itkContourExtractor2DImageFilterTest.cxx +++ b/Modules/Filtering/Path/test/itkContourExtractor2DImageFilterTest.cxx @@ -456,7 +456,7 @@ static itkContourExtractor2DImageFilterTestNamespace::MyVertexListList expected_ void ShowExtractorAsVariables(itkContourExtractor2DImageFilterTestNamespace::ExtractorType::Pointer extractor, - std::string name) + const std::string & name) { for (unsigned long i = 0; i < extractor->GetNumberOfIndexedOutputs(); ++i) { diff --git a/Modules/IO/CSV/include/itkCSVFileReaderBase.h b/Modules/IO/CSV/include/itkCSVFileReaderBase.h index 273e9a9c5d0..69dfd93aed9 100644 --- a/Modules/IO/CSV/include/itkCSVFileReaderBase.h +++ b/Modules/IO/CSV/include/itkCSVFileReaderBase.h @@ -140,7 +140,7 @@ class ITKIOCSV_EXPORT CSVFileReaderBase : public LightProcessObject */ template TData - ConvertStringToValueType(const std::string str) + ConvertStringToValueType(const std::string & str) { TData value; std::istringstream isstream(str); diff --git a/Modules/IO/ImageBase/test/itkImageFileWriterStreamingPastingCompressingTest1.cxx b/Modules/IO/ImageBase/test/itkImageFileWriterStreamingPastingCompressingTest1.cxx index f3ef5843e11..5254d4358de 100644 --- a/Modules/IO/ImageBase/test/itkImageFileWriterStreamingPastingCompressingTest1.cxx +++ b/Modules/IO/ImageBase/test/itkImageFileWriterStreamingPastingCompressingTest1.cxx @@ -87,9 +87,9 @@ SameImage(std::string testImageFileName, ImagePointer baselineImage) } bool -ActualTest(std::string inputFileName, - std::string outputFileNameBase, - std::string outputFileNameExtension, +ActualTest(const std::string & inputFileName, + const std::string & outputFileNameBase, + const std::string & outputFileNameExtension, bool streamWriting, bool pasteWriting, bool compressWriting, diff --git a/Modules/IO/Meta/test/testMetaImage.cxx b/Modules/IO/Meta/test/testMetaImage.cxx index b00d96add69..c67124f3966 100644 --- a/Modules/IO/Meta/test/testMetaImage.cxx +++ b/Modules/IO/Meta/test/testMetaImage.cxx @@ -29,7 +29,7 @@ template int -ReadWriteCompare(PixelType value, std::string type) +ReadWriteCompare(PixelType value, const std::string & type) { std::cout << "Testing: " << type << std::endl; using ImageType = itk::Image; diff --git a/Modules/IO/NRRD/test/itkNrrdImageIOTest.h b/Modules/IO/NRRD/test/itkNrrdImageIOTest.h index 7062e0a3974..1a1a49e3730 100644 --- a/Modules/IO/NRRD/test/itkNrrdImageIOTest.h +++ b/Modules/IO/NRRD/test/itkNrrdImageIOTest.h @@ -57,7 +57,7 @@ itkNrrdImageIOTestGenerateRandomImage(unsigned int size) template int -itkNrrdImageIOTestReadWriteTest(std::string fn, unsigned int size, std::string inputFile, bool compression = false) +itkNrrdImageIOTestReadWriteTest(const std::string & fn, unsigned int size, const std::string & inputFile, bool compression = false) { using ImageType = itk::Image; diff --git a/Modules/IO/TIFF/test/itkTIFFImageIOTestPalette.cxx b/Modules/IO/TIFF/test/itkTIFFImageIOTestPalette.cxx index 1e39bd97f22..8c913311a30 100644 --- a/Modules/IO/TIFF/test/itkTIFFImageIOTestPalette.cxx +++ b/Modules/IO/TIFF/test/itkTIFFImageIOTestPalette.cxx @@ -25,7 +25,7 @@ template void -printPalette(std::vector palette) +printPalette(const std::vector & palette) { for (unsigned int i = 0; i < palette.size(); ++i) { diff --git a/Modules/IO/TransformHDF5/test/itkIOTransformHDF5Test.cxx b/Modules/IO/TransformHDF5/test/itkIOTransformHDF5Test.cxx index 535441dafa3..29e24f139fe 100644 --- a/Modules/IO/TransformHDF5/test/itkIOTransformHDF5Test.cxx +++ b/Modules/IO/TransformHDF5/test/itkIOTransformHDF5Test.cxx @@ -39,7 +39,7 @@ template static int -ReadWriteTest(const std::string fileName, const bool isRealDisplacementField, const bool useCompression) +ReadWriteTest(const std::string & fileName, const bool isRealDisplacementField, const bool useCompression) { // First make a DisplacementField with known values constexpr double aNumberThatCanNotBeRepresentedInFloatingPoint = 1e-5 + 1e-7 + 1e-9 + 1e-13; @@ -177,7 +177,7 @@ ReadWriteTest(const std::string fileName, const bool isRealDisplacementField, co template static int -oneTest(const std::string goodname, const std::string badname, const bool useCompression) +oneTest(const std::string & goodname, const std::string badname, const bool useCompression) { using AffineTransformType = typename itk::AffineTransform; using AffineTransformTypeNotRegistered = typename itk::AffineTransform; diff --git a/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx b/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx index b05ceecd4e1..b9f675468c6 100644 --- a/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx +++ b/Modules/IO/VTK/test/itkVTKImageIO2Test.cxx @@ -302,7 +302,7 @@ class VTKImageIOTester template int -Test1AsciiBinary(std::string filePrefix, std::string outputPath, std::string typeName, bool ascii, bool read = true) +Test1AsciiBinary(std::string filePrefix, std::string outputPath, const std::string & typeName, bool ascii, bool read = true) { std::string ab; if (ascii) diff --git a/Modules/IO/VTK/test/itkVTKImageIOFileReadTest.cxx b/Modules/IO/VTK/test/itkVTKImageIOFileReadTest.cxx index b333c37d1c5..df5c956e063 100644 --- a/Modules/IO/VTK/test/itkVTKImageIOFileReadTest.cxx +++ b/Modules/IO/VTK/test/itkVTKImageIOFileReadTest.cxx @@ -23,7 +23,7 @@ template int -ReadImage(const std::string fileName, typename TImage::Pointer image) +ReadImage(const std::string & fileName, typename TImage::Pointer image) { using IOType = itk::VTKImageIO; diff --git a/Modules/IO/XML/src/itkDOMNode.cxx b/Modules/IO/XML/src/itkDOMNode.cxx index 9909365fc6d..5f48213ab3e 100644 --- a/Modules/IO/XML/src/itkDOMNode.cxx +++ b/Modules/IO/XML/src/itkDOMNode.cxx @@ -569,7 +569,7 @@ DOMNode::Find(const std::string & path) if (pos != std::string::npos) { const std::string s2 = s.substr(pos + 1); - s = s.substr(0, pos); + s.resize(pos); std::istringstream iss(s2); IdentifierType i = 0; iss >> i; diff --git a/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationOnVectorTest.cxx b/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationOnVectorTest.cxx index f94c30c03e4..5cf0da05df1 100644 --- a/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationOnVectorTest.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationOnVectorTest.cxx @@ -37,7 +37,7 @@ template int itkAutoScaledGradientDescentRegistrationOnVectorTestTemplated(int numberOfIterations, double shiftOfStep, - std::string scalesOption) + const std::string & scalesOption) { const unsigned int Dimension = TMovingTransform::SpaceDimension; diff --git a/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx b/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx index 5a891c9f964..29320a34d67 100644 --- a/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx @@ -37,7 +37,7 @@ template int itkAutoScaledGradientDescentRegistrationTestTemplated(int numberOfIterations, double shiftOfStep, - std::string scalesOption, + const std::string & scalesOption, bool usePhysicalSpaceForShift, bool estimateLearningRateOnce, bool estimateLearningRateAtEachIteration, diff --git a/Modules/Numerics/Optimizersv4/test/itkQuasiNewtonOptimizerv4Test.cxx b/Modules/Numerics/Optimizersv4/test/itkQuasiNewtonOptimizerv4Test.cxx index 388916b8b3c..40be8f93e70 100644 --- a/Modules/Numerics/Optimizersv4/test/itkQuasiNewtonOptimizerv4Test.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkQuasiNewtonOptimizerv4Test.cxx @@ -39,7 +39,7 @@ template int itkQuasiNewtonOptimizerv4TestTemplated(int numberOfIterations, double shiftOfStep, - std::string scalesOption, + const std::string & scalesOption, bool usePhysicalSpaceForShift = true) { const unsigned int Dimension = TMovingTransform::SpaceDimension; diff --git a/Modules/Segmentation/ConnectedComponents/test/itkHardConnectedComponentImageFilterTest.cxx b/Modules/Segmentation/ConnectedComponents/test/itkHardConnectedComponentImageFilterTest.cxx index 00213306b11..113350110d3 100644 --- a/Modules/Segmentation/ConnectedComponents/test/itkHardConnectedComponentImageFilterTest.cxx +++ b/Modules/Segmentation/ConnectedComponents/test/itkHardConnectedComponentImageFilterTest.cxx @@ -23,7 +23,7 @@ template int -DoIt(int argc, char * argv[], const std::string pixelType) +DoIt(int argc, char * argv[], const std::string & pixelType) { if (argc < 2) {