From 175de75bb7c7cd15f2e61425af495faab18c6c30 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Wed, 22 Sep 2010 03:23:29 +0000 Subject: [PATCH] add skipLastPyramidLevel option --- registration/clitkBLUTDIR.ggo | 4 +++- registration/clitkBLUTDIRGenericFilter.cxx | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/registration/clitkBLUTDIR.ggo b/registration/clitkBLUTDIR.ggo index 4d84fce..4443da1 100755 --- a/registration/clitkBLUTDIR.ggo +++ b/registration/clitkBLUTDIR.ggo @@ -82,6 +82,8 @@ option "upperBound" - "7: The upper bound" double no default="0.0" section "Registration" -option "levels" - "Number of resolution levels" int no default="1" +option "levels" - "Number of resolution levels" int no default="1" +option "skipLastPyramidLevel" - "Skip full resolution pyramid level" flag off option "intermediate" - "Write the coefficient image of the intermediate levels (provide levels filenames)" string no multiple + diff --git a/registration/clitkBLUTDIRGenericFilter.cxx b/registration/clitkBLUTDIRGenericFilter.cxx index 02ce0dd..2e0c756 100755 --- a/registration/clitkBLUTDIRGenericFilter.cxx +++ b/registration/clitkBLUTDIRGenericFilter.cxx @@ -113,7 +113,7 @@ void BLUTDIRGenericFilter::InitializeImageType() typedef itk::SmartPointer Pointer; itkNewMacro( Self ); protected: - RegistrationInterfaceCommand() {}; + RegistrationInterfaceCommand() { }; public: // Registration @@ -204,11 +204,22 @@ void BLUTDIRGenericFilter::InitializeImageType() m_Initializer->InitializeTransform(); ParametersType* newParameters= new typename TransformType::ParametersType(m_Initializer->GetTransform()->GetNumberOfParameters()); + // DS : if we want to skip the last pyramid level, force to only 1 iteration + DD(m_ArgsInfo.skipLastPyramidLevel_flag); + if (m_ArgsInfo.skipLastPyramidLevel_flag) { + DD(m_ArgsInfo.maxIt_arg); + std::cout << "I skip the last pyramid level : set max iteration to 1" << std::endl; + m_ArgsInfo.maxIt_arg = 1; + DD(m_ArgsInfo.maxIt_arg); + } + // Reinitialize an Optimizer (!= number of parameters) m_GenericOptimizer = GenericOptimizerType::New(); m_GenericOptimizer->SetArgsInfo(m_ArgsInfo); m_GenericOptimizer->SetMaximize(m_Maximize); m_GenericOptimizer->SetNumberOfParameters(m_Initializer->GetTransform()->GetNumberOfParameters()); + + typedef itk::SingleValuedNonLinearOptimizer OptimizerType; OptimizerType::Pointer optimizer = m_GenericOptimizer->GetOptimizerPointer(); optimizer->AddObserver( itk::IterationEvent(), m_CommandIterationUpdate); -- 2.47.1