GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmAnonymizer.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMANONYMIZER_H
15 #define GDCMANONYMIZER_H
16
17 #include "gdcmFile.h"
18 #include "gdcmSubject.h"
19 #include "gdcmEvent.h"
20 #include "gdcmSmartPointer.h"
21
22 namespace gdcm
23 {
24 class TagPath;
25 class IOD;
26 class CryptographicMessageSyntax;
27
75 class GDCM_EXPORT Anonymizer : public Subject
76 {
77 public:
78 Anonymizer():F(new File),CMS(NULL) {}
79 ~Anonymizer();
80
83 bool Empty( Tag const &t );
84 //bool Empty( PrivateTag const &t );
85 //bool Empty( TagPath const &t );
86
88 bool Remove( Tag const &t );
89 //bool Remove( PrivateTag const &t );
90 //bool Remove( TagPath const &t );
91
94 bool Replace( Tag const &t, const char *value );
95
98 bool Replace( Tag const &t, const char *value, VL const & vl );
99 //bool Replace( PrivateTag const &t, const char *value, VL const & vl );
100 //bool Replace( TagPath const &t, const char *value, VL const & vl );
101
103 bool RemovePrivateTags();
104
106 bool RemoveGroupLength();
107
109 bool RemoveRetired();
110
111 // TODO:
112 // bool Remove( PRIVATE_TAGS | GROUP_LENGTH | RETIRED );
113
115 void SetFile(const File& f) { F = f; }
116 //const File &GetFile() const { return *F; }
117 File &GetFile() { return *F; }
118
123 bool BasicApplicationLevelConfidentialityProfile(bool deidentify = true);
124
126 void SetCryptographicMessageSyntax( CryptographicMessageSyntax *cms );
127 const CryptographicMessageSyntax *GetCryptographicMessageSyntax() const;
128
130 static SmartPointer<Anonymizer> New() { return new Anonymizer; }
131
133 static std::vector<Tag> GetBasicApplicationLevelConfidentialityProfileAttributes();
134
135 protected:
136 // Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2)
137 bool BALCPProtect(DataSet &ds, Tag const & tag, const IOD &iod);
138 bool CanEmptyTag(Tag const &tag, const IOD &iod) const;
139 void RecurseDataSet( DataSet & ds );
140
141 private:
142 bool BasicApplicationLevelConfidentialityProfile1();
143 bool BasicApplicationLevelConfidentialityProfile2();
144 bool CheckIfSequenceContainsAttributeToAnonymize(File const &file, SequenceOfItems* sqi) const;
145
146 private:
147 // I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object...
148 SmartPointer<File> F;
149 CryptographicMessageSyntax *CMS;
150 };
151
158 } // end namespace gdcm
159
160 #endif //GDCMANONYMIZER_H