]> Creatis software - clitk.git/blob - common/vvImage.h
37fa547cf163b6dcae1e0f0a9c8e4383bcd10270
[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 <itkProcessObject.h>
25
26 #include <vtkImageReslice.h>
27 #include <vtkSmartPointer.h>
28 #include <vtkTransform.h>
29
30 class vtkImageData;
31
32 //------------------------------------------------------------------------------
33 class vvImage : public itk::LightObject
34 {
35 public :
36   typedef vvImage Self;
37   typedef itk::SmartPointer<Self> Pointer;
38   typedef itk::ProcessObject::Pointer ConverterPointer;
39   itkNewMacro(Self);
40
41   void Init();
42   void Reset();
43   template<class TItkImageType> void AddItkImage(TItkImageType *input);
44   const std::vector<vtkImageData*>& GetVTKImages();
45   const std::vector<vtkImageData*>& GetTransformedVTKImages();
46   vtkImageData* GetFirstVTKImageData();
47   int GetNumberOfDimensions() const;
48   int GetNumberOfSpatialDimensions();
49   void GetScalarRange(double* range);
50   unsigned long GetActualMemorySize();
51   std::vector<double> GetSpacing();
52   std::vector<double> GetOrigin() const;
53   std::vector<int> GetSize();
54   std::string GetScalarTypeAsITKString();
55   int GetNumberOfScalarComponents();
56   int GetScalarSize();
57   bool IsTimeSequence() const;
58   bool IsScalarTypeInteger();
59   bool IsScalarTypeInteger(int t);
60   vtkSmartPointer<vtkTransform> GetTransform();
61   void SetTimeSpacing(double s) { mTimeSpacing = s; }
62   void SetTimeOrigin(double o) { mTimeOrigin = o; }
63   void UpdateReslice();
64   bool HaveSameSizeAndSpacingThan(vvImage * other);
65
66 private:
67   vvImage();
68   ~vvImage();
69
70   std::vector< ConverterPointer > mItkToVtkConverters;
71   std::vector<vtkImageData*> mVtkImages;
72
73   std::vector< vtkSmartPointer<vtkImageReslice> > mVtkImageReslice;
74   vtkSmartPointer<vtkTransform> mTransform;
75   std::vector<vtkImageData*> mTransformedVtkImages;
76
77   double mTimeOrigin;
78   double mTimeSpacing;
79   unsigned int mImageDimension;
80 };
81 //------------------------------------------------------------------------------
82
83 #include "vvImage.txx"
84
85 #endif