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