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

Generated on Tue Dec 6 2011 07:25:31 for GDCM by doxygen 1.7.5.1
SourceForge.net Logo