]> Creatis software - gdcm.git/blobdiff - Testing/TestMakeIcon.cxx
Fix mistypings
[gdcm.git] / Testing / TestMakeIcon.cxx
index 1ff478a8ee5a2707c05892f4767a8a39afa3c357..e7aa034ce6b626b8019674b3548714d621cd8154 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestMakeIcon.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:46 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2007/08/29 15:56:41 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -35,7 +35,7 @@ int TestMakeIcon (int argc, char *argv[])
 
    std::string output = "testIcon.dcm";
 
-   gdcm::Debug::DebugOn();
+   GDCM_NAME_SPACE::Debug::DebugOn();
 
    if ( argc == 3 )
    {
@@ -48,46 +48,48 @@ int TestMakeIcon (int argc, char *argv[])
                 << " input filename.dcm output Filename.dcm" << std::endl;
    }
 
-   gdcm::File *f = new gdcm::File( );
+   GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New( );
    f->SetFileName( input );
    f->Load( );
 
    if ( ! f->IsReadable() )
    {
       std::cout << " Failed to Open/Parse file" << input << std::endl;
-      delete f;
+      f->Delete();
       return 1;
    }  
-   gdcm::FileHelper *fh = new gdcm::FileHelper(f); 
+   GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f); 
    uint8_t *pixels = fh->GetImageData();
    uint32_t lgth   = fh->GetImageDataSize();
 
-   gdcm::SeqEntry *icon = f->InsertSeqEntry(0x0088, 0x0200);
-   gdcm::SQItem *sqi = new gdcm::SQItem(1);
+   GDCM_NAME_SPACE::SeqEntry *icon = f->InsertSeqEntry(0x0088, 0x0200);
+   GDCM_NAME_SPACE::SQItem *sqi = GDCM_NAME_SPACE::SQItem::New(1);
    icon->AddSQItem(sqi, 1);
+   sqi->Delete();
 
-   // icone is just define like the image
+   // icone is just defined like the image
    // The purpose is NOT to imagine an icon, 
    // just check the stuff works
 
    uint16_t binVal[3]={0x52f7,0xf358,0xad9b};
  
-   sqi->InsertEntryString( "MONOCHROME2", 0x0028,0x0004);
-   sqi->InsertEntryString( "128", 0x0028,0x0010);
-   sqi->InsertEntryString( "8",   0x0028,0x0100);
-   sqi->InsertEntryString( "8",   0x0028,0x0101);
-   sqi->InsertEntryString( "7",   0x0028,0x0102);
-   sqi->InsertEntryString( "0",   0x0028,0x0103);
-   sqi->InsertEntryBinArea(  (uint8_t *)binVal, 3*2, 0x0005,0x0010,"OW");
-   sqi->InsertEntryBinArea(  pixels, lgth, 0x7fe0,0x0010);
+   sqi->InsertEntryString( "MONOCHROME2", 0x0028,0x0004, "CS");
+   sqi->InsertEntryString( "128", 0x0028,0x0010, "US");
+   sqi->InsertEntryString( "8",   0x0028,0x0100, "US");
+   sqi->InsertEntryString( "8",   0x0028,0x0101, "US");
+   sqi->InsertEntryString( "7",   0x0028,0x0102, "US");
+   sqi->InsertEntryString( "0",   0x0028,0x0103, "US");
+   sqi->InsertEntryBinArea(  (uint8_t *)binVal, 3*2, 0x0005,0x0010,"OB");
+   sqi->InsertEntryBinArea(  pixels, lgth, 0x7fe0,0x0010,"OB");
    // just to see if it's stored a the right place
-   sqi->InsertEntryString( "128", 0x0028,0x0011);
+   sqi->InsertEntryString( "128", 0x0028,0x0011, "US");
     
    fh->WriteDcmExplVR(output);
 
-   delete f;
+   f->Delete();
+   fh->Delete();
 
-   f = new gdcm::File();
+   f = GDCM_NAME_SPACE::File::New();
    f->SetFileName(output);
    f->Load();
    f->Print();
@@ -98,8 +100,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "Sequence 0088|0200 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "Sequence 0088|0200 found" << std::endl;
@@ -110,8 +111,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "Sequence 0088|0200 has no SQItem" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -122,8 +122,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "GetDataEntry 0028|0010 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->DataEntry 0028|0010 found" << std::endl;
@@ -133,8 +132,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0028,0x0010)->GetString()
                 << " - Expected : 128" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -143,8 +141,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "GetDataEntry 0028|0011 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->DataEntry 0028|0011 found" << std::endl;
@@ -154,8 +151,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0028,0x0011)->GetString()
                 << " - Expected : 128" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -164,8 +160,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "GetDataEntry 0028|0100 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->DataEntry 0028|0100 found" << std::endl;
@@ -175,8 +170,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0028,0x0100)->GetString()
                 << " - Expected : 8" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -185,8 +179,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "GetDataEntry 0028|0101 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->DataEntry 0028|0101 found" << std::endl;
@@ -196,8 +189,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0028,0x0101)->GetString()
                 << " - Expected : 8" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -206,8 +198,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "DataEntry 0028|0102 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->DataEntry 0028|0102 found" << std::endl;
@@ -217,8 +208,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0028,0x0102)->GetString()
                 << " - Expected : 7" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -227,8 +217,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "GetDataEntry 0028|0010 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->DataEntry 0028|0103 found" << std::endl;
@@ -238,8 +227,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0028,0x0103)->GetString()
                 << " - Expected : 0" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -248,8 +236,7 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "GetDataEntry 0005|0010 not found" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "First Item ->GetDataEntry 0005|0010 found" << std::endl;
@@ -259,8 +246,7 @@ int TestMakeIcon (int argc, char *argv[])
                 << "Read : " << sqi->GetDataEntry(0x0005,0x0010)->GetLength()
                 << " - Expected : 6" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
 
@@ -270,14 +256,12 @@ int TestMakeIcon (int argc, char *argv[])
    {
       std::cout << "Value 0005|0010 don't match (DataEntry)" << std::endl
                 << "   ... Failed" << std::endl;
-      delete fh;
-      delete f;
+      f->Delete();
       return 1;
    }
    std::cout << "Value DataEntry 0005|0010 OK" << std::endl;
 
-   delete fh;
-   delete f;
+   f->Delete();
    std::cout << "   ... OK" << std::endl;
 
    return 0;