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 DCMIMAGE_H
00035 #define DCMIMAGE_H
00036
00037 #include "dcmtk/config/osconfig.h"
00038
00039 #include "dcmtk/ofstd/ofcast.h"
00040
00041 #include "dcmtk/dcmimgle/dimoimg.h"
00042 #include "dcmtk/dcmimgle/didispfn.h"
00043 #include "dcmtk/dcmimgle/diutils.h"
00044
00045
00046
00047
00048
00049
00050 class DcmXfer;
00051 class DcmObject;
00052 class DcmOverlayData;
00053 class DcmLongString;
00054 class DcmUnsignedShort;
00055
00056 class DiPixel;
00057 class DiDocument;
00058 class DiPluginFormat;
00059
00060
00061
00062
00063
00064
00068 class DicomImage
00069 {
00070
00071 public:
00072
00073
00074
00085 DicomImage(const char *filename,
00086 const unsigned long flags = 0,
00087 const unsigned long fstart = 0,
00088 const unsigned long fcount = 0);
00089
00090 #ifndef STARVIEW
00091
00103 DicomImage(DcmObject *object,
00104 const E_TransferSyntax xfer,
00105 const unsigned long flags = 0,
00106 const unsigned long fstart = 0,
00107 const unsigned long fcount = 0);
00108
00125 DicomImage(DcmObject *object,
00126 const E_TransferSyntax xfer,
00127 const double slope,
00128 const double intercept,
00129 const unsigned long flags = 0,
00130 const unsigned long fstart = 0,
00131 const unsigned long fcount = 0);
00132
00150 DicomImage(DcmObject *object,
00151 E_TransferSyntax xfer,
00152 const DcmUnsignedShort &data,
00153 const DcmUnsignedShort &descriptor,
00154 const DcmLongString *explanation = NULL,
00155 const unsigned long flags = 0,
00156 const unsigned long fstart = 0,
00157 const unsigned long fcount = 0);
00158 #endif
00159
00162 virtual ~DicomImage();
00163
00164
00165
00166
00173 static const char *getString(const EI_Status status);
00174
00181 static const char *getString(const EP_Interpretation interpret);
00182
00187 inline EI_Status getStatus() const
00188 {
00189 return (Image != NULL) ?
00190 Image->getStatus() : ImageStatus;
00191 }
00192
00200 inline unsigned long getFrameCount() const
00201 {
00202 return (Image != NULL) ?
00203 Image->getNumberOfFrames() : 0;
00204 }
00205
00212 inline unsigned long getFirstFrame() const
00213 {
00214 return (Image != NULL) ?
00215 Image->getFirstFrame() : 0;
00216 }
00217
00223 inline unsigned long getRepresentativeFrame() const
00224 {
00225 return (Image != NULL) ?
00226 Image->getRepresentativeFrame() : 0;
00227 }
00228
00233 inline unsigned long getWidth() const
00234 {
00235 return (Image != NULL) ?
00236 Image->getColumns() : 0;
00237 }
00238
00243 inline unsigned long getHeight() const
00244 {
00245 return (Image != NULL) ?
00246 Image->getRows() : 0;
00247 }
00248
00253 inline int getDepth() const
00254 {
00255 return (Image != NULL) ?
00256 Image->getBits() : 0;
00257 }
00258
00272 inline int getMinMaxValues(double &min,
00273 double &max,
00274 const int mode = 0) const
00275 {
00276 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00277 Image->getMonoImagePtr()->getMinMaxValues(min, max, mode) : 0;
00278 }
00279
00284 inline double getWidthHeightRatio() const
00285 {
00286 return (Image != NULL) ?
00287 Image->getColumnRowRatio() : 0;
00288 }
00289
00294 inline double getHeightWidthRatio() const
00295 {
00296 return (Image != NULL) ?
00297 Image->getRowColumnRatio() : 0;
00298 }
00299
00306 inline int setWidthHeightRatio(const double ratio) const
00307 {
00308 return (Image != NULL) ?
00309 Image->setColumnRowRatio(ratio) : 0;
00310 }
00311
00318 inline int setHeightWidthRatio(const double ratio) const
00319 {
00320 return (Image != NULL) ?
00321 Image->setRowColumnRatio(ratio) : 0;
00322 }
00323
00330 inline int isOutputValueUnused(const unsigned long value)
00331 {
00332 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00333 Image->getMonoImagePtr()->isValueUnused(value) : 0;
00334 }
00335
00336
00337
00349 inline unsigned long getOutputDataSize(const int bits = 0) const
00350 {
00351 return (Image != NULL) ?
00352 Image->getOutputDataSize(Image->getBits(bits)) : 0;
00353 }
00354
00373 inline const void *getOutputData(const int bits = 0,
00374 const unsigned long frame = 0,
00375 const int planar = 0)
00376 {
00377 return (Image != NULL) ?
00378 Image->getOutputData(frame, Image->getBits(bits), planar) : NULL;
00379 }
00380
00399 inline int getOutputData(void *buffer,
00400 const unsigned long size,
00401 const int bits = 0,
00402 const unsigned long frame = 0,
00403 const int planar = 0)
00404 {
00405 return (Image != NULL) ?
00406 Image->getOutputData(buffer, size, frame, Image->getBits(bits), planar) : 0;
00407 }
00408
00420 inline const void *getOutputPlane(const int plane) const
00421 {
00422 return (Image != NULL) ?
00423 Image->getOutputPlane(plane) : NULL;
00424 }
00425
00429 inline void deleteOutputData() const
00430 {
00431 if (Image != NULL)
00432 Image->deleteOutputData();
00433 }
00434
00435
00436
00441 inline int isMonochrome() const
00442 {
00443 return (PhotometricInterpretation == EPI_Monochrome1) || (PhotometricInterpretation == EPI_Monochrome2);
00444 }
00445
00450 inline EP_Interpretation getPhotometricInterpretation() const
00451 {
00452 return PhotometricInterpretation;
00453 }
00454
00459 int hasSOPclassUID(const char *uid) const;
00460
00470 inline const DiPixel *getInterData() const
00471 {
00472 return (Image != NULL) ?
00473 Image->getInterData() : NULL;
00474 }
00475
00476
00477
00478
00483 inline DiDisplayFunction *getDisplayFunction() const
00484 {
00485 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00486 Image->getMonoImagePtr()->getDisplayFunction() : OFstatic_cast(DiDisplayFunction *, NULL);
00487 }
00488
00495 inline int setDisplayFunction(DiDisplayFunction *display)
00496 {
00497 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00498 Image->getMonoImagePtr()->setDisplayFunction(display) : 0;
00499 }
00500
00508 inline int setNoDisplayFunction()
00509 {
00510 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00511 Image->getMonoImagePtr()->setNoDisplayFunction() : 0;
00512 }
00513
00520 inline int deleteDisplayLUT(const int bits = 0)
00521 {
00522 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00523 Image->getMonoImagePtr()->deleteDisplayLUT(bits) : 0;
00524 }
00525
00537 inline int convertPValueToDDL(const Uint16 pvalue,
00538 Uint16 &ddl,
00539 const int bits = 8)
00540 {
00541 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00542 Image->getMonoImagePtr()->convertPValueToDDL(pvalue, ddl, bits) : 0;
00543 }
00544
00545
00546
00547
00555 inline int setNoVoiTransformation()
00556 {
00557 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00558 Image->getMonoImagePtr()->setNoVoiTransformation() : 0;
00559 }
00560
00572 inline int setMinMaxWindow(const int idx = 0)
00573 {
00574 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00575 Image->getMonoImagePtr()->setMinMaxWindow(idx) : 0;
00576 }
00577
00586 inline int setHistogramWindow(const double thresh = 0.05)
00587 {
00588 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00589 Image->getMonoImagePtr()->setHistogramWindow(thresh) : 0;
00590 }
00591
00608 inline int setRoiWindow(const unsigned long left_pos,
00609 const unsigned long top_pos,
00610 const unsigned long width,
00611 const unsigned long height,
00612 const unsigned long frame = 0)
00613 {
00614 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00615 Image->getMonoImagePtr()->setRoiWindow(left_pos, top_pos, width, height, frame) : 0;
00616 }
00617
00626 inline int setWindow(const unsigned long window)
00627 {
00628 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00629 Image->getMonoImagePtr()->setWindow(window) : 0;
00630 }
00631
00642 inline int setWindow(const double center,
00643 const double width)
00644 {
00645 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00646 Image->getMonoImagePtr()->setWindow(center, width) : 0;
00647 }
00648
00656 inline int getWindow(double ¢er,
00657 double &width)
00658 {
00659 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00660 Image->getMonoImagePtr()->getWindow(center, width) : 0;
00661 }
00662
00668 inline unsigned long getWindowCount() const
00669 {
00670 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00671 Image->getMonoImagePtr()->getWindowCount() : 0;
00672 }
00673
00687 inline int setVoiLut(const DcmUnsignedShort &data,
00688 const DcmUnsignedShort &descriptor,
00689 const DcmLongString *explanation = NULL,
00690 const OFBool ignoreDepth = OFFalse)
00691 {
00692 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00693 Image->getMonoImagePtr()->setVoiLut(data, descriptor, explanation, ignoreDepth) : 0;
00694 }
00695
00706 inline int setVoiLut(const unsigned long table,
00707 const OFBool ignoreDepth = OFFalse)
00708 {
00709 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00710 Image->getMonoImagePtr()->setVoiLut(table, ignoreDepth) : 0;
00711 }
00712
00717 inline unsigned long getVoiLutCount() const
00718 {
00719 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00720 Image->getMonoImagePtr()->getVoiLutCount() : 0;
00721 }
00722
00727 inline const char *getVoiTransformationExplanation() const
00728 {
00729 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00730 Image->getMonoImagePtr()->getVoiTransformationExplanation() : OFstatic_cast(const char *, NULL);
00731 }
00732
00740 inline const char *getVoiWindowExplanation(const unsigned long window,
00741 OFString &explanation) const
00742 {
00743 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00744 Image->getMonoImagePtr()->getVoiWindowExplanation(window, explanation) : OFstatic_cast(const char *, NULL);
00745 }
00746
00754 inline const char *getVoiLutExplanation(const unsigned long table,
00755 OFString &explanation) const
00756 {
00757 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00758 Image->getMonoImagePtr()->getVoiLutExplanation(table, explanation) : OFstatic_cast(const char *, NULL);
00759 }
00760
00765 inline const char *getModalityLutExplanation() const
00766 {
00767 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00768 Image->getMonoImagePtr()->getModalityLutExplanation() : OFstatic_cast(const char *, NULL);
00769 }
00770
00771
00772
00778 inline EP_Polarity getPolarity() const
00779 {
00780 return (Image != NULL) ?
00781 Image->getPolarity() : EPP_Normal;
00782 }
00783
00792 inline int setPolarity(const EP_Polarity polarity)
00793 {
00794 return (Image != NULL) ?
00795 Image->setPolarity(polarity) : 0;
00796 }
00797
00810 inline int setHardcopyParameters(const unsigned int min,
00811 const unsigned int max,
00812 const unsigned int reflect,
00813 const unsigned int illumin)
00814 {
00815 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00816 Image->getMonoImagePtr()->setHardcopyParameters(min, max, reflect, illumin) : 0;
00817 }
00818
00819
00820
00827 inline ES_PresentationLut getPresentationLutShape() const
00828 {
00829 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00830 Image->getMonoImagePtr()->getPresentationLutShape() : ESP_Default;
00831 }
00832
00844 inline int setPresentationLutShape(const ES_PresentationLut shape)
00845 {
00846 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00847 Image->getMonoImagePtr()->setPresentationLutShape(shape) : 0;
00848 }
00849
00863 inline int setPresentationLut(const DcmUnsignedShort &data,
00864 const DcmUnsignedShort &descriptor,
00865 const DcmLongString *explanation = NULL,
00866 const OFBool ignoreDepth = OFFalse)
00867 {
00868 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00869 Image->getMonoImagePtr()->setPresentationLut(data, descriptor, explanation, ignoreDepth) : 0;
00870 }
00871
00876 inline const char *getPresentationLutExplanation() const
00877 {
00878 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00879 Image->getMonoImagePtr()->getPresentationLutExplanation() : OFstatic_cast(const char *, NULL);
00880 }
00881
00893 inline int setInversePresentationLut(const DcmUnsignedShort &data,
00894 const DcmUnsignedShort &descriptor,
00895 const OFBool ignoreDepth = OFFalse)
00896 {
00897 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00898 Image->getMonoImagePtr()->setInversePresentationLut(data, descriptor, ignoreDepth) : 0;
00899 }
00900
00901
00902
00903
00920 inline int addOverlay(const unsigned int group,
00921 const signed int left_pos,
00922 const signed int top_pos,
00923 const unsigned int width,
00924 const unsigned int height,
00925 const DcmOverlayData &data,
00926 const DcmLongString &label,
00927 const DcmLongString &description,
00928 const EM_Overlay mode = EMO_Default)
00929 {
00930 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00931 Image->getMonoImagePtr()->addOverlay(group, left_pos, top_pos, width, height, data, label, description, mode) : 0;
00932 }
00933
00940 inline int removeOverlay(const unsigned int group)
00941 {
00942 return ((Image != NULL) && (Image->getOverlayPtr(1) != NULL)) ?
00943 Image->getOverlayPtr(1)->removePlane(group) : 0;
00944 }
00945
00951 inline int removeAllOverlays()
00952 {
00953 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
00954 Image->getMonoImagePtr()->removeAllOverlays() : 0;
00955 }
00956
00965 inline int isOverlayVisible(const unsigned int plane,
00966 const unsigned int idx = 0)
00967 {
00968 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
00969 Image->getOverlayPtr(idx)->isPlaneVisible(plane) : 0;
00970 }
00971
00980 inline int showOverlay(const unsigned int plane,
00981 const unsigned int idx = 0)
00982 {
00983 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
00984 Image->getOverlayPtr(idx)->showPlane(plane) : 0;
00985 }
00986
00997 inline int showOverlay(const unsigned int plane,
00998 const EM_Overlay mode,
00999 const double fore = 1.0,
01000 const double thresh = 0.5,
01001 const unsigned int idx = 0)
01002 {
01003 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01004 Image->getOverlayPtr(idx)->showPlane(plane, fore, thresh, mode) : 0;
01005 }
01006
01014 inline int showOverlay(const unsigned int plane,
01015 const Uint16 pvalue)
01016 {
01017 return ((Image != NULL) && (Image->getOverlayPtr(1) != NULL)) ?
01018 Image->getOverlayPtr(1)->showPlane(plane, pvalue) : 0;
01019 }
01020
01028 inline int showAllOverlays(const unsigned int idx = 0)
01029 {
01030 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01031 Image->getOverlayPtr(idx)->showAllPlanes() : 0;
01032 }
01033
01044 inline int showAllOverlays(const EM_Overlay mode,
01045 const double fore = 1,
01046 const double thresh = 0.5,
01047 const unsigned int idx = 0)
01048 {
01049 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01050 Image->getOverlayPtr(idx)->showAllPlanes(fore, thresh, mode) : 0;
01051 }
01052
01061 inline int hideOverlay(const unsigned int plane,
01062 const unsigned int idx = 0)
01063 {
01064 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01065 Image->getOverlayPtr(idx)->hidePlane(plane) : 0;
01066 }
01067
01075 inline int hideAllOverlays(const unsigned int idx = 0)
01076 {
01077 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01078 Image->getOverlayPtr(idx)->hideAllPlanes() : 0;
01079 }
01080
01091 inline int placeOverlay(const unsigned int plane,
01092 const signed int left_pos,
01093 const signed int top_pos,
01094 const unsigned int idx = 0)
01095 {
01096 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01097 Image->getOverlayPtr(idx)->placePlane(plane, left_pos, top_pos) : 0;
01098 }
01099
01106 inline unsigned int getOverlayCount(const unsigned int idx = 0) const
01107 {
01108 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01109 Image->getOverlayPtr(idx)->getCount() : 0;
01110 }
01111
01119 inline unsigned int getOverlayGroupNumber(const unsigned int plane,
01120 const unsigned int idx = 0) const
01121 {
01122 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01123 Image->getOverlayPtr(idx)->getPlaneGroupNumber(plane) : 0;
01124 }
01125
01133 inline const char *getOverlayLabel(const unsigned int plane,
01134 const unsigned int idx = 0) const
01135 {
01136 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01137 Image->getOverlayPtr(idx)->getPlaneLabel(plane) : OFstatic_cast(const char *, NULL);
01138 }
01139
01147 inline const char *getOverlayDescription(const unsigned int plane,
01148 const unsigned int idx = 0) const
01149 {
01150 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01151 Image->getOverlayPtr(idx)->getPlaneDescription(plane) : OFstatic_cast(const char *, NULL);
01152 }
01153
01161 inline EM_Overlay getOverlayMode(const unsigned int plane,
01162 const unsigned int idx = 0) const
01163 {
01164 return ((Image != NULL) && (Image->getOverlayPtr(idx) != NULL)) ?
01165 Image->getOverlayPtr(idx)->getPlaneMode(plane) : EMO_Default;
01166 }
01167
01195 const void *getOverlayData(const unsigned int plane,
01196 unsigned int &left_pos,
01197 unsigned int &top_pos,
01198 unsigned int &width,
01199 unsigned int &height,
01200 EM_Overlay &mode,
01201 const unsigned long frame = 0,
01202 const int bits = 8,
01203 const Uint16 fore = 0xff,
01204 const Uint16 back = 0x0,
01205 const unsigned int idx = 2) const
01206 {
01207 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01208 Image->getMonoImagePtr()->getOverlayData(frame, plane, left_pos, top_pos, width, height, mode, idx, bits, fore, back) : NULL;
01209 }
01210
01231 const void *getFullOverlayData(const unsigned int plane,
01232 unsigned int &width,
01233 unsigned int &height,
01234 const unsigned long frame = 0,
01235 const int bits = 8,
01236 const Uint16 fore = 0xff,
01237 const Uint16 back = 0x0,
01238 const unsigned int idx = 0) const
01239 {
01240 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01241 Image->getMonoImagePtr()->getFullOverlayData(frame, plane, width, height, idx, bits, fore, back) : NULL;
01242 }
01243
01247 inline void deleteOverlayData() const
01248 {
01249 if ((Image != NULL) && (Image->getMonoImagePtr() != NULL))
01250 Image->getMonoImagePtr()->deleteOverlayData();
01251 }
01252
01269 unsigned long create6xxx3000OverlayData(Uint8 *&buffer,
01270 const unsigned int plane,
01271 unsigned int &width,
01272 unsigned int &height,
01273 unsigned long &frames,
01274 const unsigned int idx = 0) const
01275 {
01276 return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?
01277 Image->getMonoImagePtr()->create6xxx3000OverlayData(buffer, plane, width, height, frames, idx) : 0;
01278 }
01279
01280
01281
01282
01291 DicomImage *createDicomImage(unsigned long fstart = 0,
01292 unsigned long fcount = 0) const;
01293
01307 DicomImage *createScaledImage(const unsigned long width,
01308 const unsigned long height = 0,
01309 const int interpolate = 0,
01310 int aspect = 0) const;
01311
01325 DicomImage *createScaledImage(const double xfactor,
01326 const double yfactor = 0,
01327 const int interpolate = 0,
01328 const int aspect = 0) const;
01329
01350 DicomImage *createScaledImage(const signed long left_pos,
01351 const signed long top_pos,
01352 unsigned long clip_width,
01353 unsigned long clip_height,
01354 unsigned long scale_width = 0,
01355 unsigned long scale_height = 0,
01356 const int interpolate = 0,
01357 int aspect = 0,
01358 const Uint16 pvalue = 0) const;
01359
01380 DicomImage *createScaledImage(const signed long left_pos,
01381 const signed long top_pos,
01382 unsigned long width,
01383 unsigned long height,
01384 const double xfactor,
01385 const double yfactor = 0,
01386 const int interpolate = 0,
01387 const int aspect = 0,
01388 const Uint16 pvalue = 0) const;
01389
01402 DicomImage *createClippedImage(const signed long left_pos,
01403 const signed long top_pos,
01404 unsigned long width = 0,
01405 unsigned long height = 0,
01406 const Uint16 pvalue = 0) const;
01407
01417 int flipImage(int horz = 1,
01418 int vert = 0) const;
01419
01428 DicomImage *createFlippedImage(int horz = 1,
01429 int vert = 0) const;
01430
01439 int rotateImage(signed int degree) const;
01440
01448 DicomImage *createRotatedImage(signed int degree) const;
01449
01461 DicomImage *createMonochromeImage(const double red = 0.299,
01462 const double green = 0.587,
01463 const double blue = 0.114) const;
01464
01489 unsigned long createWindowsDIB(void *&data,
01490 const unsigned long size,
01491 const unsigned long frame = 0,
01492 const int bits = 24,
01493 const int upsideDown = 0,
01494 const int padding = 1)
01495 {
01496 return (Image != NULL) ?
01497 Image->createDIB(data, size, frame, bits, upsideDown, padding) : 0;
01498 }
01499
01512 unsigned long createJavaAWTBitmap(void *&data,
01513 const unsigned long frame = 0,
01514 const int bits = 32)
01515 {
01516 return (Image != NULL) ?
01517 Image->createAWTBitmap(data, frame, bits) : 0;
01518 }
01519
01529 static void *create12BitPackedBitmap(const void *buffer,
01530 const unsigned long size,
01531 const unsigned long count)
01532 {
01533 return DiMonoImage::createPackedBitmap(buffer, size, count, 16, 12);
01534 }
01535
01545 DicomImage *createMonoOutputImage(const unsigned long frame,
01546 const int bits);
01547
01548
01549
01577 inline int writeFrameToDataset(DcmItem &dataset,
01578 const int bits = 0,
01579 const unsigned long frame = 0,
01580 const int planar = 0)
01581 {
01582 return (Image != NULL) ?
01583 Image->writeFrameToDataset(dataset, frame, bits, planar) : 0;
01584 }
01585
01610 inline int writeImageToDataset(DcmItem &dataset,
01611 const int mode = 0)
01612 {
01613 return (Image != NULL) ?
01614 Image->writeImageToDataset(dataset, mode) : 0;
01615 }
01616
01630 int writePPM(const char *filename,
01631 const int bits = 0,
01632 const unsigned long frame = 0);
01633
01647 int writePPM(ostream &stream,
01648 const int bits = 0,
01649 const unsigned long frame = 0);
01650
01664 int writePPM(FILE *stream,
01665 const int bits = 0,
01666 const unsigned long frame = 0);
01667
01681 int writeRawPPM(const char *filename,
01682 const int bits = 0,
01683 const unsigned long frame= 0);
01684
01698 int writeRawPPM(FILE *stream,
01699 const int bits = 0,
01700 const unsigned long frame = 0);
01701
01714 int writeBMP(FILE *stream,
01715 const int bits = 0,
01716 const unsigned long frame = 0);
01717
01730 int writeBMP(const char *filename,
01731 const int bits = 0,
01732 const unsigned long frame = 0);
01733
01743 int writePluginFormat(const DiPluginFormat *plugin,
01744 FILE *stream,
01745 const unsigned long frame = 0);
01746
01756 int writePluginFormat(const DiPluginFormat *plugin,
01757 const char *filename,
01758 const unsigned long frame = 0);
01759
01760
01761 protected:
01762
01769 DicomImage(const DicomImage *dicom,
01770 DiImage *image,
01771 const EP_Interpretation interpret = EPI_Unknown);
01772
01776 void Init();
01777
01782 int checkDataDictionary();
01783
01788 const char *getSOPclassUID() const;
01789
01798 int normalizeDegreeValue(signed int °ree) const;
01799
01800
01801 private:
01802
01804 EI_Status ImageStatus;
01806 EP_Interpretation PhotometricInterpretation;
01807
01809 DiDocument *Document;
01811 DiImage *Image;
01812
01813
01814
01815 DicomImage(const DicomImage &);
01816 DicomImage &operator=(const DicomImage &);
01817 };
01818
01819
01820 #endif
01821
01822
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853
01854
01855
01856
01857
01858
01859
01860
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929
01930
01931
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953
01954
01955
01956
01957
01958
01959
01960
01961
01962
01963
01964
01965
01966
01967
01968
01969
01970
01971
01972
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999
02000
02001
02002
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022
02023
02024
02025
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049
02050
02051
02052
02053
02054
02055
02056
02057
02058
02059
02060