00001 /* 00002 * 00003 * Copyright (C) 1993-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmqrdb 00015 * 00016 * Author: Marco Eichelberg / Didier Lemoine / Gilles Mevel 00017 * 00018 * Purpose: enums and structures used for the database index file 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:41 $ 00022 * CVS/RCS Revision: $Revision: 1.6 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 #ifndef DATAPRIV_H 00030 #define DATAPRIV_H 00031 00032 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00033 00034 #include "dcmtk/dcmnet/dicom.h" 00035 #include "dcmtk/dcmdata/dcdatset.h" 00036 #include "dcmtk/dcmdata/dcuid.h" 00037 #include "dcmtk/dcmdata/dcdeftag.h" 00038 #include "dcmtk/dcmqrdb/dcmqrdbi.h" 00039 00040 BEGIN_EXTERN_C 00041 #ifdef HAVE_IO_H 00042 #define access my_access // Workaround to make Visual C++ Compiler happy! 00043 #include <io.h> 00044 #undef access 00045 #endif 00046 END_EXTERN_C 00047 00050 enum DB_KEY_TYPE 00051 { 00053 UNIQUE_KEY, 00055 REQUIRED_KEY, 00057 OPTIONAL_KEY 00058 }; 00059 00062 enum DB_QUERY_CLASS 00063 { 00065 PATIENT_ROOT, 00067 STUDY_ROOT, 00069 PATIENT_STUDY 00070 }; 00071 00074 enum DB_KEY_CLASS 00075 { 00077 DATE_CLASS, 00079 TIME_CLASS, 00081 UID_CLASS, 00083 STRING_CLASS, 00085 OTHER_CLASS 00086 }; 00087 00088 00092 #define PATIENT_LEVEL_STRING "PATIENT" 00093 #define STUDY_LEVEL_STRING "STUDY" 00094 #define SERIE_LEVEL_STRING "SERIES" 00095 #define IMAGE_LEVEL_STRING "IMAGE" 00096 00097 /* 00098 ** Maximum size of things to put in db records. 00099 ** Some values will have vm>1 thus these maximums are 00100 ** intended to leave enough space for most common uses. 00101 */ 00102 #define AE_MAX_LENGTH 128 /* Application Entity */ 00103 #define AS_MAX_LENGTH 32 /* Age String */ 00104 #define AT_MAX_LENGTH 32 /* Attribute Tag */ 00105 #define CS_MAX_LENGTH 128 /* Code String */ 00106 #define DA_MAX_LENGTH 80 /* Date */ 00107 #define DS_MAX_LENGTH 128 /* Decimal String */ 00108 #define DT_MAX_LENGTH 208 /* Date Time */ 00109 #define FL_MAX_LENGTH 32 /* FLoating point single */ 00110 #define FD_MAX_LENGTH 64 /* Floating point Double */ 00111 #define IS_MAX_LENGTH 96 /* Integer String */ 00112 #define LO_MAX_LENGTH 64 /* Long String */ 00113 #define LT_MAX_LENGTH 10240 /* Long Text */ 00114 #define PN_MAX_LENGTH 64 /* Person Name */ 00115 #define SH_MAX_LENGTH 16 /* Short String */ 00116 #define SL_MAX_LENGTH 32 /* Signed Long */ 00117 #define SS_MAX_LENGTH 16 /* Signed Short */ 00118 #define ST_MAX_LENGTH 1024 /* Short Text */ 00119 #define TM_MAX_LENGTH 128 /* Time */ 00120 #define UI_MAX_LENGTH 64 /* Unique Identifier */ 00121 #define UL_MAX_LENGTH 32 /* Unsigned Long */ 00122 #define US_MAX_LENGTH 16 /* Unsigned Short */ 00123 #define CS_LABEL_MAX_LENGTH 16 /* Code String - Presentation Label */ 00124 #define DESCRIPTION_MAX_LENGTH 128 /* Not related to any particular DICOM attribute */ 00125 00126 #define DBC_MAXSTRING 256 00127 00128 #define MAX_MAX_STUDIES DB_UpperMaxStudies 00129 #define MAX_NUMBER_OF_IMAGES 10000 00130 #define SIZEOF_IDXRECORD (sizeof (IdxRecord)) 00131 #define SIZEOF_STUDYDESC (sizeof (StudyDescRecord) * MAX_MAX_STUDIES) 00132 00136 struct DB_SmallDcmElmt 00137 { 00138 public: 00140 DB_SmallDcmElmt(); 00141 00143 char* PValueField ; 00144 00146 Uint32 ValueLength ; 00147 00149 DcmTagKey XTag ; 00150 00151 private: 00153 DB_SmallDcmElmt(const DB_SmallDcmElmt& copy); 00155 DB_SmallDcmElmt& operator=(const DB_SmallDcmElmt& copy); 00156 }; 00157 00161 struct DB_ElementList 00162 { 00164 DB_ElementList(): elem(), next(NULL) {} 00165 00167 DB_SmallDcmElmt elem ; 00168 00170 struct DB_ElementList *next ; 00171 00172 private: 00174 DB_ElementList(const DB_ElementList& copy); 00176 DB_ElementList& operator=(const DB_ElementList& copy); 00177 }; 00178 00179 struct DB_UidList 00180 { 00181 char *patient ; 00182 char *study ; 00183 char *serie ; 00184 char *image ; 00185 struct DB_UidList *next ; 00186 }; 00187 00188 struct DB_CounterList 00189 { 00190 int idxCounter ; 00191 struct DB_CounterList *next ; 00192 }; 00193 00194 struct DB_FindAttr 00195 { 00196 DcmTagKey tag ; 00197 DB_LEVEL level ; 00198 DB_KEY_TYPE keyAttr ; 00199 DB_KEY_CLASS keyClass ; 00200 00201 /* to passify some C++ compilers */ 00202 DB_FindAttr(const DcmTagKey& t, DB_LEVEL l, DB_KEY_TYPE kt, DB_KEY_CLASS kc) 00203 : tag(t), level(l), keyAttr(kt), keyClass(kc) { } 00204 }; 00205 00206 struct DB_Private_Handle 00207 { 00208 int pidx ; 00209 DB_ElementList *findRequestList ; 00210 DB_ElementList *findResponseList ; 00211 DB_LEVEL queryLevel ; 00212 char indexFilename[DBC_MAXSTRING+1] ; 00213 char storageArea[DBC_MAXSTRING+1] ; 00214 long maxBytesPerStudy ; 00215 long maxStudiesAllowed ; 00216 int idxCounter ; 00217 DB_CounterList *moveCounterList ; 00218 int NumberRemainOperations ; 00219 DB_QUERY_CLASS rootLevel ; 00220 DB_UidList *uidList ; 00221 00222 DB_Private_Handle() 00223 : pidx(0) 00224 , findRequestList(NULL) 00225 , findResponseList(NULL) 00226 , queryLevel(STUDY_LEVEL) 00227 // , indexFilename() 00228 // , storageArea() 00229 , maxBytesPerStudy(0) 00230 , maxStudiesAllowed(0) 00231 , idxCounter(0) 00232 , moveCounterList(NULL) 00233 , NumberRemainOperations(0) 00234 , rootLevel(STUDY_ROOT) 00235 , uidList(NULL) 00236 { 00237 } 00238 }; 00239 00244 struct StudyDescRecord 00245 { 00247 char StudyInstanceUID [UI_MAX_LENGTH] ; 00248 00250 long StudySize ; 00251 00253 double LastRecordedDate ; 00254 00256 int NumberofRegistratedImages ; 00257 }; 00258 00259 struct ImagesofStudyArray 00260 { 00261 int idxCounter ; 00262 double RecordedDate ; 00263 long ImageSize ; 00264 }; 00265 00266 00267 /* the following constants define which array element 00268 * of the param[] array in the IdxRecord structure 00269 * is linked to which value field in the IdxRecord. 00270 * numbers must be continuous, starting with 0. 00271 * 00272 * The constant NBPARAMETERS must contain the number 00273 * of array elements to be referenced in param[] 00274 * (= highest index +1) 00275 */ 00276 00277 #define RECORDIDX_PatientBirthDate 0 00278 #define RECORDIDX_PatientSex 1 00279 #define RECORDIDX_PatientName 2 00280 #define RECORDIDX_PatientID 3 00281 #define RECORDIDX_PatientBirthTime 4 00282 #define RECORDIDX_OtherPatientIDs 5 00283 #define RECORDIDX_OtherPatientNames 6 00284 #define RECORDIDX_EthnicGroup 7 00285 #define RECORDIDX_NumberofPatientRelatedStudies 8 00286 #define RECORDIDX_NumberofPatientRelatedSeries 9 00287 #define RECORDIDX_NumberofPatientRelatedInstances 10 00288 #define RECORDIDX_StudyDate 11 00289 #define RECORDIDX_StudyTime 12 00290 #define RECORDIDX_StudyID 13 00291 #define RECORDIDX_StudyDescription 14 00292 #define RECORDIDX_NameOfPhysiciansReadingStudy 15 00293 #define RECORDIDX_AccessionNumber 16 00294 #define RECORDIDX_ReferringPhysicianName 17 00295 #define RECORDIDX_ProcedureDescription 18 00296 #define RECORDIDX_AttendingPhysiciansName 19 00297 #define RECORDIDX_StudyInstanceUID 20 00298 #define RECORDIDX_OtherStudyNumbers 21 00299 #define RECORDIDX_AdmittingDiagnosesDescription 22 00300 #define RECORDIDX_PatientAge 23 00301 #define RECORDIDX_PatientSize 24 00302 #define RECORDIDX_PatientWeight 25 00303 #define RECORDIDX_Occupation 26 00304 #define RECORDIDX_NumberofStudyRelatedSeries 27 00305 #define RECORDIDX_NumberofStudyRelatedInstances 28 00306 #define RECORDIDX_SeriesNumber 29 00307 #define RECORDIDX_SeriesInstanceUID 30 00308 #define RECORDIDX_Modality 31 00309 #define RECORDIDX_ImageNumber 32 00310 #define RECORDIDX_SOPInstanceUID 33 00311 #define RECORDIDX_SeriesDate 34 00312 #define RECORDIDX_SeriesTime 35 00313 #define RECORDIDX_SeriesDescription 36 00314 #define RECORDIDX_ProtocolName 37 00315 #define RECORDIDX_OperatorsName 38 00316 #define RECORDIDX_PerformingPhysicianName 39 00317 #define RECORDIDX_PresentationLabel 40 00318 00319 #define NBPARAMETERS 41 00320 00321 00326 struct IdxRecord 00327 { 00329 IdxRecord(); 00330 00331 char filename [DBC_MAXSTRING+1] ; 00332 char SOPClassUID [UI_MAX_LENGTH+1] ; 00333 double RecordedDate ; 00334 int ImageSize ; 00335 00336 DB_SmallDcmElmt param [NBPARAMETERS] ; 00337 00338 char PatientBirthDate [DA_MAX_LENGTH+1] ; 00339 char PatientSex [CS_MAX_LENGTH+1] ; 00340 char PatientName [PN_MAX_LENGTH+1] ; 00341 char PatientID [LO_MAX_LENGTH+1] ; 00342 char PatientBirthTime [TM_MAX_LENGTH+1] ; 00343 char OtherPatientIDs [LO_MAX_LENGTH+1] ; 00344 char OtherPatientNames [PN_MAX_LENGTH+1] ; 00345 char EthnicGroup [SH_MAX_LENGTH+1] ; 00346 char NumberofPatientRelatedStudies [IS_MAX_LENGTH+1] ; 00347 char NumberofPatientRelatedSeries [IS_MAX_LENGTH+1] ; 00348 char NumberofPatientRelatedInstances [IS_MAX_LENGTH+1] ; 00349 00350 char StudyDate [DA_MAX_LENGTH+1] ; 00351 char StudyTime [TM_MAX_LENGTH+1] ; 00352 char StudyID [CS_MAX_LENGTH+1] ; 00353 char StudyDescription [LO_MAX_LENGTH+1] ; 00354 char NameOfPhysiciansReadingStudy [PN_MAX_LENGTH+1] ; 00355 00356 char AccessionNumber [CS_MAX_LENGTH+1] ; 00357 char ReferringPhysicianName [PN_MAX_LENGTH+1] ; 00358 char ProcedureDescription [LO_MAX_LENGTH+1] ; 00359 char AttendingPhysiciansName [PN_MAX_LENGTH+1] ; 00360 char StudyInstanceUID [UI_MAX_LENGTH+1] ; 00361 char OtherStudyNumbers [IS_MAX_LENGTH+1] ; 00362 char AdmittingDiagnosesDescription [LO_MAX_LENGTH+1] ; 00363 char PatientAge [AS_MAX_LENGTH+1] ; 00364 char PatientSize [DS_MAX_LENGTH+1] ; 00365 char PatientWeight [DS_MAX_LENGTH+1] ; 00366 char Occupation [SH_MAX_LENGTH+1] ; 00367 char NumberofStudyRelatedSeries [IS_MAX_LENGTH+1] ; 00368 char NumberofStudyRelatedInstances [IS_MAX_LENGTH+1] ; 00369 00370 char SeriesNumber [IS_MAX_LENGTH+1] ; 00371 char SeriesInstanceUID [UI_MAX_LENGTH+1] ; 00372 char Modality [CS_MAX_LENGTH+1] ; 00373 00374 char ImageNumber [IS_MAX_LENGTH+1] ; 00375 char SOPInstanceUID [UI_MAX_LENGTH+1] ; 00376 00377 char SeriesDate [DA_MAX_LENGTH+1] ; 00378 char SeriesTime [TM_MAX_LENGTH+1] ; 00379 char SeriesDescription [LO_MAX_LENGTH+1] ; 00380 char ProtocolName [LO_MAX_LENGTH+1] ; 00381 char OperatorsName [PN_MAX_LENGTH+1] ; 00382 char PerformingPhysicianName [PN_MAX_LENGTH+1] ; 00383 char PresentationLabel [CS_LABEL_MAX_LENGTH+1] ; 00384 00385 DVIFhierarchyStatus hstat; 00386 00387 // Not related to any particular DICOM attribute ! 00388 char InstanceDescription [DESCRIPTION_MAX_LENGTH+1] ; 00389 00390 private: 00391 /* undefined */ IdxRecord(const IdxRecord& copy); 00392 /* undefined */ IdxRecord& operator=(const IdxRecord& copy); 00393 }; 00394 00395 00396 #endif 00397 00398 /* 00399 * CVS Log 00400 * $Log: dcmqridx.h,v $ 00401 * Revision 1.6 2010-10-14 13:16:41 joergr 00402 * Updated copyright header. Added reference to COPYRIGHT file. 00403 * 00404 * Revision 1.5 2010-08-09 13:23:00 joergr 00405 * Updated data dictionary to 2009 edition of the DICOM standard. From now on, 00406 * the official "keyword" is used for the attribute name which results in a 00407 * number of minor changes (e.g. "PatientsName" is now called "PatientName"). 00408 * 00409 * Revision 1.4 2009-01-30 14:45:02 joergr 00410 * Uncommented initialization of array variables in order to avoid compiler 00411 * warnings reported by VisualStudio 2005. 00412 * 00413 * Revision 1.3 2008-04-15 15:43:37 meichel 00414 * Fixed endless recursion bug in the index file handling code when 00415 * the index file does not exist 00416 * 00417 * Revision 1.2 2005/12/08 16:04:24 meichel 00418 * Changed include path schema for all DCMTK header files 00419 * 00420 * Revision 1.1 2005/03/30 13:34:50 meichel 00421 * Initial release of module dcmqrdb that will replace module imagectn. 00422 * It provides a clear interface between the Q/R DICOM front-end and the 00423 * database back-end. The imagectn code has been re-factored into a minimal 00424 * class structure. 00425 * 00426 * 00427 */