}
//--------------------------------------------------------------------
-std::string vvImage::GetScalarTypeAsString()
+std::string vvImage::GetScalarTypeAsITKString()
{
// WARNING VTK pixel type different from ITK Pixel type
std::string vtktype = mVtkImages[0]->GetScalarTypeAsString();
}
//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+vtkImageData * CopyAndCastToFloatFrom(vtkImageData * input)
+{
+ vtkImageData * p = vtkImageData::New();
+ p->SetExtent(input->GetExtent ()); // Only first ! could not be 4D
+ p->SetScalarTypeToFloat();
+ p->AllocateScalars();
+ p->CopyAndCastFrom(input, input->GetExtent());
+ return p;
+}
+//--------------------------------------------------------------------
+
+
#endif // VVIMAGE_CXX
class vtkImageReslice;
class vtkAbstractTransform;
+//------------------------------------------------------------------------------
class vvImage : public itk::LightObject
{
public :
void Init();
void Reset();
-
void SetImage(std::vector<vtkImageData*> images);
void AddImage(vtkImageData* image);
const std::vector<vtkImageData*>& GetVTKImages();
vtkImageData* GetFirstVTKImageData();
-
int GetNumberOfDimensions() const;
int GetNumberOfSpatialDimensions();
- ///Writes the scalar range to the provided array, which must have room for two doubles
void GetScalarRange(double* range);
unsigned long GetActualMemorySize();
std::vector<double> GetSpacing();
std::vector<double> GetOrigin() const;
std::vector<int> GetSize();
- std::string GetScalarTypeAsString();
+ std::string GetScalarTypeAsITKString();
int GetNumberOfScalarComponents();
int GetScalarSize();
bool IsTimeSequence();
bool IsScalarTypeInteger();
bool IsScalarTypeInteger(int t);
-
vtkSmartPointer<vtkTransform> GetTransform();
void SetTransform(vtkSmartPointer<vtkTransform> transform);
-
- void SetTimeSpacing(double s) {
- mTimeSpacing = s;
- }
- void SetTimeOrigin(double o) {
- mTimeOrigin = o;
- }
-
+ void SetTimeSpacing(double s) { mTimeSpacing = s; }
+ void SetTimeOrigin(double o) { mTimeOrigin = o; }
void UpdateReslice();
private:
double mTimeOrigin;
double mTimeSpacing;
};
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+vtkImageData * CopyAndCastToFloatFrom(vtkImageData * p);
+//------------------------------------------------------------------------------
#endif