1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
23 #include <itkObjectFactory.h>
24 #include <itkProcessObject.h>
25 #include <itkMinimumMaximumImageCalculator.h>
26 #include <itkCastImageFilter.h>
28 #define VTK_EXCLUDE_STRSTREAM_HEADERS
29 #include <vtkSmartPointer.h>
30 #include <vtkTransform.h>
34 //------------------------------------------------------------------------------
35 class vvImage : public itk::LightObject
39 typedef itk::SmartPointer<Self> Pointer;
40 typedef itk::ProcessObject::Pointer ConverterPointer;
43 struct DimensionDispatchBase {};
44 template< unsigned int VDimension >
45 struct DimensionDispatch:public DimensionDispatchBase {};
49 template<class TItkImageType> void AddItkImage(TItkImageType *input);
50 void AddVtkImage(vtkImageData* input);
51 const std::vector<vtkImageData*>& GetVTKImages();
52 vtkImageData* GetFirstVTKImageData();
53 int GetNumberOfDimensions() const;
54 int GetNumberOfSpatialDimensions();
55 void GetScalarRange(double* range);
56 template<class TPixelType, unsigned int VImageDimension> void ComputeScalarRangeBase(itk::Image<TPixelType,VImageDimension> *input);
57 template<class TPixelType, unsigned int VImageDimension> void ComputeScalarRange(DimensionDispatchBase, itk::Image<TPixelType,VImageDimension> *input);
58 template<class TPixelType, unsigned int VImageDimension> void ComputeScalarRange(DimensionDispatch< 1 >, itk::Image<TPixelType,VImageDimension> *input);
59 unsigned long GetActualMemorySize();
60 std::vector<double> GetSpacing();
61 std::vector<double> GetOrigin() const;
62 std::vector<int> GetSize();
63 std::vector< std::vector<double> > GetDirection();
64 std::string GetScalarTypeAsITKString();
65 int GetNumberOfScalarComponents();
67 bool IsTimeSequence() const;
68 bool IsScalarTypeInteger();
69 bool IsScalarTypeInteger(int t);
70 const std::vector< vtkSmartPointer<vtkTransform> >& GetTransform();
71 void InitializeTransform();
72 void SetTimeSpacing(double s) { mTimeSpacing = s; }
73 void SetTimeOrigin(double o) { mTimeOrigin = o; }
74 bool HaveSameSizeAndSpacingThan(vvImage * other);
76 itk::MetaDataDictionary* GetFirstMetaDataDictionary();
82 std::vector< ConverterPointer > mItkToVtkConverters;
83 std::vector< vtkImageData* > mVtkImages;
84 std::vector< vtkSmartPointer<vtkTransform> > mTransform;
86 std::vector< itk::MetaDataDictionary* > mDictionary;
90 unsigned int mImageDimension;
93 //------------------------------------------------------------------------------
95 #include "vvImage.txx"