00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef DVIFACE_H
00036 #define DVIFACE_H
00037
00038 #include "dcmtk/config/osconfig.h"
00039
00040
00041 #include "dcmtk/ofstd/ofstream.h"
00042 #include "dcmtk/dcmdata/dctk.h"
00043 #include "dcmtk/dcmpstat/dvpscf.h"
00044 #include "dcmtk/dcmpstat/dvpstat.h"
00045 #include "dcmtk/dcmqrdb/dcmqridx.h"
00046 #include "dcmtk/ofstd/ofstring.h"
00047 #include "dcmtk/dcmpstat/dvcache.h"
00048
00049
00050 class OFLogFile;
00051 class DicomImage;
00052 class DiDisplayFunction;
00053 class DVPSStoredPrint;
00054 class DVPSPrintMessageHandler;
00055 class DSRDocument;
00056 class DVSignatureHandler;
00057
00062 class DVInterface: public DVConfiguration
00063 {
00064
00065 public:
00066
00076 DVInterface(const char *config_file = NULL, OFBool useLog = OFFalse);
00077
00080 virtual ~DVInterface();
00081
00082
00083
00093 OFCondition loadImage(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
00094
00101 OFCondition loadImage(const char *filename);
00102
00110 OFCondition loadReferencedImage(size_t idx, OFBool changeStatus = OFFalse);
00111
00122 OFCondition loadPState(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
00123
00132 OFCondition loadPState(const char *pstName, const char *imgName = NULL);
00133
00142 OFCondition loadStructuredReport(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
00143
00149 OFCondition loadStructuredReport(const char *filename);
00150
00163 OFCondition loadSRTemplate(const char *reportID);
00164
00177 OFCondition savePState(OFBool replaceSOPInstanceUID);
00178
00192 OFCondition savePState(const char *filename, OFBool replaceSOPInstanceUID, OFBool explicitVR=OFTrue);
00193
00203 OFCondition saveCurrentImage(const char *filename, OFBool explicitVR=OFTrue);
00204
00216 OFCondition saveStructuredReport();
00217
00230 OFCondition saveStructuredReport(const char *filename, OFBool explicitVR=OFTrue);
00231
00240 OFCondition addImageReferenceToPState(const char *studyUID, const char *seriesUID, const char *instanceUID);
00241
00245 size_t getNumberOfImageReferences();
00246
00253 DVPresentationState& getCurrentPState()
00254 {
00255 return *pState;
00256 }
00257
00263 DSRDocument& getCurrentReport()
00264 {
00265 return *pReport;
00266 }
00267
00272 DVPSStoredPrint& getPrintHandler()
00273 {
00274 return *pPrint;
00275 }
00276
00284 OFCondition resetPresentationState();
00285
00291 OFCondition saveCurrentPStateForReset();
00292
00301 OFCondition releaseDatabase();
00302
00312 const char *getFilename(const char *studyUID, const char *seriesUID, const char *instanceUID);
00313
00322 Uint32 getNumberOfStudies();
00323
00332 OFCondition selectStudy(Uint32 idx);
00333
00342 OFCondition selectStudy(const char *studyUID);
00343
00350 DVIFhierarchyStatus getStudyStatus() ;
00351
00357 const char *getStudyUID();
00358
00364 const char *getStudyDescription();
00365
00371 const char *getStudyDate();
00372
00378 const char *getStudyTime();
00379
00385 const char *getReferringPhysiciansName();
00386
00392 const char *getAccessionNumber();
00393
00399 const char *getNameOfPhysiciansReadingStudy();
00400
00408 const char *getPatientName();
00409
00417 const char *getPatientID();
00418
00426 const char *getPatientBirthDate();
00427
00435 const char *getPatientSex();
00436
00444 const char *getPatientBirthTime();
00445
00453 const char *getOtherPatientNames();
00454
00462 const char *getOtherPatientID();
00463
00471 const char *getEthnicGroup();
00472
00480 Uint32 getNumberOfSeries();
00481
00489 OFCondition selectSeries(Uint32 idx);
00490
00498 OFCondition selectSeries(const char *seriesUID);
00499
00505 const char *getSeriesUID();
00506
00512 DVIFhierarchyStatus getSeriesStatus();
00513
00521 DVPSInstanceType getSeriesType();
00522
00528 DVPSInstanceType getInstanceType();
00529
00535 const char *getSeriesNumber();
00536
00542 const char *getSeriesDate();
00543
00549 const char *getSeriesTime();
00550
00556 const char *getSeriesDescription();
00557
00563 const char *getSeriesPerformingPhysiciansName();
00564
00570 const char *getSeriesProtocolName();
00571
00577 const char *getSeriesOperatorsName();
00578
00584 const char *getModality();
00585
00593 Uint32 getNumberOfInstances();
00594
00602 OFCondition selectInstance(Uint32 idx);
00603
00611 OFCondition selectInstance(const char *instanceUID);
00612
00622 OFCondition selectInstance(const char *instanceUID, const char *sopClassUID);
00623
00633 OFCondition selectInstance(const char *studyUID, const char *seriesUID, const char *instanceUID);
00634
00640 const char *getSOPClassUID();
00641
00647 const char *getInstanceUID();
00648
00654 const char *getImageNumber();
00655
00661 const char *getFilename();
00662
00668 DVIFhierarchyStatus getInstanceStatus() ;
00669
00675 const char *getInstanceDescription();
00676
00682 const char *getPresentationLabel();
00683
00684
00685
00686
00699 OFCondition instanceReviewed(const char *studyUID, const char *seriesUID, const char *instanceUID);
00700
00712 OFCondition deleteInstance(const char *studyUID, const char *seriesUID, const char *instanceUID);
00713
00724 OFCondition deleteSeries(const char *studyUID, const char *seriesUID);
00725
00735 OFCondition deleteStudy(const char *studyUID);
00736
00737
00738
00750 OFCondition startReceiver();
00751
00759 OFCondition terminateReceiver();
00760
00776 OFCondition startQueryRetrieveServer();
00777
00787 OFCondition terminateQueryRetrieveServer();
00788
00799 OFBool newInstancesReceived();
00800
00813 OFCondition sendStudy(const char *targetID, const char *studyUID)
00814 {
00815 return sendIOD(targetID, studyUID, NULL, NULL);
00816 }
00817
00832 OFCondition sendSeries(const char *targetID, const char *studyUID, const char *seriesUID)
00833 {
00834 return sendIOD(targetID, studyUID, seriesUID, NULL);
00835 }
00836
00854 OFCondition sendIOD(const char *targetID, const char *studyUID, const char *seriesUID, const char *instanceUID);
00855
00866 OFCondition dumpIOD(const char *filename);
00867
00883 OFCondition dumpIOD(const char *studyUID, const char *seriesUID, const char *instanceUID);
00884
00895 OFCondition checkIOD(const char *filename);
00896
00912 OFCondition checkIOD(const char *studyUID, const char *seriesUID, const char *instanceUID);
00913
00931 OFCondition saveDICOMImage(
00932 const char *filename,
00933 const void *pixelData,
00934 unsigned long width,
00935 unsigned long height,
00936 double aspectRatio=1.0,
00937 OFBool explicitVR=OFTrue,
00938 const char *instanceUID=NULL);
00939
00954 OFCondition saveDICOMImage(
00955 const void *pixelData,
00956 unsigned long width,
00957 unsigned long height,
00958 double aspectRatio=1.0);
00959
00977 OFCondition saveHardcopyGrayscaleImage(
00978 const char *filename,
00979 const void *pixelData,
00980 unsigned long width,
00981 unsigned long height,
00982 double aspectRatio=1.0,
00983 OFBool explicitVR=OFTrue,
00984 const char *instanceUID=NULL);
00985
01000 OFCondition saveHardcopyGrayscaleImage(
01001 const void *pixelData,
01002 unsigned long width,
01003 unsigned long height,
01004 double aspectRatio=1.0);
01005
01015 OFCondition saveFileFormatToDB(DcmFileFormat &fileformat);
01016
01026 OFCondition loadStoredPrint(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
01027
01034 OFCondition loadStoredPrint(const char *filename);
01035
01047 OFCondition saveStoredPrint(
01048 const char *filename,
01049 OFBool writeRequestedImageSize,
01050 OFBool explicitVR=OFTrue,
01051 const char *instanceUID=NULL);
01052
01063 OFCondition saveStoredPrint(OFBool writeRequestedImageSize);
01064
01068 size_t getNumberOfPrintPreviews();
01069
01081 OFCondition loadPrintPreview(size_t idx, OFBool printLUT = OFTrue, OFBool changeStatus = OFFalse);
01082
01085 void unloadPrintPreview();
01086
01091 unsigned long getPrintPreviewSize();
01092
01101 void setMaxPrintPreviewWidthHeight(unsigned long width, unsigned long height);
01102
01109 OFCondition getPrintPreviewWidthHeight(unsigned long &width, unsigned long &height);
01110
01117 OFCondition getPrintPreviewBitmap(void *bitmap, unsigned long size);
01118
01125 OFCondition disablePState();
01126
01132 OFCondition enablePState();
01133
01139 Uint32 getNumberOfPStates();
01140
01147 OFCondition selectPState(Uint32 idx, OFBool changeStatus = OFFalse);
01148
01154 const char *getPStateDescription(Uint32 idx);
01155
01161 const char *getPStateLabel(Uint32 idx);
01162
01170 OFBool isDisplayTransformPossible(DVPSDisplayTransform transform = DVPSD_GSDF);
01171
01176 OFCondition setAmbientLightValue(double value);
01177
01182 OFCondition getAmbientLightValue(double &value);
01183
01184
01185
01191 OFCondition setCurrentPrinter(const char *targetID);
01192
01197 const char *getCurrentPrinter();
01198
01205 OFCondition setPrinterMediumType(const char *value);
01206
01210 const char *getPrinterMediumType();
01211
01218 OFCondition setPrinterFilmDestination(const char *value);
01219
01223 const char *getPrinterFilmDestination();
01224
01231 OFCondition setPrinterFilmSessionLabel(const char *value);
01232
01236 const char *getPrinterFilmSessionLabel();
01237
01244 OFCondition setPrinterPriority(const char *value);
01245
01249 const char *getPrinterPriority();
01250
01257 OFCondition setPrinterOwnerID(const char *value);
01258
01262 const char *getPrinterOwnerID();
01263
01270 OFCondition setPrinterNumberOfCopies(unsigned long value);
01271
01275 unsigned long getPrinterNumberOfCopies();
01276
01282 void clearFilmSessionSettings();
01283
01289 OFCondition selectDisplayPresentationLUT(const char *lutID);
01290
01296 const char *getDisplayPresentationLUTID();
01297
01305 OFCondition selectPrintPresentationLUT(const char *lutID);
01306
01312 const char *getPrintPresentationLUTID();
01313
01318 OFCondition spoolPrintJob(OFBool deletePrintedImages=OFTrue);
01319
01331 OFCondition startPrintSpooler();
01332
01339 OFCondition terminatePrintSpooler();
01340
01353 OFCondition startPrintServer();
01354
01362 OFCondition terminatePrintServer();
01363
01374 OFCondition addToPrintHardcopyFromDB(const char *studyUID, const char *seriesUID, const char *instanceUID);
01375
01386 OFCondition spoolStoredPrintFromDB(const char *studyUID, const char *seriesUID, const char *instanceUID);
01387
01397 OFCondition printSCUcreateBasicFilmSession(DVPSPrintMessageHandler& printHandler, OFBool plutInSession);
01398
01399
01400
01404 OFBool isActiveAnnotation() { return activateAnnotation; }
01405
01409 OFBool getPrependDateTime() { return prependDateTime; }
01410
01414 OFBool getPrependPrinterName() { return prependPrinterName; }
01415
01419 OFBool getPrependLighting() { return prependLighting; }
01420
01424 const char *getAnnotationText() { return annotationText.c_str(); }
01425
01429 void setActiveAnnotation(OFBool value) { activateAnnotation=value; }
01430
01434 void setPrependDateTime(OFBool value) { prependDateTime=value; }
01435
01439 void setPrependPrinterName(OFBool value) { prependPrinterName=value; }
01440
01444 void setPrependLighting(OFBool value) { prependLighting=value; }
01445
01449 void setAnnotationText(const char *value);
01450
01451
01452
01464 OFBool verifyUserPassword(const char *userID, const char *passwd);
01465
01489 OFCondition verifyAndSignStructuredReport(const char *userID, const char *passwd, DVPSVerifyAndSignMode mode);
01490
01491
01492
01493
01499 virtual void setLog(OFConsole *stream, OFBool verbMode, OFBool dbgMode);
01500
01508 void setLogFilter(DVPSLogMessageLevel level);
01509
01518 OFCondition writeLogMessage(
01519 DVPSLogMessageLevel level,
01520 const char *module,
01521 const char *message);
01522
01523
01524
01531 const char *getCurrentSignatureValidationHTML(DVPSObjectType objtype) const;
01532
01537 const char *getCurrentSignatureValidationOverview() const;
01538
01543 DVPSSignatureStatus getCurrentSignatureStatus(DVPSObjectType objtype) const;
01544
01548 DVPSSignatureStatus getCombinedImagePStateSignatureStatus() const;
01549
01554 unsigned long getNumberOfCorrectSignatures(DVPSObjectType objtype) const;
01555
01560 unsigned long getNumberOfUntrustworthySignatures(DVPSObjectType objtype) const;
01561
01566 unsigned long getNumberOfCorruptSignatures(DVPSObjectType objtype) const;
01567
01572 void disableImageAndPState();
01573
01574 private:
01575
01578 DVInterface(const DVInterface&);
01579
01582 DVInterface& operator=(const DVInterface&);
01583
01591 OFCondition exchangeImageAndPState(DVPresentationState *newState, DcmFileFormat *image, DcmFileFormat *state=NULL);
01592
01599 OFCondition lockDatabase();
01600
01607 OFCondition lockExclusive();
01608
01612 OFCondition unlockExclusive();
01613
01620 OFCondition createPrintJobFilenames(const char *printer, OFString& tempname, OFString& jobname);
01621
01626 OFCondition createQueryRetrieveServerConfigFile(const char *filename);
01627
01634 OFCondition startExternalApplication(const char *application, const char *filename);
01635
01636
01637
01640 DVPSStoredPrint *pPrint;
01641
01644 DVPresentationState *pState;
01645
01648 DSRDocument *pReport;
01649
01652 DVSignatureHandler *pSignatureHandler;
01653
01656 DVPresentationState *pStoredPState;
01657
01660 DcmFileFormat *pDicomImage;
01661
01665 DcmFileFormat *pDicomPState;
01666
01669 DicomImage *pHardcopyImage;
01670
01674 OFString printJobIdentifier;
01675
01678 unsigned long printJobCounter;
01679
01682 OFString configPath;
01683
01687 OFString databaseIndexFile;
01688
01692 unsigned long referenceTime;
01693
01696 DiDisplayFunction *displayFunction[DVPSD_max];
01697
01700 DcmQueryRetrieveIndexDatabaseHandle *pHandle;
01701
01704 OFBool lockingMode;
01705
01708 DVStudyCache idxCache;
01709
01712 IdxRecord idxRec;
01713
01716 int idxRecPos;
01717
01720 OFBool imageInDatabase;
01721
01722
01723
01726 OFBool createIndexCache();
01727
01730 OFBool createPStateCache();
01731
01734 void clearIndexCache();
01735
01738 void clearIndexRecord(IdxRecord &record,
01739 int &recpos);
01740
01744 OFBool readIndexRecord(const int pos,
01745 IdxRecord &record,
01746 int *oldpos = NULL);
01747
01751 void updateStatusCache();
01752
01755 DVStudyCache::ItemStruct *getStudyStruct(const char *studyUID = NULL,
01756 const char *seriesUID = NULL);
01757
01760 DVSeriesCache::ItemStruct *getSeriesStruct(const char *studyUID = NULL,
01761 const char *seriesUID = NULL,
01762 const char *instanceUID = NULL);
01763
01766 DVInstanceCache::ItemStruct *getInstanceStruct(const char *studyUID = NULL,
01767 const char *seriesUID = NULL,
01768 const char *instanceUID = NULL);
01769
01772 int findStudyIdx(StudyDescRecord *study,
01773 const char *uid);
01774
01777 int deleteImageFile(const char *filename);
01778
01781 void resetDatabaseReferenceTime();
01782
01783
01787 OFCondition instanceReviewed(int pos);
01788
01791 unsigned long minimumPrintBitmapWidth;
01792
01795 unsigned long minimumPrintBitmapHeight;
01796
01799 unsigned long maximumPrintBitmapWidth;
01800
01803 unsigned long maximumPrintBitmapHeight;
01804
01807 unsigned long maximumPrintPreviewWidth;
01808
01811 unsigned long maximumPrintPreviewHeight;
01812
01815 unsigned long maximumPreviewImageWidth;
01816
01819 unsigned long maximumPreviewImageHeight;
01820
01823 OFString currentPrinter;
01824
01827 OFString displayCurrentLUTID;
01828
01831 OFString printCurrentLUTID;
01832
01835 OFString printerMediumType;
01836
01839 OFString printerFilmDestination;
01840
01843 OFString printerFilmSessionLabel;
01844
01847 unsigned long printerNumberOfCopies;
01848
01852 OFString printerPriority;
01853
01856 OFString printerOwnerID;
01857
01860 OFBool activateAnnotation;
01861
01864 OFBool prependDateTime;
01865
01868 OFBool prependPrinterName;
01869
01872 OFBool prependLighting;
01873
01876 OFString annotationText;
01877
01880 OFLogFile *logFile;
01881 };
01882
01883
01884 #endif
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168
02169
02170
02171
02172
02173
02174
02175
02176
02177
02178
02179
02180
02181
02182
02183
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217
02218
02219
02220
02221
02222
02223
02224
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237