]> Creatis software - clitk.git/blob - common/vvImage.h
38348eece3d2db2ecc67ea8bf28d1d5f41cec4d9
[clitk.git] / common / vvImage.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
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 copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef VVIMAGE_H
19 #define VVIMAGE_H
20
21 #include <iostream>
22 #include <vector>
23 #include <itkObjectFactory.h>
24 #include <vtkSmartPointer.h>
25
26 class vtkImageData;
27 class vtkImageReslice;
28 class vtkTransform;
29 class vtkImageReslice;
30 class vtkAbstractTransform;
31
32 class vvImage : public itk::LightObject
33 {
34 public :
35   typedef vvImage Self;
36   typedef itk::SmartPointer<Self> Pointer;
37   itkNewMacro(Self);
38
39   void Init();
40   void Reset();
41
42   void SetImage(std::vector<vtkImageData*> images);
43   void AddImage(vtkImageData* image);
44   const std::vector<vtkImageData*>& GetVTKImages();
45   vtkImageData* GetFirstVTKImageData();
46
47   int GetNumberOfDimensions() const;
48   int GetNumberOfSpatialDimensions();
49   ///Writes the scalar range to the provided array, which must have room for two doubles
50   void GetScalarRange(double* range);
51   unsigned long GetActualMemorySize();
52   std::vector<double> GetSpacing();
53   std::vector<double> GetOrigin() const;
54   std::vector<int> GetSize();
55   std::string GetScalarTypeAsString();
56   int GetNumberOfScalarComponents();
57   int GetScalarSize();
58   bool IsTimeSequence();
59   bool IsScalarTypeInteger();
60   bool IsScalarTypeInteger(int t);
61
62   vtkSmartPointer<vtkTransform> GetTransform();
63   void SetTransform(vtkSmartPointer<vtkTransform> transform);
64
65   void SetTimeSpacing(double s) {
66     mTimeSpacing = s;
67   }
68   void SetTimeOrigin(double o) {
69     mTimeOrigin = o;
70   }
71
72   void UpdateReslice();
73
74 private:
75   vvImage();
76   ~vvImage();
77
78   std::vector<vtkImageData*> mVtkImages;
79   std::vector< vtkSmartPointer<vtkImageReslice> > mVtkImageReslice;
80   vtkSmartPointer<vtkTransform> mTransform;
81   double mTimeOrigin;
82   double mTimeSpacing;
83 };
84
85 #endif