GDCM  2.2.6
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;
29 {
30 public:
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 
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
static size_t RGBPlanesToRGBPixels(T *out, const T *r, const T *g, const T *b, size_t s)
Definition: gdcmImageChangePlanarConfiguration.h:59
ImageChangePlanarConfiguration class Class to change the Planar configuration of an input DICOM By de...
Definition: gdcmImageChangePlanarConfiguration.h:28
ImageToImageFilter class Super class for all filter taking an image and producing an output image...
Definition: gdcmImageToImageFilter.h:27
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
static size_t RGBPixelsToRGBPlanes(T *r, T *g, T *b, const T *rgb, size_t s)
Definition: gdcmImageChangePlanarConfiguration.h:74
unsigned int GetPlanarConfiguration() const
Definition: gdcmImageChangePlanarConfiguration.h:36
ImageChangePlanarConfiguration()
Definition: gdcmImageChangePlanarConfiguration.h:31
~ImageChangePlanarConfiguration()
Definition: gdcmImageChangePlanarConfiguration.h:32
void SetPlanarConfiguration(unsigned int pc)
Set/Get requested PlanarConfigation.
Definition: gdcmImageChangePlanarConfiguration.h:35

Generated on Sat Dec 21 2013 05:56:17 for GDCM by doxygen 1.8.5
SourceForge.net Logo