32 #include <boost/algorithm/string.hpp>
34 #include <gdcmGlobal.h>
35 #include <gdcmDictSet.h>
37 #include "gdcmDocument.h"
38 #include "gdcmFileHelper.h"
41 #if defined(USE_GDCM2)
42 #include "gdcmGlobal.h"
44 #include "gdcmDictPrinter.h"
45 #include "gdcmPrinter.h"
46 #include "gdcmReader.h"
47 #include "gdcmSmartPointer.h"
48 #include "gdcmSequenceOfItems.h"
50 #include "icons/save.xpm"
56 : wxDialog(parent, -1,_T(
"DICOM TAGS"), wxDefaultPosition, wxSize(550,580)), filename(i_filename)
59 mIcon =
new wxImageList(size,size,
true);
60 mIcon->Add(wxBitmap(wxBitmap(wxIcon(save_xpm)).ConvertToImage().Rescale(size, size)));
61 wxToolBar *mToolBar =
new wxToolBar(
this,-1,wxDefaultPosition,wxDefaultSize);
62 mToolBar->AddTool(
DUMP_SAVE_ID,_T(
"Save"),
mIcon->GetBitmap(0), _T(
"Save Dicom Tags in text file"));
64 DumpText =
new wxTextCtrl(
this, wxID_ANY,_T(
""), wxPoint(5,30), wxSize(520,510), wxTE_READONLY| wxMac | wxTE_MULTILINE | wxTE_RICH );
78 std::string result =
"";
83 GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
84 f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
86 f->SetMaxSizeLoadEntry(0xffff);
88 GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
89 f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSEQ |GDCM_NAME_SPACE::LD_NOSHADOW);
90 fh->SetPrintLevel( 0 );
94 while(std::getline(os, line))
96 result +=
clean(line.c_str());
102 #if defined(USE_GDCM2)
104 reader.SetFileName(
filename.c_str() );
107 gdcm::Printer printer;
108 printer.SetFile ( reader.GetFile() );
109 printer.SetColor( 0 );
184 DumpText->SetValue(crea::std2wx(result));
193 if (i_line.substr(4,1) ==
"|")
197 std::string signification;
199 std::string resultat;
201 tag =
"(" + i_line.substr(0,9) +
")";
202 line = i_line.substr(14,i_line.size()-10);
203 int pos1 = (int)line.find_first_of(
"[");
204 int pos2 = (int)line.find_first_of(
"]");
205 signification = line.substr(pos1+1, pos2-pos1-1);
206 line = line.substr(pos2+1);
207 pos1 = (int)line.find_first_of(
"[");
208 pos2 = (int)line.find_first_of(
"]");
209 value = line.substr(pos1+1, pos2-pos1-1);
210 resultat = tag +
" " + signification +
": " +value;
224 wxFileDialog* FD =
new wxFileDialog( 0,_T(
"Select file"), _T(
""), _T(
""),
225 crea::std2wx(
"*.txt"), wxOPEN, wxDefaultPosition);
226 if (FD->ShowModal()==wxID_OK)
229 std::ofstream ofs(crea::wx2std(FD->GetPath()).c_str());
231 ofs << crea::wx2std(
DumpText->GetValue());;