dimorot.h

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: DicomMonochromeRotateTemplate (Header)
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2005/12/08 16:47:57 $
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 DIMOROT_H
00035 #define DIMOROT_H
00036 
00037 #include "dcmtk/config/osconfig.h"
00038 #include "dcmtk/dcmdata/dctypes.h"
00039 #include "dcmtk/ofstd/ofcast.h"
00040 
00041 #include "dcmtk/dcmimgle/dimopxt.h"
00042 #include "dcmtk/dcmimgle/dirotat.h"
00043 
00044 
00045 /*---------------------*
00046  *  class declaration  *
00047  *---------------------*/
00048 
00052 template<class T>
00053 class DiMonoRotateTemplate
00054   : public DiMonoPixelTemplate<T>,
00055     protected DiRotateTemplate<T>
00056 {
00057 
00058  public:
00059 
00070     DiMonoRotateTemplate(const DiMonoPixel *pixel,
00071                          const Uint16 src_cols,
00072                          const Uint16 src_rows,
00073                          const Uint16 dest_cols,
00074                          const Uint16 dest_rows,
00075                          const Uint32 frames,
00076                          const int degree)
00077       : DiMonoPixelTemplate<T>(pixel, OFstatic_cast(unsigned long, dest_cols) * OFstatic_cast(unsigned long, dest_rows) * frames),
00078         DiRotateTemplate<T>(1, src_cols, src_rows, dest_cols, dest_rows, frames)
00079     {
00080         if ((pixel != NULL) && (pixel->getCount() > 0))
00081         {
00082             if (pixel->getCount() == OFstatic_cast(unsigned long, src_cols) * OFstatic_cast(unsigned long, src_rows) * frames)
00083                 rotate(OFstatic_cast(const T *, pixel->getData()), degree);
00084             else {
00085                 if (DicomImageClass::checkDebugLevel(DicomImageClass::DL_Warnings))
00086                 {
00087                    ofConsole.lockCerr() << "WARNING: could not rotate image ... corrupted data." << endl;
00088                    ofConsole.unlockCerr();
00089                 }
00090             }
00091         }
00092     }
00093 
00096     ~DiMonoRotateTemplate()
00097     {
00098     }
00099 
00100 
00101  private:
00102 
00108     inline void rotate(const T *pixel,
00109                        const int degree)
00110     {
00111         if (pixel != NULL)
00112         {
00113             this->Data = new T[DiMonoPixelTemplate<T>::getCount()];
00114             if (this->Data != NULL)
00115             {
00116                 if (degree == 90)
00117                     rotateRight(&pixel, &(this->Data));
00118                 else if (degree == 180)
00119                     rotateTopDown(&pixel, &(this->Data));
00120                 else if (degree == 270)
00121                     rotateLeft(&pixel, &(this->Data));
00122             }
00123         }
00124     }
00125 };
00126 
00127 
00128 #endif
00129 
00130 
00131 /*
00132  *
00133  * CVS/RCS Log:
00134  * $Log: dimorot.h,v $
00135  * Revision 1.11  2005/12/08 16:47:57  meichel
00136  * Changed include path schema for all DCMTK header files
00137  *
00138  * Revision 1.10  2004/04/21 10:00:36  meichel
00139  * Minor modifications for compilation with gcc 3.4.0
00140  *
00141  * Revision 1.9  2003/12/08 18:47:49  joergr
00142  * Adapted type casts to new-style typecast operators defined in ofcast.h.
00143  * Removed leading underscore characters from preprocessor symbols (reserved
00144  * symbols). Updated copyright header.
00145  *
00146  * Revision 1.8  2001/06/01 15:49:48  meichel
00147  * Updated copyright header
00148  *
00149  * Revision 1.7  2000/09/12 10:04:45  joergr
00150  * Corrected bug: wrong parameter for attribute search routine led to crashes
00151  * when multiple pixel data attributes were contained in the dataset (e.g.
00152  * IconImageSequence). Added new checking routines to avoid crashes when
00153  * processing corrupted image data.
00154  *
00155  * Revision 1.6  2000/03/08 16:24:21  meichel
00156  * Updated copyright header.
00157  *
00158  * Revision 1.5  1999/09/17 12:43:23  joergr
00159  * Added/changed/completed DOC++ style comments in the header files.
00160  *
00161  * Revision 1.4  1999/03/24 17:20:17  joergr
00162  * Added/Modified comments and formatting.
00163  *
00164  * Revision 1.3  1999/02/11 16:40:46  joergr
00165  * Corrected some typos and formatting.
00166  *
00167  * Revision 1.2  1998/12/14 17:26:26  joergr
00168  * Corrected a typo.
00169  *
00170  * Revision 1.1  1998/11/27 14:57:48  joergr
00171  * Added copyright message.
00172  * Added methods and classes for flipping and rotating, changed for
00173  * scaling and clipping.
00174  *
00175  *
00176  */


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5