dcmimgle/include/dimoimg.h
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 DIMOIMG_H
00035
#define DIMOIMG_H
00036
00037
#include "osconfig.h"
00038
#include "dctypes.h"
00039
#include "ofcast.h"
00040
00041
#include "diimage.h"
00042
#include "dimopx.h"
00043
#include "dimoopx.h"
00044
#include "diovlay.h"
00045
#include "diluptab.h"
00046
#include "didispfn.h"
00047
00048
00049
00050
00051
00052
00053
class DiColorImage;
00054
00055
00056
00057
00058
00059
00062 class DiMonoImage
00063 :
public DiImage
00064 {
00065
00066
public:
00067
00073
DiMonoImage(
const DiDocument *docu,
00074
const EI_Status status);
00075
00083
DiMonoImage(
const DiDocument *docu,
00084
const EI_Status status,
00085
const double slope,
00086
const double intercept);
00087
00096
DiMonoImage(
const DiDocument *docu,
00097
const EI_Status status,
00098
const DcmUnsignedShort &data,
00099
const DcmUnsignedShort &descriptor,
00100
const DcmLongString *explanation);
00101
00104
virtual ~DiMonoImage();
00105
00117
int getMinMaxValues(
double &min,
00118
double &max,
00119
const int mode)
const;
00120
00125 DiDisplayFunction *
getDisplayFunction()
const
00126
{
00127
return DisplayFunction;
00128 }
00129
00136
int setDisplayFunction(
DiDisplayFunction *display);
00137
00145
int setNoDisplayFunction();
00146
00154
int setNoVoiTransformation();
00155
00162 inline int deleteDisplayLUT(
const int bits)
00163 {
00164
return (
DisplayFunction != NULL) ?
DisplayFunction->
deleteLookupTable(bits) : 0;
00165 }
00166
00173 inline int isValueUnused(
const unsigned long value)
00174 {
00175
return (
OutputData != NULL) ?
OutputData->
isUnused(value) : 0;
00176 }
00177
00189
int convertPValueToDDL(
const Uint16 pvalue,
00190 Uint16 &ddl,
00191
const int bits);
00192
00202
int setMinMaxWindow(
const int idx = 1);
00203
00218
int setRoiWindow(
const unsigned long left_pos,
00219
const unsigned long top_pos,
00220
const unsigned long width,
00221
const unsigned long height,
00222
const unsigned long frame);
00223
00231
int setHistogramWindow(
const double thresh);
00232
00240
int setWindow(
const unsigned long pos = 0);
00241
00253
int setWindow(
const double center,
00254
const double width,
00255
const char *explanation = NULL);
00256
00264
int getWindow(
double ¢er,
00265
double &width);
00266
00271 inline unsigned long getWindowCount()
const
00272
{
00273
return WindowCount;
00274 }
00275
00287
int setVoiLut(
const DcmUnsignedShort &data,
00288
const DcmUnsignedShort &descriptor,
00289
const DcmLongString *explanation,
00290
const OFBool ignoreDepth = OFFalse);
00291
00301
int setVoiLut(
const unsigned long pos,
00302
const OFBool ignoreDepth = OFFalse);
00303
00308 inline unsigned long getVoiLutCount()
const
00309
{
00310
return VoiLutCount;
00311 }
00312
00317 inline const char *
getVoiTransformationExplanation()
const
00318
{
00319
return VoiExplanation.
c_str();
00320 }
00321
00329
const char *
getVoiWindowExplanation(
const unsigned long pos,
00330
OFString &explanation)
const;
00331
00339
const char *
getVoiLutExplanation(
const unsigned long pos,
00340
OFString &explanation)
const;
00341
00346 inline const char *
getModalityLutExplanation()
const
00347
{
00348
return (
InterData != NULL) ?
InterData->
getModalityLutExplanation() : OFstatic_cast(
const char *, NULL);
00349 }
00350
00362
int setHardcopyParameters(
const unsigned int min,
00363
const unsigned int max,
00364
const unsigned int reflect,
00365
const unsigned int illumin);
00366
00373 ES_PresentationLut
getPresentationLutShape() const;
00374
00386
int setPresentationLutShape(const ES_PresentationLut shape);
00387
00399
int setPresentationLut(const
DcmUnsignedShort &data,
00400 const
DcmUnsignedShort &descriptor,
00401 const
DcmLongString *explanation = NULL,
00402 const OFBool ignoreDepth = OFFalse);
00403
00415
int setInversePresentationLut(const
DcmUnsignedShort &data,
00416 const
DcmUnsignedShort &descriptor,
00417 const OFBool ignoreDepth = OFFalse);
00418
00423 inline const
char *getPresentationLutExplanation()
const
00424
{
00425
return (
PresLutData != NULL) ?
PresLutData->
getExplanation() : OFstatic_cast(
const char *, NULL);
00426 }
00427
00444
int addOverlay(
const unsigned int group,
00445
const signed int left_pos,
00446
const signed int top_pos,
00447
const unsigned int columns,
00448
const unsigned int rows,
00449
const DcmOverlayData &data,
00450
const DcmLongString &label,
00451
const DcmLongString &description,
00452
const EM_Overlay mode);
00453
00458
int removeAllOverlays();
00459
00466 inline DiOverlay *
getOverlayPtr(
const unsigned int idx)
00467 {
00468
return (idx < 2) ?
Overlays[idx] : OFstatic_cast(
DiOverlay *, NULL);
00469 }
00470
00475 inline DiMonoImage *
getMonoImagePtr()
00476 {
00477
return this;
00478 }
00479
00489
int flip(
const int horz,
00490
const int vert);
00491
00500
int rotate(
const int degree);
00501
00512 virtual int getBits(
const int bits = 0)
const
00513
{
00514
return (((bits < 1) || (bits > MAX_BITS)) && (bits != MI_PastelColor)) ? BitsPerSample : bits;
00515 }
00516
00523
virtual unsigned long getOutputDataSize(
const int bits = 0)
const;
00524
00534
virtual const void *
getOutputData(
const unsigned long frame,
00535
const int bits,
00536
const int planar = 0) = 0;
00537
00549
virtual int getOutputData(
void *buffer,
00550
const unsigned long size,
00551
const unsigned long frame,
00552
const int bits,
00553
const int planar = 0) = 0;
00554
00562
const void *
getOutputPlane(
const int dummy)
const;
00563
00567
void deleteOutputData();
00568
00586
const void *
getOverlayData(
const unsigned long frame,
00587
const unsigned int plane,
00588
unsigned int &left_pos,
00589
unsigned int &top_pos,
00590
unsigned int &width,
00591
unsigned int &height,
00592 EM_Overlay &mode,
00593
const unsigned int idx,
00594
const int bits = 8,
00595
const Uint16 fore = 0xff,
00596
const Uint16 back = 0x0);
00597
00612
const void *
getFullOverlayData(
const unsigned long frame,
00613
const unsigned int plane,
00614
unsigned int &width,
00615
unsigned int &height,
00616
const unsigned int idx,
00617
const int bits = 8,
00618
const Uint16 fore = 0xff,
00619
const Uint16 back = 0x0);
00620
00624
void deleteOverlayData();
00625
00642
unsigned long create6xxx3000OverlayData(Uint8 *&buffer,
00643
const unsigned int plane,
00644
unsigned int &width,
00645
unsigned int &height,
00646
unsigned long &frames,
00647
const unsigned int idx = 0);
00648
00653 const DiMonoPixel *
getInterData()
const
00654
{
00655
return InterData;
00656 }
00657
00670
unsigned long createDIB(
void *&data,
00671
const unsigned long size,
00672
const unsigned long frame,
00673
const int bits,
00674
const int upsideDown,
00675
const int padding = 1);
00676
00686
unsigned long createAWTBitmap(
void *&data,
00687
const unsigned long frame,
00688
const int bits);
00689
00701
static void *
createPackedBitmap(
const void *buffer,
00702
const unsigned long size,
00703
const unsigned long count,
00704
const int alloc,
00705
const int stored);
00706
00715
DiImage *
createOutputImage(
const unsigned long frame,
00716
const int bits);
00717
00724
int writeImageToDataset(
DcmItem &dataset);
00725
00735
int writePPM(ostream &stream,
00736
const unsigned long frame,
00737
const int bits);
00738
00748
int writePPM(FILE *stream,
00749
const unsigned long frame,
00750
const int bits);
00751
00760
int writeRawPPM(FILE *stream,
00761
const unsigned long frame,
00762
const int bits);
00763
00772
int writeBMP(FILE *stream,
00773
const unsigned long frame,
00774
const int bits);
00775
00776
00777
protected:
00778
00785
DiMonoImage(
const DiDocument *image,
00786
const EI_Status status,
00787
const char dummy);
00788
00795
DiMonoImage(
const DiMonoImage *image,
00796
const unsigned long fstart,
00797
const unsigned long fcount);
00798
00808
DiMonoImage(
const DiColorImage *image,
00809
const double red,
00810
const double green,
00811
const double blue);
00812
00830
DiMonoImage(
const DiMonoImage *image,
00831
const signed long left_pos,
00832
const signed long top_pos,
00833
const Uint16 src_cols,
00834
const Uint16 src_rows,
00835
const Uint16 dest_cols,
00836
const Uint16 dest_rows,
00837
const int interpolate,
00838
const int aspect,
00839
const Uint16 pvalue);
00840
00847
DiMonoImage(
const DiMonoImage *image,
00848
const int horz,
00849
const int vert);
00850
00856
DiMonoImage(
const DiMonoImage *image,
00857
const int degree);
00858
00867
DiMonoImage(
const DiMonoImage *image,
00868
DiMonoOutputPixel *pixel,
00869
const unsigned long frame,
00870
const int stored,
00871
const int alloc);
00872
00877
void Init(
DiMonoModality *modality);
00878
00883
void InitUint8(
DiMonoModality *modality);
00884
00889
void InitSint8(
DiMonoModality *modality);
00890
00895
void InitUint16(
DiMonoModality *modality);
00896
00901
void InitSint16(
DiMonoModality *modality);
00902
00907
void InitUint32(
DiMonoModality *modality);
00908
00913
void InitSint32(
DiMonoModality *modality);
00914
00919
int checkInterData(
const int mode = 1);
00920
00927
virtual void updateImagePixelModuleAttributes(
DcmItem &dataset);
00928
00941
const void *
getData(
void *buffer,
00942
const unsigned long size,
00943
const unsigned long frame,
00944
int bits,
00945
const int planar,
00946
const int negative);
00947
00959
void getDataUint8(
void *buffer,
00960
DiDisplayFunction *disp,
00961
const int samples,
00962
const unsigned long frame,
00963
const int bits,
00964
const Uint32 low,
00965
const Uint32 high);
00966
00978
void getDataSint8(
void *buffer,
00979
DiDisplayFunction *disp,
00980
const int samples,
00981
const unsigned long frame,
00982
const int bits,
00983
const Uint32 low,
00984
const Uint32 high);
00985
00997
void getDataUint16(
void *buffer,
00998
DiDisplayFunction *disp,
00999
const int samples,
01000
const unsigned long frame,
01001
const int bits,
01002
const Uint32 low,
01003
const Uint32 high);
01004
01016
void getDataSint16(
void *buffer,
01017
DiDisplayFunction *disp,
01018
const int samples,
01019
const unsigned long frame,
01020
const int bits,
01021
const Uint32 low,
01022
const Uint32 high);
01023
01035
void getDataUint32(
void *buffer,
01036
DiDisplayFunction *disp,
01037
const int samples,
01038
const unsigned long frame,
01039
const int bits,
01040
const Uint32 low,
01041
const Uint32 high);
01042
01054
void getDataSint32(
void *buffer,
01055
DiDisplayFunction *disp,
01056
const int samples,
01057
const unsigned long frame,
01058
const int bits,
01059
const Uint32 low,
01060
const Uint32 high);
01061
01070
int createLinODPresentationLut(
const unsigned long count,
const int bits);
01071
01073 double WindowCenter;
01075 double WindowWidth;
01077 unsigned long WindowCount;
01079 unsigned long VoiLutCount;
01080
01082 int ValidWindow;
01083
01085 OFString VoiExplanation;
01086
01088 ES_PresentationLut
PresLutShape;
01089
01091 unsigned int MinDensity;
01093 unsigned int MaxDensity;
01095 unsigned int Reflection;
01097 unsigned int Illumination;
01098
01100 DiOverlay *
Overlays[2];
01102 DiLookupTable *
VoiLutData;
01104 DiLookupTable *
PresLutData;
01106 DiMonoPixel *
InterData;
01107
01109 DiDisplayFunction *
DisplayFunction;
01110
01111
01112
private:
01113
01115 DiMonoOutputPixel *
OutputData;
01117 void *
OverlayData;
01118
01119
01120
01121
DiMonoImage(
const DiMonoImage &);
01122
DiMonoImage &operator=(
const DiMonoImage &);
01123 };
01124
01125
01126
#endif
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196
01197
01198
01199
01200
01201
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256
01257
01258
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306
01307
01308
01309
Generated on 4 Nov 2004 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.3.8