# The wxWidgets-based components
if (USE_WXWIDGETS)
FILE(GLOB SOURCES_CREAIMAGEIO_WX
+ creaImageIOWxAttributeSelectionPanel.cpp
+ creaImageIOWxCustomizeConfigPanel.cpp
+ creaImageIOWxDescriptorPanel.cpp
+ creaImageIOWxEditFieldsPanel.cpp
+ creaImageIOWxExportDlg.cpp
+ creaImageIOWxDumpPanel.cpp
creaImageIOWxGimmickView.cpp
- creaImageIOWxTreeView.cpp
- creaImageIOWxGimmickReaderDialog.cpp
+ creaImageIOWxGimmickReaderDialog.cpp
creaImageIOWxGimmickFrame.cpp
creaImageIOWxGimmickPanel.cpp
creaImageIOWxGimmickTools.cpp
- creaImageIOWxCustomizeConfigPanel.cpp
creaImageIOWxListenerPanel.cpp
- creaImageIOWxEditFieldsPanel.cpp
- creaImageIOWxAttributeSelectionPanel.cpp
- creaImageIOWxPACSConnectionPanel.cpp
- creaImageIOWxDescriptorPanel.cpp
- creaImageIOWxDumpPanel.cpp
+ creaImageIOWxPACSConnectionPanel.cpp
+ creaImageIOWxTreeView.cpp
)
endif()
/// Type of map from TreeHandler name to TreeHandler*
typedef std::map<std::string, TreeHandler*> TreeHandlerMapType;
+ typedef std::map<std::string, TreeHandler*>::const_iterator ItTreeHandlerMap;
+
/// Returns the TreeHandlerMap (ref)
TreeHandlerMapType& GetTreeHandlerMap() { return mTreeHandlerMap; }
+
/// Returns the TreeHandlerMap (const ref)
const TreeHandlerMapType& GetTreeHandlerMap() const
{ return mTreeHandlerMap; }
virtual void DumpTags(const std::string filename)
{GimmickError("INTERNAL ERROR : DumpTags not implemented"); }
+ ///Edits the fields of a given node
+ virtual void ExportToStorage(const std::vector<std::string> keys)
+ { GimmickError("INTERNAL ERROR : ExportToStorage not implemented"); }
+
///Copies selected files
virtual void SaveAs(const std::vector<std::string>& filenames)
{ GimmickError("INTERNAL ERROR : SaveAs not implemented"); }
//=====================================================================
//=====================================================================
/// Gimmick DB are based on descriptors with a tree structure .
- /// Ecah level contains attributes (DICOM or other) to identify data
+ /// Each level contains attributes (DICOM or other) to identify data
/// WxDescriptorPanel allows creation, modification and save of descriptors.
///
--- /dev/null
+#include <creaImageIOWxExportDlg.h>
+
+namespace creaImageIO
+{
+ // CTor
+ WxExportDlg::WxExportDlg(wxWindow *parent, const std::vector<std::string> storages)
+ : wxDialog(parent, -1,_T("EXPORT FILES TO STORAGE"), wxDefaultPosition, wxSize(260,150))
+ {
+ int size = 16;
+
+ wxStaticText * ExportText=new wxStaticText(this,-1,_T(" Storage to export: "), wxPoint(5,10));
+ wxArrayString names;
+ std::vector<std::string>::const_iterator it = storages.begin();
+ for(;it != storages.end(); it++)
+ {
+ names.Add(crea::std2wx(*it));
+ }
+ ExportCombo = new wxComboBox(this, ID_EXPORTCOMBO_CTRL,_T(""),wxPoint(120,10), wxSize(120,25),names);
+ ExportCombo->SetSelection(0);
+ // Connect( ExportCombo->GetId(), wxEVT_COMMAND_TEXT_UPDATED , (wxObjectEventFunction) &WxDescriptorPanel::OnDicomAttribute );
+
+ // VALIDATION BUTTON
+ wxButton *Ok = new wxButton(this, -1,_T("OK"), wxPoint(5,50) );
+ Connect( Ok->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WxExportDlg::OnOk );
+
+ wxButton *Cancel = new wxButton(this, wxID_CANCEL,_T("CANCEL"), wxPoint(100,50) );
+ Layout();
+
+ }
+
+ WxExportDlg::~WxExportDlg(){}
+
+
+ void WxExportDlg::OnOk(wxCommandEvent &event)
+ {
+ m_name = crea::wx2std(ExportCombo->GetValue());
+ Close();
+ SetReturnCode(ID_EXPORT_OK);
+ }
+
+
+}
\ No newline at end of file
--- /dev/null
+#ifndef __creaImageIOWxExportDlg_h_INCLUDED__
+#define __creaImageIOWxExportDlg_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+#include <creaWx.h>
+#include <creaImageIOWxGimmickView.h>
+
+#define ID_EXPORTCOMBO_CTRL 1801
+#define ID_EXPORT_OK 1802
+
+namespace creaImageIO{
+ /**
+ * \ingroup GUI
+ */
+ //=====================================================================
+ //=====================================================================
+ /// Gimmick can handle multiple database with different organisations.
+ /// WxDescriptorPanel allows to select the storage to export data.
+ ///
+ class WxExportDlg : public wxDialog
+ {
+ public:
+ ///CTor
+ WxExportDlg(wxWindow *parent, const std::vector<std::string> storages);
+ ///DTor
+ ~WxExportDlg();
+
+ /// Get selected storage
+ const std::string& GetStorage(){ return m_name;}
+
+ private:
+
+ /// Storage ComboBox
+ wxComboBox *ExportCombo;
+
+ ///Validate selected storage
+ void OnOk(wxCommandEvent &event);
+
+ /// Storage name
+ std::string m_name;
+ };
+}
+#endif // USE_WIDGETS
+// EOF
+#endif
#include <creaImageIOWxAttributeSelectionPanel.h>
#include <creaImageIOWxDescriptorPanel.h>
#include <creaImageIOWxDumpPanel.h>
+#include <creaImageIOWxExportDlg.h>
using namespace crea;
// Icons
pan->ShowModal();
}
+ //========================================================================
+ void WxGimmickView::ExportToStorage(const std::vector<std::string> i_filenames)
+ {
+ std::vector<std::string> storages;
+ Gimmick::TreeHandlerMapType::iterator it = mGimmick->GetTreeHandlerMap().begin();
+ for(;it != mGimmick->GetTreeHandlerMap().end(); it++)
+ {
+ storages.push_back(it->first);
+ }
+
+ WxExportDlg* exp= new WxExportDlg(this,storages);
+ if ( exp->ShowModal() ==ID_EXPORT_OK)
+ {
+ std::string storage = exp->GetStorage();
+ mProgressDialog =
+ new wxProgressDialog(_T("Adding file(s)"),
+ _T(""),
+ 1000,
+ this,
+ wxPD_ELAPSED_TIME |
+ // wxPD_ESTIMATED_TIME |
+ // wxPD_REMAINING_TIME |
+ wxPD_CAN_ABORT );
+ mGimmick->AddFiles(storage,i_filenames);
+ mProgressDialog->Pulse(_T("Updating view..."));
+ UpdateTreeViewLevel(storage,1);
+ delete mProgressDialog;
+ DisplayAddSummary();
+ }
+ }
+
+
+
//========================================================================
void WxGimmickView::OnFieldsEdited(tree::Node* node, const std::string& name, const std::string& key, const std::string& val)
{
/// Display all Dicom Tags
void DumpTags(const std::string i_filename);
+ /// Export from Storage to Storage
+ void ExportToStorage(const std::vector<std::string> i_filenames);
+
/// Progress dialog
wxProgressDialog* mProgressDialog;
Connect( mFilterID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupFilter) );
+ ////SubMenuItem EXPORT
+ subExportMenu = new wxMenu;
+ wxMenuItem *subExp1 = subExportMenu->Append(wxID_ANY, _T("&Export to Storage"));
+ Connect( subExp1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnExportToStorage) );
//ItemMenu
menuItem =new wxMenu;
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"));
+ menuItem->AppendSubMenu(subExportMenu, wxT("&Export"));
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
}
}
+ //================================================================
+
+ //================================================================
+
+ void WxTreeView::OnExportToStorage(wxCommandEvent &event)
+ {
+ std::vector<std::string> filesname;
+ std::vector<tree::Node*> nodes;
+ nodes.push_back(((ItemData*)GetCtrl(mLastRightLevel)->GetItemData(mLastRightSelected))->node);
+ GetFilenamesAsString(nodes,filesname);
+ GetGimmickView()->ExportToStorage(filesname);
+ }
+
+ //================================================================
+
+ //================================================================
+
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;
- }
- }
+ 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 display alll dicom tags for a file
void OnDumpTags(wxCommandEvent &event);
+ ///Callback when the user needs to transfer data from storage to storage
+ void OnExportToStorage(wxCommandEvent &event);
+
///Callback on mouse click
void OnMouseClick(wxMouseEvent& event);
unsigned int mLastLevel;
wxMenu* menuItem;
+ wxMenu *subExportMenu;
int mAnonymizingID;
int mLocalCopyID;
int mEditFieldID;
int mDumpID;
+ int mExportID;
+ int mExport2StorageID;
// If set to true then OnSelectedChanged returns immediately.
// Used to do avoid useless process during multiple selections