From: Romulo Pinho Date: Tue, 20 Dec 2011 17:24:01 +0000 (+0100) Subject: Possibility to add a VTK image to vvImage X-Git-Tag: v1.3.0~133 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=1a59b22f9105492f15d971d66f3ab29981e91ed6;p=clitk.git Possibility to add a VTK image to vvImage --- 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;