GDCM 2.0.17
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 Module: $URL$ 00005 00006 Copyright (c) 2006-2010 Mathieu Malaterre 00007 All rights reserved. 00008 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 #ifndef GDCMANONYMIZER_H 00016 #define GDCMANONYMIZER_H 00017 00018 #include "gdcmFile.h" 00019 #include "gdcmSubject.h" 00020 #include "gdcmEvent.h" 00021 #include "gdcmSmartPointer.h" 00022 00023 namespace gdcm 00024 { 00025 class TagPath; 00026 class IOD; 00027 class CryptographicMessageSyntax; 00028 00076 class GDCM_EXPORT Anonymizer : public Subject 00077 { 00078 public: 00079 Anonymizer():F(new File),CMS(NULL) {} 00080 ~Anonymizer(); 00081 00084 bool Empty( Tag const &t ); 00085 //bool Empty( PrivateTag const &t ); 00086 //bool Empty( TagPath const &t ); 00087 00089 bool Remove( Tag const &t ); 00090 //bool Remove( PrivateTag const &t ); 00091 //bool Remove( TagPath const &t ); 00092 00095 bool Replace( Tag const &t, const char *value ); 00096 00099 bool Replace( Tag const &t, const char *value, VL const & vl ); 00100 //bool Replace( PrivateTag const &t, const char *value, VL const & vl ); 00101 //bool Replace( TagPath const &t, const char *value, VL const & vl ); 00102 00104 bool RemovePrivateTags(); 00105 00107 bool RemoveGroupLength(); 00108 00110 bool RemoveRetired(); 00111 00112 // TODO: 00113 // bool Remove( PRIVATE_TAGS | GROUP_LENGTH | RETIRED ); 00114 00116 void SetFile(const File& f) { F = f; } 00117 //const File &GetFile() const { return *F; } 00118 File &GetFile() { return *F; } 00119 00124 bool BasicApplicationLevelConfidentialityProfile(bool deidentify = true); 00125 00127 void SetCryptographicMessageSyntax( CryptographicMessageSyntax *cms ); 00128 const CryptographicMessageSyntax *GetCryptographicMessageSyntax() const; 00129 00131 static SmartPointer<Anonymizer> New() { return new Anonymizer; } 00132 00134 static std::vector<Tag> GetBasicApplicationLevelConfidentialityProfileAttributes(); 00135 00136 protected: 00137 // Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2) 00138 bool BALCPProtect(DataSet &ds, Tag const & tag, const IOD &iod); 00139 bool CanEmptyTag(Tag const &tag, const IOD &iod) const; 00140 void RecurseDataSet( DataSet & ds ); 00141 00142 private: 00143 bool BasicApplicationLevelConfidentialityProfile1(); 00144 bool BasicApplicationLevelConfidentialityProfile2(); 00145 bool CheckIfSequenceContainsAttributeToAnonymize(File const &file, SequenceOfItems* sqi) const; 00146 00147 private: 00148 // I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object... 00149 SmartPointer<File> F; 00150 CryptographicMessageSyntax *CMS; 00151 }; 00152 00159 } // end namespace gdcm 00160 00161 #endif //GDCMANONYMIZER_H