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 #ifndef DVIFACE_H
00032 #define DVIFACE_H
00033
00034 #include "dcmtk/config/osconfig.h"
00035
00036
00037 #include "dcmtk/ofstd/ofstream.h"
00038 #include "dcmtk/dcmpstat/dvpscf.h"
00039 #include "dcmtk/dcmpstat/dvpstat.h"
00040 #include "dcmtk/dcmqrdb/dcmqridx.h"
00041 #include "dcmtk/ofstd/ofstring.h"
00042 #include "dcmtk/dcmpstat/dvcache.h"
00043
00044
00045 class DicomImage;
00046 class DiDisplayFunction;
00047 class DVPSStoredPrint;
00048 class DVPSPrintMessageHandler;
00049 class DSRDocument;
00050 class DVSignatureHandler;
00051
00056 class DVInterface: public DVConfiguration
00057 {
00058
00059 public:
00060
00070 DVInterface(const char *config_file = NULL, OFBool useLog = OFFalse);
00071
00074 virtual ~DVInterface();
00075
00076
00077
00087 OFCondition loadImage(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
00088
00095 OFCondition loadImage(const char *filename);
00096
00104 OFCondition loadReferencedImage(size_t idx, OFBool changeStatus = OFFalse);
00105
00116 OFCondition loadPState(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
00117
00126 OFCondition loadPState(const char *pstName, const char *imgName = NULL);
00127
00136 OFCondition loadStructuredReport(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
00137
00143 OFCondition loadStructuredReport(const char *filename);
00144
00157 OFCondition loadSRTemplate(const char *reportID);
00158
00171 OFCondition savePState(OFBool replaceSOPInstanceUID);
00172
00186 OFCondition savePState(const char *filename, OFBool replaceSOPInstanceUID, OFBool explicitVR=OFTrue);
00187
00197 OFCondition saveCurrentImage(const char *filename, OFBool explicitVR=OFTrue);
00198
00210 OFCondition saveStructuredReport();
00211
00224 OFCondition saveStructuredReport(const char *filename, OFBool explicitVR=OFTrue);
00225
00234 OFCondition addImageReferenceToPState(const char *studyUID, const char *seriesUID, const char *instanceUID);
00235
00239 size_t getNumberOfImageReferences();
00240
00247 DVPresentationState& getCurrentPState()
00248 {
00249 return *pState;
00250 }
00251
00257 DSRDocument& getCurrentReport()
00258 {
00259 return *pReport;
00260 }
00261
00266 DVPSStoredPrint& getPrintHandler()
00267 {
00268 return *pPrint;
00269 }
00270
00278 OFCondition resetPresentationState();
00279
00285 OFCondition saveCurrentPStateForReset();
00286
00295 OFCondition releaseDatabase();
00296
00306 const char *getFilename(const char *studyUID, const char *seriesUID, const char *instanceUID);
00307
00316 Uint32 getNumberOfStudies();
00317
00326 OFCondition selectStudy(Uint32 idx);
00327
00336 OFCondition selectStudy(const char *studyUID);
00337
00344 DVIFhierarchyStatus getStudyStatus() ;
00345
00351 const char *getStudyUID();
00352
00358 const char *getStudyDescription();
00359
00365 const char *getStudyDate();
00366
00372 const char *getStudyTime();
00373
00379 const char *getReferringPhysiciansName();
00380
00386 const char *getAccessionNumber();
00387
00393 const char *getNameOfPhysiciansReadingStudy();
00394
00402 const char *getPatientName();
00403
00411 const char *getPatientID();
00412
00420 const char *getPatientBirthDate();
00421
00429 const char *getPatientSex();
00430
00438 const char *getPatientBirthTime();
00439
00447 const char *getOtherPatientNames();
00448
00456 const char *getOtherPatientID();
00457
00465 const char *getEthnicGroup();
00466
00474 Uint32 getNumberOfSeries();
00475
00483 OFCondition selectSeries(Uint32 idx);
00484
00492 OFCondition selectSeries(const char *seriesUID);
00493
00499 const char *getSeriesUID();
00500
00506 DVIFhierarchyStatus getSeriesStatus();
00507
00515 DVPSInstanceType getSeriesType();
00516
00522 DVPSInstanceType getInstanceType();
00523
00529 const char *getSeriesNumber();
00530
00536 const char *getSeriesDate();
00537
00543 const char *getSeriesTime();
00544
00550 const char *getSeriesDescription();
00551
00557 const char *getSeriesPerformingPhysiciansName();
00558
00564 const char *getSeriesProtocolName();
00565
00571 const char *getSeriesOperatorsName();
00572
00578 const char *getModality();
00579
00587 Uint32 getNumberOfInstances();
00588
00596 OFCondition selectInstance(Uint32 idx);
00597
00605 OFCondition selectInstance(const char *instanceUID);
00606
00616 OFCondition selectInstance(const char *instanceUID, const char *sopClassUID);
00617
00627 OFCondition selectInstance(const char *studyUID, const char *seriesUID, const char *instanceUID);
00628
00634 const char *getSOPClassUID();
00635
00641 const char *getInstanceUID();
00642
00648 const char *getImageNumber();
00649
00655 const char *getFilename();
00656
00662 DVIFhierarchyStatus getInstanceStatus() ;
00663
00669 const char *getInstanceDescription();
00670
00676 const char *getPresentationLabel();
00677
00678
00679
00680
00693 OFCondition instanceReviewed(const char *studyUID, const char *seriesUID, const char *instanceUID);
00694
00706 OFCondition deleteInstance(const char *studyUID, const char *seriesUID, const char *instanceUID);
00707
00718 OFCondition deleteSeries(const char *studyUID, const char *seriesUID);
00719
00729 OFCondition deleteStudy(const char *studyUID);
00730
00731
00732
00744 OFCondition startReceiver();
00745
00753 OFCondition terminateReceiver();
00754
00770 OFCondition startQueryRetrieveServer();
00771
00781 OFCondition terminateQueryRetrieveServer();
00782
00793 OFBool newInstancesReceived();
00794
00807 OFCondition sendStudy(const char *targetID, const char *studyUID)
00808 {
00809 return sendIOD(targetID, studyUID, NULL, NULL);
00810 }
00811
00826 OFCondition sendSeries(const char *targetID, const char *studyUID, const char *seriesUID)
00827 {
00828 return sendIOD(targetID, studyUID, seriesUID, NULL);
00829 }
00830
00848 OFCondition sendIOD(const char *targetID, const char *studyUID, const char *seriesUID, const char *instanceUID);
00849
00860 OFCondition dumpIOD(const char *filename);
00861
00877 OFCondition dumpIOD(const char *studyUID, const char *seriesUID, const char *instanceUID);
00878
00889 OFCondition checkIOD(const char *filename);
00890
00906 OFCondition checkIOD(const char *studyUID, const char *seriesUID, const char *instanceUID);
00907
00925 OFCondition saveDICOMImage(
00926 const char *filename,
00927 const void *pixelData,
00928 unsigned long width,
00929 unsigned long height,
00930 double aspectRatio=1.0,
00931 OFBool explicitVR=OFTrue,
00932 const char *instanceUID=NULL);
00933
00948 OFCondition saveDICOMImage(
00949 const void *pixelData,
00950 unsigned long width,
00951 unsigned long height,
00952 double aspectRatio=1.0);
00953
00971 OFCondition saveHardcopyGrayscaleImage(
00972 const char *filename,
00973 const void *pixelData,
00974 unsigned long width,
00975 unsigned long height,
00976 double aspectRatio=1.0,
00977 OFBool explicitVR=OFTrue,
00978 const char *instanceUID=NULL);
00979
00994 OFCondition saveHardcopyGrayscaleImage(
00995 const void *pixelData,
00996 unsigned long width,
00997 unsigned long height,
00998 double aspectRatio=1.0);
00999
01009 OFCondition saveFileFormatToDB(DcmFileFormat &fileformat);
01010
01020 OFCondition loadStoredPrint(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse);
01021
01028 OFCondition loadStoredPrint(const char *filename);
01029
01041 OFCondition saveStoredPrint(
01042 const char *filename,
01043 OFBool writeRequestedImageSize,
01044 OFBool explicitVR=OFTrue,
01045 const char *instanceUID=NULL);
01046
01057 OFCondition saveStoredPrint(OFBool writeRequestedImageSize);
01058
01062 size_t getNumberOfPrintPreviews();
01063
01075 OFCondition loadPrintPreview(size_t idx, OFBool printLUT = OFTrue, OFBool changeStatus = OFFalse);
01076
01079 void unloadPrintPreview();
01080
01085 unsigned long getPrintPreviewSize();
01086
01095 void setMaxPrintPreviewWidthHeight(unsigned long width, unsigned long height);
01096
01103 OFCondition getPrintPreviewWidthHeight(unsigned long &width, unsigned long &height);
01104
01111 OFCondition getPrintPreviewBitmap(void *bitmap, unsigned long size);
01112
01119 OFCondition disablePState();
01120
01126 OFCondition enablePState();
01127
01133 Uint32 getNumberOfPStates();
01134
01141 OFCondition selectPState(Uint32 idx, OFBool changeStatus = OFFalse);
01142
01148 const char *getPStateDescription(Uint32 idx);
01149
01155 const char *getPStateLabel(Uint32 idx);
01156
01164 OFBool isDisplayTransformPossible(DVPSDisplayTransform transform = DVPSD_GSDF);
01165
01170 OFCondition setAmbientLightValue(double value);
01171
01176 OFCondition getAmbientLightValue(double &value);
01177
01178
01179
01185 OFCondition setCurrentPrinter(const char *targetID);
01186
01191 const char *getCurrentPrinter();
01192
01199 OFCondition setPrinterMediumType(const char *value);
01200
01204 const char *getPrinterMediumType();
01205
01212 OFCondition setPrinterFilmDestination(const char *value);
01213
01217 const char *getPrinterFilmDestination();
01218
01225 OFCondition setPrinterFilmSessionLabel(const char *value);
01226
01230 const char *getPrinterFilmSessionLabel();
01231
01238 OFCondition setPrinterPriority(const char *value);
01239
01243 const char *getPrinterPriority();
01244
01251 OFCondition setPrinterOwnerID(const char *value);
01252
01256 const char *getPrinterOwnerID();
01257
01264 OFCondition setPrinterNumberOfCopies(unsigned long value);
01265
01269 unsigned long getPrinterNumberOfCopies();
01270
01276 void clearFilmSessionSettings();
01277
01283 OFCondition selectDisplayPresentationLUT(const char *lutID);
01284
01290 const char *getDisplayPresentationLUTID();
01291
01299 OFCondition selectPrintPresentationLUT(const char *lutID);
01300
01306 const char *getPrintPresentationLUTID();
01307
01312 OFCondition spoolPrintJob(OFBool deletePrintedImages=OFTrue);
01313
01325 OFCondition startPrintSpooler();
01326
01333 OFCondition terminatePrintSpooler();
01334
01347 OFCondition startPrintServer();
01348
01356 OFCondition terminatePrintServer();
01357
01368 OFCondition addToPrintHardcopyFromDB(const char *studyUID, const char *seriesUID, const char *instanceUID);
01369
01380 OFCondition spoolStoredPrintFromDB(const char *studyUID, const char *seriesUID, const char *instanceUID);
01381
01391 OFCondition printSCUcreateBasicFilmSession(DVPSPrintMessageHandler& printHandler, OFBool plutInSession);
01392
01393
01394
01398 OFBool isActiveAnnotation() { return activateAnnotation; }
01399
01403 OFBool getPrependDateTime() { return prependDateTime; }
01404
01408 OFBool getPrependPrinterName() { return prependPrinterName; }
01409
01413 OFBool getPrependLighting() { return prependLighting; }
01414
01418 const char *getAnnotationText() { return annotationText.c_str(); }
01419
01423 void setActiveAnnotation(OFBool value) { activateAnnotation=value; }
01424
01428 void setPrependDateTime(OFBool value) { prependDateTime=value; }
01429
01433 void setPrependPrinterName(OFBool value) { prependPrinterName=value; }
01434
01438 void setPrependLighting(OFBool value) { prependLighting=value; }
01439
01443 void setAnnotationText(const char *value);
01444
01445
01446
01458 OFBool verifyUserPassword(const char *userID, const char *passwd);
01459
01483 OFCondition verifyAndSignStructuredReport(const char *userID, const char *passwd, DVPSVerifyAndSignMode mode);
01484
01485
01486
01487
01494 const char *getCurrentSignatureValidationHTML(DVPSObjectType objtype) const;
01495
01500 const char *getCurrentSignatureValidationOverview() const;
01501
01506 DVPSSignatureStatus getCurrentSignatureStatus(DVPSObjectType objtype) const;
01507
01511 DVPSSignatureStatus getCombinedImagePStateSignatureStatus() const;
01512
01517 unsigned long getNumberOfCorrectSignatures(DVPSObjectType objtype) const;
01518
01523 unsigned long getNumberOfUntrustworthySignatures(DVPSObjectType objtype) const;
01524
01529 unsigned long getNumberOfCorruptSignatures(DVPSObjectType objtype) const;
01530
01535 void disableImageAndPState();
01536
01537 private:
01538
01541 DVInterface(const DVInterface&);
01542
01545 DVInterface& operator=(const DVInterface&);
01546
01554 OFCondition exchangeImageAndPState(DVPresentationState *newState, DcmFileFormat *image, DcmFileFormat *state=NULL);
01555
01562 OFCondition lockDatabase();
01563
01570 OFCondition lockExclusive();
01571
01575 OFCondition unlockExclusive();
01576
01583 OFCondition createPrintJobFilenames(const char *printer, OFString& tempname, OFString& jobname);
01584
01589 OFCondition createQueryRetrieveServerConfigFile(const char *filename);
01590
01597 OFCondition startExternalApplication(const char *application, const char *filename);
01598
01599
01600
01603 DVPSStoredPrint *pPrint;
01604
01607 DVPresentationState *pState;
01608
01611 DSRDocument *pReport;
01612
01615 DVSignatureHandler *pSignatureHandler;
01616
01619 DVPresentationState *pStoredPState;
01620
01623 DcmFileFormat *pDicomImage;
01624
01628 DcmFileFormat *pDicomPState;
01629
01632 DicomImage *pHardcopyImage;
01633
01637 OFString printJobIdentifier;
01638
01641 unsigned long printJobCounter;
01642
01645 OFString configPath;
01646
01650 OFString databaseIndexFile;
01651
01655 unsigned long referenceTime;
01656
01659 DiDisplayFunction *displayFunction[DVPSD_max];
01660
01663 DcmQueryRetrieveIndexDatabaseHandle *pHandle;
01664
01667 OFBool lockingMode;
01668
01671 DVStudyCache idxCache;
01672
01675 IdxRecord idxRec;
01676
01679 int idxRecPos;
01680
01683 OFBool imageInDatabase;
01684
01685
01686
01689 OFBool createIndexCache();
01690
01693 OFBool createPStateCache();
01694
01697 void clearIndexCache();
01698
01701 void clearIndexRecord(IdxRecord &record,
01702 int &recpos);
01703
01707 OFBool readIndexRecord(const int pos,
01708 IdxRecord &record,
01709 int *oldpos = NULL);
01710
01714 void updateStatusCache();
01715
01718 DVStudyCache::ItemStruct *getStudyStruct(const char *studyUID = NULL,
01719 const char *seriesUID = NULL);
01720
01723 DVSeriesCache::ItemStruct *getSeriesStruct(const char *studyUID = NULL,
01724 const char *seriesUID = NULL,
01725 const char *instanceUID = NULL);
01726
01729 DVInstanceCache::ItemStruct *getInstanceStruct(const char *studyUID = NULL,
01730 const char *seriesUID = NULL,
01731 const char *instanceUID = NULL);
01732
01735 int findStudyIdx(StudyDescRecord *study,
01736 const char *uid);
01737
01740 int deleteImageFile(const char *filename);
01741
01744 void resetDatabaseReferenceTime();
01745
01746
01750 OFCondition instanceReviewed(int pos);
01751
01754 unsigned long minimumPrintBitmapWidth;
01755
01758 unsigned long minimumPrintBitmapHeight;
01759
01762 unsigned long maximumPrintBitmapWidth;
01763
01766 unsigned long maximumPrintBitmapHeight;
01767
01770 unsigned long maximumPrintPreviewWidth;
01771
01774 unsigned long maximumPrintPreviewHeight;
01775
01778 unsigned long maximumPreviewImageWidth;
01779
01782 unsigned long maximumPreviewImageHeight;
01783
01786 OFString currentPrinter;
01787
01790 OFString displayCurrentLUTID;
01791
01794 OFString printCurrentLUTID;
01795
01798 OFString printerMediumType;
01799
01802 OFString printerFilmDestination;
01803
01806 OFString printerFilmSessionLabel;
01807
01810 unsigned long printerNumberOfCopies;
01811
01815 OFString printerPriority;
01816
01819 OFString printerOwnerID;
01820
01823 OFBool activateAnnotation;
01824
01827 OFBool prependDateTime;
01828
01831 OFBool prependPrinterName;
01832
01835 OFBool prependLighting;
01836
01839 OFString annotationText;
01840 };
01841
01842
01843 #endif
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
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