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 DIOVPLN_H
00035
#define DIOVPLN_H
00036
00037
#include "osconfig.h"
00038
#include "dctypes.h"
00039
#include "ofstring.h"
00040
#include "ofstream.h"
00041
#include "ofcast.h"
00042
00043
#include "diutils.h"
00044
00045
#define INCLUDE_CSTDDEF
00046
#include "ofstdinc.h"
00047
00048
00049
00050
00051
00052
00053
class DcmOverlayData;
00054
class DcmLongString;
00055
00056
class DiDocument;
00057
00058
00059
00060
00061
00062
00065 class DiOverlayPlane
00066 {
00067
00068
public:
00069
00076
DiOverlayPlane(
const DiDocument *docu,
00077
const unsigned int group,
00078 Uint16 alloc);
00079
00092
DiOverlayPlane(
const unsigned int group,
00093
const Sint16 left_pos,
00094
const Sint16 top_pos,
00095
const Uint16 columns,
00096
const Uint16 rows,
00097
const DcmOverlayData &data,
00098
const DcmLongString &label,
00099
const DcmLongString &description,
00100
const EM_Overlay mode);
00101
00113
DiOverlayPlane(
DiOverlayPlane *plane,
00114
const unsigned int bit,
00115 Uint16 *data,
00116 Uint16 *temp,
00117
const Uint16 width,
00118
const Uint16 height,
00119
const Uint16 columns,
00120
const Uint16 rows);
00121
00124
~DiOverlayPlane();
00125
00132 inline Sint16
getLeft(
const Sint32 left_pos = 0)
const
00133
{
00134
return OFstatic_cast(Sint16, OFstatic_cast(Sint32,
Left) - left_pos);
00135 }
00136
00143 inline Sint16
getTop(
const Sint32 top_pos = 0)
const
00144
{
00145
return OFstatic_cast(Sint16, OFstatic_cast(Sint32,
Top) - top_pos);
00146 }
00147
00152 inline Uint16
getWidth()
const
00153
{
00154
return Width;
00155 }
00156
00161 inline Uint16
getHeight()
const
00162
{
00163
return Height;
00164 }
00165
00172 inline Uint16
getRight(
const Sint32 left_pos = 0)
const
00173
{
00174
return (OFstatic_cast(Sint32,
Left) + OFstatic_cast(Sint32,
Width) - left_pos > 0) ?
00175 OFstatic_cast(Uint16, OFstatic_cast(Sint32,
Left) + OFstatic_cast(Sint32,
Width) - left_pos) : 0;
00176 }
00177
00184 inline Uint16
getBottom(
const Sint32 top_pos = 0)
const
00185
{
00186
return (OFstatic_cast(Sint32,
Top) + OFstatic_cast(Sint32,
Height) - top_pos > 0) ?
00187 OFstatic_cast(Uint16, OFstatic_cast(Sint32,
Top) + OFstatic_cast(Sint32,
Height) - top_pos) : 0;
00188 }
00189
00194 inline int isValid()
const
00195
{
00196
return Valid;
00197 }
00198
00203 inline int isVisible()
const
00204
{
00205
return Visible;
00206 }
00207
00210 inline void show()
00211 {
00212
Visible = 1;
00213 }
00214
00217 inline void hide()
00218 {
00219
Visible = 0;
00220 }
00221
00227 inline void place(
const signed int left_pos,
00228
const signed int top_pos)
00229 {
00230
Left = left_pos;
Top = top_pos;
00231 }
00232
00238
void setScaling(
const double xfactor,
00239
const double yfactor);
00240
00248
void setFlipping(
const int horz,
00249
const int vert,
00250
const signed long columns,
00251
const signed long rows);
00252
00261
void setRotation(
const int degree,
00262
const signed long left_pos,
00263
const signed long top_pos,
00264
const Uint16 columns,
00265
const Uint16 rows);
00266
00273
void show(
const double fore,
00274
const double thresh,
00275
const EM_Overlay mode);
00276
00284
int show(
const Uint16 pvalue);
00285
00290 inline unsigned long getNumberOfFrames()
const
00291
{
00292
return NumberOfFrames;
00293 }
00294
00299 inline double getForeground()
const
00300
{
00301
return Foreground;
00302 }
00303
00308 inline double getThreshold()
const
00309
{
00310
return Threshold;
00311 }
00312
00318 inline Uint16
getPValue()
const
00319
{
00320
return PValue;
00321 }
00322
00327 inline EM_Overlay
getMode()
const
00328
{
00329
return Mode;
00330 }
00331
00336 inline int isEmbedded()
const
00337
{
00338
return EmbeddedData;
00339 }
00340
00345 const char *
getLabel()
const
00346
{
00347
return (
Label.
empty()) ? OFstatic_cast(
const char *, NULL) :
Label.
c_str();
00348 }
00349
00354 const char *
getDescription()
const
00355
{
00356
return (
Description.
empty()) ? OFstatic_cast(
const char *, NULL) :
Description.
c_str();
00357 }
00358
00363 Uint16
getGroupNumber()
const
00364
{
00365
return GroupNumber;
00366 }
00367
00383
void *
getData(
const unsigned long frame,
00384
const Uint16 xmin,
00385
const Uint16 ymin,
00386
const Uint16 xmax,
00387
const Uint16 ymax,
00388
const int bits,
00389
const Uint16 fore,
00390
const Uint16 back);
00391
00404
unsigned long create6xxx3000Data(Uint8 *&buffer,
00405
unsigned int &width,
00406
unsigned int &height,
00407
unsigned long &frames);
00408
00415
inline int reset(
const unsigned long frame);
00416
00421
inline int getNextBit();
00422
00428
inline void setStart(
const Uint16 x,
00429
const Uint16 y);
00430
00431
00432
protected:
00433
00435 Uint32
NumberOfFrames;
00437 Uint16
ImageFrameOrigin;
00438
00440 Sint16
Top;
00442 Sint16
Left;
00444 Uint16
Height;
00446 Uint16
Width;
00448 Uint16
Rows;
00450 Uint16
Columns;
00452 Uint16
BitsAllocated;
00454 Uint16
BitPosition;
00455
00457 double Foreground;
00459 double Threshold;
00461 Uint16
PValue;
00462
00464 EM_Overlay
Mode;
00466 EM_Overlay
DefaultMode;
00467
00469 OFString Label;
00471 OFString Description;
00472
00474 Uint16
GroupNumber;
00475
00477 int Valid;
00479 int Visible;
00480
00481
00482
private:
00483
00485 unsigned long BitPos;
00487 unsigned long StartBitPos;
00488
00490 unsigned int StartLeft;
00492 unsigned int StartTop;
00493
00495 int EmbeddedData;
00496
00498 const Uint16 *
Ptr;
00500 const Uint16 *
StartPtr;
00502 const Uint16 *
Data;
00503
00504
00505
00506
DiOverlayPlane(
const DiOverlayPlane &);
00507
DiOverlayPlane &operator=(
const DiOverlayPlane &);
00508 };
00509
00510
00511
00512
00513
00514 inline int DiOverlayPlane::reset(
const unsigned long frame)
00515 {
00516
int result = 0;
00517
if (
Valid && (
Data != NULL) && (frame >=
ImageFrameOrigin) && (frame <
ImageFrameOrigin +
NumberOfFrames))
00518 {
00519
const unsigned long bits = (OFstatic_cast(
unsigned long,
StartLeft) + OFstatic_cast(
unsigned long,
StartTop) *
00520 OFstatic_cast(
unsigned long,
Columns) + frame * OFstatic_cast(
unsigned long,
Rows) *
00521 OFstatic_cast(
unsigned long,
Columns)) * OFstatic_cast(
unsigned long,
BitsAllocated);
00522
StartBitPos =
BitPos = OFstatic_cast(
unsigned long,
BitPosition) + bits;
00523
StartPtr =
Ptr =
Data + (bits >> 4);
00524 result = (
getRight() > 0) && (
getBottom() > 0);
00525 }
00526
return result;
00527 }
00528
00529
00530 inline int DiOverlayPlane::getNextBit()
00531 {
00532
int result;
00533
if (
BitsAllocated == 16)
00534 result = OFstatic_cast(
int, *(
Ptr++) & (1 <<
BitPosition));
00535
else
00536 {
00537
Ptr =
StartPtr + (
BitPos >> 4);
00538 result = OFstatic_cast(
int, *
Ptr & (1 << (
BitPos & 0xf)));
00539
BitPos +=
BitsAllocated;
00540 }
00541
return result;
00542 }
00543
00544
00545 inline void DiOverlayPlane::setStart(
const Uint16 x,
00546
const Uint16 y)
00547 {
00548
if (
BitsAllocated == 16)
00549
Ptr =
StartPtr + OFstatic_cast(
unsigned long, y -
Top) * OFstatic_cast(
unsigned long,
Columns) +
00550 OFstatic_cast(
unsigned long, x -
Left);
00551
else
00552
BitPos =
StartBitPos + (OFstatic_cast(
unsigned long, y - Top) * OFstatic_cast(
unsigned long,
Columns) +
00553 OFstatic_cast(
unsigned long, x - Left)) * OFstatic_cast(
unsigned long,
BitsAllocated);
00554 }
00555
00556
00557
#endif
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664