X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FvvImage.h;h=cbb0284ce0e925f706032825c7e8888da7744987;hb=d55f025b18f68066a52b8f33c2dc6481e82c2580;hp=38348eece3d2db2ecc67ea8bf28d1d5f41cec4d9;hpb=916b360a5059598577cb44f87381ccb1f0514476;p=clitk.git diff --git a/common/vvImage.h b/common/vvImage.h index 38348ee..cbb0284 100644 --- a/common/vvImage.h +++ b/common/vvImage.h @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,72 +14,84 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #ifndef VVIMAGE_H #define VVIMAGE_H #include #include #include +#include +#include +#include + +#define VTK_EXCLUDE_STRSTREAM_HEADERS #include +#include class vtkImageData; -class vtkImageReslice; -class vtkTransform; -class vtkImageReslice; -class vtkAbstractTransform; +//------------------------------------------------------------------------------ class vvImage : public itk::LightObject { public : typedef vvImage Self; typedef itk::SmartPointer Pointer; + typedef itk::ProcessObject::Pointer ConverterPointer; itkNewMacro(Self); + + struct DimensionDispatchBase {}; + template< unsigned int VDimension > + struct DimensionDispatch:public DimensionDispatchBase {}; void Init(); void Reset(); - - void SetImage(std::vector images); - void AddImage(vtkImageData* image); + template void AddItkImage(TItkImageType *input); + void AddVtkImage(vtkImageData* input); const std::vector& GetVTKImages(); vtkImageData* GetFirstVTKImageData(); - int GetNumberOfDimensions() const; int GetNumberOfSpatialDimensions(); - ///Writes the scalar range to the provided array, which must have room for two doubles void GetScalarRange(double* range); + template void ComputeScalarRangeBase(itk::Image *input); + template void ComputeScalarRange(DimensionDispatchBase, itk::Image *input); + template void ComputeScalarRange(DimensionDispatch< 1 >, itk::Image *input); unsigned long GetActualMemorySize(); std::vector GetSpacing(); std::vector GetOrigin() const; std::vector GetSize(); - std::string GetScalarTypeAsString(); + std::vector< std::vector > GetDirection(); + std::string GetScalarTypeAsITKString(); int GetNumberOfScalarComponents(); int GetScalarSize(); - bool IsTimeSequence(); + bool IsTimeSequence() const; bool IsScalarTypeInteger(); bool IsScalarTypeInteger(int t); - - vtkSmartPointer GetTransform(); - void SetTransform(vtkSmartPointer transform); - - void SetTimeSpacing(double s) { - mTimeSpacing = s; - } - void SetTimeOrigin(double o) { - mTimeOrigin = o; - } - - void UpdateReslice(); + const std::vector< vtkSmartPointer >& GetTransform(); + void InitializeTransform(); + void SetTimeSpacing(double s) { mTimeSpacing = s; } + void SetTimeOrigin(double o) { mTimeOrigin = o; } + bool HaveSameSizeAndSpacingThan(vvImage * other); + //META DATA + itk::MetaDataDictionary* GetFirstMetaDataDictionary(); private: vvImage(); ~vvImage(); - std::vector mVtkImages; - std::vector< vtkSmartPointer > mVtkImageReslice; - vtkSmartPointer mTransform; + std::vector< ConverterPointer > mItkToVtkConverters; + std::vector< vtkImageData* > mVtkImages; + std::vector< vtkSmartPointer > mTransform; + //META DATA + std::vector< itk::MetaDataDictionary* > mDictionary; + double mTimeOrigin; double mTimeSpacing; + unsigned int mImageDimension; + double mrange[2]; }; +//------------------------------------------------------------------------------ + +#include "vvImage.txx" #endif