1 #include <creaImageIOWxDumpPanel.h>
2 #include <creaImageIOSystem.h>
3 #include <creaImageIOGimmick.h>
4 #include <gdcmGlobal.h>
5 #include <gdcmDictSet.h>
7 #include "gdcmDocument.h"
8 #include "gdcmFileHelper.h"
9 #include "icons/save.xpm"
14 WxDumpPanel::WxDumpPanel(wxWindow *parent, std::string i_filename)
15 : wxDialog(parent, -1,_T("DICOM TAGS"), wxDefaultPosition, wxSize(550,580)), filename(i_filename)
18 mIcon = new wxImageList(size,size,true);
19 mIcon->Add(wxBitmap(wxBitmap(wxIcon(save_xpm)).ConvertToImage().Rescale(size, size)));
20 wxToolBar *mToolBar = new wxToolBar(this,-1,wxDefaultPosition,wxDefaultSize);
21 mToolBar->AddTool( DUMP_SAVE_ID,_T("Save"), mIcon->GetBitmap(0), _T("Save Dicom Tags in text file"));
23 DumpText = new wxTextCtrl( this, wxID_ANY,_T(""), wxPoint(5,30), wxSize(520,510), wxTE_READONLY| wxMac | wxTE_MULTILINE | wxTE_RICH );
29 WxDumpPanel::~WxDumpPanel(){}
31 ///////////////////////////////////////////////////
32 /// Display in a control Text all dicom tags
33 ///////////////////////////////////////////////////
34 void WxDumpPanel::Print()
37 if ( !filename.empty()) // ====== Deal with a single file ======
39 GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
40 f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
41 f->SetFileName( filename );
42 f->SetMaxSizeLoadEntry(0xffff);
44 GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
45 fh->SetPrintLevel( 0 );
49 while(std::getline(os, line))
54 DumpText->SetValue(crea::std2wx(result));
59 ///////////////////////////////////////////////////
60 /// wxEvent to save Dicom Tags in a text file //
61 ///////////////////////////////////////////////////
62 void WxDumpPanel::SaveInfos(wxCommandEvent& event)
64 wxFileDialog* FD = new wxFileDialog( 0,_T("Select file"), _T(""), _T(""),
65 crea::std2wx("*.txt"), wxOPEN, wxDefaultPosition);
66 if (FD->ShowModal()==wxID_OK)
69 std::ofstream ofs(crea::wx2std(FD->GetPath()).c_str());
71 ofs << crea::wx2std(DumpText->GetValue());;
78 ////////////////////////////////////////////////////////////
79 ////////////////////////////////////////////////////////////
80 BEGIN_EVENT_TABLE(WxDumpPanel, wxDialog)
81 EVT_TOOL(DUMP_SAVE_ID, WxDumpPanel::SaveInfos)