# 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-2010 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
    00049 class GDCM_EXPORT Image : public Pixmap
    00050 {
    00051 public:
    00052   Image ():Spacing(),SC(),Intercept(0),Slope(1) {
    00053     //DirectionCosines.resize(6);
    00054   Origin.resize( 3 /*NumberOfDimensions*/ ); // fill with 0
    00055   DirectionCosines.resize( 6 ); // fill with 0
    00056   DirectionCosines[0] = 1;
    00057   DirectionCosines[4] = 1;
    00058   Spacing.resize( 3 /*NumberOfDimensions*/, 1 ); // fill with 1
    00059
    00060   }
    00061   ~Image() {}
    00062
    00066   const double *GetSpacing() const;
    00067   double GetSpacing(unsigned int idx) const;
    00068   void SetSpacing(const double *spacing);
    00069   void SetSpacing(unsigned int idx, double spacing);
    00070
    00073   const double *GetOrigin() const;
    00074   double GetOrigin(unsigned int idx) const;
    00075   void SetOrigin(const float *ori);
    00076   void SetOrigin(const double *ori);
    00077   void SetOrigin(unsigned int idx, double ori);
    00078
    00081   const double *GetDirectionCosines() const;
    00082   double GetDirectionCosines(unsigned int idx) const;
    00083   void SetDirectionCosines(const float *dircos);
    00084   void SetDirectionCosines(const double *dircos);
    00085   void SetDirectionCosines(unsigned int idx, double dircos);
    00086
    00088   void Print(std::ostream &os) const;
    00089
    00091   SwapCode GetSwapCode() const
    00092     {
    00093     return SC;
    00094     }
    00095   void SetSwapCode(SwapCode sc)
    00096     {
    00097     SC = sc;
    00098     }
    00099
    00100 //  Image(Image const&);
    00101 //  Image &operator= (Image const&);
    00102
    00104   void SetIntercept(double intercept) { Intercept = intercept; }
    00105   double GetIntercept() const { return Intercept; }
    00106
    00108   void SetSlope(double slope) { Slope = slope; }
    00109   double GetSlope() const { return Slope; }
    00110
    00111 private:
    00112   std::vector<double> Spacing;
    00113   std::vector<double> Origin;
    00114   std::vector<double> DirectionCosines;
    00115
    00116   // I believe the following 3 ivars can be derived from TS ...
    00117   SwapCode SC;
    00118   double Intercept;
    00119   double Slope;
    00120 };
    00121
    00127 } // end namespace gdcm
    00128
    00129 #endif //GDCMIMAGE_H