]> Creatis software - clitk.git/commitdiff
change GetScalarTypeAsString to GetScalarTypeAsITKString to make explicit that type...
authordsarrut <dsarrut>
Wed, 7 Jul 2010 06:57:56 +0000 (06:57 +0000)
committerdsarrut <dsarrut>
Wed, 7 Jul 2010 06:57:56 +0000 (06:57 +0000)
common/vvImage.cxx
common/vvImage.h

index cbcf7497cb80bcb878580ecb49e5679dba6a53e9..797fa3e9dd35458d383850e6c388fcde946b9654 100644 (file)
@@ -138,7 +138,7 @@ void vvImage::GetScalarRange(double* range)
 }
 
 //--------------------------------------------------------------------
-std::string vvImage::GetScalarTypeAsString()
+std::string vvImage::GetScalarTypeAsITKString()
 {
   // WARNING VTK pixel type different from ITK Pixel type
   std::string vtktype = mVtkImages[0]->GetScalarTypeAsString();
@@ -295,4 +295,18 @@ void vvImage::UpdateReslice()
 }
 //--------------------------------------------------------------------
 
+
+//--------------------------------------------------------------------
+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
index 38348eece3d2db2ecc67ea8bf28d1d5f41cec4d9..7dbba1f3577c2ce65b7280071fb0e81375b76f52 100644 (file)
@@ -29,6 +29,7 @@ class vtkTransform;
 class vtkImageReslice;
 class vtkAbstractTransform;
 
+//------------------------------------------------------------------------------
 class vvImage : public itk::LightObject
 {
 public :
@@ -38,37 +39,27 @@ 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:
@@ -81,5 +72,10 @@ private:
   double mTimeOrigin;
   double mTimeSpacing;
 };
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+vtkImageData * CopyAndCastToFloatFrom(vtkImageData * p);
+//------------------------------------------------------------------------------
 
 #endif