OFFIS DCMTK  Version 3.6.0
dcmqridx.h
1 /*
2  *
3  * Copyright (C) 1993-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmqrdb
15  *
16  * Author: Marco Eichelberg / Didier Lemoine / Gilles Mevel
17  *
18  * Purpose: enums and structures used for the database index file
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:41 $
22  * CVS/RCS Revision: $Revision: 1.6 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DATAPRIV_H
30 #define DATAPRIV_H
31 
32 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
33 
34 #include "dcmtk/dcmnet/dicom.h"
35 #include "dcmtk/dcmdata/dcdatset.h"
36 #include "dcmtk/dcmdata/dcuid.h"
37 #include "dcmtk/dcmdata/dcdeftag.h"
38 #include "dcmtk/dcmqrdb/dcmqrdbi.h"
39 
40 BEGIN_EXTERN_C
41 #ifdef HAVE_IO_H
42 #define access my_access // Workaround to make Visual C++ Compiler happy!
43 #include <io.h>
44 #undef access
45 #endif
46 END_EXTERN_C
47 
50 enum DB_KEY_TYPE
51 {
53  UNIQUE_KEY,
55  REQUIRED_KEY,
57  OPTIONAL_KEY
58 };
59 
62 enum DB_QUERY_CLASS
63 {
65  PATIENT_ROOT,
67  STUDY_ROOT,
69  PATIENT_STUDY
70 };
71 
74 enum DB_KEY_CLASS
75 {
77  DATE_CLASS,
79  TIME_CLASS,
81  UID_CLASS,
83  STRING_CLASS,
85  OTHER_CLASS
86 };
87 
88 
92 #define PATIENT_LEVEL_STRING "PATIENT"
93 #define STUDY_LEVEL_STRING "STUDY"
94 #define SERIE_LEVEL_STRING "SERIES"
95 #define IMAGE_LEVEL_STRING "IMAGE"
96 
97 /*
98 ** Maximum size of things to put in db records.
99 ** Some values will have vm>1 thus these maximums are
100 ** intended to leave enough space for most common uses.
101 */
102 #define AE_MAX_LENGTH 128 /* Application Entity */
103 #define AS_MAX_LENGTH 32 /* Age String */
104 #define AT_MAX_LENGTH 32 /* Attribute Tag */
105 #define CS_MAX_LENGTH 128 /* Code String */
106 #define DA_MAX_LENGTH 80 /* Date */
107 #define DS_MAX_LENGTH 128 /* Decimal String */
108 #define DT_MAX_LENGTH 208 /* Date Time */
109 #define FL_MAX_LENGTH 32 /* FLoating point single */
110 #define FD_MAX_LENGTH 64 /* Floating point Double */
111 #define IS_MAX_LENGTH 96 /* Integer String */
112 #define LO_MAX_LENGTH 64 /* Long String */
113 #define LT_MAX_LENGTH 10240 /* Long Text */
114 #define PN_MAX_LENGTH 64 /* Person Name */
115 #define SH_MAX_LENGTH 16 /* Short String */
116 #define SL_MAX_LENGTH 32 /* Signed Long */
117 #define SS_MAX_LENGTH 16 /* Signed Short */
118 #define ST_MAX_LENGTH 1024 /* Short Text */
119 #define TM_MAX_LENGTH 128 /* Time */
120 #define UI_MAX_LENGTH 64 /* Unique Identifier */
121 #define UL_MAX_LENGTH 32 /* Unsigned Long */
122 #define US_MAX_LENGTH 16 /* Unsigned Short */
123 #define CS_LABEL_MAX_LENGTH 16 /* Code String - Presentation Label */
124 #define DESCRIPTION_MAX_LENGTH 128 /* Not related to any particular DICOM attribute */
125 
126 #define DBC_MAXSTRING 256
127 
128 #define MAX_MAX_STUDIES DB_UpperMaxStudies
129 #define MAX_NUMBER_OF_IMAGES 10000
130 #define SIZEOF_IDXRECORD (sizeof (IdxRecord))
131 #define SIZEOF_STUDYDESC (sizeof (StudyDescRecord) * MAX_MAX_STUDIES)
132 
137 {
138 public:
140  DB_SmallDcmElmt();
141 
143  char* PValueField ;
144 
146  Uint32 ValueLength ;
147 
150 
151 private:
153  DB_SmallDcmElmt(const DB_SmallDcmElmt& copy);
156 };
157 
162 {
164  DB_ElementList(): elem(), next(NULL) {}
165 
168 
171 
172 private:
174  DB_ElementList(const DB_ElementList& copy);
177 };
178 
180 {
181  char *patient ;
182  char *study ;
183  char *serie ;
184  char *image ;
185  struct DB_UidList *next ;
186 };
187 
189 {
190  int idxCounter ;
191  struct DB_CounterList *next ;
192 };
193 
195 {
196  DcmTagKey tag ;
197  DB_LEVEL level ;
198  DB_KEY_TYPE keyAttr ;
199  DB_KEY_CLASS keyClass ;
200 
201  /* to passify some C++ compilers */
202  DB_FindAttr(const DcmTagKey& t, DB_LEVEL l, DB_KEY_TYPE kt, DB_KEY_CLASS kc)
203  : tag(t), level(l), keyAttr(kt), keyClass(kc) { }
204 };
205 
207 {
208  int pidx ;
209  DB_ElementList *findRequestList ;
210  DB_ElementList *findResponseList ;
211  DB_LEVEL queryLevel ;
212  char indexFilename[DBC_MAXSTRING+1] ;
213  char storageArea[DBC_MAXSTRING+1] ;
214  long maxBytesPerStudy ;
215  long maxStudiesAllowed ;
216  int idxCounter ;
217  DB_CounterList *moveCounterList ;
218  int NumberRemainOperations ;
219  DB_QUERY_CLASS rootLevel ;
220  DB_UidList *uidList ;
221 
223  : pidx(0)
224  , findRequestList(NULL)
225  , findResponseList(NULL)
226  , queryLevel(STUDY_LEVEL)
227 // , indexFilename()
228 // , storageArea()
229  , maxBytesPerStudy(0)
230  , maxStudiesAllowed(0)
231  , idxCounter(0)
232  , moveCounterList(NULL)
233  , NumberRemainOperations(0)
234  , rootLevel(STUDY_ROOT)
235  , uidList(NULL)
236  {
237  }
238 };
239 
245 {
247  char StudyInstanceUID [UI_MAX_LENGTH] ;
248 
250  long StudySize ;
251 
254 
257 };
258 
260 {
261  int idxCounter ;
262  double RecordedDate ;
263  long ImageSize ;
264 };
265 
266 
267 /* the following constants define which array element
268  * of the param[] array in the IdxRecord structure
269  * is linked to which value field in the IdxRecord.
270  * numbers must be continuous, starting with 0.
271  *
272  * The constant NBPARAMETERS must contain the number
273  * of array elements to be referenced in param[]
274  * (= highest index +1)
275  */
276 
277 #define RECORDIDX_PatientBirthDate 0
278 #define RECORDIDX_PatientSex 1
279 #define RECORDIDX_PatientName 2
280 #define RECORDIDX_PatientID 3
281 #define RECORDIDX_PatientBirthTime 4
282 #define RECORDIDX_OtherPatientIDs 5
283 #define RECORDIDX_OtherPatientNames 6
284 #define RECORDIDX_EthnicGroup 7
285 #define RECORDIDX_NumberofPatientRelatedStudies 8
286 #define RECORDIDX_NumberofPatientRelatedSeries 9
287 #define RECORDIDX_NumberofPatientRelatedInstances 10
288 #define RECORDIDX_StudyDate 11
289 #define RECORDIDX_StudyTime 12
290 #define RECORDIDX_StudyID 13
291 #define RECORDIDX_StudyDescription 14
292 #define RECORDIDX_NameOfPhysiciansReadingStudy 15
293 #define RECORDIDX_AccessionNumber 16
294 #define RECORDIDX_ReferringPhysicianName 17
295 #define RECORDIDX_ProcedureDescription 18
296 #define RECORDIDX_AttendingPhysiciansName 19
297 #define RECORDIDX_StudyInstanceUID 20
298 #define RECORDIDX_OtherStudyNumbers 21
299 #define RECORDIDX_AdmittingDiagnosesDescription 22
300 #define RECORDIDX_PatientAge 23
301 #define RECORDIDX_PatientSize 24
302 #define RECORDIDX_PatientWeight 25
303 #define RECORDIDX_Occupation 26
304 #define RECORDIDX_NumberofStudyRelatedSeries 27
305 #define RECORDIDX_NumberofStudyRelatedInstances 28
306 #define RECORDIDX_SeriesNumber 29
307 #define RECORDIDX_SeriesInstanceUID 30
308 #define RECORDIDX_Modality 31
309 #define RECORDIDX_ImageNumber 32
310 #define RECORDIDX_SOPInstanceUID 33
311 #define RECORDIDX_SeriesDate 34
312 #define RECORDIDX_SeriesTime 35
313 #define RECORDIDX_SeriesDescription 36
314 #define RECORDIDX_ProtocolName 37
315 #define RECORDIDX_OperatorsName 38
316 #define RECORDIDX_PerformingPhysicianName 39
317 #define RECORDIDX_PresentationLabel 40
318 
319 #define NBPARAMETERS 41
320 
321 
326 struct IdxRecord
327 {
329  IdxRecord();
330 
331  char filename [DBC_MAXSTRING+1] ;
332  char SOPClassUID [UI_MAX_LENGTH+1] ;
333  double RecordedDate ;
334  int ImageSize ;
335 
336  DB_SmallDcmElmt param [NBPARAMETERS] ;
337 
338  char PatientBirthDate [DA_MAX_LENGTH+1] ;
339  char PatientSex [CS_MAX_LENGTH+1] ;
340  char PatientName [PN_MAX_LENGTH+1] ;
341  char PatientID [LO_MAX_LENGTH+1] ;
342  char PatientBirthTime [TM_MAX_LENGTH+1] ;
343  char OtherPatientIDs [LO_MAX_LENGTH+1] ;
344  char OtherPatientNames [PN_MAX_LENGTH+1] ;
345  char EthnicGroup [SH_MAX_LENGTH+1] ;
346  char NumberofPatientRelatedStudies [IS_MAX_LENGTH+1] ;
347  char NumberofPatientRelatedSeries [IS_MAX_LENGTH+1] ;
348  char NumberofPatientRelatedInstances [IS_MAX_LENGTH+1] ;
349 
350  char StudyDate [DA_MAX_LENGTH+1] ;
351  char StudyTime [TM_MAX_LENGTH+1] ;
352  char StudyID [CS_MAX_LENGTH+1] ;
353  char StudyDescription [LO_MAX_LENGTH+1] ;
354  char NameOfPhysiciansReadingStudy [PN_MAX_LENGTH+1] ;
355 
356  char AccessionNumber [CS_MAX_LENGTH+1] ;
357  char ReferringPhysicianName [PN_MAX_LENGTH+1] ;
358  char ProcedureDescription [LO_MAX_LENGTH+1] ;
359  char AttendingPhysiciansName [PN_MAX_LENGTH+1] ;
360  char StudyInstanceUID [UI_MAX_LENGTH+1] ;
361  char OtherStudyNumbers [IS_MAX_LENGTH+1] ;
362  char AdmittingDiagnosesDescription [LO_MAX_LENGTH+1] ;
363  char PatientAge [AS_MAX_LENGTH+1] ;
364  char PatientSize [DS_MAX_LENGTH+1] ;
365  char PatientWeight [DS_MAX_LENGTH+1] ;
366  char Occupation [SH_MAX_LENGTH+1] ;
367  char NumberofStudyRelatedSeries [IS_MAX_LENGTH+1] ;
368  char NumberofStudyRelatedInstances [IS_MAX_LENGTH+1] ;
369 
370  char SeriesNumber [IS_MAX_LENGTH+1] ;
371  char SeriesInstanceUID [UI_MAX_LENGTH+1] ;
372  char Modality [CS_MAX_LENGTH+1] ;
373 
374  char ImageNumber [IS_MAX_LENGTH+1] ;
375  char SOPInstanceUID [UI_MAX_LENGTH+1] ;
376 
377  char SeriesDate [DA_MAX_LENGTH+1] ;
378  char SeriesTime [TM_MAX_LENGTH+1] ;
379  char SeriesDescription [LO_MAX_LENGTH+1] ;
380  char ProtocolName [LO_MAX_LENGTH+1] ;
381  char OperatorsName [PN_MAX_LENGTH+1] ;
382  char PerformingPhysicianName [PN_MAX_LENGTH+1] ;
383  char PresentationLabel [CS_LABEL_MAX_LENGTH+1] ;
384 
385  DVIFhierarchyStatus hstat;
386 
387  // Not related to any particular DICOM attribute !
388  char InstanceDescription [DESCRIPTION_MAX_LENGTH+1] ;
389 
390 private:
391  /* undefined */ IdxRecord(const IdxRecord& copy);
392  /* undefined */ IdxRecord& operator=(const IdxRecord& copy);
393 };
394 
395 
396 #endif
397 
398 /*
399  * CVS Log
400  * $Log: dcmqridx.h,v $
401  * Revision 1.6 2010-10-14 13:16:41 joergr
402  * Updated copyright header. Added reference to COPYRIGHT file.
403  *
404  * Revision 1.5 2010-08-09 13:23:00 joergr
405  * Updated data dictionary to 2009 edition of the DICOM standard. From now on,
406  * the official "keyword" is used for the attribute name which results in a
407  * number of minor changes (e.g. "PatientsName" is now called "PatientName").
408  *
409  * Revision 1.4 2009-01-30 14:45:02 joergr
410  * Uncommented initialization of array variables in order to avoid compiler
411  * warnings reported by VisualStudio 2005.
412  *
413  * Revision 1.3 2008-04-15 15:43:37 meichel
414  * Fixed endless recursion bug in the index file handling code when
415  * the index file does not exist
416  *
417  * Revision 1.2 2005/12/08 16:04:24 meichel
418  * Changed include path schema for all DCMTK header files
419  *
420  * Revision 1.1 2005/03/30 13:34:50 meichel
421  * Initial release of module dcmqrdb that will replace module imagectn.
422  * It provides a clear interface between the Q/R DICOM front-end and the
423  * database back-end. The imagectn code has been re-factored into a minimal
424  * class structure.
425  *
426  *
427  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2