]> Creatis software - gdcm.git/blobdiff - src/gdcmHeader.cxx
Now, TestCopyDicom deals with private Entries
[gdcm.git] / src / gdcmHeader.cxx
index 4419fb9131a13f7191ac94d2844a387b2c08a674..5ecbbc981585d0cd70d2bb03e2154c381bbdb15c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeader.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/01 16:23:59 $
-  Version:   $Revision: 1.183 $
+  Date:      $Date: 2004/09/14 16:47:08 $
+  Version:   $Revision: 1.186 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -108,10 +108,7 @@ void gdcmHeader::Write(FILE* fp,FileType filetype)
       SetEntryByNumber("16", 0x0028,0x0100);
    }
 
-  // correct Pixel group Length if necessary
-
-   // TODO : create a gdcmHeader::Write method and move this part.
-   //        (only gdcmHeader knows GrPixel, NumPixel)
+  // TODO : correct 'Pixel group' Length if necessary
 
    int i_lgPix = GetEntryLengthByNumber(GrPixel, NumPixel);
    if (i_lgPix != -2)
@@ -1194,7 +1191,6 @@ uint8_t* gdcmHeader::GetLUTRGBA()
       *a = 1; // Alpha component
       a += 4;
    }
-
    return LUTRGBA;
 } 
 
@@ -1208,6 +1204,12 @@ std::string gdcmHeader::GetTransfertSyntaxName()
    // use the gdcmTS (TS : Transfert Syntax)
    std::string transfertSyntax = GetEntryByNumber(0x0002,0x0010);
 
+   if ( transfertSyntax == GDCM_NOTLOADED ) { // fusible
+      std::cout << "Transfert Syntax not loaded. " << std::endl
+               << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE"
+               << std::endl;
+      return "Uncompressed ACR-NEMA";
+   }
    if ( transfertSyntax == GDCM_UNFOUND )
    {
       dbg.Verbose(0, "gdcmHeader::GetTransfertSyntaxName:"
@@ -1257,13 +1259,14 @@ void gdcmHeader::SetImageDataSize(size_t ImageDataSize)
  */
 bool gdcmHeader::AnonymizeHeader()
 {
-   gdcmDocEntry* patientNameHE = GetDocEntryByNumber (0x0010, 0x0010);
+   // If exist, replace by spaces
+   SetEntryByNumber ("  ",0x0010, 0x2154); // Telephone   
+   SetEntryByNumber ("  ",0x0010, 0x1040); // Adress
+   SetEntryByNumber ("  ",0x0010, 0x0020); // Patient ID
 
-   ReplaceIfExistByNumber ("  ",0x0010, 0x2154); // Telephone   
-   ReplaceIfExistByNumber ("  ",0x0010, 0x1040); // Adress
-   ReplaceIfExistByNumber ("  ",0x0010, 0x0020); // Patient ID
+   gdcmDocEntry* patientNameHE = GetDocEntryByNumber (0x0010, 0x0010);
   
-   if ( patientNameHE )
+   if ( patientNameHE ) // we replace it by Study Instance UID (why not)
    {
       std::string studyInstanceUID =  GetEntryByNumber (0x0020, 0x000d);
       if ( studyInstanceUID != GDCM_UNFOUND )