dcmimage/include/dcmtk/dcmimage/dicosct.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:  dcmimage
00015  *
00016  *  Author:  Joerg Riesmeier
00017  *
00018  *  Purpose: DicomColorScaleTemplate (Header)
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:16:29 $
00022  *  CVS/RCS Revision: $Revision: 1.21 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 
00030 #ifndef DICOSCT_H
00031 #define DICOSCT_H
00032 
00033 #include "dcmtk/config/osconfig.h"
00034 
00035 #include "dcmtk/dcmimage/dicopxt.h"
00036 #include "dcmtk/dcmimgle/discalet.h"
00037 
00038 
00039 /*---------------------*
00040  *  class declaration  *
00041  *---------------------*/
00042 
00045 template<class T>
00046 class DiColorScaleTemplate
00047   : public DiColorPixelTemplate<T>,
00048     protected DiScaleTemplate<T>
00049 {
00050 
00051  public:
00052 
00068     DiColorScaleTemplate(const DiColorPixel *pixel,
00069                          const Uint16 columns,
00070                          const Uint16 rows,
00071                          const signed long left_pos,
00072                          const signed long top_pos,
00073                          const Uint16 src_cols,
00074                          const Uint16 src_rows,
00075                          const Uint16 dest_cols,
00076                          const Uint16 dest_rows,
00077                          const Uint32 frames,
00078                          const int bits,
00079                          const int interpolate)
00080       : DiColorPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames),
00081         DiScaleTemplate<T>(3, columns, rows, left_pos, top_pos, src_cols, src_rows, dest_cols, dest_rows, frames, bits)
00082    {
00083         if ((pixel != NULL) && (pixel->getCount() > 0))
00084         {
00085             if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames)
00086                 scale(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), interpolate);
00087             else {
00088                 DCMIMAGE_WARN("could not scale image ... corrupted data");
00089             }
00090         }
00091     }
00092 
00095     virtual ~DiColorScaleTemplate()
00096     {
00097     }
00098 
00099 
00100  private:
00101 
00107     inline void scale(const T *pixel[3],
00108                       const int interpolate)
00109     {
00110         if (Init(pixel))
00111             scaleData(pixel, this->Data, interpolate);
00112     }
00113 };
00114 
00115 
00116 #endif
00117 
00118 
00119 /*
00120  *
00121  * CVS/RCS Log:
00122  * $Log: dicosct.h,v $
00123  * Revision 1.21  2010-10-14 13:16:29  joergr
00124  * Updated copyright header. Added reference to COPYRIGHT file.
00125  *
00126  * Revision 1.20  2010-03-01 09:08:46  uli
00127  * Removed some unnecessary include directives in the headers.
00128  *
00129  * Revision 1.19  2009-10-14 10:25:13  joergr
00130  * Fixed minor issues in log output. Also updated copyright date (if required).
00131  *
00132  * Revision 1.18  2009-10-13 14:08:33  uli
00133  * Switched to logging mechanism provided by the "new" oflog module
00134  *
00135  * Revision 1.17  2006-08-15 16:35:01  meichel
00136  * Updated the code in module dcmimage to correctly compile when
00137  *   all standard C++ classes remain in namespace std.
00138  *
00139  * Revision 1.16  2005/12/08 16:01:37  meichel
00140  * Changed include path schema for all DCMTK header files
00141  *
00142  * Revision 1.15  2004/04/21 10:00:31  meichel
00143  * Minor modifications for compilation with gcc 3.4.0
00144  *
00145  * Revision 1.14  2004/02/06 11:18:18  joergr
00146  * Distinguish more clearly between const and non-const access to pixel data.
00147  *
00148  * Revision 1.13  2003/12/23 11:45:54  joergr
00149  * Adapted type casts to new-style typecast operators defined in ofcast.h.
00150  * Removed leading underscore characters from preprocessor symbols (reserved
00151  * symbols). Updated copyright header.
00152  *
00153  * Revision 1.12  2002/12/09 13:37:52  joergr
00154  * Renamed parameter/local variable to avoid name clashes with global
00155  * declaration left and/or right (used for as iostream manipulators).
00156  *
00157  * Revision 1.11  2001/11/09 16:45:23  joergr
00158  * Updated/Enhanced comments.
00159  *
00160  * Revision 1.10  2001/06/01 15:49:30  meichel
00161  * Updated copyright header
00162  *
00163  * Revision 1.9  2000/12/08 14:06:02  joergr
00164  * Added new checking routines to avoid crashes when processing corrupted image
00165  * data.
00166  *
00167  * Revision 1.8  2000/03/08 16:21:52  meichel
00168  * Updated copyright header.
00169  *
00170  * Revision 1.7  1999/08/25 16:58:06  joergr
00171  * Added new feature: Allow clipping region to be outside the image
00172  * (overlapping).
00173  *
00174  * Revision 1.6  1999/04/28 12:52:00  joergr
00175  * Corrected some typos, comments and formatting.
00176  *
00177  * Revision 1.5  1998/11/27 13:51:07  joergr
00178  * Added copyright message.
00179  *
00180  * Revision 1.4  1998/05/11 14:53:14  joergr
00181  * Added CVS/RCS header to each file.
00182  *
00183  *
00184  */


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