]> Creatis software - gdcm.git/blob - src/gdcmCommon.h
ENH: Adding a dos file
[gdcm.git] / src / gdcmCommon.h
1 /*=========================================================================\r
2                                                                                 \r
3   Program:   gdcm\r
4   Module:    $RCSfile: gdcmCommon.h,v $\r
5   Language:  C++\r
6   Date:      $Date: 2006/01/24 19:57:54 $\r
7   Version:   $Revision: 1.103 $\r
8                                                                                 \r
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de\r
10   l'Image). All rights reserved. See Doc/License.txt or\r
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.\r
12                                                                                 \r
13      This software is distributed WITHOUT ANY WARRANTY; without even\r
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
15      PURPOSE.  See the above copyright notices for more information.\r
16                                                                                 \r
17 =========================================================================*/\r
18 \r
19 #ifndef GDCMCOMMON_H\r
20 #define GDCMCOMMON_H\r
21 \r
22 #include "gdcmConfigure.h"\r
23 #include "gdcmSystem.h"\r
24 #include "gdcmMacro.h"\r
25 \r
26 #include <string>\r
27 \r
28 //-----------------------------------------------------------------------------\r
29 #if defined(_WIN32) && defined(BUILD_SHARED_LIBS)\r
30   #ifdef gdcm_EXPORTS\r
31     #define GDCM_EXPORT __declspec( dllexport )\r
32   #else\r
33     #define GDCM_EXPORT __declspec( dllimport )\r
34   #endif\r
35 #else\r
36   #define GDCM_EXPORT\r
37 #endif\r
38 \r
39 //-----------------------------------------------------------------------------\r
40 /// \brief namespace for Grass root DiCoM\r
41 namespace gdcm\r
42 {\r
43 \r
44 // Centralize information about the gdcm dictionary in only one file:\r
45 #ifndef PUB_DICT_PATH\r
46 #  define PUB_DICT_PATH   "../Dicts/"\r
47 #endif\r
48 #define PUB_DICT_NAME     "DicomV3Dict"\r
49 #define PUB_DICT_FILENAME "gdcm.dic"\r
50 #define DICT_ELEM         "DicomDir.dic"\r
51 #define DICT_TS           "dicomTS.dic"\r
52 #define DICT_VR           "dicomVR.dic"\r
53 #define DICT_GROUP_NAME   "DictGroupName.dic"\r
54 \r
55 GDCM_EXPORT extern const std::string GDCM_UNKNOWN;\r
56 GDCM_EXPORT extern const std::string GDCM_UNFOUND;\r
57 GDCM_EXPORT extern const std::string GDCM_BINLOADED;\r
58 GDCM_EXPORT extern const std::string GDCM_NOTLOADED;\r
59 GDCM_EXPORT extern const std::string GDCM_UNREAD;\r
60 GDCM_EXPORT extern const std::string GDCM_NOTASCII;\r
61 GDCM_EXPORT extern const std::string GDCM_PIXELDATA;\r
62 \r
63 GDCM_EXPORT extern const std::string GDCM_VRUNKNOWN;\r
64 \r
65 GDCM_EXPORT extern const char GDCM_FILESEPARATOR;\r
66 \r
67 /// \brief TagKey is made to hold the standard Dicom Tag \r
68 ///               (Group number, Element number)\r
69 /// Instead of using the two '16 bits integers' as the Hask Table key, we\r
70 /// converted into a string (e.g. 0x0018,0x0050 converted into "0018|0050")\r
71 /// It appears to be a huge waste of time.\r
72 /// We'll fix the mess up -without any change in the API- as soon as the bench\r
73 /// marks are fully performed.\r
74 \r
75 #if defined(_MSC_VER) && (_MSC_VER == 1200)\r
76 // Doing everything within gdcm namespace to avoid polluting 3d party software\r
77 inline std::ostream& operator<<(std::ostream& _O, std::string _val)\r
78 {\r
79   return _O << _val.c_str();\r
80 }\r
81 #endif\r
82 \r
83 /// \brief TagName is made to hold the 'non hexa" fields (VR, VM, Name) \r
84 ///        of Dicom Entries\r
85 typedef std::string TagName;\r
86 \r
87 /// \brief various types of a DICOM file (for internal use only)\r
88 enum FileType {\r
89    Unknown = 0,\r
90    ExplicitVR, // DicomDir is in this case. Except when it's ImplicitVR !...\r
91    ImplicitVR,\r
92    ACR,\r
93    ACR_LIBIDO,\r
94    JPEG\r
95 };\r
96 \r
97 /// \brief type of the elements composing a DICOMDIR (for internal use only)\r
98 enum DicomDirType {\r
99    DD_UNKNOWN = 0,\r
100    DD_META,\r
101    DD_PATIENT,\r
102    DD_STUDY,\r
103    DD_SERIE,\r
104    DD_IMAGE,\r
105    DD_VISIT\r
106 };\r
107 \r
108 /// \brief comparison operators (as used in SerieHelper::AddRestriction() )\r
109 enum CompOperators {\r
110    GDCM_EQUAL = 0,\r
111    GDCM_DIFFERENT,\r
112    GDCM_GREATER,\r
113    GDCM_GREATEROREQUAL,\r
114    GDCM_LESS,\r
115    GDCM_LESSOREQUAL\r
116 };\r
117 \r
118 /// \brief Loading mode\r
119 enum LodModeType\r
120 {\r
121    LD_ALL         = 0x00000000, // Load all\r
122    LD_NOSEQ       = 0x00000001, // Don't load Sequences\r
123    LD_NOSHADOW    = 0x00000002, // Don't load odd groups\r
124    LD_NOSHADOWSEQ = 0x00000004  // Don't load Sequences if they belong \r
125                                 //            to an odd group\r
126                                 // (*exclusive* from LD_NOSEQ and LD_NOSHADOW)\r
127 };\r
128 \r
129 /**\r
130  * \brief structure, for internal use only\r
131  */  \r
132 struct DicomElement\r
133 {\r
134    /// Dicom Group number\r
135    unsigned short int Group;\r
136    /// Dicom Element number\r
137    unsigned short int Elem;\r
138    /// value (coded as a std::string) of the Element\r
139    std::string Value;\r
140 };\r
141 \r
142 } //namespace gdcm\r
143 //-----------------------------------------------------------------------------\r
144 #endif\r