Warning "no valid points..." with Powell optimizer and VersorRigid3DTransform

I’m hoping someone can have a look at my code and see where I’m going wrong. I had this warning (“no valid points…” is all I can read in the output window and the scroll bar at the bottom doesn’t function) when I first implemented this registration but the project got corrupted and I wanted to refactor it, and now I can’t remember how I resolved it.

ImageStitcherV2.h (4.9 KB)
ImageStitcherV2.cpp (9.9 KB)

This usually means the images no longer overlap.

An approach to understand what is happening is to resample the moving image at each iteration, and visualize the fixed and moving images together.

1 Like

This is happening even with identical images, and initial transform set to identity. I think I’m forgetting to set something up in the registration but I haven’t been able to find example code for setting up the Powell optimizer. Any idea where I could find that to see how my parameter settings compare with working code?

Here is a code fragment from working code. Optimizer is not used for normal image to image registration, though.

#ifdef USE_POWELL
		typedef itk::PowellOptimizerv4<double> OptimizerType;
#else
		typedef itk::AmoebaOptimizerv4 OptimizerType;
#endif
		OptimizerType::Pointer optimizer = OptimizerType::New();
		optimizer->SetMetric(cost);
		optimizer->SetDoEstimateScales(false);
		optimizer->SetNumberOfIterations(MaximumNumberOfIterations);

		OptimizerType::ScalesType scales(numberOfParams);
		CostType::ParametersType delta(numberOfParams);
		OptimizerType::ScalesType weights(numberOfParams);
		unsigned i = 0;
        for (; i < numCenters; i++)
		{
			scales[i] = 0.2;
			delta[i] = 0.2;
			weights[i] = 0.1;
		}
        for (; i < total; i++)
		{
			scales[i] = 1.0;
			delta[i] = 1.0;
			weights[i] = 10.0;
		}
		unsigned iStart = i;
		for (; i < numberOfParams; i++)
		{
			scales[i] = Activities[i - iStart] / 100;
			delta[i] = scales[i] * 10;
			weights[i] = 1.0;
		}
		optimizer->SetScales(scales);
		optimizer->SetWeights(weights);

#ifdef USE_POWELL
		optimizer->SetStepTolerance(0.1);
		optimizer->SetStepLength(0.5);
#else //Nelder-Meade initial simplex
		optimizer->SetAutomaticInitialSimplex(false);
		optimizer->SetInitialSimplexDelta(delta);
#endif

		try
		{
			optimizer->StartOptimization();
		}
		catch (itk::ExceptionObject e)
		{
			std::cerr << e << std::endl;
			return EXIT_FAILURE;
		}

		CostType::ParametersType params = optimizer->GetCurrentPosition();
        std::cout << '\n' << optimizer->GetStopConditionDescription() << std::endl << std::endl;
		//std::cout << "\nParams: " << params;
		//std::cout << "\nCost: " << optimizer->GetCurrentMetricValue();
		//std::cout << "\nIterations: " << optimizer->GetCurrentIteration();
1 Like