# gdcmImage.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004   Module:  $URL$
    00005
    00006   Copyright (c) 2006-2009 Mathieu Malaterre
    00007   All rights reserved.
    00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00009
    00010      This software is distributed WITHOUT ANY WARRANTY; without even
    00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00012      PURPOSE.  See the above copyright notice for more information.
    00013
    00014 =========================================================================*/
    00015 #ifndef __gdcmImage_h
    00016 #define __gdcmImage_h
    00017
    00018 #include "gdcmPixmap.h"
    00019 #include "gdcmSwapCode.h"
    00020
    00021 #include <vector>
    00022
    00023 namespace gdcm
    00024 {
    00025
    00045 class GDCM_EXPORT Image : public Pixmap
    00046 {
    00047 public:
    00048   Image ():Spacing(),SC(),Intercept(0),Slope(1) {
    00049     //DirectionCosines.resize(6);
    00050   Origin.resize( 3 /*NumberOfDimensions*/ ); // fill with 0
    00051   DirectionCosines.resize( 6 ); // fill with 0
    00052   DirectionCosines[0] = 1;
    00053   DirectionCosines[4] = 1;
    00054   Spacing.resize( 3 /*NumberOfDimensions*/, 1 ); // fill with 1
    00055
    00056   }
    00057   ~Image() {}
    00058
    00062   const double *GetSpacing() const;
    00063   double GetSpacing(unsigned int idx) const;
    00064   void SetSpacing(const double *spacing);
    00065   void SetSpacing(unsigned int idx, double spacing);
    00066
    00069   const double *GetOrigin() const;
    00070   double GetOrigin(unsigned int idx) const;
    00071   void SetOrigin(const float *ori);
    00072   void SetOrigin(const double *ori);
    00073   void SetOrigin(unsigned int idx, double ori);
    00074
    00077   const double *GetDirectionCosines() const;
    00078   double GetDirectionCosines(unsigned int idx) const;
    00079   void SetDirectionCosines(const float *dircos);
    00080   void SetDirectionCosines(const double *dircos);
    00081   void SetDirectionCosines(unsigned int idx, double dircos);
    00082
    00084   void Print(std::ostream &os) const;
    00085
    00087   SwapCode GetSwapCode() const
    00088     {
    00089     return SC;
    00090     }
    00091   void SetSwapCode(SwapCode sc)
    00092     {
    00093     SC = sc;
    00094     }
    00095
    00096 //  Image(Image const&);
    00097 //  Image &operator= (Image const&);
    00098
    00100   void SetIntercept(double intercept) { Intercept = intercept; }
    00101   double GetIntercept() const { return Intercept; }
    00102
    00104   void SetSlope(double slope) { Slope = slope; }
    00105   double GetSlope() const { return Slope; }
    00106
    00107 private:
    00108   std::vector<double> Spacing;
    00109   std::vector<double> Origin;
    00110   std::vector<double> DirectionCosines;
    00111
    00112   // I believe the following 3 ivars can be derived from TS ...
    00113   SwapCode SC;
    00114   double Intercept;
    00115   double Slope;
    00116 };
    00117
    00123 } // end namespace gdcm
    00124
    00125 #endif //__gdcmImage_h
    00126