]> Creatis software - gdcm.git/commitdiff
Pass the VR to method InsertEntryString
authorjpr <jpr>
Tue, 11 Apr 2006 16:05:03 +0000 (16:05 +0000)
committerjpr <jpr>
Tue, 11 Apr 2006 16:05:03 +0000 (16:05 +0000)
Testing/TestBuildUpDicomDir.cxx
Testing/TestCopyRescaleDicom.cxx
Testing/TestImageSet.cxx
Testing/TestMakeIcon.cxx
Testing/TestWriteSimple.cxx

index 64efd4b0e89217b6f6856c06d88911ab061cd81e..a30c88c5008b6c8ddd1575fb2f3ad899f9701d88 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestBuildUpDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 14:52:30 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2006/04/11 16:05:03 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -39,7 +39,9 @@ int TestBuildUpDicomDir(int argc, char *argv[])
    {
       std::cerr << "Usage: " << argv[0] << " dummy " << std::endl;
    }
-
+   
+ //gdcm::Debug::DebugOn();
    bool errorFound = false; 
    gdcm::DicomDir *dcmdir;
    std::string dirName;  
@@ -74,17 +76,17 @@ int TestBuildUpDicomDir(int argc, char *argv[])
    s11 = p1->NewStudy();  
    s11->SetEntryString("StudyDescrOne.One_",0x0008, 0x1030);
    // we know entry (0008,1060) is not yet created
-   s11->InsertEntryString("Dr Mabuse",     0x0008, 0x1060);
+   s11->InsertEntryString("Dr^Mabuse",     0x0008, 0x1060, "PN");
    // fill here other Study characteristics
 
    gdcm::DicomDirStudy *s12 = p1->NewStudy();    
    s12->SetEntryString("StudyDescrOne.Two",0x0008, 0x1030);
-   s12->InsertEntryString("Dr Zorglub",    0x0008, 0x1060);
+   s12->InsertEntryString("Dr^Zorglub",    0x0008, 0x1060, "PN");
    // fill here other Study characteristics
 
    gdcm::DicomDirStudy *s13 = p1->NewStudy();  
    s13->SetEntryString("StudyDescrOne.Tree",0x0008, 0x1030);
-   s13->InsertEntryString("Dr Follamour",   0x0008, 0x1060);
+   s13->InsertEntryString("Dr^Follamour",   0x0008, 0x1060, "PN");
    // fill here other Study characteristics
  
    gdcm::DicomDirSerie *s111;
@@ -251,7 +253,9 @@ int TestBuildUpDicomDir(int argc, char *argv[])
                 << "]" << std::endl;
  
       valueStuff = s11->GetEntryString(0x0008, 0x1060);
-      if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr Mabuse") )
+std::cout << "----------------length-----------------" << valueStuff.length() <<
+std::endl;     
+      if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr^Mabuse") )
       {
          std::cout << "2 : 0x0008,0x1060 [" 
                    << s11->GetEntryString(0x0008,0x1060)
@@ -259,7 +263,7 @@ int TestBuildUpDicomDir(int argc, char *argv[])
          errorFound = true;
          break;
       }
-      std::cout << "Pysician : [" 
+      std::cout << "Physician : [" 
                 << valueStuff
                 << "]" << std::endl;
       if ( (s12 = p1->GetNextStudy()) == 0 )
@@ -281,7 +285,7 @@ int TestBuildUpDicomDir(int argc, char *argv[])
                 << "]" << std::endl;
 
       if ( gdcm::Util::DicomStringEqual(s12->GetEntryString(0x0008,
-                                           0x1060),"Dr Zorglub " ))
+                                           0x1060),"Dr^Zorglub " ))
       {
          std::cout << "4 0x0008,0x1060 [" 
                    << s12->GetEntryString(0x0008,0x1060)
@@ -289,7 +293,8 @@ int TestBuildUpDicomDir(int argc, char *argv[])
          errorFound = true;
          break;
       }
-      std::cout << "Pysician : [" 
+   std::cout << "___________________________________" << std::endl;
+      std::cout << "Pysician Reading Study: [" 
                 << s12->GetEntryString(0x0008,0x1060)
                 << "]" << std::endl;
 
@@ -308,7 +313,7 @@ int TestBuildUpDicomDir(int argc, char *argv[])
                 << "]" << std::endl;
 
       valueStuff = s13->GetEntryString(0x0008, 0x1060);
-      if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr Follamour") )
+      if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr^Follamour") )
       {
          std::cout << "5 0x0008,0x1060 [" 
                    << valueStuff
index 58491763c3c61c91b099360d6a5a39039b9af670..4421bff8169f4e6585978b504a8a2ee9fb2b9e8e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestCopyRescaleDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 08:35:46 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2006/04/11 16:05:03 $
+  Version:   $Revision: 1.22 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -114,10 +114,10 @@ int CopyRescaleDicom(std::string const &filename,
    if( bitsStored == "16" )
    {
       std::cout << "Rescale...";
-      copyF.InsertEntryString( "8", 0x0028, 0x0100); // Bits Allocated
-      copyF.InsertEntryString( "8", 0x0028, 0x0101); // Bits Stored
-      copyF.InsertEntryString( "7", 0x0028, 0x0102); // High Bit
-      copyF.InsertEntryString( "0", 0x0028, 0x0103); // Pixel Representation
+      copyF.InsertEntryString( "8", 0x0028, 0x0100, "US"); // Bits Allocated
+      copyF.InsertEntryString( "8", 0x0028, 0x0101, "US"); // Bits Stored
+      copyF.InsertEntryString( "7", 0x0028, 0x0102, "US"); // High Bit
+      copyF.InsertEntryString( "0", 0x0028, 0x0103, "US"); // Pixel Representation
 
       // We assume the value were from 0 to uint16_t max
       rescaleSize = dataSize / 2;
index 4caf0ade80e4a8ddea67ff4e32ec4a0a7af58385..789a43b20d1a70c711e0adb814dafbc1dbe4c439 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestImageSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 14:52:31 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2006/04/11 16:05:03 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -152,19 +152,19 @@ gdcm::File *WriteImage(gdcm::File *file, const std::string &fileName)
    std::ostringstream str;
 
    // Set the image size
-   file->InsertEntryString("256",0x0028,0x0011); // Columns
-   file->InsertEntryString("256",0x0028,0x0010); // Rows
+   file->InsertEntryString("256",0x0028,0x0011,"US"); // Columns
+   file->InsertEntryString("256",0x0028,0x0010,"US"); // Rows
 
    // Set the pixel type
-   file->InsertEntryString("8",0x0028,0x0100); // Bits Allocated
-   file->InsertEntryString("8",0x0028,0x0101); // Bits Stored
-   file->InsertEntryString("7",0x0028,0x0102); // High Bit
+   file->InsertEntryString("8",0x0028,0x0100,"US"); // Bits Allocated
+   file->InsertEntryString("8",0x0028,0x0101,"US"); // Bits Stored
+   file->InsertEntryString("7",0x0028,0x0102,"US"); // High Bit
 
    // Set the pixel representation
-   file->InsertEntryString("0",0x0028,0x0103); // Pixel Representation
+   file->InsertEntryString("0",0x0028,0x0103,"US"); // Pixel Representation
 
    // Set the samples per pixel
-   file->InsertEntryString("1",0x0028,0x0002); // Samples per Pixel
+   file->InsertEntryString("1",0x0028,0x0002,"US"); // Samples per Pixel
 
    // The so called 'prepared image', built ex nihilo just before,
    // has NO Pixel Element yet.
@@ -252,10 +252,10 @@ int TestImageSet(int argc, char *argv[])
       // It's up to the user to initialize Serie UID and Study UID
       // Study Instance UID
       studyUID = gdcm::Util::CreateUniqueUID();
-      file->InsertEntryString(studyUID, 0x0020, 0x000d);
+      file->InsertEntryString(studyUID, 0x0020, 0x000d, "UI");
       // Series Instance UID
       serieUID = gdcm::Util::CreateUniqueUID();
-      file->InsertEntryString(serieUID, 0x0020, 0x000e);
+      file->InsertEntryString(serieUID, 0x0020, 0x000e, "UI");
 
       newFile = WriteImage(file, fileName.str());
       if( !newFile )
@@ -287,8 +287,8 @@ int TestImageSet(int argc, char *argv[])
       std::ostringstream fileName;
       fileName << "FileSeq" << i << ".dcm";
       file = gdcm::File::New();
-      file->InsertEntryString(studyUID, 0x0020, 0x000d);
-      file->InsertEntryString(serieUID, 0x0020, 0x000e);
+      file->InsertEntryString(studyUID, 0x0020, 0x000d, "UI");
+      file->InsertEntryString(serieUID, 0x0020, 0x000e, "UI");
 
       newFile = WriteImage(file, fileName.str());
       if( !newFile )
@@ -319,9 +319,9 @@ int TestImageSet(int argc, char *argv[])
       std::ostringstream fileName;
       fileName << "FileSeq" << i << ".dcm";
       file = gdcm::File::New();
-      file->InsertEntryString(studyUID, 0x0020, 0x000d);
+      file->InsertEntryString(studyUID, 0x0020, 0x000d, "UI");
       serieUID = gdcm::Util::CreateUniqueUID();
-      file->InsertEntryString(serieUID, 0x0020, 0x000e);
+      file->InsertEntryString(serieUID, 0x0020, 0x000e, "UI");
       newFile = WriteImage(file, fileName.str());
       if( !newFile )
       {
index 678f8930118639a3d7b53af3c47a316ed8ff7797..2da82ce370002e9589319f9af66bd4ea9f2bded6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestMakeIcon.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 14:52:31 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2006/04/11 16:05:03 $
+  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
@@ -73,16 +73,16 @@ int TestMakeIcon (int argc, char *argv[])
 
    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->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,"OW");
    sqi->InsertEntryBinArea(  pixels, lgth, 0x7fe0,0x0010);
    // 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);
 
index b955cde0b36156c0d61443172714f69388ab72ea..4b8685d150d0b919b8b791467396d1ccc0e92bb6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestWriteSimple.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/04/07 14:15:56 $
-  Version:   $Revision: 1.48 $
+  Date:      $Date: 2006/04/11 16:05:03 $
+  Version:   $Revision: 1.49 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -127,16 +127,16 @@ int WriteSimple(Image &img)
    // Set the image size
    str.str("");
    str << img.sizeX;
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0011); // Columns
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0011,"US"); // Columns
    str.str("");
    str << img.sizeY;
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0010); // Rows
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0010,"US"); // Rows
 
    if(img.sizeZ>1)
    {
       str.str("");
       str << img.sizeZ;
-      fileToBuild->InsertEntryString(str.str(),0x0028,0x0008); // Number of Frames
+      fileToBuild->InsertEntryString(str.str(),0x0028,0x0008, "IS"); // Number of Frames
    }
 
    fileName << "-" << img.sizeX << "-" << img.sizeY << "-" << img.sizeZ;
@@ -144,20 +144,20 @@ int WriteSimple(Image &img)
    // Set the pixel type
    str.str("");
    str << img.componentSize;
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0100); // Bits Allocated
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0100,"US"); // Bits Allocated
 
    str.str("");
    str << img.componentUse;
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0101); // Bits Stored
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0101,"US"); // Bits Stored
 
    str.str("");
    str << ( img.componentSize - 1 );
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0102); // High Bit
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0102,"US"); // High Bit
 
    // Set the pixel representation
    str.str("");
    str << img.sign;
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0103); // Pixel Representation
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0103, "US"); // Pixel Representation
 
    fileName << "-" << img.componentSize;
    if(img.sign == 0)
@@ -179,7 +179,7 @@ int WriteSimple(Image &img)
    // Set the samples per pixel
    str.str("");
    str << img.components;
-   fileToBuild->InsertEntryString(str.str(),0x0028,0x0002); // Samples per Pixel
+   fileToBuild->InsertEntryString(str.str(),0x0028,0x0002, "US"); // Samples per Pixel
 
 // Step 2 : Create the output image
    std::cout << "2...";