dcmimgle/include/dcmtk/dcmimgle/diovlay.h

00001 /*
00002  *
00003  *  Copyright (C) 1996-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module:  dcmimgle
00015  *
00016  *  Author:  Joerg Riesmeier
00017  *
00018  *  Purpose: DicomOverlay (Header)
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:16:26 $
00022  *  CVS/RCS Revision: $Revision: 1.27 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 
00030 #ifndef DIOVLAY_H
00031 #define DIOVLAY_H
00032 
00033 #include "dcmtk/config/osconfig.h"
00034 #include "dcmtk/ofstd/ofcast.h"
00035 
00036 #include "dcmtk/dcmimgle/diobjcou.h"
00037 #include "dcmtk/dcmimgle/diovdat.h"
00038 #include "dcmtk/dcmimgle/diovpln.h"
00039 #include "dcmtk/dcmimgle/diutils.h"
00040 
00041 
00042 /*------------------------*
00043  *  forward declarations  *
00044  *------------------------*/
00045 
00046 class DiDocument;
00047 
00048 class DcmOverlayData;
00049 class DcmLongString;
00050 
00051 
00052 /*---------------------*
00053  *  class declaration  *
00054  *---------------------*/
00055 
00058 class DiOverlay
00059   : public DiObjectCounter
00060 {
00061 
00062  public:
00063 
00071     DiOverlay(const DiDocument *docu = NULL,
00072               const Uint16 alloc = 0,
00073               const Uint16 stored = 0,
00074               const Uint16 high = 0);
00075 
00084     DiOverlay(const DiOverlay *overlay,
00085               const signed long left_pos,
00086               const signed long top_pos,
00087               const double xfactor,
00088               const double yfactor);
00089 
00098     DiOverlay(const DiOverlay *overlay,
00099               const int horz,
00100               const int vert,
00101               const Uint16 columns,
00102               const Uint16 rows);
00103 
00111     DiOverlay(const DiOverlay *overlay,
00112               const int degree,
00113               const Uint16 columns,
00114               const Uint16 rows);
00115 
00118     virtual ~DiOverlay();
00119 
00126     int isPlaneVisible(unsigned int plane);
00127 
00134     int showPlane(unsigned int plane);
00135 
00145     int showPlane(unsigned int plane,
00146                   const double fore,
00147                   const double thresh,
00148                   const EM_Overlay mode);
00149 
00158     int showPlane(unsigned int plane,
00159                   const Uint16 pvalue);
00160 
00165     int showAllPlanes();
00166 
00175     int showAllPlanes(const double fore,
00176                       const double thresh,
00177                       const EM_Overlay mode);
00178 
00185     int hidePlane(unsigned int plane);
00186 
00191     int hideAllPlanes();
00192 
00201     int placePlane(unsigned int plane,
00202                    const signed int left_pos,
00203                    const signed int top_pos);
00204 
00211     unsigned int getPlaneGroupNumber(unsigned int plane) const;
00212 
00219     const char *getPlaneLabel(unsigned int plane) const;
00220 
00227     const char *getPlaneDescription(unsigned int plane) const;
00228 
00235     EM_Overlay getPlaneMode(unsigned int plane) const;
00236 
00241     inline unsigned int getCount() const
00242     {
00243         return (Data != NULL) ? Data->Count : 0;
00244     }
00245 
00251     inline signed long getLeft() const
00252     {
00253         return Left;
00254     }
00255 
00261     inline signed long getTop() const
00262     {
00263         return Top;
00264     }
00265 
00270     int hasEmbeddedData() const;
00271 
00289     int addPlane(const unsigned int group,
00290                  const signed int left_pos,
00291                  const signed int top_pos,
00292                  const unsigned int columns,
00293                  const unsigned int rows,
00294                  const DcmOverlayData &data,
00295                  const DcmLongString &label,
00296                  const DcmLongString &description,
00297                  const EM_Overlay mode);
00298 
00299 
00306     int removePlane(const unsigned int group);
00307 
00308     inline DiOverlayPlane *getPlane(const unsigned int plane) const
00309     {
00310         return ((Data != NULL) && (Data->Planes != NULL) && (plane < Data->Count)) ? Data->Planes[plane] : OFstatic_cast(DiOverlayPlane *, NULL);
00311     }
00312 
00320     inline int hasPlane(unsigned int plane,
00321                         const int visible = 0) const
00322     {
00323         return (convertToPlaneNumber(plane, AdditionalPlanes) > 1) && (!visible || Data->Planes[plane]->isVisible());
00324     }
00325 
00344     void *getPlaneData(const unsigned long frame,
00345                        unsigned int plane,
00346                        unsigned int &left_pos,
00347                        unsigned int &top_pos,
00348                        unsigned int &width,
00349                        unsigned int &height,
00350                        EM_Overlay &mode,
00351                        const Uint16 columns,
00352                        const Uint16 rows,
00353                        const int bits = 8,
00354                        const Uint16 fore = 0xff,
00355                        const Uint16 back = 0x0);
00356 
00370     void *getFullPlaneData(const unsigned long frame,
00371                            unsigned int plane,
00372                            unsigned int &width,
00373                            unsigned int &height,
00374                            const int bits = 8,
00375                            const Uint16 fore = 0xff,
00376                            const Uint16 back = 0x0);
00377 
00391     unsigned long create6xxx3000PlaneData(Uint8 *&buffer,
00392                                           unsigned int plane,
00393                                           unsigned int &width,
00394                                           unsigned int &height,
00395                                           unsigned long &frames);
00396 
00398     static const unsigned int MaxOverlayCount;
00400     static const unsigned int FirstOverlayGroup;
00401 
00402 
00403  protected:
00404 
00411     Uint16 *Init(const DiOverlay *overlay);
00412 
00423     int convertToPlaneNumber(unsigned int &plane,
00424                              const int mode) const;
00425 
00432     unsigned int convertToGroupNumber(const unsigned int plane) const
00433     {
00434         return FirstOverlayGroup + 2 * plane;
00435     }
00436 
00444     int isValidGroupNumber(const unsigned int group) const;
00445 
00454     int checkPlane(const unsigned int plane,
00455                    const int mode = 1);
00456 
00457 
00458  private:
00459 
00461     signed long Left;
00463     signed long Top;
00465     Uint16 Width;
00467     Uint16 Height;
00469     unsigned long Frames;
00470 
00472     int AdditionalPlanes;
00473 
00475     DiOverlayData *Data;
00476 
00477  // --- declarations to avoid compiler warnings
00478 
00479     DiOverlay(const DiOverlay &);
00480     DiOverlay &operator=(const DiOverlay &);
00481 };
00482 
00483 
00484 #endif
00485 
00486 
00487 /*
00488  *
00489  * CVS/RCS Log:
00490  * $Log: diovlay.h,v $
00491  * Revision 1.27  2010-10-14 13:16:26  joergr
00492  * Updated copyright header. Added reference to COPYRIGHT file.
00493  *
00494  * Revision 1.26  2010-03-01 09:08:47  uli
00495  * Removed some unnecessary include directives in the headers.
00496  *
00497  * Revision 1.25  2008-11-18 11:01:28  joergr
00498  * Fixed issue with incorrectly encoded overlay planes (wrong values for
00499  * OverlayBitsAllocated and OverlayBitPosition).
00500  *
00501  * Revision 1.24  2005/12/08 16:48:01  meichel
00502  * Changed include path schema for all DCMTK header files
00503  *
00504  * Revision 1.23  2003/12/08 19:32:14  joergr
00505  * Adapted type casts to new-style typecast operators defined in ofcast.h.
00506  * Removed leading underscore characters from preprocessor symbols (reserved
00507  * symbols). Updated CVS header.
00508  *
00509  * Revision 1.22  2003/06/12 15:08:34  joergr
00510  * Fixed inconsistent API documentation reported by Doxygen.
00511  *
00512  * Revision 1.21  2002/12/09 13:32:55  joergr
00513  * Renamed parameter/local variable to avoid name clashes with global
00514  * declaration left and/or right (used for as iostream manipulators).
00515  *
00516  * Revision 1.20  2001/09/28 13:09:59  joergr
00517  * Added method to extract embedded overlay planes from pixel data and store
00518  * them in group (6xxx,3000) format.
00519  *
00520  * Revision 1.19  2001/06/01 15:49:49  meichel
00521  * Updated copyright header
00522  *
00523  * Revision 1.18  2001/05/14 09:49:18  joergr
00524  * Added support for "1 bit output" of overlay planes; useful to extract
00525  * overlay planes from the pixel data and store them separately in the dataset.
00526  *
00527  * Revision 1.17  2000/03/08 16:24:22  meichel
00528  * Updated copyright header.
00529  *
00530  * Revision 1.16  1999/10/20 10:34:04  joergr
00531  * Enhanced method getOverlayData to support 12 bit data for print.
00532  *
00533  * Revision 1.15  1999/09/17 12:46:05  joergr
00534  * Added/changed/completed DOC++ style comments in the header files.
00535  * Splitted file diovlay.h into two files (one for each class).
00536  *
00537  * Revision 1.14  1999/08/25 16:41:54  joergr
00538  * Added new feature: Allow clipping region to be outside the image
00539  * (overlapping).
00540  *
00541  * Revision 1.13  1999/05/03 11:09:30  joergr
00542  * Minor code purifications to keep Sun CC 2.0.1 quiet.
00543  *
00544  * Revision 1.12  1999/04/29 16:46:46  meichel
00545  * Minor code purifications to keep DEC cxx 6 quiet.
00546  *
00547  * Revision 1.11  1999/03/24 17:20:19  joergr
00548  * Added/Modified comments and formatting.
00549  *
00550  * Revision 1.10  1999/03/22 08:52:17  joergr
00551  * Added parameter to specify (transparent) background color for method
00552  * getOverlayData().
00553  *
00554  * Revision 1.9  1999/02/08 12:39:50  joergr
00555  * Corrected some typos and formatting.
00556  *
00557  * Revision 1.8  1999/02/03 17:33:51  joergr
00558  * Added support for calibration according to Barten transformation (incl.
00559  * a DISPLAY file describing the monitor characteristic).
00560  *
00561  * Revision 1.7  1998/12/23 13:21:29  joergr
00562  * Changed parameter type (long to int) to avoid warning reported by MSVC5.
00563  *
00564  * Revision 1.6  1998/12/23 11:36:28  joergr
00565  * Changed order of parameters for addOverlay() and getOverlayData().
00566  * Corrected bug concerning additional overlay planes.
00567  *
00568  * Revision 1.5  1998/12/22 14:35:30  joergr
00569  * Added method to check whether plane is visible, to get plane mode and to
00570  * remove all planes. Set 'value' used for getOverlay/PlaneData().
00571  * Changed meaning of return values (differentiate between different value
00572  * for 'true').
00573  *
00574  * Revision 1.4  1998/12/16 16:37:50  joergr
00575  * Added method to export overlay planes (create 8-bit bitmap).
00576  * Implemented flipping and rotation of overlay planes.
00577  *
00578  * Revision 1.3  1998/12/14 17:27:35  joergr
00579  * Added methods to add and remove additional overlay planes (still untested).
00580  * Added methods to support overlay labels and descriptions.
00581  *
00582  * Revision 1.2  1998/11/30 12:24:26  joergr
00583  * Removed wrong 'inline' from method declaration (reported by MSVC5).
00584  *
00585  * Revision 1.1  1998/11/27 15:42:39  joergr
00586  * Added copyright message.
00587  * Added method to detach pixel data if it is no longer needed.
00588  * Replaced delete by delete[] for array types.
00589  * Added methods and constructors for flipping and rotating, changed for
00590  * scaling and clipping.
00591  *
00592  * Revision 1.5  1998/07/01 08:39:26  joergr
00593  * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional
00594  * options), e.g. add copy constructors.
00595  *
00596  * Revision 1.4  1998/05/11 14:53:25  joergr
00597  * Added CVS/RCS header to each file.
00598  *
00599  *
00600  */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1