From 819712afaad76d8be1e21c506507814c32f5ccfd Mon Sep 17 00:00:00 2001 From: malaterre Date: Tue, 1 Mar 2005 16:12:20 +0000 Subject: [PATCH] ENH: Fix Compilation on older SunOS --- vtk/vtkGdcmWriter.cxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vtk/vtkGdcmWriter.cxx b/vtk/vtkGdcmWriter.cxx index 478db385..7ffdc082 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/02/25 19:54:06 $ - Version: $Revision: 1.17 $ + Date: $Date: 2005/03/01 16:12:20 $ + Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,7 +27,7 @@ #include #include -vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.17 $"); +vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.18 $"); vtkStandardNewMacro(vtkGdcmWriter); //----------------------------------------------------------------------------- @@ -161,36 +161,36 @@ void SetImageInformation(gdcm::FileHelper *file,vtkImageData *image) extent[3]-extent[2]+1, extent[5]-extent[4]+1}; - str.str(""); + str.seekp(0); str << dim[0]; file->InsertValEntry(str.str(),0x0028,0x0011); // Columns - str.str(""); + str.seekp(0); str << dim[1]; file->InsertValEntry(str.str(),0x0028,0x0010); // Rows if(dim[2]>1) { - str.str(""); + str.seekp(0); str << dim[2]; //file->Insert(str.str(),0x0028,0x0012); // Planes file->InsertValEntry(str.str(),0x0028,0x0008); // Number of Frames } // Pixel type - str.str(""); + str.seekp(0); str << image->GetScalarSize()*8; file->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated file->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored - str.str(""); + str.seekp(0); str << image->GetScalarSize()*8-1; file->InsertValEntry(str.str(),0x0028,0x0102); // High Bit // Pixel Repr // FIXME : what do we do when the ScalarType is // VTK_UNSIGNED_INT or VTK_UNSIGNED_LONG - str.str(""); + str.seekp(0); if( image->GetScalarType() == VTK_UNSIGNED_CHAR || image->GetScalarType() == VTK_UNSIGNED_SHORT || image->GetScalarType() == VTK_UNSIGNED_INT || @@ -205,27 +205,27 @@ void SetImageInformation(gdcm::FileHelper *file,vtkImageData *image) file->InsertValEntry(str.str(),0x0028,0x0103); // Pixel Representation // Samples per pixel - str.str(""); + str.seekp(0); str << image->GetNumberOfScalarComponents(); file->InsertValEntry(str.str(),0x0028,0x0002); // Samples per Pixel // Spacing double *sp = image->GetSpacing(); - str.str(""); + str.seekp(0); // 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]; file->InsertValEntry(str.str(),0x0028,0x0030); // Pixel Spacing - str.str(""); + str.seekp(0); str << sp[2]; file->InsertValEntry(str.str(),0x0018,0x0088); // Spacing Between Slices // Origin double *org = image->GetOrigin(); - str.str(""); + str.seekp(0); str << org[0] << "\\" << org[1] << "\\" << org[2]; file->InsertValEntry(str.str(),0x0020,0x0032); // Image Position Patient str.unsetf( std::ios::fixed ); //done with floating point values @@ -233,10 +233,10 @@ void SetImageInformation(gdcm::FileHelper *file,vtkImageData *image) // Window / Level double *rng=image->GetScalarRange(); - str.str(""); + str.seekp(0); str << rng[1]-rng[0]; file->InsertValEntry(str.str(),0x0028,0x1051); // Window Width - str.str(""); + str.seekp(0); str << (rng[1]+rng[0])/2.0; file->InsertValEntry(str.str(),0x0028,0x1050); // Window Center -- 2.45.1