From: dsarrut Date: Wed, 22 Sep 2010 03:23:29 +0000 (+0000) Subject: add skipLastPyramidLevel option X-Git-Tag: v1.2.0~380 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=175de75bb7c7cd15f2e61425af495faab18c6c30;p=clitk.git add skipLastPyramidLevel option --- 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);