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