OFFIS DCMTK  Version 3.6.0
dcmqrdbi.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: Andrew Hewett, Marco Eichelberg
17  *
18  * Purpose: class DcmQueryRetrieveIndexDatabaseHandle
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:41 $
22  * CVS/RCS Revision: $Revision: 1.8 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCMQRDBI_H
30 #define DCMQRDBI_H
31 
32 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
33 #include "dcmtk/dcmqrdb/dcmqrdba.h" /* for class DcmQueryRetrieveDatabaseHandle */
34 
35 #include "dcmtk/dcmnet/dicom.h"
36 #include "dcmtk/dcmnet/dimse.h"
37 #include "dcmtk/ofstd/offname.h"
38 
39 struct StudyDescRecord;
40 struct DB_Private_Handle;
41 struct DB_SmallDcmElmt;
42 struct IdxRecord;
43 struct DB_ElementList;
45 
46 #define DBINDEXFILE "index.dat"
47 
48 #ifndef _WIN32
49 /* we lock image files on all platforms except Win32 where it does not work
50  * due to the different semantics of LockFile/LockFileEx compared to flock.
51  */
52 #define LOCK_IMAGE_FILES
53 #endif
54 
57 enum DB_LEVEL
58 {
60  PATIENT_LEVEL,
62  STUDY_LEVEL,
64  SERIE_LEVEL,
66  IMAGE_LEVEL
67 };
68 
76 enum DVIFhierarchyStatus
77 {
79  DVIF_objectIsNotNew,
81  DVIF_objectIsNew,
83  DVIF_objectContainsNewSubobjects
84 };
85 
87 #define DB_UpperMaxStudies 500
88 
90 #define DB_UpperMaxBytesPerStudy 0x40000000L
91 
92 
98 {
99 public:
100 
111  const char *storageArea,
112  long maxStudiesPerStorageArea,
113  long maxBytesPerStudy,
114  OFCondition& result);
115 
121 
127  void setIdentifierChecking(OFBool checkFind, OFBool checkMove);
128 
139  const char *SOPClassUID,
140  const char *SOPInstanceUID,
141  char *newImageFileName);
142 
155  const char *SOPClassUID,
156  const char *SOPInstanceUID,
157  const char *imageFileName,
159  OFBool isNew = OFTrue );
160 
175  const char *SOPClassUID,
176  DcmDataset *findRequestIdentifiers,
178 
191  DcmDataset **findResponseIdentifiers,
193 
201 
216  const char *SOPClassUID,
217  DcmDataset *moveRequestIdentifiers,
219 
240  char *SOPClassUID,
241  char *SOPInstanceUID,
242  char *imageFileName,
243  unsigned short *numberOfRemainingSubOperations,
245 
253 
258 
259  // methods not inherited from the base class
260 
264  void enableQuotaSystem(OFBool enable);
265 
269  static void printIndexFile (char *storeArea);
270 
276  OFCondition deleteImageFile(char* imgFile);
277 
282  OFCondition DB_lock(OFBool exclusive);
283 
287 
293  OFCondition DB_IdxGetNext(int *idx, IdxRecord *idxRec);
294 
299  OFCondition DB_IdxInitLoop(int *idx);
300 
306  OFCondition DB_IdxRead(int idx, IdxRecord *idxRec);
307 
313 
319 
324  OFCondition DB_IdxRemove(int idx);
325 
330  OFCondition instanceReviewed(int idx);
331 
333  const char *getStorageArea() const;
334 
336  const char *getIndexFilename() const;
337 
338 
339 private:
340 
341  OFCondition removeDuplicateImage(
342  const char *SOPInstanceUID, const char *StudyInstanceUID,
343  StudyDescRecord *pStudyDesc, const char *newImageFileName);
344  int deleteOldestStudy(StudyDescRecord *pStudyDesc);
345  OFCondition deleteOldestImages(StudyDescRecord *pStudyDesc, int StudyNum, char *StudyUID, long RequiredSize);
346  int matchDate (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt);
347  int matchTime (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt);
348  int matchUID (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt);
349  int matchStrings (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt);
350  int matchOther (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt);
351  int dbmatch (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt);
352  void makeResponseList(DB_Private_Handle *phandle, IdxRecord *idxRec);
353  int matchStudyUIDInStudyDesc (StudyDescRecord *pStudyDesc, char *StudyUID, int maxStudiesAllowed);
354  OFCondition checkupinStudyDesc(StudyDescRecord *pStudyDesc, char *StudyUID, long imageSize);
355 
356  OFCondition hierarchicalCompare (
357  DB_Private_Handle *phandle,
358  IdxRecord *idxRec,
359  DB_LEVEL level,
360  DB_LEVEL infLevel,
361  int *match);
362 
363  OFCondition testFindRequestList (
364  DB_ElementList *findRequestList,
365  DB_LEVEL queryLevel,
366  DB_LEVEL infLevel,
367  DB_LEVEL lowestLevel);
368 
369  OFCondition testMoveRequestList (
370  DB_ElementList *findRequestList,
371  DB_LEVEL queryLevel,
372  DB_LEVEL infLevel,
373  DB_LEVEL lowestLevel);
374 
377 
380 
383 
386 
389 
390 };
391 
392 
397 {
398 public:
399 
404 
407 
417  const char *callingAETitle,
418  const char *calledAETitle,
419  OFCondition& result) const;
420 
421 private:
422 
425 };
426 
427 #endif
428 
429 /*
430  * CVS Log
431  * $Log: dcmqrdbi.h,v $
432  * Revision 1.8 2010-10-14 13:16:41 joergr
433  * Updated copyright header. Added reference to COPYRIGHT file.
434  *
435  * Revision 1.7 2009-11-24 10:10:42 uli
436  * Switched to logging mechanism provided by the "new" oflog module.
437  *
438  * Revision 1.6 2009-08-21 09:50:07 joergr
439  * Replaced tabs by spaces and updated copyright date.
440  *
441  * Revision 1.5 2008-04-15 15:43:37 meichel
442  * Fixed endless recursion bug in the index file handling code when
443  * the index file does not exist
444  *
445  * Revision 1.4 2005/12/08 16:04:22 meichel
446  * Changed include path schema for all DCMTK header files
447  *
448  * Revision 1.3 2005/04/22 15:36:34 meichel
449  * Passing calling aetitle to DcmQueryRetrieveDatabaseHandleFactory::createDBHandle
450  * to allow configuration retrieval based on calling aetitle.
451  *
452  * Revision 1.2 2005/04/04 10:04:45 meichel
453  * Added public declarations for index file functions that are
454  * used from module dcmpstat
455  *
456  * Revision 1.1 2005/03/30 13:34:50 meichel
457  * Initial release of module dcmqrdb that will replace module imagectn.
458  * It provides a clear interface between the Q/R DICOM front-end and the
459  * database back-end. The imagectn code has been re-factored into a minimal
460  * class structure.
461  *
462  *
463  */


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