]> Creatis software - clitk.git/blob - common/vvImage.h
Modified transform in vvImage. Now a vtkGeneralTransform which composes a vtkGridTran...
[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 vtkGeneralTransform;
29 class vtkTransform;
30 class vtkGridTransform;
31
32 //------------------------------------------------------------------------------
33 class vvImage : public itk::LightObject
34 {
35 public :
36   typedef vvImage Self;
37   typedef itk::SmartPointer<Self> Pointer;
38   itkNewMacro(Self);
39
40   void Init();
41   void Reset();
42   void SetImage(std::vector<vtkImageData*> images);
43   void AddImage(vtkImageData* image);
44   const std::vector<vtkImageData*>& GetVTKImages();
45   vtkImageData* GetFirstVTKImageData();
46   int GetNumberOfDimensions() const;
47   int GetNumberOfSpatialDimensions();
48   void GetScalarRange(double* range);
49   unsigned long GetActualMemorySize();
50   std::vector<double> GetSpacing();
51   std::vector<double> GetOrigin() const;
52   std::vector<int> GetSize();
53   std::string GetScalarTypeAsITKString();
54   int GetNumberOfScalarComponents();
55   int GetScalarSize();
56   bool IsTimeSequence();
57   bool IsScalarTypeInteger();
58   bool IsScalarTypeInteger(int t);
59   vtkSmartPointer<vtkTransform> GetTransform();
60   vtkSmartPointer<vtkGridTransform> GetGridTransform();
61   void SetTransform(vtkSmartPointer<vtkTransform> transform);
62   void SetTimeSpacing(double s) { mTimeSpacing = s; }
63   void SetTimeOrigin(double o) { mTimeOrigin = o; }
64   void UpdateReslice();
65
66 private:
67   vvImage();
68   ~vvImage();
69
70   std::vector<vtkImageData*> mVtkImages;
71   std::vector< vtkSmartPointer<vtkImageReslice> > mVtkImageReslice;
72   vtkSmartPointer<vtkGeneralTransform> mGeneralTransform;
73   vtkSmartPointer<vtkTransform> mTransform;
74   vtkSmartPointer<vtkGridTransform> mGridTransform;
75   double mTimeOrigin;
76   double mTimeSpacing;
77 };
78 //------------------------------------------------------------------------------
79
80 //------------------------------------------------------------------------------
81 vtkImageData * CopyAndCastToFloatFrom(vtkImageData * p);
82 //------------------------------------------------------------------------------
83
84 #endif