dcmimgle/include/dcmtk/dcmimgle/dimocpt.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: DicomMonochromeCopyTemplate (Header)
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:16:26 $
00022  *  CVS/RCS Revision: $Revision: 1.15 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 
00030 #ifndef DIMOCPT_H
00031 #define DIMOCPT_H
00032 
00033 #include "dcmtk/config/osconfig.h"
00034 #include "dcmtk/ofstd/ofbmanip.h"
00035 #include "dcmtk/ofstd/ofcast.h"
00036 
00037 #include "dcmtk/dcmimgle/dimopxt.h"
00038 
00039 
00040 /*---------------------*
00041  *  class declaration  *
00042  *---------------------*/
00043 
00046 template<class T>
00047 class DiMonoCopyTemplate
00048   : public DiMonoPixelTemplate<T>
00049 {
00050 
00051  public:
00052 
00060     DiMonoCopyTemplate(const DiMonoPixel *pixel,
00061                        const unsigned long fstart,
00062                        const unsigned long fcount,
00063                        const unsigned long fsize)
00064       : DiMonoPixelTemplate<T>(pixel, fcount * fsize)
00065     {
00066         if ((pixel != NULL) && (pixel->getCount() > 0))
00067         {
00068             if ((pixel->getCount() > fstart * fsize) && (pixel->getCount() >= (fstart + fcount) * fsize))
00069                 copy(OFstatic_cast(const T *, pixel->getData()) + fstart * fsize);
00070             /* need to determine the global min/max value */
00071             this->determineMinMax();
00072         }
00073     }
00074 
00077     ~DiMonoCopyTemplate()
00078     {
00079     }
00080 
00081 
00082  private:
00083 
00088     inline void copy(const T *pixel)
00089     {
00090         if (pixel != NULL)
00091         {
00092             this->Data = new T[this->getCount()];
00093             if (this->Data != NULL)
00094                 OFBitmanipTemplate<T>::copyMem(pixel, this->Data, this->getCount());
00095         }
00096     }
00097 };
00098 
00099 
00100 #endif
00101 
00102 
00103 /*
00104  *
00105  * CVS/RCS Log:
00106  * $Log: dimocpt.h,v $
00107  * Revision 1.15  2010-10-14 13:16:26  joergr
00108  * Updated copyright header. Added reference to COPYRIGHT file.
00109  *
00110  * Revision 1.14  2010-03-01 09:08:47  uli
00111  * Removed some unnecessary include directives in the headers.
00112  *
00113  * Revision 1.13  2007-12-10 16:11:53  joergr
00114  * Fixed compilation problem with gcc 4.1.2 on Linux x86_64.
00115  *
00116  * Revision 1.12  2007/02/08 17:10:27  joergr
00117  * Need to determine global min/max value after copying pixel data.
00118  *
00119  * Revision 1.11  2005/12/08 16:47:48  meichel
00120  * Changed include path schema for all DCMTK header files
00121  *
00122  * Revision 1.10  2004/04/21 10:00:36  meichel
00123  * Minor modifications for compilation with gcc 3.4.0
00124  *
00125  * Revision 1.9  2003/12/08 18:26:50  joergr
00126  * Adapted type casts to new-style typecast operators defined in ofcast.h.
00127  * Removed leading underscore characters from preprocessor symbols (reserved
00128  * symbols). Updated copyright header.
00129  *
00130  * Revision 1.8  2001/06/01 15:49:44  meichel
00131  * Updated copyright header
00132  *
00133  * Revision 1.7  2000/09/12 10:04:44  joergr
00134  * Corrected bug: wrong parameter for attribute search routine led to crashes
00135  * when multiple pixel data attributes were contained in the dataset (e.g.
00136  * IconImageSequence). Added new checking routines to avoid crashes when
00137  * processing corrupted image data.
00138  *
00139  * Revision 1.6  2000/03/08 16:24:18  meichel
00140  * Updated copyright header.
00141  *
00142  * Revision 1.5  1999/09/17 12:23:56  joergr
00143  * Added/changed/completed DOC++ style comments in the header files.
00144  *
00145  * Revision 1.4  1999/04/28 14:49:19  joergr
00146  * Changed comments/formatting.
00147  *
00148  * Revision 1.2  1999/02/11 16:01:56  joergr
00149  * Corrected some typos and formatting.
00150  *
00151  * Revision 1.1  1998/11/27 15:15:50  joergr
00152  * Added copyright message.
00153  * Introduced new method and corresponding classes to create a copy of a
00154  * dcmimage object (optional parameters: frame start and count).
00155  *
00156  *
00157  */


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