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 DCMIMAGE_H
00031 #define DCMIMAGE_H
00032
00033 #include "dcmtk/config/osconfig.h"
00034
00035 #include "dcmtk/ofstd/ofcast.h"
00036
00037 #include "dcmtk/dcmimgle/dimoimg.h"
00038 #include "dcmtk/dcmimgle/didispfn.h"
00039 #include "dcmtk/dcmimgle/diutils.h"
00040
00041
00042
00043
00044
00045
00046 class DcmXfer;
00047 class DcmObject;
00048 class DcmOverlayData;
00049 class DcmLongString;
00050 class DcmUnsignedShort;
00051
00052 class DiPixel;
00053 class DiDocument;
00054 class DiPluginFormat;
00055
00056
00057
00058
00059
00060
00064 class DicomImage
00065 {
00066
00067 public:
00068
00069
00070
00081 DicomImage(const char *filename,
00082 const unsigned long flags = 0,
00083 const unsigned long fstart = 0,
00084 const unsigned long fcount = 0);
00085
00086 #ifndef STARVIEW
00087
00099 DicomImage(DcmObject *object,
00100 const E_TransferSyntax xfer,
00101 const unsigned long flags = 0,
00102 const unsigned long fstart = 0,
00103 const unsigned long fcount = 0);
00104
00121 DicomImage(DcmObject *object,
00122 const E_TransferSyntax xfer,
00123 const double slope,
00124 const double intercept,
00125 const unsigned long flags = 0,
00126 const unsigned long fstart = 0,
00127 const unsigned long fcount = 0);
00128
00146 DicomImage(DcmObject *object,
00147 E_TransferSyntax xfer,
00148 const DcmUnsignedShort &data,
00149 const DcmUnsignedShort &descriptor,
00150 const DcmLongString *explanation = NULL,
00151 const unsigned long flags = 0,
00152 const unsigned long fstart = 0,
00153 const unsigned long fcount = 0);
00154 #endif
00155
00158 virtual ~DicomImage();
00159
00160
00161
00162
00177 inline int processNextFrames(const unsigned long fcount = 0)
00178 {
00179 return (Image != NULL) ?
00180 Image->processNextFrames(fcount) : 0;
00181 }
00182
00183
00184
00185
00192 static const char *getString(const EI_Status status);
00193
00200 static const char *getString(const EP_Interpretation interpret);
00201
00206 inline EI_Status getStatus() const
00207 {
00208 return (Image != NULL) ?
00209 Image->getStatus() : ImageStatus;
00210 }
00211
00219 inline unsigned long getFrameCount() const
00220 {
00221 return (Image != NULL) ?
00222 Image->getNumberOfFrames() : 0;
00223 }
00224
00231 inline unsigned long getFirstFrame() const
00232 {
00233 return (Image != NULL) ?
00234 Image->getFirstFrame() : 0;
00235 }
00236
00242 inline unsigned long getRepresentativeFrame() const
00243 {
00244 return (Image != NULL) ?
00245 Image->getRepresentativeFrame() : 0;
00246 }
00247
00252 inline unsigned long getWidth() const
00253 {
00254 return (Image != NULL) ?
00255 Image->getColumns() : 0;
00256 }
00257
00262 inline unsigned long getHeight() const
00263 {
00264 return (Image != NULL) ?
00265 Image->getRows() : 0;
00266 }
00267
00272 inline int getDepth() const
00273 {
00274 return (Image != NULL) ?
00275 Image->getBits() : 0;
00276 }
00277
00291 inline int getMinMaxValues(double &min,
00292 double &max,
00293 const int mode = 0) const
00294 {
00295 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00296 Image->getMonoImagePtr()->getMinMaxValues(min, max, mode) : 0;
00297 }
00298
00305 inline double getWidthHeightRatio() const
00306 {
00307 return (Image != NULL) ?
00308 Image->getColumnRowRatio() : 0;
00309 }
00310
00318 inline double getHeightWidthRatio() const
00319 {
00320 return (Image != NULL) ?
00321 Image->getRowColumnRatio() : 0;
00322 }
00323
00330 inline int setWidthHeightRatio(const double ratio) const
00331 {
00332 return (Image != NULL) ?
00333 Image->setColumnRowRatio(ratio) : 0;
00334 }
00335
00342 inline int setHeightWidthRatio(const double ratio) const
00343 {
00344 return (Image != NULL) ?
00345 Image->setRowColumnRatio(ratio) : 0;
00346 }
00347
00354 inline int isOutputValueUnused(const unsigned long value)
00355 {
00356 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00357 Image->getMonoImagePtr()->isValueUnused(value) : 0;
00358 }
00359
00360
00361
00373 inline unsigned long getOutputDataSize(const int bits = 0) const
00374 {
00375 return (Image != NULL) ?
00376 Image->getOutputDataSize(Image->getBits(bits)) : 0;
00377 }
00378
00397 inline const void *getOutputData(const int bits = 0,
00398 const unsigned long frame = 0,
00399 const int planar = 0)
00400 {
00401 return (Image != NULL) ?
00402 Image->getOutputData(frame, Image->getBits(bits), planar) : NULL;
00403 }
00404
00423 inline int getOutputData(void *buffer,
00424 const unsigned long size,
00425 const int bits = 0,
00426 const unsigned long frame = 0,
00427 const int planar = 0)
00428 {
00429 return (Image != NULL) ?
00430 Image->getOutputData(buffer, size, frame, Image->getBits(bits), planar) : 0;
00431 }
00432
00444 inline const void *getOutputPlane(const int plane) const
00445 {
00446 return (Image != NULL) ?
00447 Image->getOutputPlane(plane) : NULL;
00448 }
00449
00453 inline void deleteOutputData() const
00454 {
00455 if (Image != NULL)
00456 Image->deleteOutputData();
00457 }
00458
00459
00460
00465 inline int isMonochrome() const
00466 {
00467 return (PhotometricInterpretation == EPI_Monochrome1) || (PhotometricInterpretation == EPI_Monochrome2);
00468 }
00469
00474 inline EP_Interpretation getPhotometricInterpretation() const
00475 {
00476 return PhotometricInterpretation;
00477 }
00478
00483 int hasSOPclassUID(const char *uid) const;
00484
00496 inline const DiPixel *getInterData() const
00497 {
00498 return (Image != NULL) ?
00499 Image->getInterData() : NULL;
00500 }
00501
00502
00503
00504
00509 inline DiDisplayFunction *getDisplayFunction() const
00510 {
00511 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00512 Image->getMonoImagePtr()->getDisplayFunction() : OFstatic_cast(DiDisplayFunction *, NULL);
00513 }
00514
00521 inline int setDisplayFunction(DiDisplayFunction *display)
00522 {
00523 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00524 Image->getMonoImagePtr()->setDisplayFunction(display) : 0;
00525 }
00526
00534 inline int setNoDisplayFunction()
00535 {
00536 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00537 Image->getMonoImagePtr()->setNoDisplayFunction() : 0;
00538 }
00539
00546 inline int deleteDisplayLUT(const int bits = 0)
00547 {
00548 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00549 Image->getMonoImagePtr()->deleteDisplayLUT(bits) : 0;
00550 }
00551
00563 inline int convertPValueToDDL(const Uint16 pvalue,
00564 Uint16 &ddl,
00565 const int bits = 8)
00566 {
00567 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00568 Image->getMonoImagePtr()->convertPValueToDDL(pvalue, ddl, bits) : 0;
00569 }
00570
00571
00572
00573
00581 inline int setNoVoiTransformation()
00582 {
00583 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00584 Image->getMonoImagePtr()->setNoVoiTransformation() : 0;
00585 }
00586
00598 inline int setMinMaxWindow(const int idx = 0)
00599 {
00600 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00601 Image->getMonoImagePtr()->setMinMaxWindow(idx) : 0;
00602 }
00603
00612 inline int setHistogramWindow(const double thresh = 0.05)
00613 {
00614 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00615 Image->getMonoImagePtr()->setHistogramWindow(thresh) : 0;
00616 }
00617
00634 inline int setRoiWindow(const unsigned long left_pos,
00635 const unsigned long top_pos,
00636 const unsigned long width,
00637 const unsigned long height,
00638 const unsigned long frame = 0)
00639 {
00640 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00641 Image->getMonoImagePtr()->setRoiWindow(left_pos, top_pos, width, height, frame) : 0;
00642 }
00643
00652 inline int setWindow(const unsigned long window)
00653 {
00654 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00655 Image->getMonoImagePtr()->setWindow(window) : 0;
00656 }
00657
00668 inline int setWindow(const double center,
00669 const double width)
00670 {
00671 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00672 Image->getMonoImagePtr()->setWindow(center, width) : 0;
00673 }
00674
00682 inline int getWindow(double ¢er,
00683 double &width)
00684 {
00685 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00686 Image->getMonoImagePtr()->getWindow(center, width) : 0;
00687 }
00688
00694 inline unsigned long getWindowCount() const
00695 {
00696 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00697 Image->getMonoImagePtr()->getWindowCount() : 0;
00698 }
00699
00710 inline int setVoiLutFunction(const EF_VoiLutFunction function)
00711 {
00712 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00713 Image->getMonoImagePtr()->setVoiLutFunction(function) : 0;
00714 }
00715
00722 inline EF_VoiLutFunction getVoiLutFunction() const
00723 {
00724 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00725 Image->getMonoImagePtr()->getVoiLutFunction() : EFV_Default;
00726 }
00727
00740 inline int setVoiLut(const DcmUnsignedShort &data,
00741 const DcmUnsignedShort &descriptor,
00742 const DcmLongString *explanation = NULL,
00743 const EL_BitsPerTableEntry descripMode = ELM_UseValue)
00744 {
00745 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00746 Image->getMonoImagePtr()->setVoiLut(data, descriptor, explanation, descripMode) : 0;
00747 }
00748
00758 inline int setVoiLut(const unsigned long table,
00759 const EL_BitsPerTableEntry descripMode = ELM_UseValue)
00760 {
00761 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00762 Image->getMonoImagePtr()->setVoiLut(table, descripMode) : 0;
00763 }
00764
00769 inline unsigned long getVoiLutCount() const
00770 {
00771 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00772 Image->getMonoImagePtr()->getVoiLutCount() : 0;
00773 }
00774
00779 inline const char *getVoiTransformationExplanation() const
00780 {
00781 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00782 Image->getMonoImagePtr()->getVoiTransformationExplanation() : OFstatic_cast(const char *, NULL);
00783 }
00784
00792 inline const char *getVoiWindowExplanation(const unsigned long window,
00793 OFString &explanation) const
00794 {
00795 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00796 Image->getMonoImagePtr()->getVoiWindowExplanation(window, explanation) : OFstatic_cast(const char *, NULL);
00797 }
00798
00806 inline const char *getVoiLutExplanation(const unsigned long table,
00807 OFString &explanation) const
00808 {
00809 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00810 Image->getMonoImagePtr()->getVoiLutExplanation(table, explanation) : OFstatic_cast(const char *, NULL);
00811 }
00812
00817 inline const char *getModalityLutExplanation() const
00818 {
00819 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00820 Image->getMonoImagePtr()->getModalityLutExplanation() : OFstatic_cast(const char *, NULL);
00821 }
00822
00823
00824
00830 inline EP_Polarity getPolarity() const
00831 {
00832 return (Image != NULL) ?
00833 Image->getPolarity() : EPP_Normal;
00834 }
00835
00844 inline int setPolarity(const EP_Polarity polarity)
00845 {
00846 return (Image != NULL) ?
00847 Image->setPolarity(polarity) : 0;
00848 }
00849
00863 inline int setHardcopyParameters(const unsigned int min,
00864 const unsigned int max,
00865 const unsigned int reflect,
00866 const unsigned int illumin)
00867 {
00868 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00869 Image->getMonoImagePtr()->setHardcopyParameters(min, max, reflect, illumin) : 0;
00870 }
00871
00872
00873
00880 inline ES_PresentationLut getPresentationLutShape() const
00881 {
00882 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00883 Image->getMonoImagePtr()->getPresentationLutShape() : ESP_Default;
00884 }
00885
00897 inline int setPresentationLutShape(const ES_PresentationLut shape)
00898 {
00899 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00900 Image->getMonoImagePtr()->setPresentationLutShape(shape) : 0;
00901 }
00902
00915 inline int setPresentationLut(const DcmUnsignedShort &data,
00916 const DcmUnsignedShort &descriptor,
00917 const DcmLongString *explanation = NULL,
00918 const EL_BitsPerTableEntry descripMode = ELM_UseValue)
00919 {
00920 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00921 Image->getMonoImagePtr()->setPresentationLut(data, descriptor, explanation, descripMode) : 0;
00922 }
00923
00928 inline const char *getPresentationLutExplanation() const
00929 {
00930 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00931 Image->getMonoImagePtr()->getPresentationLutExplanation() : OFstatic_cast(const char *, NULL);
00932 }
00933
00944 inline int setInversePresentationLut(const DcmUnsignedShort &data,
00945 const DcmUnsignedShort &descriptor,
00946 const EL_BitsPerTableEntry descripMode = ELM_UseValue)
00947 {
00948 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00949 Image->getMonoImagePtr()->setInversePresentationLut(data, descriptor, descripMode) : 0;
00950 }
00951
00952
00953
00954
00971 inline int addOverlay(const unsigned int group,
00972 const signed int left_pos,
00973 const signed int top_pos,
00974 const unsigned int width,
00975 const unsigned int height,
00976 const DcmOverlayData &data,
00977 const DcmLongString &label,
00978 const DcmLongString &description,
00979 const EM_Overlay mode = EMO_Default)
00980 {
00981 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00982 Image->getMonoImagePtr()->addOverlay(group, left_pos, top_pos, width, height, data, label, description, mode) : 0;
00983 }
00984
00991 inline int removeOverlay(const unsigned int group)
00992 {
00993 return ((Image != NULL) && (Image->getOverlayPtr(1) != NULL)) ?
00994 Image->getOverlayPtr(1)->removePlane(group) : 0;
00995 }
00996
01002 inline int removeAllOverlays()
01003 {
01004 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01005 Image->getMonoImagePtr()->removeAllOverlays() : 0;
01006 }
01007
01016 inline int isOverlayVisible(const unsigned int plane,
01017 const unsigned int idx = 0)
01018 {
01019 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01020 Image->getOverlayPtr(idx)->isPlaneVisible(plane) : 0;
01021 }
01022
01031 inline int showOverlay(const unsigned int plane,
01032 const unsigned int idx = 0)
01033 {
01034 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01035 Image->getOverlayPtr(idx)->showPlane(plane) : 0;
01036 }
01037
01048 inline int showOverlay(const unsigned int plane,
01049 const EM_Overlay mode,
01050 const double fore = 1.0,
01051 const double thresh = 0.5,
01052 const unsigned int idx = 0)
01053 {
01054 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01055 Image->getOverlayPtr(idx)->showPlane(plane, fore, thresh, mode) : 0;
01056 }
01057
01065 inline int showOverlay(const unsigned int plane,
01066 const Uint16 pvalue)
01067 {
01068 return ((Image != NULL) && (Image->getOverlayPtr(1) != NULL)) ?
01069 Image->getOverlayPtr(1)->showPlane(plane, pvalue) : 0;
01070 }
01071
01079 inline int showAllOverlays(const unsigned int idx = 0)
01080 {
01081 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01082 Image->getOverlayPtr(idx)->showAllPlanes() : 0;
01083 }
01084
01095 inline int showAllOverlays(const EM_Overlay mode,
01096 const double fore = 1,
01097 const double thresh = 0.5,
01098 const unsigned int idx = 0)
01099 {
01100 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01101 Image->getOverlayPtr(idx)->showAllPlanes(fore, thresh, mode) : 0;
01102 }
01103
01112 inline int hideOverlay(const unsigned int plane,
01113 const unsigned int idx = 0)
01114 {
01115 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01116 Image->getOverlayPtr(idx)->hidePlane(plane) : 0;
01117 }
01118
01126 inline int hideAllOverlays(const unsigned int idx = 0)
01127 {
01128 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01129 Image->getOverlayPtr(idx)->hideAllPlanes() : 0;
01130 }
01131
01142 inline int placeOverlay(const unsigned int plane,
01143 const signed int left_pos,
01144 const signed int top_pos,
01145 const unsigned int idx = 0)
01146 {
01147 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01148 Image->getOverlayPtr(idx)->placePlane(plane, left_pos, top_pos) : 0;
01149 }
01150
01157 inline unsigned int getOverlayCount(const unsigned int idx = 0) const
01158 {
01159 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01160 Image->getOverlayPtr(idx)->getCount() : 0;
01161 }
01162
01170 inline unsigned int getOverlayGroupNumber(const unsigned int plane,
01171 const unsigned int idx = 0) const
01172 {
01173 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01174 Image->getOverlayPtr(idx)->getPlaneGroupNumber(plane) : 0;
01175 }
01176
01184 inline const char *getOverlayLabel(const unsigned int plane,
01185 const unsigned int idx = 0) const
01186 {
01187 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01188 Image->getOverlayPtr(idx)->getPlaneLabel(plane) : OFstatic_cast(const char *, NULL);
01189 }
01190
01198 inline const char *getOverlayDescription(const unsigned int plane,
01199 const unsigned int idx = 0) const
01200 {
01201 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01202 Image->getOverlayPtr(idx)->getPlaneDescription(plane) : OFstatic_cast(const char *, NULL);
01203 }
01204
01212 inline EM_Overlay getOverlayMode(const unsigned int plane,
01213 const unsigned int idx = 0) const
01214 {
01215 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01216 Image->getOverlayPtr(idx)->getPlaneMode(plane) : EMO_Default;
01217 }
01218
01246 const void *getOverlayData(const unsigned int plane,
01247 unsigned int &left_pos,
01248 unsigned int &top_pos,
01249 unsigned int &width,
01250 unsigned int &height,
01251 EM_Overlay &mode,
01252 const unsigned long frame = 0,
01253 const int bits = 8,
01254 const Uint16 fore = 0xff,
01255 const Uint16 back = 0x0,
01256 const unsigned int idx = 2) const
01257 {
01258 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01259 Image->getMonoImagePtr()->getOverlayData(frame, plane, left_pos, top_pos, width, height, mode, idx, bits, fore, back) : NULL;
01260 }
01261
01282 const void *getFullOverlayData(const unsigned int plane,
01283 unsigned int &width,
01284 unsigned int &height,
01285 const unsigned long frame = 0,
01286 const int bits = 8,
01287 const Uint16 fore = 0xff,
01288 const Uint16 back = 0x0,
01289 const unsigned int idx = 0) const
01290 {
01291 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01292 Image->getMonoImagePtr()->getFullOverlayData(frame, plane, width, height, idx, bits, fore, back) : NULL;
01293 }
01294
01298 inline void deleteOverlayData() const
01299 {
01300 if ((Image != NULL) && (Image->getMonoImagePtr() != NULL))
01301 Image->getMonoImagePtr()->deleteOverlayData();
01302 }
01303
01320 unsigned long create6xxx3000OverlayData(Uint8 *&buffer,
01321 const unsigned int plane,
01322 unsigned int &width,
01323 unsigned int &height,
01324 unsigned long &frames,
01325 const unsigned int idx = 0) const
01326 {
01327 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01328 Image->getMonoImagePtr()->create6xxx3000OverlayData(buffer, plane, width, height, frames, idx) : 0;
01329 }
01330
01331
01332
01333
01342 DicomImage *createDicomImage(unsigned long fstart = 0,
01343 unsigned long fcount = 0) const;
01344
01360 DicomImage *createScaledImage(const unsigned long width,
01361 const unsigned long height = 0,
01362 const int interpolate = 0,
01363 int aspect = 0) const;
01364
01380 DicomImage *createScaledImage(const double xfactor,
01381 const double yfactor = 0,
01382 const int interpolate = 0,
01383 const int aspect = 0) const;
01384
01407 DicomImage *createScaledImage(const signed long left_pos,
01408 const signed long top_pos,
01409 unsigned long clip_width,
01410 unsigned long clip_height,
01411 unsigned long scale_width = 0,
01412 unsigned long scale_height = 0,
01413 const int interpolate = 0,
01414 int aspect = 0,
01415 const Uint16 pvalue = 0) const;
01416
01439 DicomImage *createScaledImage(const signed long left_pos,
01440 const signed long top_pos,
01441 unsigned long width,
01442 unsigned long height,
01443 const double xfactor,
01444 const double yfactor = 0,
01445 const int interpolate = 0,
01446 const int aspect = 0,
01447 const Uint16 pvalue = 0) const;
01448
01461 DicomImage *createClippedImage(const signed long left_pos,
01462 const signed long top_pos,
01463 unsigned long width = 0,
01464 unsigned long height = 0,
01465 const Uint16 pvalue = 0) const;
01466
01476 int flipImage(int horz = 1,
01477 int vert = 0) const;
01478
01487 DicomImage *createFlippedImage(int horz = 1,
01488 int vert = 0) const;
01489
01498 int rotateImage(signed int degree) const;
01499
01507 DicomImage *createRotatedImage(signed int degree) const;
01508
01520 DicomImage *createMonochromeImage(const double red = 0.299,
01521 const double green = 0.587,
01522 const double blue = 0.114) const;
01523
01548 unsigned long createWindowsDIB(void *&data,
01549 const unsigned long size,
01550 const unsigned long frame = 0,
01551 const int bits = 24,
01552 const int upsideDown = 0,
01553 const int padding = 1)
01554 {
01555 return (Image != NULL) ?
01556 Image->createDIB(data, size, frame, bits, upsideDown, padding) : 0;
01557 }
01558
01571 unsigned long createJavaAWTBitmap(void *&data,
01572 const unsigned long frame = 0,
01573 const int bits = 32)
01574 {
01575 return (Image != NULL) ?
01576 Image->createAWTBitmap(data, frame, bits) : 0;
01577 }
01578
01588 static void *create12BitPackedBitmap(const void *buffer,
01589 const unsigned long size,
01590 const unsigned long count)
01591 {
01592 return DiMonoImage::createPackedBitmap(buffer, size, count, 16, 12);
01593 }
01594
01604 DicomImage *createMonoOutputImage(const unsigned long frame,
01605 const int bits);
01606
01607
01608
01636 inline int writeFrameToDataset(DcmItem &dataset,
01637 const int bits = 0,
01638 const unsigned long frame = 0,
01639 const int planar = 0)
01640 {
01641 return (Image != NULL) ?
01642 Image->writeFrameToDataset(dataset, frame, bits, planar) : 0;
01643 }
01644
01673 inline int writeImageToDataset(DcmItem &dataset,
01674 const int mode = 0,
01675 const int planar = 2)
01676 {
01677 return (Image != NULL) ?
01678 Image->writeImageToDataset(dataset, mode, planar) : 0;
01679 }
01680
01694 int writePPM(const char *filename,
01695 const int bits = 0,
01696 const unsigned long frame = 0);
01697
01711 int writePPM(STD_NAMESPACE ostream& stream,
01712 const int bits = 0,
01713 const unsigned long frame = 0);
01714
01728 int writePPM(FILE *stream,
01729 const int bits = 0,
01730 const unsigned long frame = 0);
01731
01745 int writeRawPPM(const char *filename,
01746 const int bits = 0,
01747 const unsigned long frame= 0);
01748
01762 int writeRawPPM(FILE *stream,
01763 const int bits = 0,
01764 const unsigned long frame = 0);
01765
01778 int writeBMP(FILE *stream,
01779 const int bits = 0,
01780 const unsigned long frame = 0);
01781
01794 int writeBMP(const char *filename,
01795 const int bits = 0,
01796 const unsigned long frame = 0);
01797
01807 int writePluginFormat(const DiPluginFormat *plugin,
01808 FILE *stream,
01809 const unsigned long frame = 0);
01810
01820 int writePluginFormat(const DiPluginFormat *plugin,
01821 const char *filename,
01822 const unsigned long frame = 0);
01823
01824
01825 protected:
01826
01833 DicomImage(const DicomImage *dicom,
01834 DiImage *image,
01835 const EP_Interpretation interpret = EPI_Unknown);
01836
01840 void Init();
01841
01846 int checkDataDictionary();
01847
01852 const char *getSOPclassUID() const;
01853
01862 int normalizeDegreeValue(signed int °ree) const;
01863
01864
01865 private:
01866
01868 EI_Status ImageStatus;
01870 EP_Interpretation PhotometricInterpretation;
01871
01873 DiDocument *Document;
01875 DiImage *Image;
01876
01877
01878
01879 DicomImage(const DicomImage &);
01880 DicomImage &operator=(const DicomImage &);
01881 };
01882
01883
01884 #endif
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060
02061
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086
02087
02088
02089
02090
02091
02092
02093
02094
02095
02096
02097
02098
02099
02100
02101
02102
02103
02104
02105
02106
02107
02108
02109
02110
02111
02112
02113
02114
02115
02116
02117
02118
02119
02120
02121
02122
02123
02124
02125
02126
02127
02128
02129
02130
02131
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151
02152
02153
02154
02155
02156
02157
02158
02159
02160
02161
02162
02163
02164
02165
02166
02167
02168