gdcmAnonymizer.h

Go to the documentation of this file.
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 
00072 class GDCM_EXPORT Anonymizer : public Subject
00073 {
00074 public:
00075   Anonymizer():F(new File),CMS(NULL) {}
00076   ~Anonymizer();
00077 
00080   bool Empty( Tag const &t );
00081   //bool Empty( PrivateTag const &t );
00082   //bool Empty( TagPath const &t );
00083 
00085   bool Remove( Tag const &t );
00086   //bool Remove( PrivateTag const &t );
00087   //bool Remove( TagPath const &t );
00088 
00091   bool Replace( Tag const &t, const char *value );
00092 
00095   bool Replace( Tag const &t, const char *value, VL const & vl );
00096   //bool Replace( PrivateTag const &t, const char *value, VL const & vl );
00097   //bool Replace( TagPath const &t, const char *value, VL const & vl );
00098 
00100   bool RemovePrivateTags();
00101 
00103   bool RemoveGroupLength();
00104 
00106   bool RemoveRetired();
00107 
00108   // TODO:
00109   // bool Remove( PRIVATE_TAGS | GROUP_LENGTH | RETIRED );
00110 
00112   void SetFile(const File& f) { F = f; }
00113   //const File &GetFile() const { return *F; }
00114   File &GetFile() { return *F; }
00115 
00120   bool BasicApplicationLevelConfidentialityProfile(bool deidentify = true);
00121 
00123   void SetCryptographicMessageSyntax( CryptographicMessageSyntax *cms );
00124   const CryptographicMessageSyntax *GetCryptographicMessageSyntax() const;
00125 
00127   static SmartPointer<Anonymizer> New() { return new Anonymizer; }
00128 
00130   static std::vector<Tag> GetBasicApplicationLevelConfidentialityProfileAttributes();
00131 
00132 protected:
00133   // Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2)
00134   bool BALCPProtect(DataSet &ds, Tag const & tag, const IOD &iod);
00135   bool CanEmptyTag(Tag const &tag, const IOD &iod) const;
00136   void RecurseDataSet( DataSet & ds );
00137 
00138 private:
00139   bool BasicApplicationLevelConfidentialityProfile1();
00140   bool BasicApplicationLevelConfidentialityProfile2();
00141   bool CheckIfSequenceContainsAttributeToAnonymize(File const &file, SequenceOfItems* sqi) const;
00142 
00143 private:
00144   // I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object...
00145   SmartPointer<File> F;
00146   CryptographicMessageSyntax *CMS;
00147 };
00148 
00155 } // end namespace gdcm
00156 
00157 #endif //GDCMANONYMIZER_H

Generated on Sat Dec 4 2010 08:58:36 for GDCM by doxygen 1.7.2
SourceForge.net Logo