X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmHeader.cxx;h=04c501ac428fe735bb535efa7ed7a16803210d98;hb=9b3db5f141ec2b11eadefaa2ea2a3a20058b37f9;hp=31bf7bc314d8f9bdaee95eb7f67ba9e4bb551d05;hpb=0574f31372f78bf8399e42ee04bd0010e684c440;p=gdcm.git diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 31bf7bc3..04c501ac 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -14,7 +14,7 @@ // Constructor / Destructor /** * \ingroup gdcmHeader - * \brief + * \brief Constructor * @param InFilename * @param exception_on_error * @param enable_sequences = true to allow the header @@ -401,7 +401,7 @@ int gdcmHeader::GetPixelSize(void) { * - 32S signed 32 bit, * - FD floating double 64 bits (Not kosher DICOM, but so usefull!) * \warning 12 bit images appear as 16 bit. - * \ 24 bit images appear as 8 bit + * 24 bit images appear as 8 bit * @return 0S if nothing found. NOT USABLE file. The caller has to check */ std::string gdcmHeader::GetPixelType(void) { @@ -434,7 +434,7 @@ std::string gdcmHeader::GetPixelType(void) { /** * \ingroup gdcmHeader * \brief Recover the offset (from the beginning of the file) - * \ of *image* pixels (not *icone image* pixels, if any !) + * of *image* pixels (not *icone image* pixels, if any !) * @return Pixel Offset */ size_t gdcmHeader::GetPixelOffset(void) { @@ -458,10 +458,10 @@ size_t gdcmHeader::GetPixelOffset(void) { if (PixelElement) { return PixelElement->GetOffset(); } else { - return 0; - std::cout << "Big trouble : Pixel Element (" +/* std::cout << "Big trouble : Pixel Element (" << std::hex << GrPixel<<","<< NumPixel<< ") NOT found" - << std::endl; + << std::endl; */ + return 0; } } // TODO : unify those two (previous one and next one) @@ -470,7 +470,7 @@ size_t gdcmHeader::GetPixelOffset(void) { * \brief Recover the pixel area length (in Bytes) * @return Pixel Element Length, as stored in the header * (NOT the memory space necessary to hold the Pixels - * - in case of embeded compressed image-) + * -in case of embeded compressed image-) * 0 : NOT USABLE file. The caller has to check. */ size_t gdcmHeader::GetPixelAreaLength(void) { @@ -487,9 +487,9 @@ size_t gdcmHeader::GetPixelAreaLength(void) { if (PixelElement) { return PixelElement->GetLength(); } else { - std::cout << "Big trouble : Pixel Element (" +/* std::cout << "Big trouble : Pixel Element (" << std::hex << GrPixel<<","<< NumPixel<< ") NOT found" - << std::endl; + << std::endl;*/ return 0; } } @@ -498,9 +498,9 @@ size_t gdcmHeader::GetPixelAreaLength(void) { * \ingroup gdcmHeader * \brief tells us if LUT are used * \warning Right now, 'Segmented xxx Palette Color Lookup Table Data' - * \ are NOT considered as LUT, since nobody knows - * \ how to deal with them - * \ Please warn me if you know sbdy that *does* know ... jprx + * are NOT considered as LUT, since nobody knows + * how to deal with them + * Please warn me if you know sbdy that *does* know ... jprx * @return true if LUT Descriptors and LUT Tables were found */ bool gdcmHeader::HasLUT(void) { @@ -530,9 +530,9 @@ bool gdcmHeader::HasLUT(void) { /** * \ingroup gdcmHeader * \brief gets the info from 0028,1101 : Lookup Table Desc-Red - * \ else 0 + * else 0 * @return Lookup Table number of Bits , 0 by default - * \ when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] + * when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] * @ return bit number of each LUT item */ int gdcmHeader::GetLUTNbits(void) { @@ -557,17 +557,17 @@ int gdcmHeader::GetLUTNbits(void) { /** * \ingroup gdcmHeader * \brief builts Red/Green/Blue/Alpha LUT from Header - * \ when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] - * \ and (0028,1101),(0028,1102),(0028,1102) - * \ - xxx Palette Color Lookup Table Descriptor - are found - * \ and (0028,1201),(0028,1202),(0028,1202) - * \ - xxx Palette Color Lookup Table Data - are found + * when (0028,0004),Photometric Interpretation = [PALETTE COLOR ] + * and (0028,1101),(0028,1102),(0028,1102) + * - xxx Palette Color Lookup Table Descriptor - are found + * and (0028,1201),(0028,1202),(0028,1202) + * - xxx Palette Color Lookup Table Data - are found * \warning does NOT deal with : - * \ 0028 1100 Gray Lookup Table Descriptor (Retired) - * \ 0028 1221 Segmented Red Palette Color Lookup Table Data - * \ 0028 1222 Segmented Green Palette Color Lookup Table Data - * \ 0028 1223 Segmented Blue Palette Color Lookup Table Data - * \ no known Dicom reader deals with them :-( + * 0028 1100 Gray Lookup Table Descriptor (Retired) + * 0028 1221 Segmented Red Palette Color Lookup Table Data + * 0028 1222 Segmented Green Palette Color Lookup Table Data + * 0028 1223 Segmented Blue Palette Color Lookup Table Data + * no known Dicom reader deals with them :-( * @return a RGBA Lookup Table */ unsigned char * gdcmHeader::GetLUTRGBA(void) { @@ -688,9 +688,9 @@ unsigned char * gdcmHeader::GetLUTRGBA(void) { /** * \ingroup gdcmHeader - * \brief gets the info from 0002,0010 : Transfert Syntax - * \ else 1. - * @return Transfert Syntax Name (as oposite to Transfert Syntax UID) + * \brief gets the info from 0002,0010 : Transfert Syntax and gdcmTS + * else 1. + * @return the full Transfert Syntax Name (as oposite to Transfert Syntax UID) */ std::string gdcmHeader::GetTransfertSyntaxName(void) { // use the gdcmTS (TS : Transfert Syntax) @@ -786,6 +786,82 @@ void gdcmHeader::SetImageDataSize(size_t ImageDataSize) { //----------------------------------------------------------------------------- // Protected +/** + * \ingroup gdcmHeader + * \brief anonymize a Header (removes Patient's personal info) + * (read the code to see which ones ...) + * @param + */ +bool gdcmHeader::anonymizeHeader() { + + gdcmHeaderEntry *patientNameHE = GetHeaderEntryByNumber (0x0010, 0x0010); + // gdcmHeaderEntry *patientIDHE = GetHeaderEntryByNumber (0x0010, 0x0020); + + ReplaceIfExistByNumber (" ",0x0010, 0x2154); // Telephone + ReplaceIfExistByNumber (" ",0x0010, 0x1040); // Adress + ReplaceIfExistByNumber (" ",0x0010, 0x0020); // Patient ID + + if (patientNameHE) { + std::string StudyInstanceUID = GetEntryByNumber (0x0020, 0x000d); + if (StudyInstanceUID !=GDCM_UNFOUND) + ReplaceOrCreateByNumber(StudyInstanceUID, 0x0010, 0x0010); + else + ReplaceOrCreateByNumber("anonymised", 0x0010, 0x0010); + } + + // Just for fun :-( + // (if any) remove or replace all the stuff that contains a Date + +//0008 0012 DA ID Instance Creation Date +//0008 0020 DA ID Study Date +//0008 0021 DA ID Series Date +//0008 0022 DA ID Acquisition Date +//0008 0023 DA ID Content Date +//0008 0024 DA ID Overlay Date +//0008 0025 DA ID Curve Date +//0008 002a DT ID Acquisition Datetime +//0018 9074 DT ACQ Frame Acquisition Datetime +//0018 9151 DT ACQ Frame Reference Datetime +//0018 a002 DT ACQ Contribution Date Time +//0020 3403 SH REL Modified Image Date (RET) +//0032 0032 DA SDY Study Verified Date +//0032 0034 DA SDY Study Read Date +//0032 1000 DA SDY Scheduled Study Start Date +//0032 1010 DA SDY Scheduled Study Stop Date +//0032 1040 DA SDY Study Arrival Date +//0032 1050 DA SDY Study Completion Date +//0038 001a DA VIS Scheduled Admission Date +//0038 001c DA VIS Scheduled Discharge Date +//0038 0020 DA VIS Admitting Date +//0038 0030 DA VIS Discharge Date +//0040 0002 DA PRC Scheduled Procedure Step Start Date +//0040 0004 DA PRC Scheduled Procedure Step End Date +//0040 0244 DA PRC Performed Procedure Step Start Date +//0040 0250 DA PRC Performed Procedure Step End Date +//0040 2004 DA PRC Issue Date of Imaging Service Request +//0040 4005 DT PRC Scheduled Procedure Step Start Date and Time +//0040 4011 DT PRC Expected Completion Date and Time +//0040 a030 DT PRC Verification Date Time +//0040 a032 DT PRC Observation Date Time +//0040 a120 DT PRC DateTime +//0040 a121 DA PRC Date +//0040 a13a DT PRC Referenced Datetime +//0070 0082 DA ??? Presentation Creation Date +//0100 0420 DT ??? SOP Autorization Date and Time +//0400 0105 DT ??? Digital Signature DateTime +//2100 0040 DA PJ Creation Date +//3006 0008 DA SSET Structure Set Date +//3008 0024 DA ??? Treatment Control Point Date +//3008 0054 DA ??? First Treatment Date +//3008 0056 DA ??? Most Recent Treatment Date +//3008 0162 DA ??? Safe Position Exit Date +//3008 0166 DA ??? Safe Position Return Date +//3008 0250 DA ??? Treatment Date +//300a 0006 DA RT RT Plan Date +//300a 022c DA RT Air Kerma Rate Reference Date +//300e 0004 DA RT Review Date + return true; + } //----------------------------------------------------------------------------- // Private