00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
#ifndef __DVPSTAT_H__
00035
#define __DVPSTAT_H__
00036
00037
#include "osconfig.h"
00038
#include "dcmpstat.h"
00039
00040
class DicomImage;
00041
class DiDisplayFunction;
00042
00047 class DVPresentationState:
public DcmPresentationState
00048 {
00049
public:
00062
DVPresentationState(
00063
DiDisplayFunction **dispFunction=NULL,
00064
unsigned long minPrintBitmapX=0,
00065
unsigned long minPrintBitmapY=0,
00066
unsigned long maxPrintBitmapX=0,
00067
unsigned long maxPrintBitmapY=0,
00068
unsigned long maxPreviewImageX=0,
00069
unsigned long maxPreviewImageY=0);
00070
00072
virtual ~DVPresentationState();
00073
00078
void clear();
00079
00090
OFCondition read(
DcmItem &dset);
00091
00118
OFCondition createFromImage(
DcmItem &dset,
00119 DVPSoverlayActivation overlayActivation = DVPSO_copyOverlays,
00120 DVPSVOIActivation voiActivation = DVPSV_preferVOILUT,
00121 OFBool curveActivation = OFTrue,
00122 OFBool shutterActivation = OFTrue,
00123 OFBool presentationActivation = OFTrue,
00124 DVPSGraphicLayering layering = DVPSG_twoLayers,
00125
const char * aetitle = NULL,
00126
const char * filesetID = NULL,
00127
const char * filesetUID = NULL);
00128
00138
OFCondition addImageReferenceAttached(
00139
const char *aetitle=NULL,
00140
const char *filesetID=NULL,
00141
const char *filesetUID=NULL);
00142
00146
OFCondition removeImageReferenceAttached();
00147
00154
OFCondition setCurrentPresentationLUT(DVPSPresentationLUTType newType);
00155
00162
OFCondition setDefaultPresentationLUTShape();
00163
00176
OFCondition setPresentationLookupTable(
00177
DcmUnsignedShort& lutDescriptor,
00178
DcmUnsignedShort& lutData,
00179
DcmLongString& lutExplanation);
00180
00191
OFCondition setPresentationLookupTable(
DcmItem &dset);
00192
00200
OFCondition writePresentationLUTforPrint(
DcmItem &dset);
00201
00207 OFBool
isMonochrome1Image() {
return currentImageMonochrome1; }
00208
00212 OFBool
haveActiveVOIWindow();
00213
00217 OFBool
haveActiveVOILUT();
00218
00223
const char *
getCurrentVOIDescription();
00224
00230
OFCondition getCurrentWindowWidth(
double &w);
00231
00237
OFCondition getCurrentWindowCenter(
double &c);
00238
00241 size_t
getNumberOfVOILUTsInImage();
00242
00245 size_t
getNumberOfVOIWindowsInImage();
00246
00253
const char *
getDescriptionOfVOILUTsInImage(size_t idx);
00254
00261
const char *
getDescriptionOfVOIWindowsInImage(size_t idx);
00262
00269
OFCondition setVOILUTFromImage(size_t idx,
00270 DVPSObjectApplicability applicability=DVPSB_currentImage);
00271
00278
OFCondition setVOIWindowFromImage(size_t idx,
00279 DVPSObjectApplicability applicability=DVPSB_currentImage);
00280
00289
OFCondition setVOIWindow(
double wCenter,
double wWidth,
const char *description=NULL,
00290 DVPSObjectApplicability applicability=DVPSB_currentImage);
00291
00304
OFCondition setVOILUT(
00305
DcmUnsignedShort& lutDescriptor,
00306
DcmUnsignedShort& lutData,
00307
DcmLongString& lutExplanation,
00308 DVPSObjectApplicability applicability=DVPSB_currentImage);
00309
00315
void deactivateVOI(DVPSObjectApplicability applicability=DVPSB_currentImage);
00316
00329
OFCondition setGammaVOILUT(
double gammaValue, DVPSObjectApplicability applicability=DVPSB_currentImage);
00330
00335 DVPSPresentationSizeMode
getDisplayedAreaPresentationSizeMode();
00336
00343
double getDisplayedAreaPresentationPixelAspectRatio();
00344
00354
OFCondition getStandardDisplayedArea(Sint32& tlhcX, Sint32& tlhcY, Sint32& brhcX, Sint32& brhcY);
00355
00365
OFCondition getImageRelativeDisplayedArea(Sint32& tlhcX, Sint32& tlhcY, Sint32& brhcX, Sint32& brhcY);
00366
00372
OFCondition getDisplayedAreaPresentationPixelSpacing(
double& x,
double& y);
00373
00378
OFCondition getDisplayedAreaPresentationPixelMagnificationRatio(
double& magnification);
00379
00384 OFBool
canUseDisplayedAreaTrueSize();
00385
00403
OFCondition setStandardDisplayedArea(
00404 DVPSPresentationSizeMode sizeMode,
00405 Sint32 tlhcX, Sint32 tlhcY,
00406 Sint32 brhcX, Sint32 brhcY,
00407
double magnification=1.0,
00408 DVPSObjectApplicability applicability=DVPSB_currentImage);
00409
00428
OFCondition setImageRelativeDisplayedArea(
00429 DVPSPresentationSizeMode sizeMode,
00430 Sint32 tlhcX, Sint32 tlhcY,
00431 Sint32 brhcX, Sint32 brhcY,
00432
double magnification=1.0,
00433 DVPSObjectApplicability applicability=DVPSB_currentImage);
00434
00439
void removeShutter(DVPSShutterType type);
00440
00451
OFCondition setRectShutter(Sint32 lv, Sint32 rv, Sint32 uh, Sint32 lh);
00461
OFCondition setCircularShutter(Sint32 centerX, Sint32 centerY, Sint32 radius);
00462
00474
OFCondition addPolyShutterVertex(Sint32 x, Sint32 y);
00475
00481
OFCondition removeGraphicLayer(size_t idx);
00482
00490 size_t
getNumberOfTextObjects(size_t layer);
00491
00501
DVPSTextObject *
getTextObject(size_t layer, size_t idx);
00502
00512
DVPSTextObject *
addTextObject(size_t layer,
00513 DVPSObjectApplicability applicability=DVPSB_allImages);
00514
00523
OFCondition removeTextObject(size_t layer, size_t idx);
00524
00538
OFCondition moveTextObject(size_t old_layer, size_t idx, size_t new_layer,
00539 DVPSObjectApplicability applicability=DVPSB_allImages);
00540
00548 size_t
getNumberOfGraphicObjects(size_t layer);
00549
00559
DVPSGraphicObject *
getGraphicObject(size_t layer, size_t idx);
00560
00570
DVPSGraphicObject *
addGraphicObject(size_t layer,
00571 DVPSObjectApplicability applicability=DVPSB_allImages);
00572
00581
OFCondition removeGraphicObject(size_t layer, size_t idx);
00582
00596
OFCondition moveGraphicObject(size_t old_layer, size_t idx, size_t new_layer,
00597 DVPSObjectApplicability applicability=DVPSB_allImages);
00598
00606
DVPSCurve *
getCurve(size_t layer, size_t idx);
00607
00612 size_t
getNumberOfCurvesInImage();
00613
00620
DVPSCurve *
getCurveInImage(size_t idx);
00621
00630
OFCondition addCurve(size_t layer, size_t curveidxinimage);
00631
00637
const char *
getActiveOverlayLabel(size_t layer, size_t idx);
00638
00644
const char *
getActiveOverlayDescription(size_t layer, size_t idx);
00645
00652 OFBool
activeOverlayIsROI(size_t layer, size_t idx);
00653
00675
OFCondition getOverlayData(
00676 size_t layer,
00677 size_t idx,
00678
const void *&overlayData,
00679
unsigned int &width,
00680
unsigned int &height,
00681
unsigned int &left_pos,
00682
unsigned int &top_pos,
00683 OFBool &isROI,
00684 Uint16 &fore,
00685
unsigned int bits = 8);
00686
00693 size_t
getNumberOfOverlaysInImage();
00694
00699 Uint16
getOverlayInImageGroup(size_t idx);
00700
00705
const char *
getOverlayInImageLabel(size_t idx);
00706
00711
const char *
getOverlayInImageDescription(size_t idx);
00712
00719 size_t
getOverlayInImageActivationLayer(size_t idx);
00720
00726 OFBool
overlayInImageIsROI(size_t idx);
00727
00735
OFCondition removeOverlayFromPresentationState(size_t idx);
00736
00747
OFCondition changeOverlayGroupInPresentationState(size_t idx, Uint16 newGroup=0);
00748
00764
OFCondition addOverlayToPresentationState(
DcmItem& overlayIOD, Uint16 groupInItem, Uint16 newGroup=0);
00765
00774 OFBool
overlayIsSuitableAsBitmapShutter(size_t idx);
00775
00784
OFCondition activateOverlayInImage(size_t layer, size_t idx);
00785
00795
OFCondition activateOverlayInPresentationState(size_t layer, size_t idx);
00796
00804
OFCondition activateOverlayAsBitmapShutter(size_t idx);
00805
00814
OFCondition deactivateOverlay(size_t layer, size_t idx);
00815
00828
OFCondition attachImage(
DcmDataset *dataset, OFBool transferOwnership);
00829
00842
OFCondition attachImage(
DcmFileFormat *fileformat, OFBool transferOwnership);
00843
00846
void detachImage();
00847
00851 OFBool
isInverse();
00852
00857
OFCondition invertImage();
00858
00877
OFCondition getPixelData(
00878
const void *&pixelData,
00879
unsigned long &width,
00880
unsigned long &height);
00881
00890
OFCondition getPixelData(
00891
void *pixelData,
00892
unsigned long size);
00893
00897
const char *
getAttachedImageSOPClassUID();
00898
00902
const char *
getAttachedImageSOPInstanceUID();
00903
00912
OFCondition getImageWidth(
unsigned long &width);
00913
00922
OFCondition getImageHeight(
unsigned long &height);
00923
00928
unsigned long getPrintBitmapSize();
00929
00937
OFCondition setMinimumPrintBitmapWidthHeight(
unsigned long width,
00938
unsigned long height);
00939
00947
OFCondition setMaximumPrintBitmapWidthHeight(
unsigned long width,
00948
unsigned long height);
00949
00957
OFCondition getPrintBitmapWidthHeight(
unsigned long &width,
00958
unsigned long &height);
00959
00966
OFCondition getPrintBitmapWidth(
unsigned long &width);
00967
00974
OFCondition getPrintBitmapHeight(
unsigned long &height);
00975
00981
double getPrintBitmapPixelAspectRatio();
00982
00991
OFCondition getPrintBitmapRequestedImageSize(
OFString& requestedImageSize);
00992
01003
OFCondition getPrintBitmap(
void *bitmap,
01004
unsigned long size,
01005 OFBool inversePLUT = OFFalse);
01006
01020
OFCondition createPreviewImage(
unsigned long maxWidth,
01021
unsigned long maxHeight,
01022 OFBool clipMode = OFFalse);
01023
01026
void deletePreviewImage();
01027
01032
unsigned long getPreviewImageSize();
01033
01039
OFCondition getPreviewImageWidthHeight(
unsigned long &width,
01040
unsigned long &height);
01041
01046
OFCondition getPreviewImageWidth(
unsigned long &width);
01047
01052
OFCondition getPreviewImageHeight(
unsigned long &height);
01053
01060
OFCondition getPreviewImageBitmap(
void *bitmap,
01061
unsigned long size);
01062
01073
OFCondition getImageMinMaxPixelRange(
double &minValue,
double& maxValue);
01074
01085
OFCondition getImageMinMaxPixelValue(
double &minValue,
double& maxValue);
01086
01093
OFCondition getImageNumberOfFrames(
unsigned long &frames);
01094
01102
OFCondition selectImageFrameNumber(
unsigned long frame);
01103
01107
unsigned long getSelectedImageFrameNumber();
01108
01115 DVPSDisplayTransform
getDisplayTransform() {
return displayTransform; }
01116
01122 void setDisplayTransform(DVPSDisplayTransform transform) {
displayTransform = transform; }
01123
01133 Uint16
convertPValueToDDL(Uint16 pvalue,
unsigned int bits = 8);
01134
01142
OFCondition writeHardcopyImageAttributes(
DcmItem &dset);
01143
01147
const char *
getCurrentImageModality();
01148
01157 Uint16
findOverlayGroup(Uint16 currentGroup=0);
01158
01167
void renderPixelData(OFBool display = OFTrue);
01168
01174
DVPSDisplayedArea *
getDisplayedAreaSelection();
01175
01180
DVPSSoftcopyVOI *
getCurrentSoftcopyVOI();
01181
01187
void setLog(
OFConsole *stream, OFBool verbMode, OFBool dbgMode);
01188
01189
private:
01190
01198
static OFCondition activateOverlayHelper(
01199
DVPSOverlay& ovl,
01200
DicomImage &image,
01201 OFBool asShutter = OFFalse,
01202 Uint16 pvalue = 0);
01203
01204
01205
01209 DcmDataset *
currentImageDataset;
01214 DcmFileFormat *
currentImageFileformat;
01218 DicomImage *
currentImage;
01222 DicomImage *
previewImage;
01225 unsigned long currentImageWidth;
01228 unsigned long currentImageHeight;
01231 unsigned long renderedImageWidth;
01234 unsigned long renderedImageHeight;
01237 signed long renderedImageTop;
01241 signed long renderedImageLeft;
01245 signed long renderedImageBottom;
01248 signed long renderedImageRight;
01251 char *
currentImageSOPClassUID;
01254 char *
currentImageSOPInstanceUID;
01258 unsigned long currentImageSelectedFrame;
01264 OFBool
currentImageOwned;
01268 OFBool
currentImageVOIValid;
01272 OFBool
currentImagePLUTValid;
01275 OFBool
currentImageFlip;
01278 DVPSRotationType
currentImageRotation;
01283 int currentImageOverlaysValid;
01284
01287 DVPSCurve_PList currentImageCurveList;
01290 DVPSVOILUT_PList currentImageVOILUTList;
01293 DVPSVOIWindow_PList currentImageVOIWindowList;
01294
01297 DcmCodeString currentImageModality;
01298
01301 OFBool
currentImageMonochrome1;
01302
01306 DVPSDisplayTransform
displayTransform;
01307
01310 OFBool
imageInverse;
01311
01314 DiDisplayFunction **
displayFunction;
01315
01318 unsigned long minimumPrintBitmapWidth;
01319
01322 unsigned long minimumPrintBitmapHeight;
01323
01326 unsigned long maximumPrintBitmapWidth;
01327
01330 unsigned long maximumPrintBitmapHeight;
01331
01334 unsigned long maximumPreviewImageWidth;
01335
01338 unsigned long maximumPreviewImageHeight;
01339
01340 };
01341
01342
#endif
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