]> Creatis software - clitk.git/blob - segmentation/clitkAnatomicalFeatureDatabase.h
add cache for read image
[clitk.git] / segmentation / clitkAnatomicalFeatureDatabase.h
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://oncora1.lyon.fnclcc.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 #ifndef CLITKANATOMICALFEATUREDATABASE_H
20 #define CLITKANATOMICALFEATUREDATABASE_H
21
22 // clitk
23 #include "clitkCommon.h"
24 #include "clitkImageCommon.h"
25
26 namespace clitk {
27   
28
29   //--------------------------------------------------------------------
30   /*
31     Class to store and retreive anatomical feature such as 3D
32     named landmarks points. 
33   */
34   class AnatomicalFeatureDatabase: public itk::Object
35   {
36   public:
37     AnatomicalFeatureDatabase();
38
39     typedef std::string TagType;
40
41     // Set/Get filename 
42     itkSetMacro(Filename, std::string);
43     itkGetConstMacro(Filename, std::string);
44
45     // Read and write DB
46     void Write();
47     void Load();
48     
49     // Set Get landmarks
50     typedef itk::Point<double,3> PointType3D;
51     void SetPoint3D(TagType tag, PointType3D & p);
52     void GetPoint3D(TagType tag, PointType3D & p);
53     double GetPoint3D(std::string tag, int dim);
54     
55     // Set Get image
56     void SetImageFilename(TagType tag, std::string f);
57     template<class ImageType>
58     typename ImageType::Pointer GetImage(TagType tag);
59     template<class ImageType>
60     void  SetImage(TagType tag, 
61                    std::string f, 
62                    typename ImageType::Pointer image, 
63                    bool write=false);
64     template<class ImageType>
65     void ReleaseImage(TagType tag);
66     
67     // Set Get Double
68     void SetDouble(TagType tag, double d);
69     double GetDouble(TagType tag);
70
71   protected:
72     std::string m_Filename;
73     typedef itk::ImageBase<3> ImageBaseType;
74     typedef std::map<TagType, std::string> MapTagType;
75     typedef std::map<TagType, ImageBaseType*> MapTagImageType;
76     MapTagType m_MapOfTag;
77     MapTagImageType m_MapOfImage;
78
79   }; // end class
80   //--------------------------------------------------------------------
81
82   #include "clitkAnatomicalFeatureDatabase.txx" 
83
84 } // end namespace clitk
85 //--------------------------------------------------------------------
86
87 #endif // CLITKANATOMICALFEATUREDATABASE_H