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: DicomMonochromeCopyTemplate (Header) 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:47:48 $ 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 DIMOCPT_H 00035 #define DIMOCPT_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/dcmdata/dctypes.h" 00039 #include "dcmtk/ofstd/ofbmanip.h" 00040 #include "dcmtk/ofstd/ofcast.h" 00041 00042 #include "dcmtk/dcmimgle/dimopxt.h" 00043 00044 00045 /*---------------------* 00046 * class declaration * 00047 *---------------------*/ 00048 00051 template<class T> 00052 class DiMonoCopyTemplate 00053 : public DiMonoPixelTemplate<T> 00054 { 00055 00056 public: 00057 00065 DiMonoCopyTemplate(const DiMonoPixel *pixel, 00066 const unsigned long fstart, 00067 const unsigned long fcount, 00068 const unsigned long fsize) 00069 : DiMonoPixelTemplate<T>(pixel, fcount * fsize) 00070 { 00071 if ((pixel != NULL) && (pixel->getCount() > 0)) 00072 { 00073 if ((pixel->getCount() > fstart * fsize) && (pixel->getCount() >= (fstart + fcount) * fsize)) 00074 copy(OFstatic_cast(const T *, pixel->getData()) + fstart * fsize); 00075 } 00076 } 00077 00080 ~DiMonoCopyTemplate() 00081 { 00082 } 00083 00084 00085 private: 00086 00091 inline void copy(const T *pixel) 00092 { 00093 if (pixel != NULL) 00094 { 00095 this->Data = new T[this->getCount()]; 00096 if (this->Data != NULL) 00097 OFBitmanipTemplate<T>::copyMem(pixel, this->Data, this->getCount()); 00098 } 00099 } 00100 }; 00101 00102 00103 #endif 00104 00105 00106 /* 00107 * 00108 * CVS/RCS Log: 00109 * $Log: dimocpt.h,v $ 00110 * Revision 1.11 2005/12/08 16:47:48 meichel 00111 * Changed include path schema for all DCMTK header files 00112 * 00113 * Revision 1.10 2004/04/21 10:00:36 meichel 00114 * Minor modifications for compilation with gcc 3.4.0 00115 * 00116 * Revision 1.9 2003/12/08 18:26:50 joergr 00117 * Adapted type casts to new-style typecast operators defined in ofcast.h. 00118 * Removed leading underscore characters from preprocessor symbols (reserved 00119 * symbols). Updated copyright header. 00120 * 00121 * Revision 1.8 2001/06/01 15:49:44 meichel 00122 * Updated copyright header 00123 * 00124 * Revision 1.7 2000/09/12 10:04:44 joergr 00125 * Corrected bug: wrong parameter for attribute search routine led to crashes 00126 * when multiple pixel data attributes were contained in the dataset (e.g. 00127 * IconImageSequence). Added new checking routines to avoid crashes when 00128 * processing corrupted image data. 00129 * 00130 * Revision 1.6 2000/03/08 16:24:18 meichel 00131 * Updated copyright header. 00132 * 00133 * Revision 1.5 1999/09/17 12:23:56 joergr 00134 * Added/changed/completed DOC++ style comments in the header files. 00135 * 00136 * Revision 1.4 1999/04/28 14:49:19 joergr 00137 * Changed comments/formatting. 00138 * 00139 * Revision 1.2 1999/02/11 16:01:56 joergr 00140 * Corrected some typos and formatting. 00141 * 00142 * Revision 1.1 1998/11/27 15:15:50 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 */