diovlay.h

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


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5