GDCM 3.2.1

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() = default;
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 gdcm_assert( (size_t)(pout - out) == 3 * s );
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 gdcm_assert( (size_t)(prgb - rgb) == 3 * s );
84 return prgb - rgb;
85}
86
87
88} // end namespace gdcm
89
90#endif //GDCMIMAGECHANGEPLANARCONFIGURATION_H
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::ImageChangePlanarConfiguration::~ImageChangePlanarConfiguration
~ImageChangePlanarConfiguration()=default
gdcm::ImageChangePlanarConfiguration::ImageChangePlanarConfiguration
ImageChangePlanarConfiguration()
Definition gdcmImageChangePlanarConfiguration.h:31
gdcm::ImageChangePlanarConfiguration::RGBPlanesToRGBPixels
static size_t RGBPlanesToRGBPixels(T *out, const T *r, const T *g, const T *b, size_t s)
Definition gdcmImageChangePlanarConfiguration.h:59
gdcm::ImageChangePlanarConfiguration::Change
bool Change()
Change.
gdcm::ImageChangePlanarConfiguration::GetPlanarConfiguration
unsigned int GetPlanarConfiguration() const
Definition gdcmImageChangePlanarConfiguration.h:36
gdcm::ImageChangePlanarConfiguration::RGBPixelsToRGBPlanes
static size_t RGBPixelsToRGBPlanes(T *r, T *g, T *b, const T *rgb, size_t s)
Definition gdcmImageChangePlanarConfiguration.h:74
gdcm::ImageChangePlanarConfiguration::SetPlanarConfiguration
void SetPlanarConfiguration(unsigned int pc)
Set/Get requested PlanarConfigation.
Definition gdcmImageChangePlanarConfiguration.h:35
gdcm::ImageToImageFilter::ImageToImageFilter
ImageToImageFilter()
gdcm_assert
#define gdcm_assert(cond)
Definition gdcmException.h:104
gdcmImageToImageFilter.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21