From 1a59b22f9105492f15d971d66f3ab29981e91ed6 Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Tue, 20 Dec 2011 18:24:01 +0100 Subject: [PATCH] Possibility to add a VTK image to vvImage --- common/vvImage.cxx | 21 +++++++++++++++++++++ common/vvImage.h | 1 + 2 files changed, 22 insertions(+) diff --git a/common/vvImage.cxx b/common/vvImage.cxx index 9a6fc8f..0bddb26 100644 --- a/common/vvImage.cxx +++ b/common/vvImage.cxx @@ -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() { diff --git a/common/vvImage.h b/common/vvImage.h index e48dbfa..ec01a1f 100644 --- a/common/vvImage.h +++ b/common/vvImage.h @@ -40,6 +40,7 @@ public : void Init(); void Reset(); template void AddItkImage(TItkImageType *input); + void AddVtkImage(vtkImageData* input); const std::vector& GetVTKImages(); vtkImageData* GetFirstVTKImageData(); int GetNumberOfDimensions() const; -- 2.47.1