======================================================================-====*/
#ifndef VVIMAGE_CXX
#define VVIMAGE_CXX
+
+// vv
#include "vvImage.h"
+
+// clitk
#include "clitkCommon.h"
+
+// vtk
#include <vtkImageData.h>
#include <vtkImageReslice.h>
-#include <cassert>
-
#include <vtkTransform.h>
+// std
+#include <cassert>
+
#define NO_RESLICE 1
//--------------------------------------------------------------------
{
mTimeSpacing = 1;
mTimeOrigin = 0;
+ mImageDimension = 0;
}
//--------------------------------------------------------------------
//--------------------------------------------------------------------
int vvImage::GetNumberOfSpatialDimensions()
{
- int dim=GetNumberOfDimensions();
- if (IsTimeSequence())
- return dim-1;
- else
- return dim;
+ return mImageDimension;
+ // int dim=GetNumberOfDimensions();
+ // if (IsTimeSequence())
+ // return dim+1;
+ // else
+ // return dim;
}
//--------------------------------------------------------------------
int vvImage::GetNumberOfDimensions() const
{
if (mVtkImages.size()) {
- int dimension = 2;
- int extent[6];
- mVtkImages[0]->GetWholeExtent(extent);
- if (extent[5] - extent[4] >= 1)
- dimension++;
- if (mVtkImages.size() > 1)
- dimension++;
- return dimension;
+ if (IsTimeSequence())
+ 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;
}
//--------------------------------------------------------------------
-bool vvImage::IsTimeSequence()
+bool vvImage::IsTimeSequence() const
{
return mVtkImages.size()>1;
}
std::string GetScalarTypeAsITKString();
int GetNumberOfScalarComponents();
int GetScalarSize();
- bool IsTimeSequence();
+ bool IsTimeSequence() const;
bool IsScalarTypeInteger();
bool IsScalarTypeInteger(int t);
vtkSmartPointer<vtkTransform> GetTransform();
vtkSmartPointer<vtkTransform> mTransform;
double mTimeOrigin;
double mTimeSpacing;
+ uint mImageDimension;
};
//------------------------------------------------------------------------------
template<class TItkImageType>
void vvImage::AddItkImage(TItkImageType *input)
{
+ mImageDimension = TItkImageType::ImageDimension;
typedef itk::ImageToVTKImageFilter <TItkImageType> ConverterType;
typename ConverterType::Pointer converter = ConverterType::New();
converter->SetInput(input);