1 /* 2 * 3 * Copyright (C) 1998-2018, 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: dcmpstat 15 * 16 * Author: Marco Eichelberg, Joerg Riesmeier 17 * 18 * Purpose: 19 * classes: DVInterface 20 * 21 */ 22 23 24 #ifndef DVIFACE_H 25 #define DVIFACE_H 26 27 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 28 29 30 #include "dcmtk/ofstd/ofstream.h" 31 #include "dcmtk/dcmpstat/dvpscf.h" /* for class DVConfiguration */ 32 #include "dcmtk/dcmpstat/dvpstat.h" /* for class DVPresentationState */ 33 #include "dcmtk/dcmqrdb/dcmqridx.h" /* for struct IdxRecord */ 34 #include "dcmtk/ofstd/ofstring.h" /* for class OFString */ 35 #include "dcmtk/dcmpstat/dvcache.h" /* for index file caching */ 36 37 38 class DicomImage; 39 class DiDisplayFunction; 40 class DVPSStoredPrint; 41 class DVPSPrintMessageHandler; 42 class DSRDocument; 43 class DVSignatureHandler; 44 45 /** Interface class for the Softcopy Presentation State viewer. 46 * This class manages the database facilities, allows to start and stop 47 * network transactions and gives access to images and presentation states. 48 */ 49 class DCMTK_DCMPSTAT_EXPORT DVInterface: public DVConfiguration 50 { 51 52 public: 53 54 /** constructor. 55 * @param config_file filename (path) of the config file to be used 56 * by the interface object. The caller should make sure that the config file 57 * really exists because the constructor cannot return an error status. 58 * If a non-existing filename (or NULL) is passed, an empty configuration file 59 * is assumed. 60 * @param useLog (optional) flag specifying whether a general log file should be used 61 * (config entry GENERAL\APPLICATION\LOGFILE). 62 */ 63 DVInterface(const char *config_file = NULL, OFBool useLog = OFFalse); 64 65 /** destructor. 66 */ 67 virtual ~DVInterface(); 68 69 /* load images, presentation states and structured reports */ 70 71 /** loads an image which is contained in the database 72 * and creates a default presentation state for the image. 73 * This method acquires a database lock which must be explicitly freed by the user. 74 * @param studyUID study instance UID of the image 75 * @param seriesUID series instance UID of the image 76 * @param instanceUID SOP instance UID of the image 77 * @param changeStatus if true the image file is marked 'reviewed' (not new) 78 * @return EC_Normal upon success, an error code otherwise. 79 */ 80 OFCondition loadImage(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse); 81 82 /** loads an image (which need not be contained in the database) 83 * and creates a default presentation state for the image. 84 * This method does not acquire a database lock. 85 * @param filename path and filename of the image to be loaded 86 * @return EC_Normal upon success, an error code otherwise. 87 */ 88 OFCondition loadImage(const char *filename); 89 90 /** loads an image which referenced by the current presentation 91 * state and needs to be contained in the database. 92 * This method acquires a database lock which must be explicitly freed by the user. 93 * @param idx index of the image to be loaded (< getNumberOfImageReferences()) 94 * @param changeStatus if true the image file is marked 'reviewed' (not new) 95 * @return EC_Normal upon success, an error code otherwise. 96 */ 97 OFCondition loadReferencedImage(size_t idx, OFBool changeStatus = OFFalse); 98 99 /** loads a presentation state which is contained in the database. 100 * The first image referenced in presentation state is also looked up in the 101 * database, loaded, and attached to the presentation state. 102 * This method acquires a database lock which must be explicitly freed by the user. 103 * @param studyUID study instance UID of the presentation state 104 * @param seriesUID series instance UID of the presentation state 105 * @param instanceUID SOP instance UID of the presentation state 106 * @param changeStatus if true the pstate and (first) image file is marked 'reviewed' (not new) 107 * @return EC_Normal upon success, an error code otherwise. 108 */ 109 OFCondition loadPState(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse); 110 111 /** loads a presentation state and an image (which need not be contained in the database) 112 * and attaches the image to the presentation state (if specified, otherwise the current 113 * image will be used). 114 * This method does not acquire a database lock. 115 * @param pstName path and filename of the presentation state to be loaded 116 * @param imgName path and filename of the image to be loaded 117 * @return EC_Normal upon success, an error code otherwise. 118 */ 119 OFCondition loadPState(const char *pstName, const char *imgName = NULL); 120 121 /** loads a structured report which is contained in the database. 122 * This method acquires a database lock which must be explicitly freed by the user. 123 * @param studyUID study instance UID of the structured report 124 * @param seriesUID series instance UID of the structured report 125 * @param instanceUID SOP instance UID of the structured report 126 * @param changeStatus if true the structured report file is marked 'reviewed' (not new) 127 * @return EC_Normal upon success, an error code otherwise. 128 */ 129 OFCondition loadStructuredReport(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse); 130 131 /** loads a structured report (which need not be contained in the database). 132 * This method does not acquire a database lock. 133 * @param filename path and filename of the structured report to be loaded 134 * @return EC_Normal upon success, an error code otherwise. 135 */ 136 OFCondition loadStructuredReport(const char *filename); 137 138 /** loads a structured reporting "template". 139 * This "template" is just a DICOM Structured Reporting file which resides in a 140 * special sub-folder and is referenced by the configuration file. This meachanism 141 * should facilitate the creation of new reports since one does not have to start 142 * with a completely empty report. 143 * Please note that the current structured report is replaced by the specified 144 * "template". New study/series/instance UIDs are generated automatically for the 145 * new report. 146 * This method does not acquire a database lock. 147 * @param reportID report identifier, as returned by getReportID(). 148 * @return EC_Normal upon success, an error code otherwise. 149 */ 150 OFCondition loadSRTemplate(const char *reportID); 151 152 /** saves the current presentation state in the same directory 153 * in which the database index file resides. The filename is generated automatically. 154 * A new SOP Instance UID is assigned whenever a presentation state is saved. 155 * After successfully storing the presentation state, the database index is updated 156 * to include the new object. 157 * This method releases under any circumstances the database lock if it exists. 158 * @param replaceSOPInstanceUID flag indicating whether the 159 * SOP Instance UID should be replaced by a new UID. 160 * If true, a new UID is always generated. If false, a new 161 * UID is generated only if no UID has been assigned before. 162 * @return EC_Normal upon success, an error code otherwise. 163 */ 164 OFCondition savePState(OFBool replaceSOPInstanceUID); 165 166 /** saves the current presentation state in a file with the given path and filename. 167 * A new SOP Instance UID is assigned whenever a presentation state is saved. 168 * This method does not acquire a database lock and does not register 169 * the saved presentation state in the database. 170 * @param filename path and filename under which the presentation state is to be saved 171 * @param replaceSOPInstanceUID flag indicating whether the 172 * SOP Instance UID should be replaced by a new UID. 173 * If true, a new UID is always generated. If false, a new 174 * UID is generated only if no UID has been assigned before. 175 * @param explicitVR selects the transfer syntax to be written. True (the default) selects 176 * Explicit VR Little Endian, False selects Implicit VR Little Endian. 177 * @return EC_Normal upon success, an error code otherwise. 178 */ 179 OFCondition savePState(const char *filename, OFBool replaceSOPInstanceUID, OFBool explicitVR=OFTrue); 180 181 /** saves the DICOM image that is currently attached to the presentation state 182 * in a file with the given path and filename. 183 * This method does not acquire a database lock and does not register 184 * the saved presentation state in the database. 185 * @param filename path and filename under which the image is to be saved 186 * @param explicitVR selects the transfer syntax to be written. True (the default) selects 187 * Explicit VR Little Endian, False selects Implicit VR Little Endian. 188 * @return EC_Normal upon success, an error code otherwise. 189 */ 190 OFCondition saveCurrentImage(const char *filename, OFBool explicitVR=OFTrue); 191 192 /** saves the current structured report in the same directory in which the database index 193 * file resides. The filename is generated automatically. A new SOP Instance UID is not 194 * assigned automatically unless the method getStructuredReport().createRevisedVersion() 195 * is called (see documentation in file dcmsr/dsrdoc.h). This is not required for the 196 * first version of a document (i.e. directly after program start or calling the method 197 * getStructuredReport().createNewDocument()). 198 * After successfully storing the structured report, the database index is updated 199 * to include the new object. 200 * This method releases under any circumstances the database lock if it exists. 201 * @return EC_Normal upon success, an error code otherwise. 202 */ 203 OFCondition saveStructuredReport(); 204 205 /** saves the current structured report in a file with the given path and filename. 206 * A new SOP Instance UID is not assigned automatically unless the method 207 * getStructuredReport().createRevisedVersion() is called (see documentation in file 208 * dcmsr/dsrdoc.h). This is not required for the first version of a document (i.e. 209 * directly after program start or calling the method getStructuredReport().createNewDocument()). 210 * This method does not acquire a database lock and does not register the saved structured 211 * report in the database. 212 * @param filename path and filename under which the structured report is to be saved 213 * @param explicitVR selects the transfer syntax to be written. True (the default) selects 214 * Explicit VR Little Endian, False selects Implicit VR Little Endian. 215 * @return EC_Normal upon success, an error code otherwise. 216 */ 217 OFCondition saveStructuredReport(const char *filename, OFBool explicitVR=OFTrue); 218 219 /** adds an image which is contained in the database 220 * to the list of referenced images of the current presentation state. 221 * This method acquires a database lock which must be explicitly freed by the user. 222 * @param studyUID study instance UID of the image 223 * @param seriesUID series instance UID of the image 224 * @param instanceUID SOP instance UID of the image 225 * @return EC_Normal upon success, an error code otherwise. 226 */ 227 OFCondition addImageReferenceToPState(const char *studyUID, const char *seriesUID, const char *instanceUID); 228 229 /** gets the number of image references contained in the current presentation state. 230 * @return number of image references, 0 if an error occurred. 231 */ 232 size_t getNumberOfImageReferences(); 233 234 /** returns a reference to the current presentation state. 235 * This reference will become invalid when the DVInterface object is deleted, 236 * a different image or presentation state is loaded 237 * (using loadPState or loadImage) or when resetPresentationState() is called. 238 * @return reference to the current presentation state 239 */ getCurrentPState()240 DVPresentationState& getCurrentPState() 241 { 242 return *pState; 243 } 244 245 /** returns a reference to the current structured report. 246 * This reference will become invalid when the DVInterface object is deleted or 247 * a different structured report is loaded (using loadStructuredReport). 248 * @return reference to the current structured report 249 */ getCurrentReport()250 DSRDocument& getCurrentReport() 251 { 252 return *pReport; 253 } 254 255 /** returns a reference to the print handler. 256 * This reference remains valid as long as the DVInterface object exists. 257 * @return reference to the current print handler 258 */ getPrintHandler()259 DVPSStoredPrint& getPrintHandler() 260 { 261 return *pPrint; 262 } 263 264 /** resets the presentation state object to the status it had immediately after the 265 * last successful operation of "loadImage" or "loadPState". A state can also explicitly 266 * specified as such a "reset state" by using the method saveCurrentPStateForReset(). 267 * Attention: The last reference returned by getCurrentPState() becomes invalid 268 * when this method is called. 269 * @return EC_Normal upon success, an error code otherwise. 270 */ 271 OFCondition resetPresentationState(); 272 273 /** saves the current state of the presentation state object to be used for 274 * resetPresentationState(). This is e.g. useful after registration of additional images 275 * directly after a new images has been loaded. 276 * @return EC_Normal upon success, an error code otherwise. 277 */ 278 OFCondition saveCurrentPStateForReset(); 279 280 /** removes any shared or exclusive lock on the database. 281 * This method should be called when a database transaction 282 * (i.e. reading all studies, series, instances etc.) is finished. 283 * As long as a lock exists on the database, no other application 284 * (i.e. the network receiver) can add new images to the database. 285 * This method also clears the index cache. 286 * @return EC_Normal upon success, an error code otherwise. 287 */ 288 OFCondition releaseDatabase(); 289 290 /** searches in the database for a DICOM instance with the given 291 * study, series and instance UIDs and returns its pathname if found. 292 * If the given instance is not found in the database, NULL is returned. 293 * This method acquires a database lock which must be explicitly freed by the user. 294 * @param studyUID the DICOM study instance UID 295 * @param seriesUID the DICOM series instance UID 296 * @param instanceUID the DICOM SOP instance UID 297 * @return filename (path) if found, NULL otherwise 298 */ 299 const char *getFilename(const char *studyUID, const char *seriesUID, const char *instanceUID); 300 301 /** returns the number of studies currently contained in the database. 302 * This method acquires a database lock which must be explicitly freed by the user. 303 * The number reported (returned) by this method remains valid as long 304 * as the database lock remains active and no function modifying the database is called. 305 * Functions that modify the database are: Storing new presentation states, 306 * deleting data, modifying the 'reviewed' status flag of IODs. 307 * @return number of studies in the database. 308 */ 309 Uint32 getNumberOfStudies(); 310 311 /** selects the study with the given index in the database. 312 * This method acquires a database lock which must be explicitly freed by the user. 313 * The selection remains valid until the database lock is removed or the database 314 * is modified (see comments for getNumberOfStudies). 315 * Implicitly the first series and first instance within this study is selected, too. 316 * @param idx index to be selected, must be < getNumberOfStudies() 317 * @return EC_Normal upon success, an error code otherwise. 318 */ 319 OFCondition selectStudy(Uint32 idx); 320 321 /** selects the study with the given UID in the database. 322 * This method acquires a database lock which must be explicitly freed by the user. 323 * The selection remains valid until the database lock is removed or the database 324 * is modified (see comments for getNumberOfStudies). 325 * Implicitly the first series and first instance within this study is selected, too. 326 * @param studyUID the DICOM study instance UID 327 * @return EC_Normal upon success, an error code otherwise. 328 */ 329 OFCondition selectStudy(const char *studyUID); 330 331 /** returns the review status of the currently selected study. 332 * May be called only if a valid study selection exists - see selectStudy(). 333 * This method acquires a database lock which must be explicitly freed by the user. 334 * Implicitly the first instance within this series is selected, too. 335 * @return study review status 336 */ 337 DVIFhierarchyStatus getStudyStatus() ; 338 339 /** returns the Study Instance UID of the currently selected study. 340 * May be called only if a valid study selection exists - see selectStudy(). 341 * This method acquires a database lock which must be explicitly freed by the user. 342 * @return Study Instance UID or NULL if absent or not selected. 343 */ 344 const char *getStudyUID(); 345 346 /** returns the Study Description of the currently selected study. 347 * May be called only if a valid study selection exists - see selectStudy(). 348 * This method acquires a database lock which must be explicitly freed by the user. 349 * @return Study Description or NULL if absent or not selected. 350 */ 351 const char *getStudyDescription(); 352 353 /** returns the Study Date of the currently selected study. 354 * May be called only if a valid study selection exists - see selectStudy(). 355 * This method acquires a database lock which must be explicitly freed by the user. 356 * @return Study Date or NULL if absent or not selected. 357 */ 358 const char *getStudyDate(); 359 360 /** returns the Study Time of the currently selected study. 361 * May be called only if a valid study selection exists - see selectStudy(). 362 * This method acquires a database lock which must be explicitly freed by the user. 363 * @return Study Time or NULL if absent or not selected. 364 */ 365 const char *getStudyTime(); 366 367 /** returns the Referring Physicians Name of the currently selected study. 368 * May be called only if a valid study selection exists - see selectStudy(). 369 * This method acquires a database lock which must be explicitly freed by the user. 370 * @return Referring Physicians Name or NULL if absent or not selected. 371 */ 372 const char *getReferringPhysiciansName(); 373 374 /** returns the Accession Number of the currently selected study. 375 * May be called only if a valid study selection exists - see selectStudy(). 376 * This method acquires a database lock which must be explicitly freed by the user. 377 * @return Accession Number or NULL if absent or not selected. 378 */ 379 const char *getAccessionNumber(); 380 381 /** returns the Name Of Physicians Reading Study of the currently selected study. 382 * May be called only if a valid study selection exists - see selectStudy(). 383 * This method acquires a database lock which must be explicitly freed by the user. 384 * @return Name Of Physicians Reading Study or NULL if absent or not selected. 385 */ 386 const char *getNameOfPhysiciansReadingStudy(); 387 388 /** returns the Patient Name of the currently selected study. 389 * May be called only if a valid study selection exists - see selectStudy(). 390 * Note: Since the database uses the Study Root model, patient data appears 391 * on the study level. 392 * This method acquires a database lock which must be explicitly freed by the user. 393 * @return Patient Name or NULL if absent or not selected. 394 */ 395 const char *getPatientName(); 396 397 /** returns the Patient ID of the currently selected study. 398 * May be called only if a valid study selection exists - see selectStudy(). 399 * Note: Since the database uses the Study Root model, patient data appears 400 * on the study level. 401 * This method acquires a database lock which must be explicitly freed by the user. 402 * @return Patient ID or NULL if absent or not selected. 403 */ 404 const char *getPatientID(); 405 406 /** returns the Patient Birth Date of the currently selected study. 407 * May be called only if a valid study selection exists - see selectStudy(). 408 * Note: Since the database uses the Study Root model, patient data appears 409 * on the study level. 410 * This method acquires a database lock which must be explicitly freed by the user. 411 * @return Patient Birth Date or NULL if absent or not selected. 412 */ 413 const char *getPatientBirthDate(); 414 415 /** returns the Patient Sex of the currently selected study. 416 * May be called only if a valid study selection exists - see selectStudy(). 417 * Note: Since the database uses the Study Root model, patient data appears 418 * on the study level. 419 * This method acquires a database lock which must be explicitly freed by the user. 420 * @return Patient Sex or NULL if absent or not selected. 421 */ 422 const char *getPatientSex(); 423 424 /** returns the Patient Birth Time of the currently selected study. 425 * May be called only if a valid study selection exists - see selectStudy(). 426 * Note: Since the database uses the Study Root model, patient data appears 427 * on the study level. 428 * This method acquires a database lock which must be explicitly freed by the user. 429 * @return Patient Birth Time or NULL if absent or not selected. 430 */ 431 const char *getPatientBirthTime(); 432 433 /** returns the Other Patient Names of the currently selected study. 434 * May be called only if a valid study selection exists - see selectStudy(). 435 * Note: Since the database uses the Study Root model, patient data appears 436 * on the study level. 437 * This method acquires a database lock which must be explicitly freed by the user. 438 * @return Other Patient Names or NULL if absent or not selected. 439 */ 440 const char *getOtherPatientNames(); 441 442 /** returns the Other Patient ID of the currently selected study. 443 * May be called only if a valid study selection exists - see selectStudy(). 444 * Note: Since the database uses the Study Root model, patient data appears 445 * on the study level. 446 * This method acquires a database lock which must be explicitly freed by the user. 447 * @return Other Patient ID or NULL if absent or not selected. 448 */ 449 const char *getOtherPatientID(); 450 451 /** returns the Patient Ethnic Group of the currently selected study. 452 * May be called only if a valid study selection exists - see selectStudy(). 453 * Note: Since the database uses the Study Root model, patient data appears 454 * on the study level. 455 * This method acquires a database lock which must be explicitly freed by the user. 456 * @return Patient Ethnic Group or NULL if absent or not selected. 457 */ 458 const char *getEthnicGroup(); 459 460 /** returns the number of series within the currently selected study. 461 * May be called only if a valid study selection exists - see selectStudy(). 462 * This method acquires a database lock which must be explicitly freed by the user. 463 * See the comments for getNumberOfStudies() about the validity period 464 * of the returned number. 465 * @return number of series in the current study. 466 */ 467 Uint32 getNumberOfSeries(); 468 469 /** selects the series with the given index within the currently selected study. 470 * This method acquires a database lock which must be explicitly freed by the user. 471 * The selection remains valid until the database lock is removed or the database 472 * is modified (see comments for getNumberOfStudies). 473 * @param idx index to be selected, must be < getNumberOfSeries() 474 * @return EC_Normal upon success, an error code otherwise. 475 */ 476 OFCondition selectSeries(Uint32 idx); 477 478 /** selects the series with the given UID within the currently selected study. 479 * This method acquires a database lock which must be explicitly freed by the user. 480 * The selection remains valid until the database lock is removed or the database 481 * is modified (see comments for getNumberOfStudies). 482 * @param seriesUID series instance UID of the image 483 * @return EC_Normal upon success, an error code otherwise. 484 */ 485 OFCondition selectSeries(const char *seriesUID); 486 487 /** returns the Series Instance UID of the currently selected series. 488 * May be called only if a valid series selection exists - see selectSeries(). 489 * This method acquires a database lock which must be explicitly freed by the user. 490 * @return Series Instance UID or NULL if absent or not selected. 491 */ 492 const char *getSeriesUID(); 493 494 /** returns the review status of the currently selected series. 495 * May be called only if a valid series selection exists - see selectSeries(). 496 * This method acquires a database lock which must be explicitly freed by the user. 497 * @return series review status 498 */ 499 DVIFhierarchyStatus getSeriesStatus(); 500 501 /** returns the type of all instances within the currently selected series. 502 * DICOM series always contain a single modality only, if not the modality of 503 * the first examined instance (which is no image) is used (e.g. PresentationState). 504 * May be called only if a valid series selection exists - see selectSeries(). 505 * This method acquires a database lock which must be explicitly freed by the user. 506 * @return instance type 507 */ 508 DVPSInstanceType getSeriesType(); 509 510 /** returns the type of the currently selected instance. 511 * May be called only if a valid instance selection exists - see selectInstance(). 512 * This method acquires a database lock which must be explicitly freed by the user. 513 * @return instance type 514 */ 515 DVPSInstanceType getInstanceType(); 516 517 /** returns the Series Number of the currently selected series. 518 * May be called only if a valid series selection exists - see selectSeries(). 519 * This method acquires a database lock which must be explicitly freed by the user. 520 * @return Series Number or NULL if absent or not selected. 521 */ 522 const char *getSeriesNumber(); 523 524 /** returns the Series Date of the currently selected series. 525 * May be called only if a valid series selection exists - see selectSeries(). 526 * This method acquires a database lock which must be explicitly freed by the user. 527 * @return Series Date or NULL if absent or not selected. 528 */ 529 const char *getSeriesDate(); 530 531 /** returns the Series Time of the currently selected series. 532 * May be called only if a valid series selection exists - see selectSeries(). 533 * This method acquires a database lock which must be explicitly freed by the user. 534 * @return Series Time or NULL if absent or not selected. 535 */ 536 const char *getSeriesTime(); 537 538 /** returns the Series Description of the currently selected series. 539 * May be called only if a valid series selection exists - see selectSeries(). 540 * This method acquires a database lock which must be explicitly freed by the user. 541 * @return Series Description or NULL if absent or not selected. 542 */ 543 const char *getSeriesDescription(); 544 545 /** returns the Series Performing Physicians Name of the currently selected series. 546 * May be called only if a valid series selection exists - see selectSeries(). 547 * This method acquires a database lock which must be explicitly freed by the user. 548 * @return Series Performing Physicians Name or NULL if absent or not selected. 549 */ 550 const char *getSeriesPerformingPhysiciansName(); 551 552 /** returns the Series Protocol Name of the currently selected series. 553 * May be called only if a valid series selection exists - see selectSeries(). 554 * This method acquires a database lock which must be explicitly freed by the user. 555 * @return Series Protocol Name or NULL if absent or not selected. 556 */ 557 const char *getSeriesProtocolName(); 558 559 /** returns the Series Operators Name of the currently selected series. 560 * May be called only if a valid series selection exists - see selectSeries(). 561 * This method acquires a database lock which must be explicitly freed by the user. 562 * @return Series Operators Name or NULL if absent or not selected. 563 */ 564 const char *getSeriesOperatorsName(); 565 566 /** returns the Modality of the currently selected series. 567 * May be called only if a valid series selection exists - see selectSeries(). 568 * This method acquires a database lock which must be explicitly freed by the user. 569 * @return Modality or NULL if absent or not selected. 570 */ 571 const char *getModality(); 572 573 /** returns the number of instances (IODs) within the currently selected series. 574 * May be called only if a valid series selection exists - see selectSeries(). 575 * This method acquires a database lock which must be explicitly freed by the user. 576 * See the comments for getNumberOfStudies() about the validity period 577 * of the returned number. 578 * @return number of instances in the current series. 579 */ 580 Uint32 getNumberOfInstances(); 581 582 /** selects the instance with the given index within the currently selected series. 583 * This method acquires a database lock which must be explicitly freed by the user. 584 * The selection remains valid until the database lock is removed or the database 585 * is modified (see comments for getNumberOfStudies). 586 * @param idx index to be selected, must be < getNumberOfInstances() 587 * @return EC_Normal upon success, an error code otherwise. 588 */ 589 OFCondition selectInstance(Uint32 idx); 590 591 /** selects the instance with the given UID within the currently selected series. 592 * This method acquires a database lock which must be explicitly freed by the user. 593 * The selection remains valid until the database lock is removed or the database 594 * is modified (see comments for getNumberOfStudies). 595 * @param instanceUID SOP instance UID of the instance 596 * @return EC_Normal upon success, an error code otherwise. 597 */ 598 OFCondition selectInstance(const char *instanceUID); 599 600 /** selects the instance with the given UID and SOP class over all studies and series. 601 * Please note that in worst case all studies, series and instances are examined. 602 * This method acquires a database lock which must be explicitly freed by the user. 603 * The selection remains valid until the database lock is removed or the database 604 * is modified (see comments for getNumberOfStudies). 605 * @param instanceUID SOP instance UID of the instance 606 * @param sopClassUID SOP class UID of the instance (might be NULL to be not compared) 607 * @return EC_Normal upon success, an error code otherwise. 608 */ 609 OFCondition selectInstance(const char *instanceUID, const char *sopClassUID); 610 611 /** selects the instance with the given UIDs. 612 * This method acquires a database lock which must be explicitly freed by the user. 613 * The selection remains valid until the database lock is removed or the database 614 * is modified (see comments for getNumberOfStudies). 615 * @param studyUID study instance UID of the instance 616 * @param seriesUID series instance UID of the instance 617 * @param instanceUID SOP instance UID of the instance 618 * @return EC_Normal upon success, an error code otherwise. 619 */ 620 OFCondition selectInstance(const char *studyUID, const char *seriesUID, const char *instanceUID); 621 622 /** returns the SOP class UID of the currently selected instance. 623 * May be called only if a valid instance selection exists - see selectInstance(). 624 * This method acquires a database lock which must be explicitly freed by the user. 625 * @return SOP Instance UID or NULL if absent or not selected. 626 */ 627 const char *getSOPClassUID(); 628 629 /** returns the SOP Instance UID of the currently selected instance. 630 * May be called only if a valid instance selection exists - see selectInstance(). 631 * This method acquires a database lock which must be explicitly freed by the user. 632 * @return SOP Instance UID or NULL if absent or not selected. 633 */ 634 const char *getInstanceUID(); 635 636 /** returns the Image Number of the currently selected instance. 637 * May be called only if a valid instance selection exists - see selectInstance(). 638 * This method acquires a database lock which must be explicitly freed by the user. 639 * @return Image Number or NULL if absent or not selected. 640 */ 641 const char *getImageNumber(); 642 643 /** returns the Filename of the currently selected instance. 644 * May be called only if a valid instance selection exists - see selectInstance(). 645 * This method acquires a database lock which must be explicitly freed by the user. 646 * @return Filename or NULL if absent or not selected. 647 */ 648 const char *getFilename(); 649 650 /** returns the review status of the currently selected instance. 651 * May be called only if a valid instance selection exists - see selectInstance(). 652 * This method acquires a database lock which must be explicitly freed by the user. 653 * @return instance review status 654 */ 655 DVIFhierarchyStatus getInstanceStatus() ; 656 657 /** returns the escription of the currently selected instance. 658 * May be called only if a valid instance selection exists - see selectInstance(). 659 * This method acquires a database lock which must be explicitly freed by the user. 660 * @return Instance Description or NULL if absent or not selected. 661 */ 662 const char *getInstanceDescription(); 663 664 /** returns the Presentation Label of the currently selected instance. 665 * May be called only if a valid instance selection exists - see selectInstance(). 666 * This method acquires a database lock which must be explicitly freed by the user. 667 * @return Presentation Label or NULL if absent or not selected. 668 */ 669 const char *getPresentationLabel(); 670 671 672 /* methods modifying the database */ 673 674 /** modifies the review flag for one instance in the database, which is set to 675 * 'reviewed' state (DVIF_objectIsNotNew). The status of the corresponding series 676 * and study is updated automatically. 677 * This method acquires a database lock which must be explicitly freed by the user. 678 * The database is modified - any study, series or instance selection 679 * and the number of studies, series and instances reported will become invalid since 680 * other processes may modify the database before the exclusive lock is granted to this method. 681 * @param studyUID study instance UID of the reviewed instance 682 * @param seriesUID series instance UID of the reviewed instance 683 * @param instanceUID SOP instance UID of the reviewed instance 684 * @return EC_Normal upon success, an error code otherwise. 685 */ 686 OFCondition instanceReviewed(const char *studyUID, const char *seriesUID, const char *instanceUID); 687 688 /** deletes the given instance from the database. If the corresponding DICOM file 689 * resides in the same directory as the index file, it is also removed. 690 * This method acquires a database lock which must be explicitly freed by the user. 691 * The database is modified - any study, series or instance selection 692 * and the number of studies, series and instances reported will become invalid since 693 * other processes may modify the database before the exclusive lock is granted to this method. 694 * @param studyUID study instance UID of the instance to be deleted 695 * @param seriesUID series instance UID of the instance to be deleted 696 * @param instanceUID SOP instance UID of the instance to be deleted 697 * @return EC_Normal upon success, an error code otherwise. 698 */ 699 OFCondition deleteInstance(const char *studyUID, const char *seriesUID, const char *instanceUID); 700 701 /** deletes the given series from the database. Any of the corresponding DICOM files 702 * residing in the same directory as the index file are also removed. 703 * This method acquires a database lock which must be explicitly freed by the user. 704 * The database is modified - any study, series or instance selection 705 * and the number of studies, series and instances reported will become invalid since 706 * other processes may modify the database before the exclusive lock is granted to this method. 707 * @param studyUID study instance UID of the series to be deleted 708 * @param seriesUID series instance UID of the series to be deleted 709 * @return EC_Normal upon success, an error code otherwise. 710 */ 711 OFCondition deleteSeries(const char *studyUID, const char *seriesUID); 712 713 /** deletes the given study from the database. Any of the corresponding DICOM files 714 * residing in the same directory as the index file are also removed. 715 * This method acquires a database lock which must be explicitly freed by the user. 716 * The database is modified - any study, series or instance selection 717 * and the number of studies, series and instances reported will become invalid since 718 * other processes may modify the database before the exclusive lock is granted to this method. 719 * @param studyUID study instance UID of the study to be deleted 720 * @return EC_Normal upon success, an error code otherwise. 721 */ 722 OFCondition deleteStudy(const char *studyUID); 723 724 /* here follow the Network interface methods */ 725 726 /** starts the network receiver processes (Storage Service Class SCPs). 727 * The receiver processes will wait for incoming DICOM associations, receive images 728 * and presentation states. Data will be stored in file and registered in the 729 * database index file. Attention: Successful return of this method is no guarantee 730 * that the network receiver has successfully started, because certain errors 731 * (i.e. incorrect settings in the config file) will only be noted in the network 732 * receiver process when running. On Unix platform, successful return of this method 733 * means that the fork() used to start the receiver was successful. 734 * On Win32 platforms, it means that the CreateProcess() call was successful. 735 * @return EC_Normal if the receiver processes could be started, an error code otherwise. 736 */ 737 OFCondition startReceiver(); 738 739 /** terminates the network receiver process (Storage Service Class SCP). 740 * This method attempts to terminate the network receiver process by 741 * requesting a DICOM association with it and delivering a special "shutdown" command. 742 * If for some reason the network receiver cannot be found (i.e. because it has 743 * terminated abnormally), a TCP/IP timeout (several seconds) may occur before this method returns. 744 * @return EC_Normal if the receiver process could be terminated, an error code otherwise. 745 */ 746 OFCondition terminateReceiver(); 747 748 /** starts the query/retrieve server process (Query/Retrieve Service Class SCP). 749 * The query/retrieve process will wait for incoming DICOM associations, serve queries and 750 * send the requested instances to the specified destination. Data will be taken from the 751 * same local database used to store received instances and created presentation states, 752 * stored print objects and hardcopy grayscale images. 753 * The configuration file which is required for the query/retrieve process will be created 754 * automatically from the 'global' configuration file each time this method is called, unless 755 * this automatical creation is disabled (entry: [QUERYRETIUEVE] AutoCreateConfigFile = false). 756 * Attention: Successful return of this method is no guarantee that the query/retrieve server 757 * has successfully started, because certain errors (i.e. incorrect settings in the config file) 758 * will only be noted in the query/retrieve process when running. On Unix platform, successful 759 * return of this method means that the fork() used to start the receiver was successful. 760 * On Win32 platforms, it means that the CreateProcess() call was successful. 761 * @return EC_Normal if the query/retrieve process could be started, an error code otherwise. 762 */ 763 OFCondition startQueryRetrieveServer(); 764 765 /** terminates the query/retrieve server process (Query/Retrieve Service Class SCP). 766 * This method attempts to terminate the query/retrieve process by requesting a 767 * DICOM association with it and delivering a special "shutdown" command. 768 * If for some reason the query/retrieve server cannot be found (i.e. because it has 769 * terminated abnormally), a TCP/IP timeout (several seconds) may occur before this 770 * method returns. 771 * @return EC_Normal if the query/retrieve process could be terminated, 772 * an error code otherwise. 773 */ 774 OFCondition terminateQueryRetrieveServer(); 775 776 /** tests whether the database has been modified in any way since the last 777 * call to this method. Any write access to the database (adding, deleting, changing) 778 * is reported. This method works by modifying and checking the "modification date/time" 779 * of the database index file. This method is not affected by database locks and can be 780 * called at any time. 781 * Always returns OFTrue for the first call after construction of the interface. 782 * Also returns OFTrue if something goes wrong (i.e. if the method cannot make sure 783 * that nothing has changed). 784 * @return OFTrue if the database has been modified since the last call to this method. 785 */ 786 OFBool newInstancesReceived(); 787 788 /** sends a complete study over network to a different DICOM peer. 789 * A separate application or process is launched to handle the send operation. 790 * This call returns when the send operation has successfully been launched. 791 * No information about the status or success of the transfer itself is being made 792 * available. 793 * @param targetID symbolic identifier of the send target, must be one of the 794 * strings returned by getTargetID(). 795 * @param studyUID Study Instance UID of the study to be sent. Must be a study 796 * contained in the database. 797 * @return EC_Normal when the send process has successfully been launched, 798 * an error condition otherwise. 799 */ sendStudy(const char * targetID,const char * studyUID)800 OFCondition sendStudy(const char *targetID, const char *studyUID) 801 { 802 return sendIOD(targetID, studyUID, NULL, NULL); 803 } 804 805 /** sends a complete series over network to a different DICOM peer. 806 * A separate application or process is launched to handle the send operation. 807 * This call returns when the send operation has successfully been launched. 808 * No information about the status or success of the transfer itself is being made 809 * available. 810 * @param targetID symbolic identifier of the send target, must be one of the 811 * strings returned by getTargetID(). 812 * @param studyUID Study Instance UID of the series to be sent. Must be a series 813 * contained in the database. 814 * @param seriesUID Series Instance UID of the series to be sent. Must be a series 815 * contained in the database. 816 * @return EC_Normal when the send process has successfully been launched, 817 * an error condition otherwise. 818 */ sendSeries(const char * targetID,const char * studyUID,const char * seriesUID)819 OFCondition sendSeries(const char *targetID, const char *studyUID, const char *seriesUID) 820 { 821 return sendIOD(targetID, studyUID, seriesUID, NULL); 822 } 823 824 /** sends a single instance (image or presentation state) 825 * over network to a different DICOM peer. 826 * A separate application or process is launched to handle the send operation. 827 * This call returns when the send operation has successfully been launched. 828 * No information about the status or success of the transfer itself is being made 829 * available. 830 * @param targetID symbolic identifier of the send target, must be one of the 831 * strings returned by getTargetID(). 832 * @param studyUID Study Instance UID of the IOD to be sent. Must be an IOD 833 * contained in the database. 834 * @param seriesUID Series Instance UID of the IOD to be sent. Must be an IOD 835 * contained in the database. 836 * @param instanceUID SOP Instance UID of the IOD to be sent. Must be an IOD 837 * contained in the database. 838 * @return EC_Normal when the send process has successfully been launched, 839 * an error condition otherwise. 840 */ 841 OFCondition sendIOD(const char *targetID, const char *studyUID, const char *seriesUID, const char *instanceUID); 842 843 /** creates a dump of the contents of a DICOM file and displays it on-screen. 844 * A separate application or process is launched to handle the dump and display. 845 * This call returns when the dump operation has successfully been launched. 846 * No information about the status or success of the process itself is being made 847 * available. 848 * This method does not acquire a database lock. 849 * @param filename path of file to be displayed. 850 * @return EC_Normal when the process has successfully been launched, 851 * an error condition otherwise. 852 */ 853 OFCondition dumpIOD(const char *filename); 854 855 /** creates a dump of the contents of a DICOM file and displays it on-screen. 856 * A separate application or process is launched to handle the dump and display. 857 * This call returns when the dump operation has successfully been launched. 858 * No information about the status or success of the process itself is being made 859 * available. 860 * This method acquires a database lock which must be explicitly freed by the user. 861 * @param studyUID Study Instance UID of the IOD to be dumped. Must be an IOD 862 * contained in the database. 863 * @param seriesUID Series Instance UID of the IOD to be dumped. Must be an IOD 864 * contained in the database. 865 * @param instanceUID SOP Instance UID of the IOD to be dumped. Must be an IOD 866 * contained in the database. 867 * @return EC_Normal when the process has successfully been launched, 868 * an error condition otherwise. 869 */ 870 OFCondition dumpIOD(const char *studyUID, const char *seriesUID, const char *instanceUID); 871 872 /** checks the contents of a DICOM file and displays an evaluation report on the screen. 873 * A separate application or process is launched to handle the evaluation and display. 874 * This call returns when the check operation has successfully been launched. 875 * No information about the status or success of the process itself is being made 876 * available. 877 * This method does not acquire a database lock. 878 * @param filename path of file to be checked. 879 * @return EC_Normal when the process has successfully been launched, 880 * an error condition otherwise. 881 */ 882 OFCondition checkIOD(const char *filename); 883 884 /** checks the contents of a DICOM file and displays an evaluation report on the screen. 885 * A separate application or process is launched to handle the evaluation and display. 886 * This call returns when the check operation has successfully been launched. 887 * No information about the status or success of the process itself is being made 888 * available. 889 * This method acquires a database lock which must be explicitly freed by the user. 890 * @param studyUID Study Instance UID of the IOD to be checked. Must be an IOD 891 * contained in the database. 892 * @param seriesUID Series Instance UID of the IOD to be checked. Must be an IOD 893 * contained in the database. 894 * @param instanceUID SOP Instance UID of the IOD to be checked. Must be an IOD 895 * contained in the database. 896 * @return EC_Normal when the process has successfully been launched, 897 * an error condition otherwise. 898 */ 899 OFCondition checkIOD(const char *studyUID, const char *seriesUID, const char *instanceUID); 900 901 /** saves a monochrome bitmap as a DICOM Secondary Capture image. 902 * The bitmap must use one byte per pixel, left to right, top to bottom 903 * order of the pixels. 0 is interpreted as black, 255 as white. 904 * @param filename the file name or path under which the image is saved. 905 * @param pixelData a pointer to the image data. Must contain at least 906 * width*height bytes of data. 907 * @param width the width of the image, must be <= 0xFFFF 908 * @param height the height of the image, must be <= 0xFFFF 909 * @param aspectRatio the pixel aspect ratio as width/height. If omitted, a pixel 910 * aspect ratio of 1/1 is assumed. 911 * @param explicitVR selects the transfer syntax to be written. 912 * True selects Explicit VR Little Endian, False selects Implicit VR Little Endian. 913 * @param instanceUID optional parameter containing the SOP Instance UID to be written. 914 * This parameter should be omitted unless the SOP Instance UID needs to be controlled 915 * externally. 916 * @return EC_Normal upon success, an error code otherwise. 917 */ 918 OFCondition saveDICOMImage( 919 const char *filename, 920 const void *pixelData, 921 unsigned long width, 922 unsigned long height, 923 double aspectRatio=1.0, 924 OFBool explicitVR=OFTrue, 925 const char *instanceUID=NULL); 926 927 /** saves a monochrome bitmap as a DICOM Secondary Capture image 928 * in the same directory in which the database index file resides. 929 * The filename is generated automatically. 930 * When the image is stored successfully, the database index is updated 931 * to include the new object. 932 * This method releases under any circumstances the database lock if it exists. 933 * @param pixelData a pointer to the image data. Must contain at least 934 * width*height bytes of data. 935 * @param width the width of the image, must be <= 0xFFFF 936 * @param height the height of the image, must be <= 0xFFFF 937 * @param aspectRatio the pixel aspect ratio as width/height. If omitted, a pixel 938 * aspect ratio of 1/1 is assumed. 939 * @return EC_Normal upon success, an error code otherwise. 940 */ 941 OFCondition saveDICOMImage( 942 const void *pixelData, 943 unsigned long width, 944 unsigned long height, 945 double aspectRatio=1.0); 946 947 /** saves a monochrome bitmap as a DICOM Hardcopy Grayscale image. 948 * The bitmap must use 16 bits per pixel, left to right, top to bottom 949 * order of the pixels. It is assumed that only values 0..4095 are used. 950 * @param filename the file name or path under which the image is saved. 951 * @param pixelData a pointer to the image data. Must contain at least 952 * width*height*2 bytes of data. 953 * @param width the width of the image, must be <= 0xFFFF 954 * @param height the height of the image, must be <= 0xFFFF 955 * @param aspectRatio the pixel aspect ratio as width/height. If omitted, a pixel 956 * aspect ratio of 1/1 is assumed. 957 * @param explicitVR selects the transfer syntax to be written. 958 * True selects Explicit VR Little Endian, False selects Implicit VR Little Endian. 959 * @param instanceUID optional parameter containing the SOP Instance UID to be written. 960 * This parameter should be omitted unless the SOP Instance UID needs to be controlled 961 * externally. 962 * @return EC_Normal upon success, an error code otherwise. 963 */ 964 OFCondition saveHardcopyGrayscaleImage( 965 const char *filename, 966 const void *pixelData, 967 unsigned long width, 968 unsigned long height, 969 double aspectRatio=1.0, 970 OFBool explicitVR=OFTrue, 971 const char *instanceUID=NULL); 972 973 /** saves a monochrome bitmap as a DICOM Hardcopy Grayscale image 974 * in the same directory in which the database index file resides. 975 * The filename is generated automatically. 976 * When the image is stored successfully, the database index is updated 977 * to include the new object. 978 * This method releases under any circumstances the database lock if it exists. 979 * @param pixelData a pointer to the image data. Must contain at least 980 * width*height*2 bytes of data. 981 * @param width the width of the image, must be <= 0xFFFF 982 * @param height the height of the image, must be <= 0xFFFF 983 * @param aspectRatio the pixel aspect ratio as width/height. If omitted, a pixel 984 * aspect ratio of 1/1 is assumed. 985 * @return EC_Normal upon success, an error code otherwise. 986 */ 987 OFCondition saveHardcopyGrayscaleImage( 988 const void *pixelData, 989 unsigned long width, 990 unsigned long height, 991 double aspectRatio=1.0); 992 993 /** saves a DICOM object into a file in the same directory in which the 994 * database index file resides. The object must contain a SOP Class 995 * UID and SOP Instance UID. The filename is generated automatically. 996 * When the image is stored successfully, the database index is 997 * updated to include the new object. This method releases under any 998 * circumstances the database lock if it exists. 999 * @param fileformat the complete DICOM file object to be written 1000 * @return EC_Normal upon success, an error code otherwise. 1001 */ 1002 OFCondition saveFileFormatToDB(DcmFileFormat &fileformat); 1003 1004 /** loads a Stored Print object which is contained in the database into memory. 1005 * Attention: The current print job (Stored Print object) will be deleted by doing this. 1006 * This method acquires a database lock which must be explicitly freed by the user. 1007 * @param studyUID study instance UID of the Stored Print object 1008 * @param seriesUID series instance UID of the Stored Print object 1009 * @param instanceUID SOP instance UID of the Stored Print object 1010 * @param changeStatus if true the stored print object is marked 'reviewed' (not new) 1011 * @return EC_Normal upon success, an error code otherwise. 1012 */ 1013 OFCondition loadStoredPrint(const char *studyUID, const char *seriesUID, const char *instanceUID, OFBool changeStatus = OFFalse); 1014 1015 /** loads a Stored Print object (which need not be contained in the database) into memory. 1016 * Attention: The current print job (Stored Print object) will be deleted by doing this. 1017 * This method does not acquire a database lock. 1018 * @param filename path and filename of the Stored Print object to be loaded 1019 * @return EC_Normal upon success, an error code otherwise. 1020 */ 1021 OFCondition loadStoredPrint(const char *filename); 1022 1023 /** saves the current print job as a Stored Print object. 1024 * @param filename the file name or path under which the image is saved. 1025 * @param writeRequestedImageSize if false, the Requested Image Size attributes are not written, 1026 * e. g. because they are not supported by the target printer. 1027 * @param explicitVR selects the transfer syntax to be written. 1028 * True selects Explicit VR Little Endian, False selects Implicit VR Little Endian. 1029 * @param instanceUID optional parameter containing the SOP Instance UID to be written. 1030 * This parameter should be omitted unless the SOP Instance UID needs to be controlled 1031 * externally. 1032 * @return EC_Normal upon success, an error code otherwise. 1033 */ 1034 OFCondition saveStoredPrint( 1035 const char *filename, 1036 OFBool writeRequestedImageSize, 1037 OFBool explicitVR=OFTrue, 1038 const char *instanceUID=NULL); 1039 1040 /** saves the current print job as a Stored Print object 1041 * in the same directory in which the database index file resides. 1042 * The filename is generated automatically. 1043 * When the image is stored successfully, the database index is updated 1044 * to include the new object. 1045 * This method releases under any circumstances the database lock if it exists. 1046 * @param writeRequestedImageSize if false, the Requested Image Size attributes are not written, 1047 * e. g. because they are not supported by the target printer. 1048 * @return EC_Normal upon success, an error code otherwise. 1049 */ 1050 OFCondition saveStoredPrint(OFBool writeRequestedImageSize); 1051 1052 /** gets the number of Hardcopy Grayscaleimages currently registered by the stored print object. 1053 * @return number of images. 1054 */ 1055 size_t getNumberOfPrintPreviews(); 1056 1057 /** loads a Hardcopy Grayscale image registered by the stored print object and creates a preview. 1058 * The preview bitmap is implicitly scaled to fit into the rectangle specified by 1059 * setMaxPrintPreviewWidthHeight(). 1060 * @param idx index of the image, must be < getNumberOfPrintPreviews() 1061 * @param printLUT OFTrue if presentation LUT should be interpreted as a print presentation LUT 1062 * (default, in this case there is no implicit scaling of the input width of the LUT and, 1063 * therefore, the VOI transformation - which is absent for print - is used), 1064 * OFFalse otherwise (softcopy interpretation of a presentation LUT) 1065 * @param changeStatus if true the hardcopy grayscale image file is marked 'reviewed' (not new) 1066 * @return EC_Normal if successful, an error code otherwise. 1067 */ 1068 OFCondition loadPrintPreview(size_t idx, OFBool printLUT = OFTrue, OFBool changeStatus = OFFalse); 1069 1070 /** removes a currently loaded Hardcopy Grayscale image from memory. 1071 */ 1072 void unloadPrintPreview(); 1073 1074 /** gets number of bytes used for the print preview bitmap. 1075 * (depends on width, height and depth) 1076 * @return number of bytes used for the preview bitmap 1077 */ 1078 unsigned long getPrintPreviewSize(); 1079 1080 /** sets the maximum print preview bitmap width and height. 1081 * Larger images are scaled down (according to the pixel aspect ratio) to fit into 1082 * the specified rectangle. 1083 * Attention: If the values differ from the the previous ones the currently loaded 1084 * hardcopy grayscale image (preview) is automatically detroyed and has to be re-loaded. 1085 * @param width maximum width of preview bitmap (in pixels) 1086 * @param height maximum height of preview bitmap (in pixels) 1087 */ 1088 void setMaxPrintPreviewWidthHeight(unsigned long width, unsigned long height); 1089 1090 /** gets width and height of print preview bitmap. 1091 * The return values depend on the current maximum preview bitmap width/height values! 1092 * @param width upon success, the bitmap width (in pixels) is returned in this parameter 1093 * @param height upon success, the bitmap height (in pixels) is returned in this parameter 1094 * @return EC_Normal upon success, an error code otherwise 1095 */ 1096 OFCondition getPrintPreviewWidthHeight(unsigned long &width, unsigned long &height); 1097 1098 /** writes the bitmap data of the print preview image into the given buffer. 1099 * The storage area must be allocated and deleted from the calling method. 1100 * @param bitmap pointer to storage area where the pixel data is copied to (array of 8 bit values) 1101 * @param size specifies size of the storage area in bytes 1102 * @return EC_Normal upon success, an error code otherwise 1103 */ 1104 OFCondition getPrintPreviewBitmap(void *bitmap, unsigned long size); 1105 1106 /** stores the current presentation state in a temporary place 1107 * and creates a new presentation state that corresponds with an 1108 * image displayed "without" presentation state. 1109 * If called twice, an error code is returned. 1110 * @return EC_Normal upon success, an error code otherwise. 1111 */ 1112 OFCondition disablePState(); 1113 1114 /** restores the stored presentation state (see disablePresentationState) 1115 * and deletes the temporary presentation state. 1116 * If no stored presentation state exists, returns an error. 1117 * @return EC_Normal upon success, an error code otherwise. 1118 */ 1119 OFCondition enablePState(); 1120 1121 /** returns number of presentation states referencing the currently selected image. 1122 * If no instance is currently selected or the selected instance is a presentation 1123 * state, returns an error. 1124 * @return number of presentation states, 0 if none available or an error occurred 1125 */ 1126 Uint32 getNumberOfPStates(); 1127 1128 /** selects and loads specified presentation state referencing the currently selected 1129 * image. 1130 * @param idx index to be selected, must be < getNumberOfPStates() 1131 * @param changeStatus if true the presentation state is marked 'reviewed' (not new) 1132 * @return EC_Normal upon success, an error code otherwise. 1133 */ 1134 OFCondition selectPState(Uint32 idx, OFBool changeStatus = OFFalse); 1135 1136 /** returns description of specified presentation state referencing the currently 1137 * selected image. 1138 * @param idx index to be selected, must be < getNumberOfPStates() 1139 * @return presentation state description or NULL idx is invalid 1140 */ 1141 const char *getPStateDescription(Uint32 idx); 1142 1143 /** returns label of specified presentation state referencing the currently 1144 * selected image. 1145 * @param idx index to be selected, must be < getNumberOfPStates() 1146 * @return presentation state label or NULL idx is invalid 1147 */ 1148 const char *getPStateLabel(Uint32 idx); 1149 1150 /** checks whether display correction is possible (in principle), 1151 * i.e. a valid monitor characteristics description exists 1152 * and current system is a low-cost system (without built-in 1153 * calibration). 1154 * @param transform display transform to be checked (default: GSDF) 1155 * @return OFTrue if display transform is possible, OFFalse otherwise 1156 */ 1157 OFBool isDisplayTransformPossible(DVPSDisplayTransform transform = DVPSD_GSDF); 1158 1159 /** sets ambient light value for the display transformation. 1160 * @param value ambient light value to be set 1161 * @return EC_Normal upon success, an error code otherwise. 1162 */ 1163 OFCondition setAmbientLightValue(double value); 1164 1165 /** returns ambient light value for the display transformation. 1166 * @param value returned ambient light value 1167 * @return EC_Normal upon success, an error code otherwise. 1168 */ 1169 OFCondition getAmbientLightValue(double &value); 1170 1171 /* print related methods */ 1172 1173 /** selects the current printer. Also adjusts the destination AE title and the 1174 * printer name attribute within the Stored Print object. 1175 * @param targetID one of the printer target IDs returned by getTargetID(). 1176 * @return EC_Normal if successful, an error code otherwise. 1177 */ 1178 OFCondition setCurrentPrinter(const char *targetID); 1179 1180 /** gets the current printer's target ID. 1181 * @return printer target ID, can be NULL if no printer is defined 1182 * in the configuration file. 1183 */ 1184 const char *getCurrentPrinter(); 1185 1186 /** sets the (optional) print medium type. 1187 * @param value new attribute value, may be NULL. 1188 * The caller is responsible for making sure 1189 * that the value is valid for the selected printer. 1190 * @return EC_Normal if successful, an error code otherwise. 1191 */ 1192 OFCondition setPrinterMediumType(const char *value); 1193 1194 /** gets the (optional) print medium type. 1195 * @return medium type, may be NULL. 1196 */ 1197 const char *getPrinterMediumType(); 1198 1199 /** sets the (optional) printer film destination. 1200 * @param value new attribute value, may be NULL. 1201 * The caller is responsible for making sure 1202 * that the value is valid for the selected printer. 1203 * @return EC_Normal if successful, an error code otherwise. 1204 */ 1205 OFCondition setPrinterFilmDestination(const char *value); 1206 1207 /** gets the (optional) printer film destination. 1208 * @return printer film destination, may be NULL or empty string. 1209 */ 1210 const char *getPrinterFilmDestination(); 1211 1212 /** sets the (optional) printer film session label. 1213 * @param value new attribute value, may be NULL. 1214 * The caller is responsible for making sure 1215 * that the value is valid for the selected printer. 1216 * @return EC_Normal if successful, an error code otherwise. 1217 */ 1218 OFCondition setPrinterFilmSessionLabel(const char *value); 1219 1220 /** gets the (optional) printer film session label. 1221 * @return printer film session label, may be NULL or empty string. 1222 */ 1223 const char *getPrinterFilmSessionLabel(); 1224 1225 /** sets the (optional) print priority. 1226 * @param value new attribute value, may be NULL. 1227 * The caller is responsible for making sure 1228 * that the value is valid for the selected printer. 1229 * @return EC_Normal if successful, an error code otherwise. 1230 */ 1231 OFCondition setPrinterPriority(const char *value); 1232 1233 /** gets the (optional) print priority. 1234 * @return print priority, may be NULL or empty string. 1235 */ 1236 const char *getPrinterPriority(); 1237 1238 /** sets the (optional) print session owner ID. 1239 * @param value new attribute value, may be NULL. 1240 * The caller is responsible for making sure 1241 * that the value is valid for the selected printer. 1242 * @return EC_Normal if successful, an error code otherwise. 1243 */ 1244 OFCondition setPrinterOwnerID(const char *value); 1245 1246 /** gets the (optional) print session owner ID. 1247 * @return print session owner ID, may be NULL or empty string. 1248 */ 1249 const char *getPrinterOwnerID(); 1250 1251 /** sets the (optional) print number of copies. 1252 * @param value new attribute value, may be 0. 1253 * The caller is responsible for making sure 1254 * that the value is valid for the selected printer. 1255 * @return EC_Normal if successful, an error code otherwise. 1256 */ 1257 OFCondition setPrinterNumberOfCopies(unsigned long value); 1258 1259 /** gets the (optional) print number of copies. 1260 * @return print number of copies, 0 if absent. 1261 */ 1262 unsigned long getPrinterNumberOfCopies(); 1263 1264 /** resets the settings for basic film session (everything that 1265 * is not managed by the Stored Print object) to initial state. 1266 * Affects medium type, film destination, film session label, 1267 * priority, owner ID, and number of copies. 1268 */ 1269 void clearFilmSessionSettings(); 1270 1271 /** sets the LUT with the given identifier 1272 * in the Presentation State as current Presentation LUT. 1273 * @param lutID LUT identifier, as returned by getLUTID(). 1274 * @return EC_Normal if successful, an error code otherwise. 1275 */ 1276 OFCondition selectDisplayPresentationLUT(const char *lutID); 1277 1278 /** if the Presentation State contains an active 1279 * Presentation LUT that was set with selectDisplayPresentationLUT(), 1280 * return the corresponding LUT identifier. 1281 * @return lutID if found, NULL or empty string otherwise. 1282 */ 1283 const char *getDisplayPresentationLUTID(); 1284 1285 /** sets the LUT with the given identifier in the Stored Print object 1286 * as current Presentation LUT. This LUT overrides the settings made 1287 * for the separate image boxes, it can be deactivated using the method 1288 * DVPSStoredPrint::setDefaultPresentationLUT(). 1289 * @param lutID LUT identifier, as returned by getLUTID(). 1290 * @return EC_Normal if successful, an error code otherwise. 1291 */ 1292 OFCondition selectPrintPresentationLUT(const char *lutID); 1293 1294 /** if the Stored Print object contains an active 1295 * Presentation LUT that was set with selectPrintPresentationLUT(), 1296 * return the corresponding LUT identifier. 1297 * @return lutID if found, NULL or empty string otherwise. 1298 */ 1299 const char *getPrintPresentationLUTID(); 1300 1301 /** start spooling of print job with current settings. 1302 * @param deletePrintedImages if true, delete printed images from queue. 1303 * @return EC_Normal if successful, an error code otherwise. 1304 */ 1305 OFCondition spoolPrintJob(OFBool deletePrintedImages=OFTrue); 1306 1307 /** starts the print spooler process. 1308 * The print spooler will wait for print jobs created with spoolPrintJob() 1309 * and communicate them to the printer using the DICOM Print Management Service Class. 1310 * Attention: Successful return of this method is no guarantee 1311 * that the spooler has successfully started, because certain errors 1312 * (i.e. incorrect settings in the config file) will only be noted in the spooler 1313 * process when running. On Unix platform, successful return of this method 1314 * means that the fork() used to start the spooler was successful. 1315 * On Win32 platforms, it means that the CreateProcess() call was successful. 1316 * @return EC_Normal if the spooler process could be started, an error code otherwise. 1317 */ 1318 OFCondition startPrintSpooler(); 1319 1320 /** terminates the print spooler process. This method creates a "dummy" 1321 * print job that request the print spooler to shutdown as soon as all other pending 1322 * print jobs are finished. 1323 * @return EC_Normal if the spooler process dummy print job could be written, 1324 * an error code otherwise. 1325 */ 1326 OFCondition terminatePrintSpooler(); 1327 1328 /** starts the print server process (Basic Grayscale Print Management SCP). 1329 * The print server process will wait for incoming DICOM associations, handle the 1330 * DICOM print protcol, store data in file and register stored print and grayscale 1331 * image objects in the database index file. 1332 * Attention: Successful return of this method is no guarantee that the print 1333 * server has successfully started, because certain errors (i.e. incorrect settings 1334 * in the config file) will only be noted in the print server process when running. 1335 * On Unix platform, successful return of this method means that the fork() used to 1336 * start the server was successful. 1337 * On Win32 platforms, it means that the CreateProcess() call was successful. 1338 * @return EC_Normal if the server process could be started, an error code otherwise. 1339 */ 1340 OFCondition startPrintServer(); 1341 1342 /** terminates the print server process (Basic Grayscale Print Management SCP). 1343 * This method attempts to terminate the print server process by requesting a DICOM 1344 * association with it and delivering a special "shutdown" command. 1345 * If for some reason the print server cannot be found (i.e. because it has terminated 1346 * abnormally), a TCP/IP timeout (several seconds) may occur before this method returns. 1347 * @return EC_Normal if the server process could be terminated, an error code otherwise. 1348 */ 1349 OFCondition terminatePrintServer(); 1350 1351 /** adds an existing DICOM image (should be Hardcopy Grayscale) 1352 * that is already present in the image database to the current print image queue 1353 * without rendering it again. 1354 * The "requested image size" option is not used - the bitmap is treated as if the 1355 * presentation mode was "SCALE TO FIT". 1356 * @param studyUID study instance UID of the image, as reported by getStudyUID() 1357 * @param seriesUID series instance UID of the image, as reported by getSeriesUID() 1358 * @param instanceUID SOP instance UID of the image, as reported by getInstanceUID() 1359 * @return EC_Normal upon success, an error code otherwise. 1360 */ 1361 OFCondition addToPrintHardcopyFromDB(const char *studyUID, const char *seriesUID, const char *instanceUID); 1362 1363 /** requests the spooler process to print an old print job that is stored 1364 * in the database as a "stored print" object. The Stored Print that is printed 1365 * does not contain all parameters of a print job. The following parameters are taken from the 1366 * current settings in this object: Target printer, medium type, 1367 * illumination and reflected ambient light. 1368 * @param studyUID study instance UID of the Stored Print, as reported by getStudyUID() 1369 * @param seriesUID series instance UID of the Stored Print, as reported by getSeriesUID() 1370 * @param instanceUID SOP instance UID of the Stored Print, as reported by getInstanceUID() 1371 * @return EC_Normal upon success, an error code otherwise. 1372 */ 1373 OFCondition spoolStoredPrintFromDB(const char *studyUID, const char *seriesUID, const char *instanceUID); 1374 1375 /** Initiates the creation of a DICOM Basic Film Session SOP Instance in the printer. 1376 * This method stores all Basic Film Session related attributes that are managed by this object 1377 * in a DICOM dataset and passes the result to the embedded Stored Print object which manages 1378 * the further communication. 1379 * @param printHandler print communication handler, association must be open. 1380 * @param plutInSession true if printer expects referenced presentation LUT sequence, illumination 1381 * and reflected ambient light in basic film session, false if it expects them in basic film box. 1382 * @return EC_Normal upon success, an error code otherwise. 1383 */ 1384 OFCondition printSCUcreateBasicFilmSession(DVPSPrintMessageHandler& printHandler, OFBool plutInSession); 1385 1386 /* annotation interface */ 1387 1388 /** gets the current setting of the annotation activity annotation flag. 1389 * @return OFTrue if annotation is on, OFFalse otherwise. 1390 */ isActiveAnnotation()1391 OFBool isActiveAnnotation() { return activateAnnotation; } 1392 1393 /** gets the current setting of the Prepend Date/Time annotation flag. 1394 * @return OFTrue if Prepend Date/Time is on, OFFalse otherwise. 1395 */ getPrependDateTime()1396 OFBool getPrependDateTime() { return prependDateTime; } 1397 1398 /** gets the current setting of the Prepend Printer Name annotation flag. 1399 * @return OFTrue if Prepend Printer Name is on, OFFalse otherwise. 1400 */ getPrependPrinterName()1401 OFBool getPrependPrinterName() { return prependPrinterName; } 1402 1403 /** gets the current setting of the Prepend Lighting annotation flag. 1404 * @return OFTrue if Prepend Lighting is on, OFFalse otherwise. 1405 */ getPrependLighting()1406 OFBool getPrependLighting() { return prependLighting; } 1407 1408 /** gets the current annotation text. 1409 * @return annotation text, may be NULL or empty string. 1410 */ getAnnotationText()1411 const char *getAnnotationText() { return annotationText.c_str(); } 1412 1413 /** switches annotation printing on/off 1414 * @param value OFTrue if annotation is switched on, OFFalse otherwise. 1415 */ setActiveAnnotation(OFBool value)1416 void setActiveAnnotation(OFBool value) { activateAnnotation=value; } 1417 1418 /** sets the Prepend Date/Time annotation flag. 1419 * @param value OFTrue if Prepend Date/Time is switched on, OFFalse otherwise. 1420 */ setPrependDateTime(OFBool value)1421 void setPrependDateTime(OFBool value) { prependDateTime=value; } 1422 1423 /** sets the Prepend Printer Name annotation flag. 1424 * @param value OFTrue if Prepend Printer Name is switched on, OFFalse otherwise. 1425 */ setPrependPrinterName(OFBool value)1426 void setPrependPrinterName(OFBool value) { prependPrinterName=value; } 1427 1428 /** sets the Prepend Lighting annotation flag. 1429 * @param value OFTrue if Prepend Lighting is switched on, OFFalse otherwise. 1430 */ setPrependLighting(OFBool value)1431 void setPrependLighting(OFBool value) { prependLighting=value; } 1432 1433 /** sets the current annotation text. 1434 * @param value new text, may be NULL. 1435 */ 1436 void setAnnotationText(const char *value); 1437 1438 /* user management interface */ 1439 1440 /** verifies the given password for the given user ID. This method tries 1441 * to load and decrypt the private key for the given user with the 1442 * given password. If this fails, the password verification fails, 1443 * otherwise the password verification succeeds. 1444 * @remark this method is only functional if DCMTK is compiled with 1445 * OpenSSL support enabled. Otherwise it always returns false. 1446 * @param userID symbolic user ID for given user, as returned by 1447 * DVConfiguration::getUserID() 1448 * @param passwd for user as entered in some GUI control 1449 * @return true if password verification succeeds, false otherwise. 1450 */ 1451 OFBool verifyUserPassword(const char *userID, const char *passwd); 1452 1453 /** verifies and digitally signs the current structured report. 1454 * If the user ID is known (i.e. specified in the configuration file) the current 1455 * structured report is verified (a verifying observer is added). If the 'mode' 1456 * parameter is set accordingly and the password is correct (see verifyUserPassword) 1457 * the report is also digitally signed. 1458 * Please note that a document can be verified/signed more than once, but only completed 1459 * documents can be verified. After signing the report no modifications should be performed 1460 * before the object is stored in the database or a file. Otherwise the digital signature 1461 * would be corrupted. Therefore, the SOP instance UID should be generated before calling 1462 * this method. 1463 * @remark this method only has full functionality if DCMTK is compiled with 1464 * OpenSSL support enabled. If not, only mode DVPSY_verify (verification) 1465 * is available and an error is returned for any other mode. 1466 * @param userID symbolic user ID for given user, as returned by 1467 * DVConfiguration::getUserID() 1468 * @param passwd for user as entered in some GUI control 1469 * @param mode flag specifying whether to verify only, verify and sign or verify and 1470 * sign and finalize the document. The difference between the second and the third mode 1471 * is that "finalize" always signs the entire document whereas the other mode only signs 1472 * the marked items (if any, all items otherwise) and leaves out certain header attributes 1473 * (e.g. the SOP instance UID and the verifying observer sequence). 1474 * @return status, EC_Normal if successful, an error code otherwise. 1475 */ 1476 OFCondition verifyAndSignStructuredReport(const char *userID, const char *passwd, DVPSVerifyAndSignMode mode); 1477 1478 1479 /* digital signatures */ 1480 1481 /** returns a string containing a complete HTML page with the 1482 * signature validation results for the last object of the 1483 * given type. Never returns NULL. 1484 * @param objtype object type 1485 * @return pointer to string with HTML page 1486 */ 1487 const char *getCurrentSignatureValidationHTML(DVPSObjectType objtype) const; 1488 1489 /** returns a string containing a complete HTML page with the 1490 * signature validation overview. Never returns NULL. 1491 * @return pointer to string with HTML page 1492 */ 1493 const char *getCurrentSignatureValidationOverview() const; 1494 1495 /** returns the status flag for the current object of given type. 1496 * @param objtype object type 1497 * @return digital signature status for object 1498 */ 1499 DVPSSignatureStatus getCurrentSignatureStatus(DVPSObjectType objtype) const; 1500 1501 /** returns the combined status flag for the current image and presentation state. 1502 * @return digital signature status for image and presentation state 1503 */ 1504 DVPSSignatureStatus getCombinedImagePStateSignatureStatus() const; 1505 1506 /** returns number of correct signatures for given object type. 1507 * @param objtype object type 1508 * @return number of digital signatures 1509 */ 1510 unsigned long getNumberOfCorrectSignatures(DVPSObjectType objtype) const; 1511 1512 /** returns number of untrustworthy signatures for given object type. 1513 * @param objtype object type 1514 * @return number of digital signatures 1515 */ 1516 unsigned long getNumberOfUntrustworthySignatures(DVPSObjectType objtype) const; 1517 1518 /** returns number of corrupt signatures for given object type. 1519 * @param objtype object type 1520 * @return number of digital signatures 1521 */ 1522 unsigned long getNumberOfCorruptSignatures(DVPSObjectType objtype) const; 1523 1524 /** disables internal settings for image and presentation state. 1525 * Called when a new SR object is loaded and the current 1526 * image/presentation state are hidden consequently. 1527 */ 1528 void disableImageAndPState(); 1529 1530 private: 1531 1532 /** private undefined copy constructor 1533 */ 1534 DVInterface(const DVInterface&); 1535 1536 /** private undefined assignment operator 1537 */ 1538 DVInterface& operator=(const DVInterface&); 1539 1540 /** helper function that exchanges the current presentation state and image 1541 * by the pointers passed and frees the old ones. 1542 * @param newState new presentation state, must not be NULL 1543 * @param image image file 1544 * @param state presentation state if newState was not created from image. 1545 * @return EC_Normal upon success, an error code otherwise. 1546 */ 1547 OFCondition exchangeImageAndPState(DVPresentationState *newState, DcmFileFormat *image, DcmFileFormat *state=NULL); 1548 1549 /** creates a database handle if none exists yet (this method may 1550 * be called multiple times without interference) and puts a shared lock 1551 * on the database. 1552 * The lock will remain until explicitly released with releaseDatabase(); 1553 * @return EC_Normal upon success, an error code otherwise. 1554 */ 1555 OFCondition lockDatabase(); 1556 1557 /** creates an exlusive lock on the database if none exists. 1558 * The lock will remain until explicitly released with releaseDatabase() 1559 * or unlockExclusive(). 1560 * This method also clears the index cache. 1561 * @return EC_Normal upon success, an error code otherwise. 1562 */ 1563 OFCondition lockExclusive(); 1564 1565 /** removes an exlusive lock on the database if any. 1566 * @return EC_Normal upon success, an error code otherwise. 1567 */ 1568 OFCondition unlockExclusive(); 1569 1570 /** creates a new pair of filenames for print job creation. 1571 * @param printer printer identifier 1572 * @param tempname temporary name is returned here 1573 * @param jobname print job name is returned here 1574 * @return EC_Normal upon success, an error code otherwise. 1575 */ 1576 OFCondition createPrintJobFilenames(const char *printer, OFString& tempname, OFString& jobname); 1577 1578 /** creates the query/retrieve server configuration file. 1579 * @param filename path to the configuration file (incl. filename) 1580 * @return EC_Normal upon success, an error code otherwise. 1581 */ 1582 OFCondition createQueryRetrieveServerConfigFile(const char *filename); 1583 1584 /** starts an external application and passes a filename. 1585 * @param application pathname of the application to be started 1586 * @param filename filename to be passed as single parameter. 1587 * @return EC_Normal if fork or CreateProcess succeeds, an error 1588 * condition otherwise. 1589 */ 1590 OFCondition startExternalApplication(const char *application, const char *filename); 1591 1592 /* member variables */ 1593 1594 /** pointer to the current print handler object 1595 */ 1596 DVPSStoredPrint *pPrint; 1597 1598 /** pointer to the current presentation state object 1599 */ 1600 DVPresentationState *pState; 1601 1602 /** pointer to the current structured reporting object (should never be NULL) 1603 */ 1604 DSRDocument *pReport; 1605 1606 /** pointer to the handler object for digital signatures 1607 */ 1608 DVSignatureHandler *pSignatureHandler; 1609 1610 /** pointer to the stored presentation state object (if any) 1611 */ 1612 DVPresentationState *pStoredPState; 1613 1614 /** pointer to the current DICOM image attached to the presentation state 1615 */ 1616 DcmFileFormat *pDicomImage; 1617 1618 /** pointer to the current DICOM dataset containing the loaded presentation state. 1619 * Is NULL when the presentation state has been created "on the fly" from image. 1620 */ 1621 DcmFileFormat *pDicomPState; 1622 1623 /** pointer to the current hardcopy grayscale image (bitmap information only) 1624 */ 1625 DicomImage *pHardcopyImage; 1626 1627 /** a unique string generated for each instance of this class. 1628 * Used to identify print jobs generated from this instance. 1629 */ 1630 OFString printJobIdentifier; 1631 1632 /** a counter used for generating print job names. 1633 */ 1634 unsigned long printJobCounter; 1635 1636 /** string containing the path name of the config file as passed to the ctor. 1637 */ 1638 OFString configPath; 1639 1640 /** string containing the path name of the database index file 1641 * after a database lock has been acquired for the first time 1642 */ 1643 OFString databaseIndexFile; 1644 1645 /** initialized with construction time of the interface object 1646 * minus one day. Used to check modifications of the database index file. 1647 */ 1648 unsigned long referenceTime; 1649 1650 /** list of display function object 1651 */ 1652 DiDisplayFunction *displayFunction[DVPSD_max]; 1653 1654 /** handle to access database/index file 1655 */ 1656 DcmQueryRetrieveIndexDatabaseHandle *pHandle; 1657 1658 /** locking mode (OFFalse => shared, OFTrue => exclusive) 1659 */ 1660 OFBool lockingMode; 1661 1662 /** hierarchical cache structure to optimize index file access 1663 */ 1664 DVStudyCache idxCache; 1665 1666 /** record structure of index items (last read entry) 1667 */ 1668 IdxRecord idxRec; 1669 1670 /** position of last read index record (for optimization purposes) 1671 */ 1672 int idxRecPos; 1673 1674 /** OFTrue if current image is already stored in database, OFFalse otherwise 1675 */ 1676 OFBool imageInDatabase; 1677 1678 /* private methods for database */ 1679 1680 /** creates index cache to optimize reading of index file 1681 */ 1682 OFBool createIndexCache(); 1683 1684 /** creates cache of referencing pstates for the current image 1685 */ 1686 OFBool createPStateCache(); 1687 1688 /** clears index cache (includes pstate cache) 1689 */ 1690 void clearIndexCache(); 1691 1692 /** clears specified index record (and makes pos invalid) 1693 */ 1694 void clearIndexRecord(IdxRecord &record, 1695 int &recpos); 1696 1697 /** reads specified index record (comparing pos with oldpos to avoid redundant 1698 * loading) 1699 */ 1700 OFBool readIndexRecord(const int pos, 1701 IdxRecord &record, 1702 int *oldpos = NULL); 1703 1704 /** updates (hierarchical) status cache (propagates status information from instances 1705 * to series and from series to studies) 1706 */ 1707 void updateStatusCache(); 1708 1709 /** returns pointer to study struct specified by given UIDs or to current study 1710 */ 1711 DVStudyCache::ItemStruct *getStudyStruct(const char *studyUID = NULL, 1712 const char *seriesUID = NULL); 1713 1714 /** returns pointer to series struct specified by given UIDs or to current series 1715 */ 1716 DVSeriesCache::ItemStruct *getSeriesStruct(const char *studyUID = NULL, 1717 const char *seriesUID = NULL, 1718 const char *instanceUID = NULL); 1719 1720 /** returns pointer to instance struct specified by given UIDs or to current instance 1721 */ 1722 DVInstanceCache::ItemStruct *getInstanceStruct(const char *studyUID = NULL, 1723 const char *seriesUID = NULL, 1724 const char *instanceUID = NULL); 1725 1726 /** returns index of specified study within study description record 1727 */ 1728 int findStudyIdx(StudyDescRecord *study, 1729 const char *uid); 1730 1731 /** conditionally deletes given image file (only if file resides in index.dat directory) 1732 */ 1733 int deleteImageFile(const char *filename); 1734 1735 /** resets index file modification time to reference time (yesterday) 1736 */ 1737 void resetDatabaseReferenceTime(); 1738 1739 1740 /** modifies the review flag for one instance in the database (see method with three UID 1741 * parameters) 1742 */ 1743 OFCondition instanceReviewed(int pos); 1744 1745 /** minimum width of print bitmap (used for implicit scaling) 1746 */ 1747 unsigned long minimumPrintBitmapWidth; 1748 1749 /** minimum height of print bitmap (used for implicit scaling) 1750 */ 1751 unsigned long minimumPrintBitmapHeight; 1752 1753 /** maximum width of print bitmap (used for implicit scaling) 1754 */ 1755 unsigned long maximumPrintBitmapWidth; 1756 1757 /** maximum height of print bitmap (used for implicit scaling) 1758 */ 1759 unsigned long maximumPrintBitmapHeight; 1760 1761 /** maximum width of print preview bitmap 1762 */ 1763 unsigned long maximumPrintPreviewWidth; 1764 1765 /** maximum height of print preview bitmap 1766 */ 1767 unsigned long maximumPrintPreviewHeight; 1768 1769 /** maximum width of (optional) preview image 1770 */ 1771 unsigned long maximumPreviewImageWidth; 1772 1773 /** maximum height of (optional) preview image 1774 */ 1775 unsigned long maximumPreviewImageHeight; 1776 1777 /** target ID of current printer, empty if no printer exists in config file 1778 */ 1779 OFString currentPrinter; 1780 1781 /** config file identifier of LUT currently selected as Display Presentation LUT 1782 */ 1783 OFString displayCurrentLUTID; 1784 1785 /** config file identifier of LUT currently selected as Print Presentation LUT 1786 */ 1787 OFString printCurrentLUTID; 1788 1789 /** printer medium type identifier, may be empty. VR=CS, VM=1 1790 */ 1791 OFString printerMediumType; 1792 1793 /** printer film destination identifier, may be empty. VR=CS, VM=1 1794 */ 1795 OFString printerFilmDestination; 1796 1797 /** printer film session label, may be empty. VR=LO, VM=1 1798 */ 1799 OFString printerFilmSessionLabel; 1800 1801 /** printer number of copies 1802 */ 1803 unsigned long printerNumberOfCopies; 1804 1805 /** printer print priority, may be empty. VR=CS, VM=1, 1806 * enumerated values: HIGH, MED, LOW 1807 */ 1808 OFString printerPriority; 1809 1810 /** printer film session owner ID, may be empty. VR=SH, VM=1 1811 */ 1812 OFString printerOwnerID; 1813 1814 /** true if annotation should be created when spooling print job 1815 */ 1816 OFBool activateAnnotation; 1817 1818 /** true if date and time should be prepended to annotation text 1819 */ 1820 OFBool prependDateTime; 1821 1822 /** true if printer name should be prepended to annotation text 1823 */ 1824 OFBool prependPrinterName; 1825 1826 /** true if reflected ambient light and illumination should be prepended to annotation text 1827 */ 1828 OFBool prependLighting; 1829 1830 /** annotation text (if any) 1831 */ 1832 OFString annotationText; 1833 }; 1834 1835 1836 #endif 1837