X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeader.cxx;h=19ae8d4db00e8fe0bc562b6210fa255962beac20;hb=05e7883306e799f93e27899a38b359b2bb1ceb0b;hp=654a1b08e831d8ffb4ad4a503c74cf51c525878b;hpb=3ac7a631bee01193732c9ae23e90dc75181697ec;p=gdcm.git diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 654a1b08..19ae8d4d 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -3,12 +3,12 @@ Program: gdcm Module: $RCSfile: gdcmHeader.cxx,v $ Language: C++ - Date: $Date: 2004/09/09 17:49:25 $ - Version: $Revision: 1.184 $ + Date: $Date: 2004/09/27 08:39:07 $ + Version: $Revision: 1.189 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details. + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -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) @@ -123,7 +120,10 @@ void gdcmHeader::Write(FILE* fp,FileType filetype) delete[] dumm; ReplaceOrCreateByNumber(s_lgPix,GrPixel, 0x0000); } - + + // FIXME : should be nice if we could move it to gdcmFile + // (or in future gdcmPixelData class) + // Drop Palette Color, if necessary if ( GetEntryByNumber(0x0028,0x0002).c_str()[0] == '3' ) @@ -135,32 +135,32 @@ void gdcmHeader::Write(FILE* fp,FileType filetype) gdcmDocEntry* e = GetDocEntryByNumber(0x0028,0x01101); if (e) { - RemoveEntry(e); + RemoveEntryNoDestroy(e); } e = GetDocEntryByNumber(0x0028,0x1102); if (e) { - RemoveEntry(e); + RemoveEntryNoDestroy(e); } e = GetDocEntryByNumber(0x0028,0x1103); if (e) { - RemoveEntry(e); + RemoveEntryNoDestroy(e); } e = GetDocEntryByNumber(0x0028,0x01201); if (e) { - RemoveEntry(e); + RemoveEntryNoDestroy(e); } e = GetDocEntryByNumber(0x0028,0x1202); if (e) { - RemoveEntry(e); + RemoveEntryNoDestroy(e); } e = GetDocEntryByNumber(0x0028,0x1203); if (e) { - RemoveEntry(e); + RemoveEntryNoDestroy(e); } } gdcmDocument::Write(fp,filetype); @@ -1115,9 +1115,9 @@ uint8_t* gdcmHeader::GetLUTRGBA() } // Load LUTs into memory, (as they were stored on disk) - uint8_t* lutR = (uint8_t*) GetEntryVoidAreaByNumber(0x0028,0x1201); - uint8_t* lutG = (uint8_t*) GetEntryVoidAreaByNumber(0x0028,0x1202); - uint8_t* lutB = (uint8_t*) GetEntryVoidAreaByNumber(0x0028,0x1203); + uint8_t* lutR = (uint8_t*) GetEntryBinAreaByNumber(0x0028,0x1201); + uint8_t* lutG = (uint8_t*) GetEntryBinAreaByNumber(0x0028,0x1202); + uint8_t* lutB = (uint8_t*) GetEntryBinAreaByNumber(0x0028,0x1203); if ( !lutR || !lutG || !lutB ) { @@ -1262,13 +1262,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 )