1 /* 2 * Medical Image Registration ToolKit (MIRTK) 3 * 4 * Copyright 2013-2015 Imperial College London 5 * Copyright 2013-2015 Andreas Schuh 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20 #include "mirtk/NumericsConfig.h" 21 #include "mirtk/ObjectFactory.h" 22 23 #ifndef MIRTK_AUTO_REGISTER 24 #include "mirtk/GradientDescent.h" 25 #include "mirtk/ConjugateGradientDescent.h" 26 #if MIRTK_Numerics_WITH_LBFGS 27 #include "mirtk/LimitedMemoryBFGSDescent.h" 28 #endif 29 #endif 30 31 32 namespace mirtk { 33 34 35 // ----------------------------------------------------------------------------- RegisterOptimizers()36static void RegisterOptimizers() 37 { 38 #ifndef MIRTK_AUTO_REGISTER 39 mirtkRegisterOptimizerMacro(GradientDescent); 40 mirtkRegisterOptimizerMacro(ConjugateGradientDescent); 41 #if MIRTK_Numerics_WITH_LBFGS 42 mirtkRegisterOptimizerMacro(LimitedMemoryBFGSDescent); 43 #endif 44 #endif 45 } 46 47 // ----------------------------------------------------------------------------- InitializeNumericsLibrary()48void InitializeNumericsLibrary() 49 { 50 static bool initialized = false; 51 if (!initialized) { 52 RegisterOptimizers(); 53 initialized = true; 54 } 55 } 56 57 58 } // namespace mirtk 59