GDCM  2.4.5
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 #include <map>
23 
24 namespace gdcm
25 {
26 class TagPath;
27 class IOD;
28 class CryptographicMessageSyntax;
29 
78 {
79 public:
80  Anonymizer():F(new File),CMS(NULL) {}
81  ~Anonymizer();
82 
85  bool Empty( Tag const &t );
86  //bool Empty( PrivateTag const &t );
87  //bool Empty( TagPath const &t );
88 
91  bool Remove( Tag const &t );
92  //bool Remove( PrivateTag const &t );
93  //bool Remove( TagPath const &t );
94 
97  bool Replace( Tag const &t, const char *value );
98 
101  bool Replace( Tag const &t, const char *value, VL const & vl );
102  //bool Replace( PrivateTag const &t, const char *value, VL const & vl );
103  //bool Replace( TagPath const &t, const char *value, VL const & vl );
104 
106  bool RemovePrivateTags();
107 
109  bool RemoveGroupLength();
110 
112  bool RemoveRetired();
113 
114  // TODO:
115  // bool Remove( PRIVATE_TAGS | GROUP_LENGTH | RETIRED );
116 
118  void SetFile(const File& f) { F = f; }
119  //const File &GetFile() const { return *F; }
120  File &GetFile() { return *F; }
121 
126  bool BasicApplicationLevelConfidentialityProfile(bool deidentify = true);
127 
129  void SetCryptographicMessageSyntax( CryptographicMessageSyntax *cms );
130  const CryptographicMessageSyntax *GetCryptographicMessageSyntax() const;
131 
133  static SmartPointer<Anonymizer> New() { return new Anonymizer; }
134 
136  static std::vector<Tag> GetBasicApplicationLevelConfidentialityProfileAttributes();
137 
140  static void ClearInternalUIDs();
141 
142 protected:
143  // Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2)
144  bool BALCPProtect(DataSet &ds, Tag const & tag, const IOD &iod);
145  bool CanEmptyTag(Tag const &tag, const IOD &iod) const;
146  void RecurseDataSet( DataSet & ds );
147 
148 private:
149  bool BasicApplicationLevelConfidentialityProfile1();
150  bool BasicApplicationLevelConfidentialityProfile2();
151  bool CheckIfSequenceContainsAttributeToAnonymize(File const &file, SequenceOfItems* sqi) const;
152 
153 private:
154  // I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object...
157 
158  typedef std::pair< Tag, std::string > TagValueKey;
159  typedef std::map< TagValueKey, std::string > DummyMapNonUIDTags;
160  typedef std::map< std::string, std::string > DummyMapUIDTags;
161  static DummyMapNonUIDTags dummyMapNonUIDTags;
162  static DummyMapUIDTags dummyMapUIDTags;
163 };
164 
171 } // end namespace gdcm
172 
173 #endif //GDCMANONYMIZER_H
Class to represent a Data Set (which contains Data Elements) A Data Set represents an instance of a r...
Definition: gdcmDataSet.h:55
File & GetFile()
Definition: gdcmAnonymizer.h:120
Class to represent a Sequence Of Items (value representation : SQ)
Definition: gdcmSequenceOfItems.h:39
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Anonymizer()
Definition: gdcmAnonymizer.h:80
Value Length.
Definition: gdcmVL.h:29
static SmartPointer< Anonymizer > New()
for wrapped language: instantiate a reference counted object
Definition: gdcmAnonymizer.h:133
Anonymizer This class is a multi purpose anonymizer. It can work in 2 mode:
Definition: gdcmAnonymizer.h:77
Subject.
Definition: gdcmSubject.h:28
Class for Smart Pointer.
Definition: gdcmObject.h:26
a DICOM File See PS 3.10 File: A File is an ordered string of zero or more bytes, where the first byt...
Definition: gdcmFile.h:33
void SetFile(const File &f)
Set/Get File.
Definition: gdcmAnonymizer.h:118
Class for representing a IOD.
Definition: gdcmIOD.h:34
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element). Basically an uint32_t which...
Definition: gdcmTag.h:38
Definition: gdcmCryptographicMessageSyntax.h:22
Definition: gdcmASN1.h:20

Generated on Fri Sep 25 2015 17:58:22 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo