]> Creatis software - gdcm.git/blobdiff - Example/WriteDicomSimple.cxx
I tried to make a Test for gdcm::Exception
[gdcm.git] / Example / WriteDicomSimple.cxx
index 19f8a9c818560a8dda99c4febeeb8f3edc6d2891..03ae9b3c65866c0413a32333e998c33c3560da5b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: WriteDicomSimple.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/20 16:16:58 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/02/02 10:06:32 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -22,7 +22,7 @@
  * The image content is a horizontal grayscale from 
  * 
  */
-#include "gdcmHeader.h"
+#include "gdcmFile.h"
 #include "gdcmFileHelper.h"
 
 #include <iostream>
@@ -39,7 +39,7 @@
 #define COLOR_WINDOW    256
 #define COLOR_LEVEL     128
 
-int main(int argc, charargv[])
+int main(int argc, char *argv[])
 {
    if (argc < 3) 
    {
@@ -57,45 +57,45 @@ int main(int argc, char* argv[])
 
 
 // Step 1 : Create the header of the image
-   gdcm::Header *header = new gdcm::Header();
+   gdcm::File *header = new gdcm::File();
    std::ostringstream str;
 
    // Set the image size
    str.str("");
    str << SIZE_X;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0011); // Columns
+   header->InsertValEntry(str.str(),0x0028,0x0011); // Columns
 
    str.str("");
    str << SIZE_Y;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0010); // Rows
+   header->InsertValEntry(str.str(),0x0028,0x0010); // Rows
 
    // Set the pixel type
    str.str("");
    str << COMPONENT_SIZE * 8;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0100); // Bits Allocated
-   header->ReplaceOrCreate(str.str(),0x0028,0x0101); // Bits Stored
+   header->InsertValEntry(str.str(),0x0028,0x0100); // Bits Allocated
+   header->InsertValEntry(str.str(),0x0028,0x0101); // Bits Stored
 
    str.str("");
    str << COMPONENT_SIZE * 8 - 1;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0102); // High Bit
+   header->InsertValEntry(str.str(),0x0028,0x0102); // High Bit
 
    // Set the pixel representation
    str.str("");
    str << "0"; // Unsigned
-   header->ReplaceOrCreate(str.str(),0x0028,0x0103); // Pixel Representation
+   header->InsertValEntry(str.str(),0x0028,0x0103); // Pixel Representation
 
    // Set the samples per pixel
    str.str("");
    str << COMPONENT;
-   header->ReplaceOrCreate(str.str(),0x0028,0x0002); // Samples per Pixel
+   header->InsertValEntry(str.str(),0x0028,0x0002); // Samples per Pixel
 
    // Set the Window / Level
    str.str("");
    str << COLOR_WINDOW;
-   header->ReplaceOrCreate(str.str(),0x0028,0x1051); // Window Width
+   header->InsertValEntry(str.str(),0x0028,0x1051); // Window Width
    str.str("");
    str << COLOR_LEVEL;
-   header->ReplaceOrCreate(str.str(),0x0028,0x1050); // Window Center
+   header->InsertValEntry(str.str(),0x0028,0x1050); // Window Center
 
    if( !header->IsReadable() )
    {