creaImageIOWxAttributeSelectionPanel.cpp
creaImageIOWxPACSConnectionPanel.cpp
creaImageIOWxDescriptorPanel.cpp
+ creaImageIOWxDumpPanel.cpp
)
endif()
mSettings = new Settings(mCurrentDirectory);
std::string dbpath = GetLocalDatabasePath();
+
// Create or open local database
std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/" + mLocalDescpName;
+
boost::algorithm::replace_all( dpath,
INVALID_FILE_SEPARATOR ,
VALID_FILE_SEPARATOR);
virtual void CreateEditFieldsDialog(tree::Node* node, std::vector<std::string> names, std::vector<std::string> keys)
{ GimmickError("INTERNAL ERROR : EditFields not implemented"); }
+ /// Display all Dicom Tags
+ virtual void DumpTags(const std::string filename)
+ {GimmickError("INTERNAL ERROR : DumpTags not implemented"); }
+
///Copies selected files
virtual void SaveAs(const std::vector<std::string>& filenames)
{ GimmickError("INTERNAL ERROR : SaveAs not implemented"); }
query += " WHERE PARENT_ID='" + node->GetAttribute("ID")
+ "'";
}
+GimmickDebugMessage(1, "query : '" <<query <<std::endl);
CppSQLite3Query q;
QUERYDB(query,q);
--- /dev/null
+#include <creaImageIOWxDumpPanel.h>
+#include <creaImageIOSystem.h>
+#include <creaImageIOGimmick.h>
+#include <gdcmGlobal.h>
+#include <gdcmDictSet.h>
+#include "gdcmFile.h"
+#include "gdcmDocument.h"
+#include "gdcmFileHelper.h"
+#include "icons/save.xpm"
+
+namespace creaImageIO
+{
+ // CTor
+ WxDumpPanel::WxDumpPanel(wxWindow *parent, std::string i_filename)
+ : wxDialog(parent, -1,_T("DICOM TAGS"), wxDefaultPosition, wxSize(550,580)), filename(i_filename)
+ {
+ int size = 16;
+ mIcon = new wxImageList(size,size,true);
+ mIcon->Add(wxBitmap(wxBitmap(wxIcon(save_xpm)).ConvertToImage().Rescale(size, size)));
+ wxToolBar *mToolBar = new wxToolBar(this,-1,wxDefaultPosition,wxDefaultSize);
+ mToolBar->AddTool( DUMP_SAVE_ID,_T("Save"), mIcon->GetBitmap(0), _T("Save Dicom Tags in text file"));
+ mToolBar->Realize();
+ DumpText = new wxTextCtrl( this, wxID_ANY,_T(""), wxPoint(5,30), wxSize(520,510), wxTE_READONLY| wxMac | wxTE_MULTILINE | wxTE_RICH );
+ Layout();
+ Print();
+ }
+
+ // DTor
+ WxDumpPanel::~WxDumpPanel(){}
+
+ ///////////////////////////////////////////////////
+ /// Display in a control Text all dicom tags
+ ///////////////////////////////////////////////////
+ void WxDumpPanel::Print()
+ {
+ std::stringstream os;
+ if ( !filename.empty()) // ====== Deal with a single file ======
+ {
+ GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New();
+ f->SetLoadMode(GDCM_NAME_SPACE::LD_ALL);
+ f->SetFileName( filename );
+ f->SetMaxSizeLoadEntry(0xffff);
+ f->Load();
+ GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
+ fh->SetPrintLevel( 0 );
+ fh->Print(os);
+ std::string result;
+ std::string line;
+ while(std::getline(os, line))
+ {
+ result +=line;
+ result += "\n";
+ }
+ DumpText->SetValue(crea::std2wx(result));
+
+ }
+ }
+
+///////////////////////////////////////////////////
+/// wxEvent to save Dicom Tags in a text file //
+///////////////////////////////////////////////////
+ void WxDumpPanel::SaveInfos(wxCommandEvent& event)
+ {
+ wxFileDialog* FD = new wxFileDialog( 0,_T("Select file"), _T(""), _T(""),
+ crea::std2wx("*.txt"), wxOPEN, wxDefaultPosition);
+ if (FD->ShowModal()==wxID_OK)
+ {
+ wxBusyCursor busy;
+ std::ofstream ofs(crea::wx2std(FD->GetPath()).c_str());
+ ofs.clear();
+ ofs << crea::wx2std(DumpText->GetValue());;
+ ofs.close();
+ }
+ Close();
+ }
+
+
+////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////
+BEGIN_EVENT_TABLE(WxDumpPanel, wxDialog)
+ EVT_TOOL(DUMP_SAVE_ID, SaveInfos)
+END_EVENT_TABLE()
+}
\ No newline at end of file
--- /dev/null
+#ifndef __creaImageIOWxDumpPanel_h_INCLUDED__
+#define __creaImageIOWxDumpPanel_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+#include <creaWx.h>
+#include <creaImageIOWxGimmickView.h>
+
+#define DUMP_SAVE_ID 1800
+
+
+namespace creaImageIO
+{
+ /**
+ * \ingroup GUI
+ */
+ //=====================================================================
+ //=====================================================================
+ /// Display all dicom tags from a given DICOM file
+ class WxDumpPanel : public wxDialog
+ {
+ public:
+
+ /// Constructor
+ WxDumpPanel(wxWindow *parent, std::string i_filename);
+
+ /// Destructor
+ ~WxDumpPanel();
+
+
+ private :
+
+ /// Display in a control Text all dicom tags
+ void Print();
+
+ /// wxEvent to save Dicom Tags in a text file
+ void SaveInfos(wxCommandEvent& event);
+
+ /// Parent DialogBox
+ wxDialog* dialog;
+
+ /// Icons list
+ wxImageList *mIcon;
+
+ /// ControlText to display tags
+ wxTextCtrl *DumpText;
+
+ /// Dicom file to display
+ std::string filename;
+
+ DECLARE_EVENT_TABLE()
+
+ }; // class WxEditFieldsPanel
+ //=====================================================================
+
+
+} // EO namespace creaImageIO
+
+
+#endif // USE_WIDGETS
+// EOF
+#endif
+
#include <creaImageIOWxEditFieldsPanel.h>
#include <creaImageIOWxAttributeSelectionPanel.h>
#include <creaImageIOWxDescriptorPanel.h>
+#include <creaImageIOWxDumpPanel.h>
using namespace crea;
// Icons
#endif
+#include <creaImageIOGimmick.h>
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
namespace creaImageIO
{
CreateIconList();
// Global sizer
- wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+ msizer = new wxBoxSizer(wxVERTICAL);
// Create the tool bar
CreateToolBar();
- sizer->Add( mToolBar, 0, wxGROW, 0);
+ msizer->Add( mToolBar, 0, wxGROW, 0);
// Split part below toolbar into notebook for views and panel
// for preview, messages...
// Bottom panel
mBottomPanel = new wxPanel(mSplitter,-1);
- wxBoxSizer *bottom_sizer = new wxBoxSizer(wxVERTICAL); //HORIZONTAL);
+ mbottom_sizer = new wxBoxSizer(wxVERTICAL); //HORIZONTAL);
// Previewer
mViewer->StartPlayer();
- bottom_sizer->Add(mViewer,1,wxGROW,1);
+ mbottom_sizer->Add(mViewer,1,wxGROW,1);
// mViewer->Show();
mText = new wxStaticText(mBottomPanel, wxID_ANY, wxT("Welcome to Gimmick!"));
- bottom_sizer->Add(mText,0,wxGROW,0);
+ mbottom_sizer->Add(mText,0,wxGROW,0);
- mBottomPanel->SetSizer(bottom_sizer);
+ mBottomPanel->SetSizer(mbottom_sizer);
// Splitting
int hsize = size.GetHeight();
mSplitter->SplitHorizontally( mNotebook, mBottomPanel,
top_minsize);
- sizer->Add( mSplitter, 1, wxGROW, 0);
+ msizer->Add( mSplitter, 1, wxGROW, 0);
mProgressDialog=0;
- SetSizer( sizer );
+ SetSizer( msizer );
SetAutoLayout(true);
Layout();
//mListener=new Listener();
GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView"
<<std::endl);
delete mIcon;
+ delete mViewer;
//if(mListener->IsAlive()) { mListener->Delete(); }
}
//======================================================================
DisplayAddSummary();
}
mViewer->StartPlayer();
+ delete FD;
}
nb->AddPage( pacs, crea::std2wx("Connect to PACS") );
//Third page: CD/DVD Watch
- WxListenerPanel* cdWatch=new WxListenerPanel(nb,dial, this, mListener->IsPaused());
+ WxListenerPanel* cdWatch=new WxListenerPanel(nb,dial, this,true);//, mListener->IsPaused());
nb->AddPage( cdWatch, crea::std2wx("CD/DVD") );
//Fourth page: Selection of attributes to show
dial->ShowModal();
}
+ //========================================================================
+ void WxGimmickView::DumpTags(std::string i_filename)
+ {
+ WxDumpPanel* pan= new WxDumpPanel (this,i_filename);
+ pan->ShowModal();
+ }
+
//========================================================================
void WxGimmickView::OnFieldsEdited(tree::Node* node, const std::string& name, const std::string& key, const std::string& val)
{
private:
+ wxBoxSizer *mbottom_sizer;
+ wxBoxSizer *msizer;
/// Is set to true at the end of constructor
/// (in order to lock callbacks from threaded objects or event
/// before everything is ok)
///Edits the fields of a given node
void CreateEditFieldsDialog(tree::Node* node, std::vector<std::string> names, std::vector<std::string> keys);
+
+ /// Display all Dicom Tags
+ void DumpTags(const std::string i_filename);
/// Progress dialog
wxProgressDialog* mProgressDialog;
#include <wx/splitter.h>
#include <wx/gdicmn.h>
#include <boost/date_time/gregorian/gregorian.hpp>
-
+#include <creaImageIOGimmick.h>
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
//=====================================================================
namespace creaImageIO
{
// mSplitter = new wxSplitterWindow( this , -1);
// Global sizer
- wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+ msizer = new wxBoxSizer(wxHORIZONTAL);
int ctrl_style = wxLC_REPORT | wxLC_VRULES;
int col_style = wxLIST_FORMAT_LEFT;
wxMenuItem* m1Item=menuItem->Append(wxID_ANY, _T("&Anonymize"));
wxMenuItem* m2Item=menuItem->Append(wxID_ANY, _T("&Local Copy"));
wxMenuItem* m3Item=menuItem->Append(wxID_ANY, _T("&Edit Fields"));
-
+ wxMenuItem* m4Item=menuItem->Append(wxID_ANY, _T("&Display Dicom Tags"));
+
mAnonymizingID=m1Item->GetId();
mLocalCopyID=m2Item->GetId();
mEditFieldID=m3Item->GetId();
+ mDumpID=m4Item->GetId();
//Connect( mAnonymizingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnAnonymize) );
Connect( mLocalCopyID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnLocalCopy) );
Connect( mEditFieldID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnEditField) );
+ Connect( mDumpID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnDumpTags) );
#endif // wxUSE_MENUS
/// Initialize the first level splitter
- sizer->Add( mLevelList[0].wxSplitter ,1, wxGROW ,0);
+ msizer->Add( mLevelList[0].wxSplitter ,1, wxGROW ,0);
// mColumnSelected=1;
mLastSelected=0;
mLastLevel=0;
//CreateColorPalette();
UpdateLevel(1);
- SetSizer( sizer );
+ SetSizer( msizer );
SetAutoLayout(true);
Layout();
GetGimmickView()->CreateEditFieldsDialog(node,names,keys);
}
}
+
+ void WxTreeView::OnDumpTags(wxCommandEvent &event)
+ {
+ if(mLastRightSelected!=-1)
+ {
+ tree::Node* node=((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node;
+ tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
+ std::vector<std::string> names;
+ std::vector<std::string> keys;
+ for (a = GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).begin();
+ a != GetTreeHandler()->GetTree().GetAttributeDescriptorList(mLastRightLevel+1).end();
+ ++a)
+ {
+ if(a->GetKey()=="FullFileName")
+ {
+ GetGimmickView()->DumpTags(node->GetAttribute("FullFileName"));
+ return;
+ }
+ }
+ }
+
+ }
+
//================================================================
//================================================================
///Callback when the user needs to edit a field
void OnEditField(wxCommandEvent& event);
+
+ ///Callback when the user needs to display alll dicom tags for a file
+ void OnDumpTags(wxCommandEvent &event);
///Callback on mouse click
void OnMouseClick(wxMouseEvent& event);
/// Called by OnItemSelected and OnItemDeSelected
// void ProcessItem
private:
+ wxBoxSizer *msizer;
/// The struct holding the data for one level
/// Holds the wx control and other data
/// such as the vector of attribute keys corresponding to the columns
int mAnonymizingID;
int mLocalCopyID;
int mEditFieldID;
+ int mDumpID;
// If set to true then OnSelectedChanged returns immediately.
// Used to do avoid useless process during multiple selections
--- /dev/null
+/* XPM */
+static const char * save_xpm[] = {
+"20 20 107 2",
+" c #FFFFFF",
+". c #E4E4FB",
+"+ c #C2C2F5",
+"@ c #ACABEF",
+"# c #A2A1EA",
+"$ c #9B9AE7",
+"% c #9493E4",
+"& c #8F8EE0",
+"* c #8D8CDE",
+"= c #A1A0E3",
+"- c #D1D1F1",
+"; c #DBDBFF",
+"> c #9392F8",
+", c #F6F8FB",
+"' c #4B58BE",
+") c #A4A3D4",
+"! c #E2E2FA",
+"~ c #BEBDFF",
+"{ c #8A89EF",
+"] c #EAEEF6",
+"^ c #3F52B8",
+"/ c #333367",
+"( c #C4C4E1",
+"_ c #BDBCF2",
+": c #8180E6",
+"< c #DEE5F0",
+"[ c #344DB3",
+"} c #7A79DF",
+"| c #7E7DBB",
+"1 c #A3A2EA",
+"2 c #7776DC",
+"3 c #D2DBEA",
+"4 c #2847AD",
+"5 c #7271D7",
+"6 c #5857A3",
+"7 c #9897E5",
+"8 c #6E6DD3",
+"9 c #C6D1E5",
+"0 c #1C41A7",
+"a c #6767CC",
+"b c #4D4D9A",
+"c c #9291E2",
+"d c #6766CC",
+"e c #BDCAE1",
+"f c #113BA1",
+"g c #5C5DC2",
+"h c #4A4A94",
+"i c #8B8ADF",
+"j c #BCBBFF",
+"k c #B7B6FF",
+"l c #6063C9",
+"m c #565EC4",
+"n c #5C5DC1",
+"o c #5456BA",
+"p c #47478F",
+"q c #8483DB",
+"r c #B4B3FF",
+"s c #AEADFF",
+"t c #A4A3FC",
+"u c #8F8EF4",
+"v c #8786EC",
+"w c #6C6BD1",
+"x c #4C50B2",
+"y c #444489",
+"z c #8281D9",
+"A c #AAA9FF",
+"B c #A09FFB",
+"C c #9493F5",
+"D c #4B5B71",
+"E c #526276",
+"F c #5B6A7D",
+"G c #4C4FB2",
+"H c #4449AA",
+"I c #494988",
+"J c #9898DF",
+"K c #A09FFF",
+"L c #9190F5",
+"M c #000000",
+"N c #343C47",
+"O c #CED9E9",
+"P c #D4DDEC",
+"Q c #677485",
+"R c #434BAE",
+"S c #3C42A3",
+"T c #6E6E9E",
+"U c #CDCDEF",
+"V c #9A99FF",
+"W c #68788D",
+"X c #D8E0ED",
+"Y c #E0E7F1",
+"Z c #737F8F",
+"` c #3541A3",
+" . c #3C42A2",
+".. c #353D9C",
+"+. c #BBBBD0",
+"@. c #C2C1F8",
+"#. c #2444AA",
+"$. c #213247",
+"%. c #ABB4C3",
+"&. c #B3BBC6",
+"*. c #BCC1CA",
+"=. c #C4C8CE",
+"-. c #484D56",
+";. c #333E9E",
+">. c #363D9C",
+",. c #8E92C6",
+"'. c #6D6C9A",
+" ",
+" ",
+" ",
+" . + @ # $ % & * = - ",
+" ; > , ' ) ",
+" ! ~ { , ] ^ / ( ",
+" _ ~ : , ] < [ } | ",
+" 1 ~ 2 , ] < 3 4 5 6 ",
+" 7 ~ 8 , ] < 3 9 0 a b ",
+" c ~ d , ] < 3 9 e f g h ",
+" i j k l m ' ^ [ 4 0 f n o p ",
+" q r s t u v : } 5 w n o x y ",
+" z A B C D D D D E F o G H I ",
+" J K L v D M N O P Q R H S T ",
+" U V v : D N W X Y Z ` ...+. ",
+" @.: #.$.%.&.*.=.-.;.>.,. ",
+" ( | 6 b h p y I '.+. ",
+" ",
+" ",
+" "};