]> Creatis software - clitk.git/blob - segmentation/clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx
6db7c4b934dee61ba449fc65164c4838159a09c8
[clitk.git] / segmentation / clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ===========================================================================**/
18
19 // clitk
20 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
21
22 //--------------------------------------------------------------------
23 clitk::FilterWithAnatomicalFeatureDatabaseManagement::
24 FilterWithAnatomicalFeatureDatabaseManagement() 
25 {
26   m_AFDB = NULL; 
27   SetAFDBFilename("default.afdb");
28   SetAFDBPath("./");
29 }
30 //--------------------------------------------------------------------
31
32
33 //--------------------------------------------------------------------
34 void clitk::FilterWithAnatomicalFeatureDatabaseManagement::WriteAFDB() 
35 {
36   GetAFDB()->SetFilename(GetAFDBFilename());
37   GetAFDB()->Write();
38 }
39 //--------------------------------------------------------------------
40
41     
42 //--------------------------------------------------------------------
43 void clitk::FilterWithAnatomicalFeatureDatabaseManagement::LoadAFDB() 
44 {
45   GetAFDB()->SetFilename(GetAFDBFilename());
46   GetAFDB()->SetPath(GetAFDBPath());
47   try {
48     GetAFDB()->Load();
49   } catch (clitk::ExceptionObject e) {
50     std::cout << "******* Could not read '" << GetAFDBFilename() << "', create one AFDB. ********" << std::endl;
51     GetAFDB();
52   }
53 }
54 //--------------------------------------------------------------------
55
56
57 //--------------------------------------------------------------------
58 clitk::AnatomicalFeatureDatabase::Pointer clitk::FilterWithAnatomicalFeatureDatabaseManagement::GetAFDB() 
59 {
60   if (!m_AFDB) {
61     m_AFDB = clitk::AnatomicalFeatureDatabase::New();
62   }
63   return m_AFDB;
64 }
65 //--------------------------------------------------------------------