GDCM 3.0.24
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
24namespace gdcm
25{
26class TagPath;
27class IOD;
28class CryptographicMessageSyntax;
29
78{
79public:
80 Anonymizer():F(new File),CMS(nullptr) {}
81 ~Anonymizer() override;
82
84 bool Empty( Tag const &t );
85
90 bool Empty( PrivateTag const &pt );
91
93 bool Clear( Tag const &t );
94 bool Clear( PrivateTag const &pt );
95
97 bool Remove( Tag const &t );
98
104 bool Remove( PrivateTag const &pt );
105
108 bool Replace( Tag const &t, const char *value );
109 bool Replace( PrivateTag const &t, const char *value );
110
113 bool Replace( Tag const &t, const char *value, VL const & vl );
114 bool Replace( PrivateTag const &t, const char *value, VL const & vl );
115
118
121
124
126 void SetFile(const File& f) { F = f; }
127 //const File &GetFile() const { return *F; }
128 File &GetFile() { return *F; }
129
135
139
141 static SmartPointer<Anonymizer> New() { return new Anonymizer; }
142
145
148 static void ClearInternalUIDs();
149
150protected:
151 // Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2)
152 bool BALCPProtect(DataSet &ds, Tag const & tag, const IOD &iod);
153 bool CanEmptyTag(Tag const &tag, const IOD &iod) const;
155
156private:
157 bool BasicApplicationLevelConfidentialityProfile1();
158 bool BasicApplicationLevelConfidentialityProfile2();
159 bool CheckIfSequenceContainsAttributeToAnonymize(File const &file, SequenceOfItems* sqi) const;
160
161private:
162 // I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object...
165
166 typedef std::pair< Tag, std::string > TagValueKey;
167 typedef std::map< TagValueKey, std::string > DummyMapNonUIDTags;
168 typedef std::map< std::string, std::string > DummyMapUIDTags;
169 static DummyMapNonUIDTags dummyMapNonUIDTags;
170 static DummyMapUIDTags dummyMapUIDTags;
171};
172
179} // end namespace gdcm
180
181#endif //GDCMANONYMIZER_H
Anonymizer.
Definition gdcmAnonymizer.h:78
bool RemoveRetired()
Main function that loop over all elements and remove retired element.
bool Remove(Tag const &t)
remove a tag (even a SQ can be removed)
bool RemovePrivateTags()
Main function that loop over all elements and remove private tags.
bool Empty(PrivateTag const &pt)
void SetFile(const File &f)
Set/Get File.
Definition gdcmAnonymizer.h:126
void RecurseDataSet(DataSet &ds)
bool Empty(Tag const &t)
Make Tag t empty (if not found tag will be created)
File & GetFile()
Definition gdcmAnonymizer.h:128
Anonymizer()
Definition gdcmAnonymizer.h:80
bool Clear(PrivateTag const &pt)
void SetCryptographicMessageSyntax(CryptographicMessageSyntax *cms)
Set/Get CMS key that will be used to encrypt the dataset within BasicApplicationLevelConfidentialityP...
static void ClearInternalUIDs()
bool BasicApplicationLevelConfidentialityProfile(bool deidentify=true)
bool BALCPProtect(DataSet &ds, Tag const &tag, const IOD &iod)
~Anonymizer() override
bool Replace(Tag const &t, const char *value)
bool Replace(PrivateTag const &t, const char *value, VL const &vl)
static std::vector< Tag > GetBasicApplicationLevelConfidentialityProfileAttributes()
Return the list of Tag that will be considered when anonymizing a DICOM file.
bool Replace(Tag const &t, const char *value, VL const &vl)
bool CanEmptyTag(Tag const &tag, const IOD &iod) const
bool Replace(PrivateTag const &t, const char *value)
static SmartPointer< Anonymizer > New()
for wrapped language: instantiate a reference counted object
Definition gdcmAnonymizer.h:141
bool Clear(Tag const &t)
Identical to 'Empty' except no action is done when tag is not present.
bool Remove(PrivateTag const &pt)
const CryptographicMessageSyntax * GetCryptographicMessageSyntax() const
bool RemoveGroupLength()
Main function that loop over all elements and remove group length.
Definition gdcmCryptographicMessageSyntax.h:23
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
a DICOM File
Definition gdcmFile.h:34
Class for representing a IOD.
Definition gdcmIOD.h:35
Class to represent a Private DICOM Data Element (Attribute) Tag (Group, Element, Owner)
Definition gdcmPrivateTag.h:39
Class to represent a Sequence Of Items.
Definition gdcmSequenceOfItems.h:40
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
Subject.
Definition gdcmSubject.h:29
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
Value Length.
Definition gdcmVL.h:30
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21