]> Creatis software - gdcm.git/blobdiff - vtk/vtkGdcmWriter.cxx
Fix mistypings
[gdcm.git] / vtk / vtkGdcmWriter.cxx
index eafbb5a7939f93b8cbaf2aaf02805e7a605191e6..2b5764734e7bf721b050436b65e9f878b76bfac8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmWriter.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/05/08 18:00:02 $
-  Version:   $Revision: 1.31 $
+  Date:      $Date: 2007/12/13 15:16:19 $
+  Version:   $Revision: 1.36 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #define vtkFloatingPointType float
 #endif
 
-vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.31 $")
+vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.36 $")
 vtkStandardNewMacro(vtkGdcmWriter)
 
-vtkCxxSetObjectMacro(vtkGdcmWriter,LookupTable,vtkLookupTable);
+vtkCxxSetObjectMacro(vtkGdcmWriter,LookupTable,vtkLookupTable)
 #if (VTK_MAJOR_VERSION >= 5)
-vtkCxxSetObjectMacro(vtkGdcmWriter,MedicalImageProperties,vtkMedicalImageProperties);
+vtkCxxSetObjectMacro(vtkGdcmWriter,MedicalImageProperties,vtkMedicalImageProperties)
 #endif
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
@@ -94,7 +94,11 @@ const char *vtkGdcmWriter::GetWriteTypeAsString()
 // The output data must be deleted by the user of the method !!!
 size_t ReverseData(vtkImageData *image,unsigned char **data)
 {
+#if (VTK_MAJOR_VERSION >= 5)
+   vtkIdType inc[3];
+#else
    int inc[3];
+#endif
    int *extent = image->GetUpdateExtent();
    int dim[3] = {extent[1]-extent[0]+1,
                  extent[3]-extent[2]+1,
@@ -138,7 +142,7 @@ size_t ReverseData(vtkImageData *image,unsigned char **data)
  * vtkMedicalImageProperties
  */
 #if (VTK_MAJOR_VERSION >= 5)
-void SetMedicalImageInformation(gdcm::FileHelper *file, vtkMedicalImageProperties *medprop)
+void SetMedicalImageInformation(GDCM_NAME_SPACE::FileHelper *file, vtkMedicalImageProperties *medprop)
 {
    // For now only do:
    // PatientName, PatientID, PatientAge, PatientSex, PatientBirthDate, StudyID
@@ -149,42 +153,42 @@ void SetMedicalImageInformation(gdcm::FileHelper *file, vtkMedicalImagePropertie
         {
         str.str("");
         str << medprop->GetPatientName();
-        file->InsertValEntry(str.str(),0x0010,0x0010); // PN 1 Patient's Name
+        file->InsertEntryString(str.str(),0x0010,0x0010,"PN"); // PN 1 Patient's Name
         }
 
      if (medprop->GetPatientID())
         {
         str.str("");
         str << medprop->GetPatientID();
-        file->InsertValEntry(str.str(),0x0010,0x0020); // LO 1 Patient ID
+        file->InsertEntryString(str.str(),0x0010,0x0020,"LO"); // LO 1 Patient ID
         }
 
      if (medprop->GetPatientAge())
         {
         str.str("");
         str << medprop->GetPatientAge();
-        file->InsertValEntry(str.str(),0x0010,0x1010); // AS 1 Patient's Age
+        file->InsertEntryString(str.str(),0x0010,0x1010,"AS"); // AS 1 Patient's Age
         }
 
      if (medprop->GetPatientSex())
         {
         str.str("");
         str << medprop->GetPatientSex();
-        file->InsertValEntry(str.str(),0x0010,0x0040); // CS 1 Patient's Sex
+        file->InsertEntryString(str.str(),0x0010,0x0040,"CS"); // CS 1 Patient's Sex
         }
 
      if (medprop->GetPatientBirthDate())
         {
         str.str("");
         str << medprop->GetPatientBirthDate();
-        file->InsertValEntry(str.str(),0x0010,0x0030); // DA 1 Patient's Birth Date
+        file->InsertEntryString(str.str(),0x0010,0x0030,"DA"); // DA 1 Patient's Birth Date
         }
 
      if (medprop->GetStudyID())
         {
         str.str("");
         str << medprop->GetStudyID();
-        file->InsertValEntry(str.str(),0x0020,0x0010); // SH 1 Study ID
+        file->InsertEntryString(str.str(),0x0020,0x0010,"SH"); // SH 1 Study ID
         }
      }
 }
@@ -193,7 +197,7 @@ void SetMedicalImageInformation(gdcm::FileHelper *file, vtkMedicalImagePropertie
 /**
  * Set the data informations in the file
  */
-void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image)
+void SetImageInformation(GDCM_NAME_SPACE::FileHelper *file, vtkImageData *image)
 {
    std::ostringstream str;
 
@@ -216,7 +220,7 @@ void SetImageInformation(gdcm::FileHelper *file, vtkImageData *image)
       str.str("");
       str << dim[2];
       //file->Insert(str.str(),0x0028,0x0012); // Planes
-      file->InsertEntryString(str.str(),0x0028,0x0008,"US"); // Number of Frames
+      file->InsertEntryString(str.str(),0x0028,0x0008,"IS"); // Number of Frames
    }
 
    // Pixel type
@@ -399,18 +403,19 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *cache,
 
 void vtkGdcmWriter::WriteDcmFile(char *fileName, vtkImageData *image)
 {
-   gdcm::FileHelper *dcmFile;
+   GDCM_NAME_SPACE::FileHelper *dcmFile;
    if ( GdcmFile != 0)
-      dcmFile = gdcm::FileHelper::New(GdcmFile);
+      dcmFile = GDCM_NAME_SPACE::FileHelper::New(GdcmFile);
    else
-      dcmFile = gdcm::FileHelper::New();
+      dcmFile = GDCM_NAME_SPACE::FileHelper::New();
    
    // From here, the write of the file begins
 
-
    // Set the medical informations:
+#if (VTK_MAJOR_VERSION >= 5)  
    SetMedicalImageInformation(dcmFile, this->MedicalImageProperties);
-       
+#endif
+      
    // Set the image informations
    SetImageInformation(dcmFile, image);
 
@@ -433,7 +438,7 @@ void vtkGdcmWriter::WriteDcmFile(char *fileName, vtkImageData *image)
          dcmFile->SetWriteTypeToDcmExplVR();
    }
   
-   dcmFile->SetContentType((gdcm::ImageContentType)ContentType);
+   dcmFile->SetContentType((GDCM_NAME_SPACE::ImageContentType)ContentType);
  
    if(!dcmFile->Write(fileName))
    {