GDCM 3.0.24
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
18
19namespace gdcm
20{
21
22class DataElement;
29{
30public:
31 ImageChangePlanarConfiguration():PlanarConfiguration(0) {}
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
52protected:
53
54private:
55 unsigned int PlanarConfiguration;
56};
57
58template <typename T>
59size_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 );
70 return pout - out;
71}
72
73template <typename T>
74size_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 );
84 return prgb - rgb;
85}
86
87
88} // end namespace gdcm
89
90#endif //GDCMIMAGECHANGEPLANARCONFIGURATION_H
ImageChangePlanarConfiguration class.
Definition gdcmImageChangePlanarConfiguration.h:29
ImageChangePlanarConfiguration()
Definition gdcmImageChangePlanarConfiguration.h:31
static size_t RGBPlanesToRGBPixels(T *out, const T *r, const T *g, const T *b, size_t s)
Definition gdcmImageChangePlanarConfiguration.h:59
unsigned int GetPlanarConfiguration() const
Definition gdcmImageChangePlanarConfiguration.h:36
static size_t RGBPixelsToRGBPlanes(T *r, T *g, T *b, const T *rgb, size_t s)
Definition gdcmImageChangePlanarConfiguration.h:74
void SetPlanarConfiguration(unsigned int pc)
Set/Get requested PlanarConfigation.
Definition gdcmImageChangePlanarConfiguration.h:35
ImageToImageFilter class.
Definition gdcmImageToImageFilter.h:28
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21