GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmImageChangePlanarConfiguration.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMIMAGECHANGEPLANARCONFIGURATION_H
15 #define GDCMIMAGECHANGEPLANARCONFIGURATION_H
16
17 #include "gdcmImageToImageFilter.h"
18
19 namespace gdcm
20 {
21
22 class DataElement;
28 class GDCM_EXPORT ImageChangePlanarConfiguration : public ImageToImageFilter
29 {
30 public:
31 ImageChangePlanarConfiguration():PlanarConfiguration(0) {}
32 ~ImageChangePlanarConfiguration() {}
33
35 void SetPlanarConfiguration(unsigned int pc) { PlanarConfiguration = pc; }
36 unsigned int GetPlanarConfiguration() const { return PlanarConfiguration; }
37
40 template <typename T>
41 static size_t RGBPlanesToRGBPixels(T *out, const T *r, const T *g, const T *b, size_t s);
42
46 template <typename T>
47 static size_t RGBPixelsToRGBPlanes(T *r, T *g, T *b, const T* rgb, size_t s);
48
50 bool Change();
51
52 protected:
53
54 private:
55 unsigned int PlanarConfiguration;
56 };
57
58 template <typename T>
59 size_t ImageChangePlanarConfiguration::RGBPlanesToRGBPixels(T *out, const T *r, const T *g, const T *b, size_t s)
60 {
61 T *pout = out;
62 for(size_t i = 0; i < s; ++i )
63 {
64 *pout++ = *r++;
65 *pout++ = *g++;
66 *pout++ = *b++;
67 }
68
69 assert( (size_t)(pout - out) == 3 * s * sizeof(T) );
70 return pout - out;
71 }
72
73 template <typename T>
74 size_t ImageChangePlanarConfiguration::RGBPixelsToRGBPlanes(T *r, T *g, T *b, const T *rgb, size_t s)
75 {
76 const T *prgb = rgb;
77 for(size_t i = 0; i < s; ++i )
78 {
79 *r++ = *prgb++;
80 *g++ = *prgb++;
81 *b++ = *prgb++;
82 }
83 assert( (size_t)(prgb - rgb) == 3 * s * sizeof(T) );
84 return prgb - rgb;
85 }
86
87
88 } // end namespace gdcm
89
90 #endif //GDCMIMAGECHANGEPLANARCONFIGURATION_H