22
22
#include <main/controllers/commandcontroller.h>
23
23
#include <main/controllers/historycontroller.h>
24
24
#include <commands/comandoexportacion.h>
25
#include <wx/ginkgostyle/ginkgostyle.h>
26
/**dcmtk dictionary...*/
27
#include <dcmtk/config/osconfig.h>
28
#include <dcmtk/dcmdata/dcdict.h>
29
#include <dcmtk/dcmdata/dcdicent.h>
31
#include <wx/msgdlg.h>
38
class AnonymizeAddTagDialog: public AnonymizeAddTagDialogBase
41
AnonymizeAddTagDialog(wxWindow* pParent): AnonymizeAddTagDialogBase(pParent)
43
DcmDataDictionary& globalDataDict = dcmDataDict.wrlock();
45
wxArrayString listOfStrings;
46
for (DcmHashDictIterator it = globalDataDict.normalBegin(); it != globalDataDict.normalEnd(); ++it)
48
DcmDictEntry entry(*(*it));
49
listOfStrings.push_back(wxString::FromUTF8(entry.getTagName()));
54
m_pTag->Append(listOfStrings);
56
if (listOfStrings.size() > 0) {
66
virtual void OnTagSelection(wxCommandEvent& /*evt*/)
68
if (m_pTag->GetSelection() >= 0) {
69
wxString tagName = m_pTag->GetStringSelection();
70
const DcmDataDictionary& globalDataDict = dcmDataDict.rdlock();
71
const DcmDictEntry* entry = globalDataDict.findEntry(tagName.ToUTF8());
74
m_pTextGroup->SetValue(wxString::Format(wxT("%04x"),entry->getGroup()));
75
m_pTextElement->SetValue(wxString::Format(wxT("%04x"),entry->getElement()));
84
if (m_pTextGroup->GetValue().ToLong(&group, 16) && m_pTextElement->GetValue().ToLong(&element, 16) && group >= 0 && group < 0xffff && element >= 0 && element < 0xffff) {
85
key = wxString::Format(wxT("%04x|%04x"), group, element);
87
return std::string(key.ToUTF8());
90
std::string getValue()
92
return std::string(m_pTextValue->GetValue().ToUTF8());
95
virtual void OnOkClick(wxCommandEvent &evt)
98
if (m_pTextGroup->GetValue().ToLong(&group, 16) && m_pTextElement->GetValue().ToLong(&element, 16) && group >= 0 && group < 0xffff && element >= 0 && element < 0xffff) {
101
wxMessageBox(_("Element field or group field have invalid values"),_("Info"),wxOK | wxICON_INFORMATION, this);
109
/**********************************************************/
26
111
GNC::GUI::AnonymizePanel::AnonymizePanel(wxWindow* pParent): GNC::GUI::AnonymizePanelBase(pParent)
65
150
for (GNC::GCS::IConfigurationController::TListGroups::iterator it = groups.begin(); it != groups.end(); ++it)
67
152
if ((*it).find("tag") != (*it).end() && (*it).find("value") != (*it).end()) {
68
Anonymize((*it)["tag"], true, (*it)["value"]);
153
Anonymize((*it)["tag"], true, (*it)["value"], false);
259
void GNC::GUI::AnonymizePanel::OnAddNewTag( wxCommandEvent &)
261
AnonymizeAddTagDialog dlg(this);
262
if (dlg.ShowModal() == wxID_OK) {
263
Anonymize(dlg.getKey(), true, dlg.getValue());
174
267
void GNC::GUI::AnonymizePanel::Anonymize(const std::string& clave, bool anonimizar)
176
269
wxString value = wxEmptyString;
185
278
Anonymize(clave, anonimizar, std::string(value.ToUTF8()));
188
void GNC::GUI::AnonymizePanel::Anonymize(const std::string& clave, bool anonimizar, const std::string& value)
281
void GNC::GUI::AnonymizePanel::Anonymize(const std::string& clave, bool anonimizar, const std::string& value, bool anonymizeIfNotExists )
190
283
if (MapOfCheck.find(clave) != MapOfCheck.end()) {
191
284
MapOfCheck[clave]->SetValue(anonimizar);
204
297
it->ChangeFlag(wxPG_PROP_MODIFIED,anonimizar);
205
298
m_pTagsList->RefreshProperty(it);
299
m_pTagsList->SelectProperty(it, true);
303
if (anonymizeIfNotExists) {
304
//key not found... add it to property grid
305
wxStringProperty* prop = NULL;
306
GIL::DICOM::IDICOMManager* pDICOMManager = GNC::GCS::IEntorno::Instance()->GetPACSController()->CrearInstanciaDeDICOMManager();
307
wxString helpString = wxString::FromUTF8(pDICOMManager->GetDescription(clave).c_str());
308
if(helpString.size()>0) {
309
helpString = wxT("(") + wxString::FromUTF8(clave.c_str()) + wxT(") ") + helpString;
310
prop = new wxStringProperty(helpString,
311
wxPG_LABEL,wxEmptyString);
313
prop = new wxStringProperty(wxString::FromUTF8(clave.c_str()),
314
wxPG_LABEL,wxEmptyString);
316
prop->SetHelpString(wxString::FromUTF8(clave.c_str()));
317
GNC::Entorno::Instance()->GetPACSController()->LiberarInstanciaDeDICOMManager(pDICOMManager);
319
prop->SetValue(wxString::FromUTF8(value.c_str()));
320
prop->ChangeFlag(wxPG_PROP_MODIFIED,anonimizar);
322
m_pTagsList->SetPropertyCell(prop,0,prop->GetLabel(),wxNullBitmap,*wxWHITE,*wxRED);
323
m_pTagsList->SetPropertyCell(prop,1,prop->GetValue(),wxNullBitmap,*wxWHITE,*wxRED);
325
m_pTagsList->AppendIn(m_pTagsList->GetRoot(), prop);
326
m_pTagsList->SelectProperty(prop, true);