dcmimgle/include/dcmtk/dcmimgle/dimoflt.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: DicomMonochromeFlipTemplate (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 DIMOFLT_H
00031 #define DIMOFLT_H
00032 
00033 #include "dcmtk/config/osconfig.h"
00034 #include "dcmtk/ofstd/oftypes.h"
00035 #include "dcmtk/ofstd/ofcast.h"
00036 
00037 #include "dcmtk/dcmimgle/dimopxt.h"
00038 #include "dcmtk/dcmimgle/diflipt.h"
00039 
00040 
00041 /*---------------------*
00042  *  class declaration  *
00043  *---------------------*/
00044 
00048 template<class T>
00049 class DiMonoFlipTemplate
00050   : public DiMonoPixelTemplate<T>,
00051     protected DiFlipTemplate<T>
00052 {
00053 
00054  public:
00055 
00065     DiMonoFlipTemplate(const DiMonoPixel *pixel,
00066                        const Uint16 columns,
00067                        const Uint16 rows,
00068                        const Uint32 frames,
00069                        const int horz,
00070                        const int vert)
00071       : DiMonoPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames),
00072         DiFlipTemplate<T>(1, columns, rows, frames)
00073     {
00074         if ((pixel != NULL) && (pixel->getCount() > 0))
00075         {
00076             if (pixel->getCount() == OFstatic_cast(unsigned long, columns) * OFstatic_cast(unsigned long, rows) * frames)
00077                 flip(OFstatic_cast(const T *, pixel->getData()), horz, vert);
00078             else {
00079                 DCMIMGLE_WARN("could not flip image ... corrupted data");
00080             }
00081         }
00082     }
00083 
00086     ~DiMonoFlipTemplate()
00087     {
00088     }
00089 
00090 
00091  private:
00092 
00099     inline void flip(const T *pixel,
00100                      const int horz,
00101                      const int vert)
00102     {
00103         if (pixel != NULL)
00104         {
00105             this->Data = new T[this->getCount()];
00106             if (this->Data != NULL)
00107             {
00108                 if (horz && vert)
00109                     flipHorzVert(&pixel, &this->Data);
00110                 else if (horz)
00111                     flipHorz(&pixel, &this->Data);
00112                 else if (vert)
00113                     flipVert(&pixel, &this->Data);
00114             }
00115         }
00116     }
00117 };
00118 
00119 
00120 #endif
00121 
00122 
00123 /*
00124  *
00125  * CVS/RCS Log:
00126  * $Log: dimoflt.h,v $
00127  * Revision 1.15  2010-10-14 13:16:26  joergr
00128  * Updated copyright header. Added reference to COPYRIGHT file.
00129  *
00130  * Revision 1.14  2010-03-01 09:08:47  uli
00131  * Removed some unnecessary include directives in the headers.
00132  *
00133  * Revision 1.13  2009-10-28 14:38:16  joergr
00134  * Fixed minor issues in log output.
00135  *
00136  * Revision 1.12  2009-10-28 09:53:40  uli
00137  * Switched to logging mechanism provided by the "new" oflog module.
00138  *
00139  * Revision 1.11  2006-08-15 16:30:11  meichel
00140  * Updated the code in module dcmimgle to correctly compile when
00141  *   all standard C++ classes remain in namespace std.
00142  *
00143  * Revision 1.10  2005/12/08 16:47:49  meichel
00144  * Changed include path schema for all DCMTK header files
00145  *
00146  * Revision 1.9  2004/04/21 10:00:36  meichel
00147  * Minor modifications for compilation with gcc 3.4.0
00148  *
00149  * Revision 1.8  2003/12/08 18:41:55  joergr
00150  * Adapted type casts to new-style typecast operators defined in ofcast.h.
00151  * Removed leading underscore characters from preprocessor symbols (reserved
00152  * symbols). Updated copyright header.
00153  *
00154  * Revision 1.7  2001/06/01 15:49:44  meichel
00155  * Updated copyright header
00156  *
00157  * Revision 1.6  2000/09/12 10:04:44  joergr
00158  * Corrected bug: wrong parameter for attribute search routine led to crashes
00159  * when multiple pixel data attributes were contained in the dataset (e.g.
00160  * IconImageSequence). Added new checking routines to avoid crashes when
00161  * processing corrupted image data.
00162  *
00163  * Revision 1.5  2000/03/08 16:24:18  meichel
00164  * Updated copyright header.
00165  *
00166  * Revision 1.4  1999/09/17 12:24:46  joergr
00167  * Added/changed/completed DOC++ style comments in the header files.
00168  *
00169  * Revision 1.3  1999/03/24 17:20:08  joergr
00170  * Added/Modified comments and formatting.
00171  *
00172  * Revision 1.2  1999/02/11 16:02:12  joergr
00173  * Corrected some typos and formatting.
00174  *
00175  * Revision 1.1  1998/11/27 14:57:47  joergr
00176  * Added copyright message.
00177  * Added methods and classes for flipping and rotating, changed for
00178  * scaling and clipping.
00179  *
00180  *
00181  */


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