diff --git a/Modules/Core/Common/test/itkIteratorTests.cxx b/Modules/Core/Common/test/itkIteratorTests.cxx index 6d5a91f847e..d1c0791fbf4 100644 --- a/Modules/Core/Common/test/itkIteratorTests.cxx +++ b/Modules/Core/Common/test/itkIteratorTests.cxx @@ -124,8 +124,7 @@ itkIteratorTests(int, char *[]) start = clock(); itk::ImageRegionIterator it(o3, region); - unsigned short scalar; - scalar = 5; + unsigned short scalar = 5; i = 0; for (; !it.IsAtEnd(); ++it) diff --git a/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx b/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx index 65c857f3a36..d712f5728f5 100644 --- a/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx +++ b/Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx @@ -442,9 +442,9 @@ itkVectorImageTest(int, char * argv[]) std::cerr << "[FAILED]" << std::endl; failed = true; } - bool adaptorTestResult; - adaptorTestResult = testVectorImageAdaptor( - vectorImageToImageAdaptor, vectorImage, region, componentToExtract); + bool adaptorTestResult = + testVectorImageAdaptor( + vectorImageToImageAdaptor, vectorImage, region, componentToExtract); if (adaptorTestResult) { failed = true; diff --git a/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx b/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx index d6cc86d0318..f4a1b31ea41 100644 --- a/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx +++ b/Modules/Core/Transform/test/itkBSplineDeformableTransformTest.cxx @@ -687,9 +687,7 @@ itkBSplineDeformableTransformTest3() int itkBSplineDeformableTransformTest(int, char *[]) { - bool failed; - - failed = itkBSplineDeformableTransformTest1(); + bool failed = itkBSplineDeformableTransformTest1(); if (failed) { return EXIT_FAILURE; diff --git a/Modules/Core/Transform/test/itkBSplineTransformTest.cxx b/Modules/Core/Transform/test/itkBSplineTransformTest.cxx index 2cf57d4ab4d..0796b0c108a 100644 --- a/Modules/Core/Transform/test/itkBSplineTransformTest.cxx +++ b/Modules/Core/Transform/test/itkBSplineTransformTest.cxx @@ -715,9 +715,7 @@ itkBSplineTransformTest3() int itkBSplineTransformTest(int, char *[]) { - bool failed; - - failed = itkBSplineTransformTest1(); + bool failed = itkBSplineTransformTest1(); if (failed) { return EXIT_FAILURE; diff --git a/Modules/Core/Transform/test/itkTestTransformGetInverse.cxx b/Modules/Core/Transform/test/itkTestTransformGetInverse.cxx index daceaadf3f4..5d89054b6bc 100644 --- a/Modules/Core/Transform/test/itkTestTransformGetInverse.cxx +++ b/Modules/Core/Transform/test/itkTestTransformGetInverse.cxx @@ -106,8 +106,7 @@ TransformTest() int itkTestTransformGetInverse(int, char *[]) { - unsigned int errorCount; - errorCount = TransformTest>(); + unsigned int errorCount = TransformTest>(); errorCount += TransformTest>(); errorCount += TransformTest>(); errorCount += TransformTest>(); diff --git a/Modules/Filtering/AntiAlias/test/itkAntiAliasBinaryImageFilterTest.cxx b/Modules/Filtering/AntiAlias/test/itkAntiAliasBinaryImageFilterTest.cxx index 72d687a7829..08a5b1e022c 100644 --- a/Modules/Filtering/AntiAlias/test/itkAntiAliasBinaryImageFilterTest.cxx +++ b/Modules/Filtering/AntiAlias/test/itkAntiAliasBinaryImageFilterTest.cxx @@ -40,13 +40,12 @@ constexpr int V_DEPTH = 64; float sphere(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); } diff --git a/Modules/Filtering/ImageGrid/test/itkInterpolateImagePointsFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkInterpolateImagePointsFilterTest.cxx index 98c94907545..723e4d9b24a 100644 --- a/Modules/Filtering/ImageGrid/test/itkInterpolateImagePointsFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkInterpolateImagePointsFilterTest.cxx @@ -255,8 +255,7 @@ test3DInterpolateImagePointsFilter() using OutputIterator = itk::ImageRegionIterator; InputIterator inIter(image, region); OutputIterator outIter(outputImage, region); - double rmse; - rmse = 0.0; + double rmse = 0.0; while (!outIter.IsAtEnd()) { double temp = inIter.Get() - outIter.Get(); diff --git a/Modules/Filtering/LabelMap/test/itkLabelImageToLabelMapFilterTest.cxx b/Modules/Filtering/LabelMap/test/itkLabelImageToLabelMapFilterTest.cxx index e5b1aeaa9ba..8717865374e 100644 --- a/Modules/Filtering/LabelMap/test/itkLabelImageToLabelMapFilterTest.cxx +++ b/Modules/Filtering/LabelMap/test/itkLabelImageToLabelMapFilterTest.cxx @@ -112,8 +112,7 @@ itkLabelImageToLabelMapFilterTest(int, char *[]) IndexType index; index[0] = ctrI; index[1] = ctrJ; - unsigned long val; - val = map->GetPixel(index); + unsigned long val = map->GetPixel(index); std::cout << "Pixel[" << ctrI << ',' << ctrJ << "]: " << val << std::endl; if (((ctrI == 5) || (ctrJ == 5)) && (ctrI != 7) && (ctrJ != 7)) { diff --git a/Modules/Filtering/LabelMap/test/itkLabelMapToLabelImageFilterTest.cxx b/Modules/Filtering/LabelMap/test/itkLabelMapToLabelImageFilterTest.cxx index f0a46737f8b..88e2fe97e9b 100644 --- a/Modules/Filtering/LabelMap/test/itkLabelMapToLabelImageFilterTest.cxx +++ b/Modules/Filtering/LabelMap/test/itkLabelMapToLabelImageFilterTest.cxx @@ -82,8 +82,7 @@ itkLabelMapToLabelImageFilterTest(int argc, char * argv[]) IndexType index; index[0] = ctrI; index[1] = ctrJ; - unsigned char val; - val = image->GetPixel(index); + unsigned char val = image->GetPixel(index); if ((ctrI == 5) || (ctrJ == 5)) { itkAssertOrThrowMacro((val == 1), "Error in Label Image."); diff --git a/Modules/Filtering/LabelMap/test/itkShiftLabelObjectTest.cxx b/Modules/Filtering/LabelMap/test/itkShiftLabelObjectTest.cxx index fb86c119951..72b06193329 100644 --- a/Modules/Filtering/LabelMap/test/itkShiftLabelObjectTest.cxx +++ b/Modules/Filtering/LabelMap/test/itkShiftLabelObjectTest.cxx @@ -86,8 +86,7 @@ itkShiftLabelObjectTest(int argc, char * argv[]) IndexType index; index[0] = ctrI; index[1] = ctrJ; - unsigned long val; - val = map->GetPixel(index); + unsigned long val = map->GetPixel(index); std::cout << "Pixel[" << ctrI << ',' << ctrJ << "]: " << val << std::endl; if ((ctrI == 5) || (ctrJ == 5)) { diff --git a/Modules/IO/NIFTI/test/itkNiftiImageIOTest.cxx b/Modules/IO/NIFTI/test/itkNiftiImageIOTest.cxx index 6d8a313f269..7213e2819eb 100644 --- a/Modules/IO/NIFTI/test/itkNiftiImageIOTest.cxx +++ b/Modules/IO/NIFTI/test/itkNiftiImageIOTest.cxx @@ -155,8 +155,7 @@ itkNiftiImageIOTest(int argc, char * argv[]) } else // This is the mechanism for doing internal testing of all data types. { - int cur_return; - cur_return = MakeNiftiImage(testFileName); + int cur_return = MakeNiftiImage(testFileName); if (cur_return != 0) { std::cerr << "Error writing Nifti file type char" << std::endl; diff --git a/Modules/Nonunit/IntegratedTest/test/itkMaximumDecisionRuleTest.cxx b/Modules/Nonunit/IntegratedTest/test/itkMaximumDecisionRuleTest.cxx index 9ffe20ea18c..f954eb4d453 100644 --- a/Modules/Nonunit/IntegratedTest/test/itkMaximumDecisionRuleTest.cxx +++ b/Modules/Nonunit/IntegratedTest/test/itkMaximumDecisionRuleTest.cxx @@ -35,16 +35,13 @@ itkMaximumDecisionRuleTest(int, char *[]) MembershipVectorType membershipScoreVector; - double membershipScore1; - membershipScore1 = 0.1; + double membershipScore1 = 0.1; membershipScoreVector.push_back(membershipScore1); - double membershipScore2; - membershipScore2 = 0.5; + double membershipScore2 = 0.5; membershipScoreVector.push_back(membershipScore2); - double membershipScore3; - membershipScore3 = 1.9; + double membershipScore3 = 1.9; membershipScoreVector.push_back(membershipScore3); // the maximum score is the third component. The decision rule should diff --git a/Modules/Nonunit/IntegratedTest/test/itkMaximumRatioDecisionRuleTest.cxx b/Modules/Nonunit/IntegratedTest/test/itkMaximumRatioDecisionRuleTest.cxx index 8d515f45db3..3ad5e98fdc1 100644 --- a/Modules/Nonunit/IntegratedTest/test/itkMaximumRatioDecisionRuleTest.cxx +++ b/Modules/Nonunit/IntegratedTest/test/itkMaximumRatioDecisionRuleTest.cxx @@ -35,21 +35,17 @@ itkMaximumRatioDecisionRuleTest(int, char *[]) MembershipVectorType membershipScoreVector; - double membershipScore1; - membershipScore1 = 0.1; + double membershipScore1 = 0.1; membershipScoreVector.push_back(membershipScore1); - double membershipScore2; - membershipScore2 = 0.5; + double membershipScore2 = 0.5; membershipScoreVector.push_back(membershipScore2); - double membershipScore3; - membershipScore3 = 1.9; + double membershipScore3 = 1.9; membershipScoreVector.push_back(membershipScore3); // add discriminantscore with a value of zero - double membershipScore4; - membershipScore4 = 0.0; + double membershipScore4 = 0.0; membershipScoreVector.push_back(membershipScore4); diff --git a/Modules/Nonunit/IntegratedTest/test/itkMinimumDecisionRuleTest.cxx b/Modules/Nonunit/IntegratedTest/test/itkMinimumDecisionRuleTest.cxx index 2af2e4344a9..833cbde3289 100644 --- a/Modules/Nonunit/IntegratedTest/test/itkMinimumDecisionRuleTest.cxx +++ b/Modules/Nonunit/IntegratedTest/test/itkMinimumDecisionRuleTest.cxx @@ -35,16 +35,13 @@ itkMinimumDecisionRuleTest(int, char *[]) MembershipVectorType membershipScoreVector; - double membershipScore1; - membershipScore1 = 1.1; + double membershipScore1 = 1.1; membershipScoreVector.push_back(membershipScore1); - double membershipScore2; - membershipScore2 = 0.5; + double membershipScore2 = 0.5; membershipScoreVector.push_back(membershipScore2); - double membershipScore3; - membershipScore3 = 1.9; + double membershipScore3 = 1.9; membershipScoreVector.push_back(membershipScore3); // the minimum score is the third component. The decision rule should diff --git a/Modules/Numerics/Statistics/test/itkDecisionRuleTest.cxx b/Modules/Numerics/Statistics/test/itkDecisionRuleTest.cxx index f1f1ecbd36e..271fec07dac 100644 --- a/Modules/Numerics/Statistics/test/itkDecisionRuleTest.cxx +++ b/Modules/Numerics/Statistics/test/itkDecisionRuleTest.cxx @@ -86,16 +86,13 @@ itkDecisionRuleTest(int, char *[]) MembershipVectorType membershipScoreVector; - double membershipScore1; - membershipScore1 = 0.1; + double membershipScore1 = 0.1; membershipScoreVector.push_back(membershipScore1); - double membershipScore2; - membershipScore2 = 0.5; + double membershipScore2 = 0.5; membershipScoreVector.push_back(membershipScore2); - double membershipScore3; - membershipScore3 = 1.9; + double membershipScore3 = 1.9; membershipScoreVector.push_back(membershipScore3); // the maximum score is the third component. The decision rule should diff --git a/Modules/Numerics/Statistics/test/itkDistanceMetricTest.cxx b/Modules/Numerics/Statistics/test/itkDistanceMetricTest.cxx index bd9ae03c0e1..8bf2dbd30a9 100644 --- a/Modules/Numerics/Statistics/test/itkDistanceMetricTest.cxx +++ b/Modules/Numerics/Statistics/test/itkDistanceMetricTest.cxx @@ -45,16 +45,14 @@ class MyDistanceMetric : public DistanceMetric double Evaluate(const TMeasurementVector &) const override { - double score; - score = 1; + double score = 1; return score; } double Evaluate(const TMeasurementVector &, const TMeasurementVector &) const override { - double score; - score = 1; + double score = 1; return score; } }; diff --git a/Modules/Numerics/Statistics/test/itkDistanceMetricTest2.cxx b/Modules/Numerics/Statistics/test/itkDistanceMetricTest2.cxx index f77953f294e..6f37c7b4f14 100644 --- a/Modules/Numerics/Statistics/test/itkDistanceMetricTest2.cxx +++ b/Modules/Numerics/Statistics/test/itkDistanceMetricTest2.cxx @@ -45,16 +45,14 @@ class MyDistanceMetric : public DistanceMetric double Evaluate(const TMeasurementVector &) const override { - double score; - score = 1; + double score = 1; return score; } double Evaluate(const TMeasurementVector &, const TMeasurementVector &) const override { - double score; - score = 1; + double score = 1; return score; } }; diff --git a/Modules/Numerics/Statistics/test/itkMembershipFunctionBaseTest.cxx b/Modules/Numerics/Statistics/test/itkMembershipFunctionBaseTest.cxx index 17da3414390..5c7374d0ed1 100644 --- a/Modules/Numerics/Statistics/test/itkMembershipFunctionBaseTest.cxx +++ b/Modules/Numerics/Statistics/test/itkMembershipFunctionBaseTest.cxx @@ -49,8 +49,7 @@ class MyMembershipFunctionBase : public MembershipFunctionBaseGetFrequency(zero_zero); + float zzF = hist2->GetFrequency(zero_zero); totalF = hist2->GetTotalFrequency(); if (itk::Math::NotAlmostEquals(zzF, 40.0f) || itk::Math::NotAlmostEquals(zzF, totalF)) diff --git a/Modules/Segmentation/Classifiers/test/itkSampleClassifierFilterTest7.cxx b/Modules/Segmentation/Classifiers/test/itkSampleClassifierFilterTest7.cxx index 79bb8ba26c3..9e8f6f7a243 100644 --- a/Modules/Segmentation/Classifiers/test/itkSampleClassifierFilterTest7.cxx +++ b/Modules/Segmentation/Classifiers/test/itkSampleClassifierFilterTest7.cxx @@ -165,8 +165,7 @@ itkSampleClassifierFilterTest7(int argc, char * argv[]) const unsigned int measurementVectorSize = sample->GetMeasurementVectorSize(); for (unsigned int j = 0; j < measurementVectorSize; ++j) { - double temp; - temp = (components[i])->GetFullParameters()[j] - trueParameters[i][j]; + double temp = (components[i])->GetFullParameters()[j] - trueParameters[i][j]; displacement += (temp * temp); } displacement = std::sqrt(displacement); diff --git a/Modules/Segmentation/LevelSets/test/itkCannySegmentationLevelSetImageFilterTest.cxx b/Modules/Segmentation/LevelSets/test/itkCannySegmentationLevelSetImageFilterTest.cxx index 855c38daef6..4077b46fd57 100644 --- a/Modules/Segmentation/LevelSets/test/itkCannySegmentationLevelSetImageFilterTest.cxx +++ b/Modules/Segmentation/LevelSets/test/itkCannySegmentationLevelSetImageFilterTest.cxx @@ -32,26 +32,24 @@ constexpr int V_DEPTH = 64; float sphere(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); } float sphere2(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.1) * (x - static_cast(V_WIDTH) / 2.1) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.1) * (x - static_cast(V_WIDTH) / 2.1) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); } diff --git a/Modules/Segmentation/LevelSets/test/itkLaplacianSegmentationLevelSetImageFilterTest.cxx b/Modules/Segmentation/LevelSets/test/itkLaplacianSegmentationLevelSetImageFilterTest.cxx index 159428b9b4f..930fac1cb22 100644 --- a/Modules/Segmentation/LevelSets/test/itkLaplacianSegmentationLevelSetImageFilterTest.cxx +++ b/Modules/Segmentation/LevelSets/test/itkLaplacianSegmentationLevelSetImageFilterTest.cxx @@ -33,26 +33,24 @@ constexpr int V_DEPTH = 64; float sphere(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); } float sphere2(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.1) * (x - static_cast(V_WIDTH) / 2.1) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.1) * (x - static_cast(V_WIDTH) / 2.1) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); } diff --git a/Modules/Segmentation/LevelSets/test/itkLevelSetFunctionTest.cxx b/Modules/Segmentation/LevelSets/test/itkLevelSetFunctionTest.cxx index 264ecf10468..5527b204f41 100644 --- a/Modules/Segmentation/LevelSets/test/itkLevelSetFunctionTest.cxx +++ b/Modules/Segmentation/LevelSets/test/itkLevelSetFunctionTest.cxx @@ -45,9 +45,8 @@ const unsigned int WIDTH = (256); float circle(unsigned int x, unsigned int y) { - float dis; - dis = (x - static_cast(WIDTH) / 2.0) * (x - static_cast(WIDTH) / 2.0) + - (y - static_cast(HEIGHT) / 2.0) * (y - static_cast(HEIGHT) / 2.0); + float dis = (x - static_cast(WIDTH) / 2.0) * (x - static_cast(WIDTH) / 2.0) + + (y - static_cast(HEIGHT) / 2.0) * (y - static_cast(HEIGHT) / 2.0); dis = RADIUS - std::sqrt(dis); return dis; } diff --git a/Modules/Segmentation/LevelSets/test/itkNarrowBandThresholdSegmentationLevelSetImageFilterTest.cxx b/Modules/Segmentation/LevelSets/test/itkNarrowBandThresholdSegmentationLevelSetImageFilterTest.cxx index c05d16d5eae..92c16f89638 100644 --- a/Modules/Segmentation/LevelSets/test/itkNarrowBandThresholdSegmentationLevelSetImageFilterTest.cxx +++ b/Modules/Segmentation/LevelSets/test/itkNarrowBandThresholdSegmentationLevelSetImageFilterTest.cxx @@ -32,13 +32,12 @@ constexpr int V_DEPTH = 64; float sphere(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); } diff --git a/Modules/Segmentation/LevelSets/test/itkParallelSparseFieldLevelSetImageFilterTest.cxx b/Modules/Segmentation/LevelSets/test/itkParallelSparseFieldLevelSetImageFilterTest.cxx index 5873b2b9235..f6cad69b279 100644 --- a/Modules/Segmentation/LevelSets/test/itkParallelSparseFieldLevelSetImageFilterTest.cxx +++ b/Modules/Segmentation/LevelSets/test/itkParallelSparseFieldLevelSetImageFilterTest.cxx @@ -48,10 +48,9 @@ const int RADIUS = (std::min(std::min(HEIGHT, WIDTH), DEPTH) / 4); float sphere(unsigned int x, unsigned int y, unsigned int z) { - float dis; - dis = (x - static_cast(WIDTH) / 2.0) * (x - static_cast(WIDTH) / 2.0) + - (y - static_cast(HEIGHT) / 2.0) * (y - static_cast(HEIGHT) / 2.0) + - (z - static_cast(DEPTH) / 2.0) * (z - static_cast(DEPTH) / 2.0); + float dis = (x - static_cast(WIDTH) / 2.0) * (x - static_cast(WIDTH) / 2.0) + + (y - static_cast(HEIGHT) / 2.0) * (y - static_cast(HEIGHT) / 2.0) + + (z - static_cast(DEPTH) / 2.0) * (z - static_cast(DEPTH) / 2.0); dis = RADIUS - std::sqrt(dis); return (-dis); } diff --git a/Modules/Segmentation/LevelSets/test/itkThresholdSegmentationLevelSetImageFilterTest.cxx b/Modules/Segmentation/LevelSets/test/itkThresholdSegmentationLevelSetImageFilterTest.cxx index 7bba58ba500..4ae6395b73f 100644 --- a/Modules/Segmentation/LevelSets/test/itkThresholdSegmentationLevelSetImageFilterTest.cxx +++ b/Modules/Segmentation/LevelSets/test/itkThresholdSegmentationLevelSetImageFilterTest.cxx @@ -32,13 +32,12 @@ constexpr int V_DEPTH = 64; float sphere(float x, float y, float z) { - float dis; - dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / - ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + - (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / - ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + - (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / - ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); + float dis = (x - static_cast(V_WIDTH) / 2.0) * (x - static_cast(V_WIDTH) / 2.0) / + ((0.2f * V_WIDTH) * (0.2f * V_WIDTH)) + + (y - static_cast(V_HEIGHT) / 2.0) * (y - static_cast(V_HEIGHT) / 2.0) / + ((0.2f * V_HEIGHT) * (0.2f * V_HEIGHT)) + + (z - static_cast(V_DEPTH) / 2.0) * (z - static_cast(V_DEPTH) / 2.0) / + ((0.2f * V_DEPTH) * (0.2f * V_DEPTH)); return (1.0f - dis); }