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 #ifndef DVPSTAT_H
00031 #define DVPSTAT_H
00032
00033 #include "dcmtk/config/osconfig.h"
00034 #include "dcmtk/dcmpstat/dcmpstat.h"
00035
00036 class DicomImage;
00037 class DiDisplayFunction;
00038
00043 class DVPresentationState: public DcmPresentationState
00044 {
00045 public:
00058 DVPresentationState(
00059 DiDisplayFunction **dispFunction=NULL,
00060 unsigned long minPrintBitmapX=0,
00061 unsigned long minPrintBitmapY=0,
00062 unsigned long maxPrintBitmapX=0,
00063 unsigned long maxPrintBitmapY=0,
00064 unsigned long maxPreviewImageX=0,
00065 unsigned long maxPreviewImageY=0);
00066
00068 virtual ~DVPresentationState();
00069
00074 void clear();
00075
00086 OFCondition read(DcmItem &dset);
00087
00114 OFCondition createFromImage(DcmItem &dset,
00115 DVPSoverlayActivation overlayActivation = DVPSO_copyOverlays,
00116 DVPSVOIActivation voiActivation = DVPSV_preferVOILUT,
00117 OFBool curveActivation = OFTrue,
00118 OFBool shutterActivation = OFTrue,
00119 OFBool presentationActivation = OFTrue,
00120 DVPSGraphicLayering layering = DVPSG_twoLayers,
00121 const char * aetitle = NULL,
00122 const char * filesetID = NULL,
00123 const char * filesetUID = NULL);
00124
00134 OFCondition addImageReferenceAttached(
00135 const char *aetitle=NULL,
00136 const char *filesetID=NULL,
00137 const char *filesetUID=NULL);
00138
00142 OFCondition removeImageReferenceAttached();
00143
00150 OFCondition setCurrentPresentationLUT(DVPSPresentationLUTType newType);
00151
00158 OFCondition setDefaultPresentationLUTShape();
00159
00172 OFCondition setPresentationLookupTable(
00173 DcmUnsignedShort& lutDescriptor,
00174 DcmUnsignedShort& lutData,
00175 DcmLongString& lutExplanation);
00176
00187 OFCondition setPresentationLookupTable(DcmItem &dset);
00188
00196 OFCondition writePresentationLUTforPrint(DcmItem &dset);
00197
00203 OFBool isMonochrome1Image() { return currentImageMonochrome1; }
00204
00208 OFBool haveActiveVOIWindow();
00209
00213 OFBool haveActiveVOILUT();
00214
00219 const char *getCurrentVOIDescription();
00220
00226 OFCondition getCurrentWindowWidth(double &w);
00227
00233 OFCondition getCurrentWindowCenter(double &c);
00234
00237 size_t getNumberOfVOILUTsInImage();
00238
00241 size_t getNumberOfVOIWindowsInImage();
00242
00249 const char *getDescriptionOfVOILUTsInImage(size_t idx);
00250
00257 const char *getDescriptionOfVOIWindowsInImage(size_t idx);
00258
00265 OFCondition setVOILUTFromImage(size_t idx,
00266 DVPSObjectApplicability applicability=DVPSB_currentImage);
00267
00274 OFCondition setVOIWindowFromImage(size_t idx,
00275 DVPSObjectApplicability applicability=DVPSB_currentImage);
00276
00285 OFCondition setVOIWindow(double wCenter, double wWidth, const char *description=NULL,
00286 DVPSObjectApplicability applicability=DVPSB_currentImage);
00287
00300 OFCondition setVOILUT(
00301 DcmUnsignedShort& lutDescriptor,
00302 DcmUnsignedShort& lutData,
00303 DcmLongString& lutExplanation,
00304 DVPSObjectApplicability applicability=DVPSB_currentImage);
00305
00311 void deactivateVOI(DVPSObjectApplicability applicability=DVPSB_currentImage);
00312
00325 OFCondition setGammaVOILUT(double gammaValue, DVPSObjectApplicability applicability=DVPSB_currentImage);
00326
00331 DVPSPresentationSizeMode getDisplayedAreaPresentationSizeMode();
00332
00339 double getDisplayedAreaPresentationPixelAspectRatio();
00340
00350 OFCondition getStandardDisplayedArea(Sint32& tlhcX, Sint32& tlhcY, Sint32& brhcX, Sint32& brhcY);
00351
00361 OFCondition getImageRelativeDisplayedArea(Sint32& tlhcX, Sint32& tlhcY, Sint32& brhcX, Sint32& brhcY);
00362
00368 OFCondition getDisplayedAreaPresentationPixelSpacing(double& x, double& y);
00369
00374 OFCondition getDisplayedAreaPresentationPixelMagnificationRatio(double& magnification);
00375
00380 OFBool canUseDisplayedAreaTrueSize();
00381
00399 OFCondition setStandardDisplayedArea(
00400 DVPSPresentationSizeMode sizeMode,
00401 Sint32 tlhcX, Sint32 tlhcY,
00402 Sint32 brhcX, Sint32 brhcY,
00403 double magnification=1.0,
00404 DVPSObjectApplicability applicability=DVPSB_currentImage);
00405
00424 OFCondition setImageRelativeDisplayedArea(
00425 DVPSPresentationSizeMode sizeMode,
00426 Sint32 tlhcX, Sint32 tlhcY,
00427 Sint32 brhcX, Sint32 brhcY,
00428 double magnification=1.0,
00429 DVPSObjectApplicability applicability=DVPSB_currentImage);
00430
00435 void removeShutter(DVPSShutterType type);
00436
00447 OFCondition setRectShutter(Sint32 lv, Sint32 rv, Sint32 uh, Sint32 lh);
00457 OFCondition setCircularShutter(Sint32 centerX, Sint32 centerY, Sint32 radius);
00458
00470 OFCondition addPolyShutterVertex(Sint32 x, Sint32 y);
00471
00477 OFCondition removeGraphicLayer(size_t idx);
00478
00486 size_t getNumberOfTextObjects(size_t layer);
00487
00497 DVPSTextObject *getTextObject(size_t layer, size_t idx);
00498
00508 DVPSTextObject *addTextObject(size_t layer,
00509 DVPSObjectApplicability applicability=DVPSB_allImages);
00510
00519 OFCondition removeTextObject(size_t layer, size_t idx);
00520
00534 OFCondition moveTextObject(size_t old_layer, size_t idx, size_t new_layer,
00535 DVPSObjectApplicability applicability=DVPSB_allImages);
00536
00544 size_t getNumberOfGraphicObjects(size_t layer);
00545
00555 DVPSGraphicObject *getGraphicObject(size_t layer, size_t idx);
00556
00566 DVPSGraphicObject *addGraphicObject(size_t layer,
00567 DVPSObjectApplicability applicability=DVPSB_allImages);
00568
00577 OFCondition removeGraphicObject(size_t layer, size_t idx);
00578
00592 OFCondition moveGraphicObject(size_t old_layer, size_t idx, size_t new_layer,
00593 DVPSObjectApplicability applicability=DVPSB_allImages);
00594
00602 DVPSCurve *getCurve(size_t layer, size_t idx);
00603
00608 size_t getNumberOfCurvesInImage();
00609
00616 DVPSCurve *getCurveInImage(size_t idx);
00617
00626 OFCondition addCurve(size_t layer, size_t curveidxinimage);
00627
00633 const char *getActiveOverlayLabel(size_t layer, size_t idx);
00634
00640 const char *getActiveOverlayDescription(size_t layer, size_t idx);
00641
00648 OFBool activeOverlayIsROI(size_t layer, size_t idx);
00649
00671 OFCondition getOverlayData(
00672 size_t layer,
00673 size_t idx,
00674 const void *&overlayData,
00675 unsigned int &width,
00676 unsigned int &height,
00677 unsigned int &left_pos,
00678 unsigned int &top_pos,
00679 OFBool &isROI,
00680 Uint16 &fore,
00681 unsigned int bits = 8);
00682
00689 size_t getNumberOfOverlaysInImage();
00690
00695 Uint16 getOverlayInImageGroup(size_t idx);
00696
00701 const char *getOverlayInImageLabel(size_t idx);
00702
00707 const char *getOverlayInImageDescription(size_t idx);
00708
00715 size_t getOverlayInImageActivationLayer(size_t idx);
00716
00722 OFBool overlayInImageIsROI(size_t idx);
00723
00731 OFCondition removeOverlayFromPresentationState(size_t idx);
00732
00743 OFCondition changeOverlayGroupInPresentationState(size_t idx, Uint16 newGroup=0);
00744
00760 OFCondition addOverlayToPresentationState(DcmItem& overlayIOD, Uint16 groupInItem, Uint16 newGroup=0);
00761
00770 OFBool overlayIsSuitableAsBitmapShutter(size_t idx);
00771
00780 OFCondition activateOverlayInImage(size_t layer, size_t idx);
00781
00791 OFCondition activateOverlayInPresentationState(size_t layer, size_t idx);
00792
00800 OFCondition activateOverlayAsBitmapShutter(size_t idx);
00801
00810 OFCondition deactivateOverlay(size_t layer, size_t idx);
00811
00824 OFCondition attachImage(DcmDataset *dataset, OFBool transferOwnership);
00825
00838 OFCondition attachImage(DcmFileFormat *fileformat, OFBool transferOwnership);
00839
00842 void detachImage();
00843
00847 OFBool isInverse();
00848
00853 OFCondition invertImage();
00854
00873 OFCondition getPixelData(
00874 const void *&pixelData,
00875 unsigned long &width,
00876 unsigned long &height);
00877
00886 OFCondition getPixelData(
00887 void *pixelData,
00888 unsigned long size);
00889
00893 const char *getAttachedImageSOPClassUID();
00894
00898 const char *getAttachedImageSOPInstanceUID();
00899
00908 OFCondition getImageWidth(unsigned long &width);
00909
00918 OFCondition getImageHeight(unsigned long &height);
00919
00924 unsigned long getPrintBitmapSize();
00925
00933 OFCondition setMinimumPrintBitmapWidthHeight(unsigned long width,
00934 unsigned long height);
00935
00943 OFCondition setMaximumPrintBitmapWidthHeight(unsigned long width,
00944 unsigned long height);
00945
00953 OFCondition getPrintBitmapWidthHeight(unsigned long &width,
00954 unsigned long &height);
00955
00962 OFCondition getPrintBitmapWidth(unsigned long &width);
00963
00970 OFCondition getPrintBitmapHeight(unsigned long &height);
00971
00977 double getPrintBitmapPixelAspectRatio();
00978
00987 OFCondition getPrintBitmapRequestedImageSize(OFString& requestedImageSize);
00988
00999 OFCondition getPrintBitmap(void *bitmap,
01000 unsigned long size,
01001 OFBool inversePLUT = OFFalse);
01002
01016 OFCondition createPreviewImage(unsigned long maxWidth,
01017 unsigned long maxHeight,
01018 OFBool clipMode = OFFalse);
01019
01022 void deletePreviewImage();
01023
01028 unsigned long getPreviewImageSize();
01029
01035 OFCondition getPreviewImageWidthHeight(unsigned long &width,
01036 unsigned long &height);
01037
01042 OFCondition getPreviewImageWidth(unsigned long &width);
01043
01048 OFCondition getPreviewImageHeight(unsigned long &height);
01049
01056 OFCondition getPreviewImageBitmap(void *bitmap,
01057 unsigned long size);
01058
01069 OFCondition getImageMinMaxPixelRange(double &minValue, double& maxValue);
01070
01081 OFCondition getImageMinMaxPixelValue(double &minValue, double& maxValue);
01082
01089 OFCondition getImageNumberOfFrames(unsigned long &frames);
01090
01098 OFCondition selectImageFrameNumber(unsigned long frame);
01099
01103 unsigned long getSelectedImageFrameNumber();
01104
01111 DVPSDisplayTransform getDisplayTransform() { return displayTransform; }
01112
01118 void setDisplayTransform(DVPSDisplayTransform transform) { displayTransform = transform; }
01119
01129 Uint16 convertPValueToDDL(Uint16 pvalue, unsigned int bits = 8);
01130
01138 OFCondition writeHardcopyImageAttributes(DcmItem &dset);
01139
01143 const char *getCurrentImageModality();
01144
01153 Uint16 findOverlayGroup(Uint16 currentGroup=0);
01154
01163 void renderPixelData(OFBool display = OFTrue);
01164
01170 DVPSDisplayedArea *getDisplayedAreaSelection();
01171
01176 DVPSSoftcopyVOI *getCurrentSoftcopyVOI();
01177
01178 private:
01179
01187 static OFCondition activateOverlayHelper(
01188 DVPSOverlay& ovl,
01189 DicomImage &image,
01190 OFBool asShutter = OFFalse,
01191 Uint16 pvalue = 0);
01192
01193
01194
01198 DcmDataset *currentImageDataset;
01203 DcmFileFormat *currentImageFileformat;
01207 DicomImage *currentImage;
01211 DicomImage *previewImage;
01214 unsigned long currentImageWidth;
01217 unsigned long currentImageHeight;
01220 unsigned long renderedImageWidth;
01223 unsigned long renderedImageHeight;
01226 signed long renderedImageTop;
01230 signed long renderedImageLeft;
01234 signed long renderedImageBottom;
01237 signed long renderedImageRight;
01240 char *currentImageSOPClassUID;
01243 char *currentImageSOPInstanceUID;
01247 unsigned long currentImageSelectedFrame;
01253 OFBool currentImageOwned;
01257 OFBool currentImageVOIValid;
01261 OFBool currentImagePLUTValid;
01264 OFBool currentImageFlip;
01267 DVPSRotationType currentImageRotation;
01272 int currentImageOverlaysValid;
01273
01276 DVPSCurve_PList currentImageCurveList;
01279 DVPSVOILUT_PList currentImageVOILUTList;
01282 DVPSVOIWindow_PList currentImageVOIWindowList;
01283
01286 DcmCodeString currentImageModality;
01287
01290 OFBool currentImageMonochrome1;
01291
01295 DVPSDisplayTransform displayTransform;
01296
01299 OFBool imageInverse;
01300
01303 DiDisplayFunction **displayFunction;
01304
01307 unsigned long minimumPrintBitmapWidth;
01308
01311 unsigned long minimumPrintBitmapHeight;
01312
01315 unsigned long maximumPrintBitmapWidth;
01316
01319 unsigned long maximumPrintBitmapHeight;
01320
01323 unsigned long maximumPreviewImageWidth;
01324
01327 unsigned long maximumPreviewImageHeight;
01328
01329 };
01330
01331 #endif
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362
01363
01364
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446
01447
01448
01449
01450
01451
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515