#define VVIMAGE_CXX
#include "vvImage.h"
#include "clitkCommon.h"
-#include <vtkTransform.h>
#include <vtkImageData.h>
#include <vtkImageReslice.h>
#include <cassert>
+#include <vtkGeneralTransform.h>
+#include <vtkTransform.h>
+#include <vtkGridTransform.h>
+
//--------------------------------------------------------------------
-vvImage::vvImage()
+vvImage::vvImage():mGeneralTransform(vtkSmartPointer<vtkGeneralTransform>::New()),
+ mTransform (vtkSmartPointer<vtkTransform>::New()),
+ mGridTransform (vtkSmartPointer<vtkGridTransform>::New())
{
+ mGeneralTransform->Concatenate(mTransform);
+ mGeneralTransform->Concatenate(mGridTransform);
Init();
}
//--------------------------------------------------------------------
{
mTimeSpacing = 1;
mTimeOrigin = 0;
-
- if (CLITK_EXPERIMENTAL)
- mTransform = vtkSmartPointer<vtkTransform>::New();
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
void vvImage::Reset()
{
- if (CLITK_EXPERIMENTAL)
- for (unsigned int i = 0; i < mVtkImages.size(); i++)
- mVtkImageReslice[i]->GetInput(0)->Delete();
- else
- for (unsigned int i = 0; i < mVtkImages.size(); i++)
- mVtkImages[i]->Delete();
+ for (unsigned int i = 0; i < mVtkImages.size(); i++)
+ mVtkImageReslice[i]->GetInput()->Delete();
mVtkImages.resize(0);
mVtkImageReslice.resize(0);
}
//--------------------------------------------------------------------
-
//--------------------------------------------------------------------
void vvImage::SetImage(std::vector< vtkImageData* > images)
{
//--------------------------------------------------------------------
void vvImage::AddImage(vtkImageData* image)
{
- if (CLITK_EXPERIMENTAL) {
- 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) );
- } else
- mVtkImages.push_back(image);
+ mVtkImageReslice.push_back(vtkSmartPointer<vtkImageReslice>::New());
+
+ mVtkImageReslice.back()->SetInterpolationModeToLinear();
+ mVtkImageReslice.back()->AutoCropOutputOn();
+ mVtkImageReslice.back()->SetBackgroundColor(-1000,-1000,-1000,1);
+ mVtkImageReslice.back()->SetResliceTransform(mGeneralTransform);
+ mVtkImageReslice.back()->SetInput(0, image);
+ mVtkImageReslice.back()->Update();
+
+ mVtkImages.push_back( mVtkImageReslice.back()->GetOutput(0) );
}
//--------------------------------------------------------------------
return dim;
}
//--------------------------------------------------------------------
-//
+
//--------------------------------------------------------------------
int vvImage::GetNumberOfDimensions() const
{
}
return 0;
}
+//--------------------------------------------------------------------
+
//--------------------------------------------------------------------
void vvImage::GetScalarRange(double* range)
{
if (temp[1] > range[1]) range[1]=temp[1];
}
}
+//--------------------------------------------------------------------
//--------------------------------------------------------------------
std::string vvImage::GetScalarTypeAsITKString()
}
//--------------------------------------------------------------------
-
//--------------------------------------------------------------------
vtkImageData* vvImage::GetFirstVTKImageData()
{
}
//--------------------------------------------------------------------
-
//--------------------------------------------------------------------
bool vvImage::IsScalarTypeInteger()
{
//--------------------------------------------------------------------
//--------------------------------------------------------------------
-void vvImage::SetTransform(vtkSmartPointer<vtkTransform> transform)
+vtkSmartPointer<vtkGridTransform> vvImage::GetGridTransform()
{
- mTransform = transform;
- this->UpdateReslice();
+ return mGridTransform;
}
//--------------------------------------------------------------------
class vtkImageData;
class vtkImageReslice;
+class vtkGeneralTransform;
class vtkTransform;
-class vtkImageReslice;
-class vtkAbstractTransform;
+class vtkGridTransform;
//------------------------------------------------------------------------------
class vvImage : public itk::LightObject
bool IsScalarTypeInteger();
bool IsScalarTypeInteger(int t);
vtkSmartPointer<vtkTransform> GetTransform();
+ vtkSmartPointer<vtkGridTransform> GetGridTransform();
void SetTransform(vtkSmartPointer<vtkTransform> transform);
void SetTimeSpacing(double s) { mTimeSpacing = s; }
void SetTimeOrigin(double o) { mTimeOrigin = o; }
std::vector<vtkImageData*> mVtkImages;
std::vector< vtkSmartPointer<vtkImageReslice> > mVtkImageReslice;
+ vtkSmartPointer<vtkGeneralTransform> mGeneralTransform;
vtkSmartPointer<vtkTransform> mTransform;
+ vtkSmartPointer<vtkGridTransform> mGridTransform;
double mTimeOrigin;
double mTimeSpacing;
};