]> Creatis software - gdcm.git/blob - src/gdcmCommon.h
Fix trouble with BCC
[gdcm.git] / src / gdcmCommon.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmCommon.h,v $
5   Language:  C++
6   Date:      $Date: 2006/05/31 16:02:32 $
7   Version:   $Revision: 1.111 $
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 #include "gdcmMacro.h"
25 #include "gdcmVRKey.h"
26 #include <string>
27
28 //-----------------------------------------------------------------------------
29 #if defined(_WIN32) && defined(BUILD_SHARED_LIBS)
30   #ifdef gdcm_EXPORTS
31     #define GDCM_EXPORT __declspec( dllexport )
32   #else
33     #define GDCM_EXPORT __declspec( dllimport )
34   #endif
35 #else
36   #define GDCM_EXPORT
37 #endif
38
39 #ifdef __BORLANDC__
40 #include <mem.h>
41 #endif
42
43 //-----------------------------------------------------------------------------
44 /// \brief namespace for Grass root DiCoM
45 namespace gdcm
46 {
47
48 // Centralize information about the gdcm dictionary in only one file:
49 #ifndef PUB_DICT_PATH
50 #  define PUB_DICT_PATH   "../Dicts/"
51 #endif
52 #define PUB_DICT_NAME     "dicomV3Dict"
53 // dicomV3.dic replaced by the generated gdcm.dic/
54 // if gdcm.dic not found, method FillDefaultDataDict() is invoked
55 //#define PUB_DICT_FILENAME "dicomV3.dic"
56 #define PUB_DICT_FILENAME "gdcm.dic"
57 #define DICT_ELEM         "DicomDir.dic"
58 #define DICT_TS           "dicomTS.dic"
59 #define DICT_VR           "dicomVR.dic"
60 #define DICT_GROUP_NAME   "DictGroupName.dic"
61
62 GDCM_EXPORT extern const std::string GDCM_UNKNOWN;
63 GDCM_EXPORT extern const std::string GDCM_UNFOUND;
64 GDCM_EXPORT extern const std::string GDCM_BINLOADED;
65 GDCM_EXPORT extern const std::string GDCM_NOTLOADED;
66 GDCM_EXPORT extern const std::string GDCM_UNREAD;
67 GDCM_EXPORT extern const std::string GDCM_NOTASCII;
68 GDCM_EXPORT extern const std::string GDCM_PIXELDATA;
69
70 GDCM_EXPORT extern const std::string GDCM_VRUNKNOWN;
71
72 GDCM_EXPORT extern const char GDCM_FILESEPARATOR;
73
74 /// \brief TagKey is made to hold the standard Dicom Tag 
75 ///               (Group number, Element number)
76 /// Instead of using the two '16 bits integers' as the Hask Table key, we
77 /// converted into a string (e.g. 0x0018,0x0050 converted into "0018|0050")
78 /// It appears to be a huge waste of time.
79 /// We'll fix the mess up -without any change in the API- as soon as the bench
80 /// marks are fully performed.
81
82 #if defined(_MSC_VER) && (_MSC_VER == 1200)
83 // Doing everything within gdcm namespace to avoid polluting 3d party software
84 inline std::ostream& operator<<(std::ostream& _O, std::string _val)
85 {
86   return _O << _val.c_str();
87 }
88 #endif
89
90 /// \brief TagName is made to hold the 'non hexa" fields (VR, VM, Name) 
91 ///        of Dicom Entries
92 typedef std::string TagName;
93
94 /// \brief various types of a DICOM file (for internal use only)
95 enum FileType {
96 // note to developer : don't forget to add as well in vtkGdcmWriter.h !
97    Unknown = 0,
98    ExplicitVR, // DicomDir is in this case. Except when it's ImplicitVR !...
99    ImplicitVR,
100    ACR,
101    ACR_LIBIDO,
102    /// \todo FIXME : an encapsulated JPEG file may be 
103    ///              either ExplicitVR or ImplicitVR, right?
104    JPEG
105 };
106
107 /// \brief type of the elements composing a DICOMDIR (for internal use only)
108 enum DicomDirType {
109    DD_UNKNOWN = 0,
110    DD_META,
111    DD_PATIENT,
112    DD_STUDY,
113    DD_SERIE,
114    DD_IMAGE,
115    DD_VISIT
116 };
117
118 /// \brief comparison operators (as used in SerieHelper::AddRestriction() )
119 enum CompOperators {
120    GDCM_EQUAL = 0,
121    GDCM_DIFFERENT,
122    GDCM_GREATER,
123    GDCM_GREATEROREQUAL,
124    GDCM_LESS,
125    GDCM_LESSOREQUAL
126 };
127
128 /// \brief Loading mode
129 enum LodModeType
130 {
131    LD_ALL         = 0x00000000, // Load all
132    LD_NOSEQ       = 0x00000001, // Don't load Sequences
133    LD_NOSHADOW    = 0x00000002, // Don't load odd groups
134    LD_NOSHADOWSEQ = 0x00000004  // Don't load Sequences if they belong 
135                                 //            to an odd group
136                                 // (*exclusive* from LD_NOSEQ and LD_NOSHADOW)
137 };
138
139 /// \brief Only user knows what kind of image he is going to write  !
140 ///
141 /// -1) user created ex nihilo his own image and wants to write it as a Dicom image.
142 ///    USER_OWN_IMAGE
143 /// -2) user modified the pixels of an existing image.
144 ///    FILTERED_IMAGE
145 /// -3) user created a new image, using existing images (eg MIP, MPR, cartography image)
146 ///   CREATED_IMAGE
147 /// -4) user modified/added some tags *without processing* the pixels (anonymization...
148 ///   UNMODIFIED_PIXELS_IMAGE
149 enum ImageContentType
150 {
151 // note to developer : don't forget to add as well in vtkGdcmWriter.h !
152       USER_OWN_IMAGE = 1,
153       FILTERED_IMAGE,
154       CREATED_IMAGE,      
155       UNMODIFIED_PIXELS_IMAGE            
156 }; 
157   
158 /**
159  * \brief structure, for internal use only
160  */  
161 struct DicomElement
162 {
163    /// Dicom Group number
164    unsigned short int Group;
165    /// Dicom Element number
166    unsigned short int Elem;
167    /// Value Representation
168    VRKey VR;
169    /// value (coded as a std::string) of the Element
170    std::string Value;
171 };
172
173 } //namespace gdcm
174 //-----------------------------------------------------------------------------
175 #endif