]> Creatis software - clitk.git/commitdiff
Possibility to add a VTK image to vvImage
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 20 Dec 2011 17:24:01 +0000 (18:24 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 20 Dec 2011 17:24:01 +0000 (18:24 +0100)
common/vvImage.cxx
common/vvImage.h

index 9a6fc8ff489f39c1d661b1a55940a46253d3a2c3..0bddb262cb7a4f8ce70d204d8be1750e3ae35f0c 100644 (file)
@@ -63,6 +63,27 @@ void vvImage::Reset()
 }
 //--------------------------------------------------------------------
 
+//--------------------------------------------------------------------
+void vvImage::AddVtkImage(vtkImageData* input)
+{
+  // RP: 20/12/2011
+  // Note that we're simply adding a new image to the vector.
+  // mItkToVtkConverters is therefore not being updated, but 
+  // up to here it's not being used anyway...
+  mImageDimension = 0;
+  int* extent = input->GetWholeExtent();
+  if (extent[4] != extent[5])
+    mImageDimension = 3;
+  else if (extent[3] != extent[4])
+    mImageDimension = 2;
+  else if (extent[0] != extent[1])
+    mImageDimension = 1;
+  
+  mVtkImages.push_back(input);
+}
+
+//--------------------------------------------------------------------
+
 //--------------------------------------------------------------------
 int vvImage::GetNumberOfSpatialDimensions()
 {
index e48dbfa323b8a70b2e387227eced9212b33550f4..ec01a1ffbe40d67f0f8b6a095f8cd56a80edacef 100644 (file)
@@ -40,6 +40,7 @@ public :
   void Init();
   void Reset();
   template<class TItkImageType> void AddItkImage(TItkImageType *input);
+  void AddVtkImage(vtkImageData* input);
   const std::vector<vtkImageData*>& GetVTKImages();
   vtkImageData* GetFirstVTKImageData();
   int GetNumberOfDimensions() const;