]> Creatis software - clitk.git/commitdiff
Enable resliced images, put in mTransformedVtkImages
authorsrit <srit>
Wed, 2 Mar 2011 18:29:09 +0000 (18:29 +0000)
committersrit <srit>
Wed, 2 Mar 2011 18:29:09 +0000 (18:29 +0000)
common/vvImage.cxx
common/vvImage.h
common/vvImage.txx

index 951c2b36a4221c60d31e1217bf4a489273598db5..1f5116849cb711a73cc80cfa19954c1bcfd7c6ab 100644 (file)
@@ -32,8 +32,6 @@
 // std
 #include <cassert>
 
-#define NO_RESLICE 1
-
 //--------------------------------------------------------------------
 vvImage::vvImage():mTransform(vtkSmartPointer<vtkTransform>::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<vtkImageData*>& vvImage::GetVTKImages()
 }
 //--------------------------------------------------------------------
 
+//--------------------------------------------------------------------
+const std::vector<vtkImageData*>& vvImage::GetTransformedVTKImages()
+{
+  return mTransformedVtkImages;
+}
+//--------------------------------------------------------------------
+
 //--------------------------------------------------------------------
 vtkImageData* vvImage::GetFirstVTKImageData()
 {
index f76d2a1321d8c28849d3cd15d49b92b2382e8bd2..5c38f31089e554844536385b45c112854899b5a5 100644 (file)
@@ -42,6 +42,7 @@ public :
   void Reset();
   template<class TItkImageType> void AddItkImage(TItkImageType *input);
   const std::vector<vtkImageData*>& GetVTKImages();
+  const std::vector<vtkImageData*>& GetTransformedVTKImages();
   vtkImageData* GetFirstVTKImageData();
   int GetNumberOfDimensions() const;
   int GetNumberOfSpatialDimensions();
@@ -67,8 +68,11 @@ private:
 
   std::vector< ConverterPointer > mItkToVtkConverters;
   std::vector<vtkImageData*> mVtkImages;
+
   std::vector< vtkSmartPointer<vtkImageReslice> > mVtkImageReslice;
   vtkSmartPointer<vtkTransform> mTransform;
+  std::vector<vtkImageData*> mTransformedVtkImages;
+
   double mTimeOrigin;
   double mTimeSpacing;
   unsigned int mImageDimension;
index e73cd27fc4d22153365031d6654c897011b1296e..c0eda2082e75f756e44a7fa33caa828e8848e22b 100755 (executable)
@@ -7,20 +7,19 @@ void vvImage::AddItkImage(TItkImageType *input)
   mImageDimension = TItkImageType::ImageDimension; 
   typedef itk::ImageToVTKImageFilter <TItkImageType> 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<vtkImageReslice>::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<vtkImageReslice>::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) );
 }
 //--------------------------------------------------------------------