OFFIS DCMTK  Version 3.6.0
diovlay.h
1 /*
2  *
3  * Copyright (C) 1996-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmimgle
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: DicomOverlay (Header)
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:26 $
22  * CVS/RCS Revision: $Revision: 1.27 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DIOVLAY_H
31 #define DIOVLAY_H
32 
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/ofcast.h"
35 
36 #include "dcmtk/dcmimgle/diobjcou.h"
37 #include "dcmtk/dcmimgle/diovdat.h"
38 #include "dcmtk/dcmimgle/diovpln.h"
39 #include "dcmtk/dcmimgle/diutils.h"
40 
41 
42 /*------------------------*
43  * forward declarations *
44  *------------------------*/
45 
46 class DiDocument;
47 
48 class DcmOverlayData;
49 class DcmLongString;
50 
51 
52 /*---------------------*
53  * class declaration *
54  *---------------------*/
55 
58 class DiOverlay
59  : public DiObjectCounter
60 {
61 
62  public:
63 
71  DiOverlay(const DiDocument *docu = NULL,
72  const Uint16 alloc = 0,
73  const Uint16 stored = 0,
74  const Uint16 high = 0);
75 
84  DiOverlay(const DiOverlay *overlay,
85  const signed long left_pos,
86  const signed long top_pos,
87  const double xfactor,
88  const double yfactor);
89 
98  DiOverlay(const DiOverlay *overlay,
99  const int horz,
100  const int vert,
101  const Uint16 columns,
102  const Uint16 rows);
103 
111  DiOverlay(const DiOverlay *overlay,
112  const int degree,
113  const Uint16 columns,
114  const Uint16 rows);
115 
118  virtual ~DiOverlay();
119 
126  int isPlaneVisible(unsigned int plane);
127 
134  int showPlane(unsigned int plane);
135 
145  int showPlane(unsigned int plane,
146  const double fore,
147  const double thresh,
148  const EM_Overlay mode);
149 
158  int showPlane(unsigned int plane,
159  const Uint16 pvalue);
160 
165  int showAllPlanes();
166 
175  int showAllPlanes(const double fore,
176  const double thresh,
177  const EM_Overlay mode);
178 
185  int hidePlane(unsigned int plane);
186 
191  int hideAllPlanes();
192 
201  int placePlane(unsigned int plane,
202  const signed int left_pos,
203  const signed int top_pos);
204 
211  unsigned int getPlaneGroupNumber(unsigned int plane) const;
212 
219  const char *getPlaneLabel(unsigned int plane) const;
220 
227  const char *getPlaneDescription(unsigned int plane) const;
228 
235  EM_Overlay getPlaneMode(unsigned int plane) const;
236 
241  inline unsigned int getCount() const
242  {
243  return (Data != NULL) ? Data->Count : 0;
244  }
245 
251  inline signed long getLeft() const
252  {
253  return Left;
254  }
255 
261  inline signed long getTop() const
262  {
263  return Top;
264  }
265 
270  int hasEmbeddedData() const;
271 
289  int addPlane(const unsigned int group,
290  const signed int left_pos,
291  const signed int top_pos,
292  const unsigned int columns,
293  const unsigned int rows,
294  const DcmOverlayData &data,
295  const DcmLongString &label,
296  const DcmLongString &description,
297  const EM_Overlay mode);
298 
299 
306  int removePlane(const unsigned int group);
307 
308  inline DiOverlayPlane *getPlane(const unsigned int plane) const
309  {
310  return ((Data != NULL) && (Data->Planes != NULL) && (plane < Data->Count)) ? Data->Planes[plane] : OFstatic_cast(DiOverlayPlane *, NULL);
311  }
312 
320  inline int hasPlane(unsigned int plane,
321  const int visible = 0) const
322  {
323  return (convertToPlaneNumber(plane, AdditionalPlanes) > 1) && (!visible || Data->Planes[plane]->isVisible());
324  }
325 
344  void *getPlaneData(const unsigned long frame,
345  unsigned int plane,
346  unsigned int &left_pos,
347  unsigned int &top_pos,
348  unsigned int &width,
349  unsigned int &height,
350  EM_Overlay &mode,
351  const Uint16 columns,
352  const Uint16 rows,
353  const int bits = 8,
354  const Uint16 fore = 0xff,
355  const Uint16 back = 0x0);
356 
370  void *getFullPlaneData(const unsigned long frame,
371  unsigned int plane,
372  unsigned int &width,
373  unsigned int &height,
374  const int bits = 8,
375  const Uint16 fore = 0xff,
376  const Uint16 back = 0x0);
377 
391  unsigned long create6xxx3000PlaneData(Uint8 *&buffer,
392  unsigned int plane,
393  unsigned int &width,
394  unsigned int &height,
395  unsigned long &frames);
396 
398  static const unsigned int MaxOverlayCount;
400  static const unsigned int FirstOverlayGroup;
401 
402 
403  protected:
404 
411  Uint16 *Init(const DiOverlay *overlay);
412 
423  int convertToPlaneNumber(unsigned int &plane,
424  const int mode) const;
425 
432  unsigned int convertToGroupNumber(const unsigned int plane) const
433  {
434  return FirstOverlayGroup + 2 * plane;
435  }
436 
444  int isValidGroupNumber(const unsigned int group) const;
445 
454  int checkPlane(const unsigned int plane,
455  const int mode = 1);
456 
457 
458  private:
459 
461  signed long Left;
463  signed long Top;
465  Uint16 Width;
467  Uint16 Height;
469  unsigned long Frames;
470 
473 
476 
477  // --- declarations to avoid compiler warnings
478 
479  DiOverlay(const DiOverlay &);
480  DiOverlay &operator=(const DiOverlay &);
481 };
482 
483 
484 #endif
485 
486 
487 /*
488  *
489  * CVS/RCS Log:
490  * $Log: diovlay.h,v $
491  * Revision 1.27 2010-10-14 13:16:26 joergr
492  * Updated copyright header. Added reference to COPYRIGHT file.
493  *
494  * Revision 1.26 2010-03-01 09:08:47 uli
495  * Removed some unnecessary include directives in the headers.
496  *
497  * Revision 1.25 2008-11-18 11:01:28 joergr
498  * Fixed issue with incorrectly encoded overlay planes (wrong values for
499  * OverlayBitsAllocated and OverlayBitPosition).
500  *
501  * Revision 1.24 2005/12/08 16:48:01 meichel
502  * Changed include path schema for all DCMTK header files
503  *
504  * Revision 1.23 2003/12/08 19:32:14 joergr
505  * Adapted type casts to new-style typecast operators defined in ofcast.h.
506  * Removed leading underscore characters from preprocessor symbols (reserved
507  * symbols). Updated CVS header.
508  *
509  * Revision 1.22 2003/06/12 15:08:34 joergr
510  * Fixed inconsistent API documentation reported by Doxygen.
511  *
512  * Revision 1.21 2002/12/09 13:32:55 joergr
513  * Renamed parameter/local variable to avoid name clashes with global
514  * declaration left and/or right (used for as iostream manipulators).
515  *
516  * Revision 1.20 2001/09/28 13:09:59 joergr
517  * Added method to extract embedded overlay planes from pixel data and store
518  * them in group (6xxx,3000) format.
519  *
520  * Revision 1.19 2001/06/01 15:49:49 meichel
521  * Updated copyright header
522  *
523  * Revision 1.18 2001/05/14 09:49:18 joergr
524  * Added support for "1 bit output" of overlay planes; useful to extract
525  * overlay planes from the pixel data and store them separately in the dataset.
526  *
527  * Revision 1.17 2000/03/08 16:24:22 meichel
528  * Updated copyright header.
529  *
530  * Revision 1.16 1999/10/20 10:34:04 joergr
531  * Enhanced method getOverlayData to support 12 bit data for print.
532  *
533  * Revision 1.15 1999/09/17 12:46:05 joergr
534  * Added/changed/completed DOC++ style comments in the header files.
535  * Splitted file diovlay.h into two files (one for each class).
536  *
537  * Revision 1.14 1999/08/25 16:41:54 joergr
538  * Added new feature: Allow clipping region to be outside the image
539  * (overlapping).
540  *
541  * Revision 1.13 1999/05/03 11:09:30 joergr
542  * Minor code purifications to keep Sun CC 2.0.1 quiet.
543  *
544  * Revision 1.12 1999/04/29 16:46:46 meichel
545  * Minor code purifications to keep DEC cxx 6 quiet.
546  *
547  * Revision 1.11 1999/03/24 17:20:19 joergr
548  * Added/Modified comments and formatting.
549  *
550  * Revision 1.10 1999/03/22 08:52:17 joergr
551  * Added parameter to specify (transparent) background color for method
552  * getOverlayData().
553  *
554  * Revision 1.9 1999/02/08 12:39:50 joergr
555  * Corrected some typos and formatting.
556  *
557  * Revision 1.8 1999/02/03 17:33:51 joergr
558  * Added support for calibration according to Barten transformation (incl.
559  * a DISPLAY file describing the monitor characteristic).
560  *
561  * Revision 1.7 1998/12/23 13:21:29 joergr
562  * Changed parameter type (long to int) to avoid warning reported by MSVC5.
563  *
564  * Revision 1.6 1998/12/23 11:36:28 joergr
565  * Changed order of parameters for addOverlay() and getOverlayData().
566  * Corrected bug concerning additional overlay planes.
567  *
568  * Revision 1.5 1998/12/22 14:35:30 joergr
569  * Added method to check whether plane is visible, to get plane mode and to
570  * remove all planes. Set 'value' used for getOverlay/PlaneData().
571  * Changed meaning of return values (differentiate between different value
572  * for 'true').
573  *
574  * Revision 1.4 1998/12/16 16:37:50 joergr
575  * Added method to export overlay planes (create 8-bit bitmap).
576  * Implemented flipping and rotation of overlay planes.
577  *
578  * Revision 1.3 1998/12/14 17:27:35 joergr
579  * Added methods to add and remove additional overlay planes (still untested).
580  * Added methods to support overlay labels and descriptions.
581  *
582  * Revision 1.2 1998/11/30 12:24:26 joergr
583  * Removed wrong 'inline' from method declaration (reported by MSVC5).
584  *
585  * Revision 1.1 1998/11/27 15:42:39 joergr
586  * Added copyright message.
587  * Added method to detach pixel data if it is no longer needed.
588  * Replaced delete by delete[] for array types.
589  * Added methods and constructors for flipping and rotating, changed for
590  * scaling and clipping.
591  *
592  * Revision 1.5 1998/07/01 08:39:26 joergr
593  * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
594  * options), e.g. add copy constructors.
595  *
596  * Revision 1.4 1998/05/11 14:53:25 joergr
597  * Added CVS/RCS header to each file.
598  *
599  *
600  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2