gdcmAnonymizer.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMANONYMIZER_H
#define GDCMANONYMIZER_H
#include "gdcmFile.h"
#include "gdcmSubject.h"
#include "gdcmEvent.h"
#include "gdcmSmartPointer.h"
#include <map>
namespace gdcm
{
class TagPath;
class IOD;
class CryptographicMessageSyntax;
class GDCM_EXPORT Anonymizer : public Subject
{
public:
Anonymizer():F(new File),CMS(nullptr) {}
~Anonymizer() override;
bool Empty( Tag const &t );
bool Empty( PrivateTag const &pt );
bool Clear( Tag const &t );
bool Clear( PrivateTag const &pt );
bool Remove( Tag const &t );
bool Remove( PrivateTag const &pt );
bool Replace( Tag const &t, const char *value );
bool Replace( PrivateTag const &t, const char *value );
bool Replace( Tag const &t, const char *value, VL const & vl );
bool Replace( PrivateTag const &t, const char *value, VL const & vl );
bool RemovePrivateTags();
bool RemoveGroupLength();
bool RemoveRetired();
void SetFile(const File& f) { F = f; }
//const File &GetFile() const { return *F; }
File &GetFile() { return *F; }
bool BasicApplicationLevelConfidentialityProfile(bool deidentify = true);
void SetCryptographicMessageSyntax( CryptographicMessageSyntax *cms );
const CryptographicMessageSyntax *GetCryptographicMessageSyntax() const;
static SmartPointer<Anonymizer> New() { return new Anonymizer; }
static std::vector<Tag> GetBasicApplicationLevelConfidentialityProfileAttributes();
static void ClearInternalUIDs();
protected:
// Internal function used to either empty a tag or set it's value to a dummy value (Type 1 vs Type 2)
bool BALCPProtect(DataSet &ds, Tag const & tag, const IOD &iod);
bool CanEmptyTag(Tag const &tag, const IOD &iod) const;
void RecurseDataSet( DataSet & ds );
private:
bool BasicApplicationLevelConfidentialityProfile1();
bool BasicApplicationLevelConfidentialityProfile2();
bool CheckIfSequenceContainsAttributeToAnonymize(File const &file, SequenceOfItems* sqi) const;
private:
// I would prefer to have a smart pointer to DataSet but DataSet does not derive from Object...
SmartPointer<File> F;
CryptographicMessageSyntax *CMS;
typedef std::pair< Tag, std::string > TagValueKey;
typedef std::map< TagValueKey, std::string > DummyMapNonUIDTags;
typedef std::map< std::string, std::string > DummyMapUIDTags;
static DummyMapNonUIDTags dummyMapNonUIDTags;
static DummyMapUIDTags dummyMapUIDTags;
};
} // end namespace gdcm
#endif //GDCMANONYMIZER_H
gdcm::Anonymizer::RemoveRetired
bool RemoveRetired()
Main function that loop over all elements and remove retired element.
gdcm::Anonymizer::Remove
bool Remove(Tag const &t)
remove a tag (even a SQ can be removed)
gdcm::Anonymizer::RemovePrivateTags
bool RemovePrivateTags()
Main function that loop over all elements and remove private tags.
gdcm::Anonymizer::Empty
bool Empty(PrivateTag const &pt)
gdcm::Anonymizer::SetFile
void SetFile(const File &f)
Set/Get File.
Definition gdcmAnonymizer.h:126
gdcm::Anonymizer::RecurseDataSet
void RecurseDataSet(DataSet &ds)
gdcm::Anonymizer::Empty
bool Empty(Tag const &t)
Make Tag t empty (if not found tag will be created).
gdcm::Anonymizer::GetFile
File & GetFile()
Definition gdcmAnonymizer.h:128
gdcm::Anonymizer::Anonymizer
Anonymizer()
Definition gdcmAnonymizer.h:80
gdcm::Anonymizer::Clear
bool Clear(PrivateTag const &pt)
gdcm::Anonymizer::SetCryptographicMessageSyntax
void SetCryptographicMessageSyntax(CryptographicMessageSyntax *cms)
Set/Get CMS key that will be used to encrypt the dataset within BasicApplicationLevelConfidentialityP...
gdcm::Anonymizer::ClearInternalUIDs
static void ClearInternalUIDs()
gdcm::Anonymizer::BasicApplicationLevelConfidentialityProfile
bool BasicApplicationLevelConfidentialityProfile(bool deidentify=true)
gdcm::Anonymizer::BALCPProtect
bool BALCPProtect(DataSet &ds, Tag const &tag, const IOD &iod)
gdcm::Anonymizer::~Anonymizer
~Anonymizer() override
gdcm::Anonymizer::Replace
bool Replace(Tag const &t, const char *value)
gdcm::Anonymizer::Replace
bool Replace(PrivateTag const &t, const char *value, VL const &vl)
gdcm::Anonymizer::GetBasicApplicationLevelConfidentialityProfileAttributes
static std::vector< Tag > GetBasicApplicationLevelConfidentialityProfileAttributes()
Return the list of Tag that will be considered when anonymizing a DICOM file.
gdcm::Anonymizer::Replace
bool Replace(Tag const &t, const char *value, VL const &vl)
gdcm::Anonymizer::CanEmptyTag
bool CanEmptyTag(Tag const &tag, const IOD &iod) const
gdcm::Anonymizer::Replace
bool Replace(PrivateTag const &t, const char *value)
gdcm::Anonymizer::New
static SmartPointer< Anonymizer > New()
for wrapped language: instantiate a reference counted object
Definition gdcmAnonymizer.h:141
gdcm::Anonymizer::Clear
bool Clear(Tag const &t)
Identical to 'Empty' except no action is done when tag is not present.
gdcm::Anonymizer::Remove
bool Remove(PrivateTag const &pt)
gdcm::Anonymizer::GetCryptographicMessageSyntax
const CryptographicMessageSyntax * GetCryptographicMessageSyntax() const
gdcm::Anonymizer::RemoveGroupLength
bool RemoveGroupLength()
Main function that loop over all elements and remove group length.
gdcm::CryptographicMessageSyntax
Definition gdcmCryptographicMessageSyntax.h:23
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::IOD
Class for representing a IOD.
Definition gdcmIOD.h:35
gdcm::PrivateTag
Class to represent a Private DICOM Data Element (Attribute) Tag (Group, Element, Owner).
Definition gdcmPrivateTag.h:39
gdcm::SequenceOfItems
Class to represent a Sequence Of Items.
Definition gdcmSequenceOfItems.h:40
gdcm::SmartPointer
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
gdcm::Subject::Subject
Subject()
gdcm::TagPath
class to handle a path of tag.
Definition gdcmTagPath.h:31
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcm::VL
Value Length.
Definition gdcmVL.h:30
gdcmEvent.h
gdcmFile.h
gdcmSmartPointer.h
gdcmSubject.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21