# 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-2009 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 CryptographicMessageSyntax;
    00027
    00063 class GDCM_EXPORT Anonymizer : public Subject
    00064 {
    00065 public:
    00066   Anonymizer():F(new File),CMS(NULL) {}
    00067   ~Anonymizer();
    00068
    00071   bool Empty( Tag const &t );
    00072   //bool Empty( PrivateTag const &t );
    00073   //bool Empty( TagPath const &t );
    00074
    00076   bool Remove( Tag const &t );
    00077   //bool Remove( PrivateTag const &t );
    00078   //bool Remove( TagPath const &t );
    00079
    00082   bool Replace( Tag const &t, const char *value );
    00083
    00086   bool Replace( Tag const &t, const char *value, VL const & vl );
    00087   //bool Replace( PrivateTag const &t, const char *value, VL const & vl );
    00088   //bool Replace( TagPath const &t, const char *value, VL const & vl );
    00089
    00091   bool RemovePrivateTags();
    00092
    00094   bool RemoveGroupLength();
    00095
    00097   bool RemoveRetired();
    00098
    00099   // TODO:
    00100   // bool Remove( PRIVATE_TAGS | GROUP_LENGTH | RETIRED );
    00101
    00103   void SetFile(const File& f) { F = f; }
    00104   //const File &GetFile() const { return *F; }
    00105   File &GetFile() { return *F; }
    00106
    00111   bool BasicApplicationLevelConfidentialityProfile(bool deidentify = true);
    00112
    00114   void SetCryptographicMessageSyntax( CryptographicMessageSyntax *cms );
    00115   const CryptographicMessageSyntax *GetCryptographicMessageSyntax() const;
    00116
    00118   static SmartPointer<Anonymizer> New() { return new Anonymizer; }
    00119
    00120 protected:
    00121   // Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2)
    00122   bool BALCPProtect(DataSet &ds, Tag const & tag);
    00123   bool CanEmptyTag(Tag const &tag);
    00124   void RecurseDataSet( DataSet & ds );
    00125
    00126 private:
    00127   bool BasicApplicationLevelConfidentialityProfile1();
    00128   bool BasicApplicationLevelConfidentialityProfile2();
    00129
    00130 private:
    00131   // I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object...
    00132   SmartPointer<File> F;
    00133   CryptographicMessageSyntax *CMS;
    00134 };
    00135
    00142 } // end namespace gdcm
    00143
    00144 #endif //__gdcmAnonymizer_h