00001 /* 00002 * 00003 * Copyright (C) 1998-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: dcmimage 00019 * 00020 * Author: Joerg Riesmeier 00021 * 00022 * Purpose: DicomColorCopyTemplate (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:01:28 $ 00026 * CVS/RCS Revision: $Revision: 1.11 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 00034 #ifndef DICOCPT_H 00035 #define DICOCPT_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/ofstd/ofbmanip.h" 00039 00040 #include "dcmtk/dcmimage/dicopxt.h" 00041 00042 00043 /*---------------------* 00044 * class declaration * 00045 *---------------------*/ 00046 00049 template<class T> 00050 class DiColorCopyTemplate 00051 : public DiColorPixelTemplate<T> 00052 { 00053 00054 public: 00055 00063 DiColorCopyTemplate(const DiColorPixel *pixel, 00064 const unsigned long fstart, 00065 const unsigned long fcount, 00066 const unsigned long fsize) 00067 : DiColorPixelTemplate<T>(pixel, fcount * fsize) 00068 { 00069 if ((pixel != NULL) && (pixel->getCount() > 0)) 00070 { 00071 if ((pixel->getCount() > fstart * fsize) && (pixel->getCount() >= (fstart + fcount) * fsize)) 00072 copy(OFstatic_cast(const T **, OFconst_cast(void *, pixel->getData())), fstart * fsize); 00073 } 00074 } 00075 00078 ~DiColorCopyTemplate() 00079 { 00080 } 00081 00082 00083 private: 00084 00090 inline void copy(const T *pixel[3], 00091 const unsigned long offset) 00092 { 00093 if (Init(pixel)) 00094 { 00095 for (int j = 0; j < 3; j++) 00096 OFBitmanipTemplate<T>::copyMem(pixel[j] + offset, this->Data[j], this->getCount()); 00097 } 00098 } 00099 }; 00100 00101 00102 #endif 00103 00104 00105 /* 00106 * 00107 * CVS/RCS Log: 00108 * $Log: dicocpt.h,v $ 00109 * Revision 1.11 2005/12/08 16:01:28 meichel 00110 * Changed include path schema for all DCMTK header files 00111 * 00112 * Revision 1.10 2004/04/21 10:00:31 meichel 00113 * Minor modifications for compilation with gcc 3.4.0 00114 * 00115 * Revision 1.9 2004/02/06 11:18:18 joergr 00116 * Distinguish more clearly between const and non-const access to pixel data. 00117 * 00118 * Revision 1.8 2003/12/23 11:18:26 joergr 00119 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00120 * Removed leading underscore characters from preprocessor symbols (reserved 00121 * symbols). Updated copyright header. 00122 * 00123 * Revision 1.7 2001/11/09 16:40:45 joergr 00124 * Updated/Enhanced comments. 00125 * 00126 * Revision 1.6 2001/06/01 15:49:27 meichel 00127 * Updated copyright header 00128 * 00129 * Revision 1.5 2000/12/08 14:06:01 joergr 00130 * Added new checking routines to avoid crashes when processing corrupted image 00131 * data. 00132 * 00133 * Revision 1.4 2000/03/08 16:21:49 meichel 00134 * Updated copyright header. 00135 * 00136 * Revision 1.3 1999/04/28 12:51:56 joergr 00137 * Corrected some typos, comments and formatting. 00138 * 00139 * Revision 1.2 1999/01/20 14:38:30 joergr 00140 * Corrected some typos and formatting. 00141 * 00142 * Revision 1.1 1998/11/27 15:16:38 joergr 00143 * Added copyright message. 00144 * Introduced new method and corresponding classes to create a copy of a 00145 * dcmimage object (optional parameters: frame start and count). 00146 * 00147 * 00148 */