GDCM  2.2.3
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 
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

Generated on Thu Nov 28 2013 07:02:50 for GDCM by doxygen 1.7.6.1
SourceForge.net Logo