From: srit Date: Wed, 2 Mar 2011 18:29:09 +0000 (+0000) Subject: Enable resliced images, put in mTransformedVtkImages X-Git-Tag: v1.2.0~224 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c13d024475699d94ed1018a1e3be7cce91f1de97;p=clitk.git Enable resliced images, put in mTransformedVtkImages --- diff --git a/common/vvImage.cxx b/common/vvImage.cxx index 951c2b3..1f51168 100644 --- a/common/vvImage.cxx +++ b/common/vvImage.cxx @@ -32,8 +32,6 @@ // std #include -#define NO_RESLICE 1 - //-------------------------------------------------------------------- vvImage::vvImage():mTransform(vtkSmartPointer::New()) { @@ -63,6 +61,7 @@ vvImage::~vvImage() void vvImage::Reset() { mVtkImages.resize(0); + mTransformedVtkImages.resize(0); mVtkImageReslice.resize(0); Init(); @@ -73,11 +72,6 @@ void vvImage::Reset() int vvImage::GetNumberOfSpatialDimensions() { return mImageDimension; - // int dim=GetNumberOfDimensions(); - // if (IsTimeSequence()) - // return dim+1; - // else - // return dim; } //-------------------------------------------------------------------- @@ -89,14 +83,6 @@ int vvImage::GetNumberOfDimensions() const return mImageDimension+1; else return mImageDimension; - // int dimension = 3; - // int extent[6]; - // mVtkImages[0]->GetWholeExtent(extent); - // if (extent[5] - extent[4] >= 1) - // dimension++; - // // if (mVtkImages.size() > 1) - // // dimension++; - // return dimension; } return 0; } @@ -213,6 +199,13 @@ const std::vector& vvImage::GetVTKImages() } //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +const std::vector& vvImage::GetTransformedVTKImages() +{ + return mTransformedVtkImages; +} +//-------------------------------------------------------------------- + //-------------------------------------------------------------------- vtkImageData* vvImage::GetFirstVTKImageData() { diff --git a/common/vvImage.h b/common/vvImage.h index f76d2a1..5c38f31 100644 --- a/common/vvImage.h +++ b/common/vvImage.h @@ -42,6 +42,7 @@ public : void Reset(); template void AddItkImage(TItkImageType *input); const std::vector& GetVTKImages(); + const std::vector& GetTransformedVTKImages(); vtkImageData* GetFirstVTKImageData(); int GetNumberOfDimensions() const; int GetNumberOfSpatialDimensions(); @@ -67,8 +68,11 @@ private: std::vector< ConverterPointer > mItkToVtkConverters; std::vector mVtkImages; + std::vector< vtkSmartPointer > mVtkImageReslice; vtkSmartPointer mTransform; + std::vector mTransformedVtkImages; + double mTimeOrigin; double mTimeSpacing; unsigned int mImageDimension; diff --git a/common/vvImage.txx b/common/vvImage.txx index e73cd27..c0eda20 100755 --- a/common/vvImage.txx +++ b/common/vvImage.txx @@ -7,20 +7,19 @@ void vvImage::AddItkImage(TItkImageType *input) mImageDimension = TItkImageType::ImageDimension; typedef itk::ImageToVTKImageFilter ConverterType; typename ConverterType::Pointer converter = ConverterType::New(); + mItkToVtkConverters.push_back(dynamic_cast< itk::ProcessObject *>(converter.GetPointer())); converter->SetInput(input); converter->Update(); - - mItkToVtkConverters.push_back(dynamic_cast< itk::ProcessObject *>(converter.GetPointer())); - mVtkImages.push_back(converter->GetOutput()); + mVtkImages.push_back( converter->GetOutput() ); - //mVtkImageReslice.push_back(vtkSmartPointer::New()); - //mVtkImageReslice.back()->SetInterpolationModeToLinear(); - //mVtkImageReslice.back()->AutoCropOutputOn(); - //mVtkImageReslice.back()->SetBackgroundColor(-1000,-1000,-1000,1); - //mVtkImageReslice.back()->SetResliceTransform(mTransform); - //mVtkImageReslice.back()->SetInput(0, image); - //mVtkImageReslice.back()->Update(); - //mVtkImages.push_back( mVtkImageReslice.back()->GetOutput(0) ); + mVtkImageReslice.push_back(vtkSmartPointer::New()); + mVtkImageReslice.back()->SetInterpolationModeToLinear(); + mVtkImageReslice.back()->AutoCropOutputOn(); + mVtkImageReslice.back()->SetBackgroundColor(-1000,-1000,-1000,1); + mVtkImageReslice.back()->SetResliceTransform(mTransform); + mVtkImageReslice.back()->SetInput(0, converter->GetOutput()); + mVtkImageReslice.back()->UpdateInformation(); + mTransformedVtkImages.push_back( mVtkImageReslice.back()->GetOutput(0) ); } //--------------------------------------------------------------------