X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vtk%2FvtkGdcmWriter.cxx;h=4cf4db2da9252039a05365a1567748ce12c6180d;hb=203521dab07f8ff3325b78969f6994b4a1c4375e;hp=e97fae2ba06791b53a295f67bf11df2019d8612d;hpb=9317c3709915a7fd018c6d45c2426a2047931de7;p=gdcm.git diff --git a/vtk/vtkGdcmWriter.cxx b/vtk/vtkGdcmWriter.cxx index e97fae2b..4cf4db2d 100644 --- a/vtk/vtkGdcmWriter.cxx +++ b/vtk/vtkGdcmWriter.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: vtkGdcmWriter.cxx,v $ Language: C++ - Date: $Date: 2005/03/03 18:26:48 $ - Version: $Revision: 1.20 $ + Date: $Date: 2005/08/22 12:23:26 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,8 +27,12 @@ #include #include -vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.20 $"); -vtkStandardNewMacro(vtkGdcmWriter); +#ifndef vtkFloatingPointType +#define vtkFloatingPointType float +#endif + +vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.24 $") +vtkStandardNewMacro(vtkGdcmWriter) //----------------------------------------------------------------------------- // Constructor / Destructor @@ -161,9 +165,9 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image) // FIXME : what do we do when the ScalarType is // VTK_UNSIGNED_INT or VTK_UNSIGNED_LONG str.str(""); - if( image->GetScalarType() == VTK_UNSIGNED_CHAR || + if( image->GetScalarType() == VTK_UNSIGNED_CHAR || image->GetScalarType() == VTK_UNSIGNED_SHORT || - image->GetScalarType() == VTK_UNSIGNED_INT || + image->GetScalarType() == VTK_UNSIGNED_INT || image->GetScalarType() == VTK_UNSIGNED_LONG ) { str << "0"; // Unsigned @@ -183,20 +187,21 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image) /// We should perform some checkings before forcing the Entry creation // Spacing - double *sp = image->GetSpacing(); + vtkFloatingPointType *sp = image->GetSpacing(); str.str(""); - // We are about to enter floating point value. By default ostringstream are smart and don't do fixed point + // We are about to enter floating point value. + // By default ostringstream are smart and don't do fixed point // thus forcing to fixed point value str.setf( std::ios::fixed ); - str << sp[0] << "\\" << sp[1]; + str << sp[1] << "\\" << sp[0]; file->InsertValEntry(str.str(),0x0028,0x0030); // Pixel Spacing str.str(""); str << sp[2]; file->InsertValEntry(str.str(),0x0018,0x0088); // Spacing Between Slices // Origin - double *org = image->GetOrigin(); + vtkFloatingPointType *org = image->GetOrigin(); /// \todo : Image Position Patient is meaningfull ONLY for CT an MR modality /// We should perform some checkings before forcing the Entry creation @@ -207,7 +212,7 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image) str.unsetf( std::ios::fixed ); //done with floating point values // Window / Level - double *rng=image->GetScalarRange(); + vtkFloatingPointType *rng = image->GetScalarRange(); str.str(""); str << rng[1]-rng[0]; @@ -279,6 +284,8 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *cache, { sprintf(this->InternalFileName, this->FilePattern,this->FileNumber); } +// Remove this code in case user is using VTK 4.2... +#if !(VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION == 2) if (this->FileNumber < this->MinimumFileNumber) { this->MinimumFileNumber = this->FileNumber; @@ -287,6 +294,7 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *cache, { this->MaximumFileNumber = this->FileNumber; } +#endif } // Write the file