Skip to content

Commit

Permalink
Merge pull request InsightSoftwareConsortium#4674 from andrei-sandor/…
Browse files Browse the repository at this point in the history
…WunreachableCode

COMP: Fix ununsed code ( if(false) )
  • Loading branch information
thewtex authored May 31, 2024
2 parents 43810c6 + ba12c7d commit 970908c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ itkJointHistogramMutualInformationImageToImageRegistrationTest(int argc, char *
std::cout << argc << std::endl;
unsigned int numberOfIterations = 10;
unsigned int numberOfDisplacementIterations = 10;
bool useScalesEstimator = true;
if (argc >= 5)
{
numberOfIterations = std::stoi(argv[4]);
Expand All @@ -164,6 +165,10 @@ itkJointHistogramMutualInformationImageToImageRegistrationTest(int argc, char *
{
numberOfDisplacementIterations = std::stoi(argv[5]);
}
if (argc >= 7)
{
useScalesEstimator = std::stoi(argv[6]);
}
std::cout << " iterations " << numberOfIterations << " displacementIterations " << numberOfDisplacementIterations
<< std::endl;

Expand Down Expand Up @@ -313,7 +318,7 @@ itkJointHistogramMutualInformationImageToImageRegistrationTest(int argc, char *
RegistrationParameterScalesFromShiftType::ScalesType displacementScales(
displacementTransform->GetNumberOfLocalParameters());
displacementScales.Fill(1);
if (false)
if (!useScalesEstimator)
{
optimizer->SetScales(displacementScales);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ itkMeanSquaresImageToImageMetricv4RegistrationTest(int argc, char * argv[])
std::cout << argc << std::endl;
unsigned int numberOfIterations = 2;
unsigned int numberOfDisplacementIterations = 2;
bool useScalesEstimator = true;
if (argc >= 5)
{
numberOfIterations = std::stoi(argv[4]);
Expand All @@ -65,6 +66,10 @@ itkMeanSquaresImageToImageMetricv4RegistrationTest(int argc, char * argv[])
{
numberOfDisplacementIterations = std::stoi(argv[5]);
}
if (argc >= 7)
{
useScalesEstimator = std::stoi(argv[6]);
}
std::cout << " iterations " << numberOfIterations << " displacementIterations " << numberOfDisplacementIterations
<< std::endl;

Expand Down Expand Up @@ -204,14 +209,15 @@ itkMeanSquaresImageToImageMetricv4RegistrationTest(int argc, char * argv[])
RegistrationParameterScalesFromShiftType::ScalesType displacementScales(
displacementTransform->GetNumberOfLocalParameters());
displacementScales.Fill(1);
if (false)
if (!useScalesEstimator)
{
optimizer->SetScales(displacementScales);
}
else
{
optimizer->SetScalesEstimator(shiftScaleEstimator);
}

optimizer->SetMetric(metric);
optimizer->SetNumberOfIterations(numberOfDisplacementIterations);
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ itkMeanSquaresImageToImageMetricv4VectorRegistrationTest(int argc, char * argv[]
std::cout << argc << std::endl;
unsigned int numberOfAffineIterations = 2;
unsigned int numberOfDisplacementIterations = 2;
bool useScalesEstimator = true;
if (argc >= 5)
{
numberOfAffineIterations = std::stoi(argv[4]);
Expand All @@ -67,6 +68,10 @@ itkMeanSquaresImageToImageMetricv4VectorRegistrationTest(int argc, char * argv[]
{
numberOfDisplacementIterations = std::stoi(argv[5]);
}
if (argc >= 7)
{
useScalesEstimator = std::stoi(argv[6]);
}
std::cout << " affine iterations " << numberOfAffineIterations << " displacementIterations "
<< numberOfDisplacementIterations << std::endl;

Expand Down Expand Up @@ -218,14 +223,16 @@ itkMeanSquaresImageToImageMetricv4VectorRegistrationTest(int argc, char * argv[]
RegistrationParameterScalesFromShiftType::ScalesType displacementScales(
displacementTransform->GetNumberOfLocalParameters());
displacementScales.Fill(1);
if (false)

if (!useScalesEstimator)
{
optimizer->SetScales(displacementScales);
}
else
{
optimizer->SetScalesEstimator(shiftScaleEstimator);
}

optimizer->SetMetric(metric);
optimizer->SetNumberOfIterations(numberOfDisplacementIterations);
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ itkMultiGradientImageToImageMetricv4RegistrationTest(int argc, char * argv[])

std::cout << argc << std::endl;
unsigned int numberOfIterations = 10;
bool useSubSampling = true;
if (argc >= 5)
{
numberOfIterations = std::stoi(argv[4]);
}
if (argc >= 6)
{
useSubSampling = std::stoi(argv[5]);
}
std::cout << " iterations " << numberOfIterations << std::endl;

constexpr unsigned int Dimension = 2;
Expand Down Expand Up @@ -113,7 +118,7 @@ itkMultiGradientImageToImageMetricv4RegistrationTest(int argc, char * argv[])
metric->SetNumberOfHistogramBins(20);
auto metric2 = MetricType2::New();

if (false)
if (!useSubSampling)
{
std::cout << "Dense sampling." << std::endl;
metric->SetUseSampledPointSet(false);
Expand Down Expand Up @@ -142,7 +147,6 @@ itkMultiGradientImageToImageMetricv4RegistrationTest(int argc, char * argv[])
metric2->SetUseSampledPointSet(true);
std::cout << "Testing metric with point set..." << std::endl;
}

metric->SetFixedImage(fixedImage);
metric->SetMovingImage(movingImage);
metric->SetFixedTransform(identityTransform);
Expand Down

0 comments on commit 970908c

Please sign in to comment.