From fcfe92562365cb738cf919d095d2f8d3608ec389 Mon Sep 17 00:00:00 2001 From: guigues Date: Mon, 16 Feb 2009 15:52:23 +0000 Subject: [PATCH] *** empty log message *** --- appli/CMakeLists.txt | 1 + .../TestWxGimmickReaderDialog/CMakeLists.txt | 11 + appli/TestWxGimmickReaderDialog/main.cxx | 78 +++++++ appli/gimmick/main.cxx | 9 +- src2/CMakeLists.txt | 23 +-- src2/OldcreaImageIOGimmickView.h | 162 +++++++++++++++ src2/creaImageIOGimmick.cpp | 47 +++-- src2/creaImageIOGimmick.h | 43 +++- src2/creaImageIOGimmickView.cpp | 35 ++++ src2/creaImageIOGimmickView.h | 70 ++++++- src2/creaImageIOSQLiteTreeHandler.cpp | 1 - src2/creaImageIOSystem.h | 39 +++- src2/creaImageIOTreeNode.cpp | 1 - src2/creaImageIOTreeView.cpp | 30 +++ src2/creaImageIOTreeView.h | 38 ++++ src2/creaImageIOWxGimmickReaderDialog.cpp | 93 +++++++++ src2/creaImageIOWxGimmickReaderDialog.h | 70 +++++++ src2/creaImageIOWxGimmickView.cpp | 38 ++++ src2/creaImageIOWxGimmickView.h | 192 ++++++++++++++++++ src2/creaImageIOWxTreeView.cpp | 34 ++++ src2/creaImageIOWxTreeView.h | 42 ++++ 21 files changed, 1000 insertions(+), 57 deletions(-) create mode 100644 appli/TestWxGimmickReaderDialog/CMakeLists.txt create mode 100644 appli/TestWxGimmickReaderDialog/main.cxx create mode 100644 src2/OldcreaImageIOGimmickView.h create mode 100644 src2/creaImageIOGimmickView.cpp create mode 100644 src2/creaImageIOTreeView.cpp create mode 100644 src2/creaImageIOTreeView.h create mode 100644 src2/creaImageIOWxGimmickReaderDialog.cpp create mode 100644 src2/creaImageIOWxGimmickReaderDialog.h create mode 100644 src2/creaImageIOWxGimmickView.cpp create mode 100644 src2/creaImageIOWxGimmickView.h create mode 100644 src2/creaImageIOWxTreeView.cpp create mode 100644 src2/creaImageIOWxTreeView.h diff --git a/appli/CMakeLists.txt b/appli/CMakeLists.txt index cdd44c7..39bde77 100644 --- a/appli/CMakeLists.txt +++ b/appli/CMakeLists.txt @@ -1,5 +1,6 @@ IF (BUILD_V2) SUBDIRS(gimmick) + SUBDIRS(TestWxGimmickReaderDialog) ELSE (BUILD_V2) SUBDIRS(TestWxGimmickDialog) ENDIF (BUILD_V2) diff --git a/appli/TestWxGimmickReaderDialog/CMakeLists.txt b/appli/TestWxGimmickReaderDialog/CMakeLists.txt new file mode 100644 index 0000000..aad22cb --- /dev/null +++ b/appli/TestWxGimmickReaderDialog/CMakeLists.txt @@ -0,0 +1,11 @@ + +IF(WIN32) + ADD_EXECUTABLE(TestWxGimmickReaderDialog WIN32 main) + SET_TARGET_PROPERTIES(TestWxGimmickReaderDialog PROPERTIES LINK_FLAGS /subsystem:console ) +ELSE(WIN32) + ADD_EXECUTABLE(TestWxGimmickReaderDialog main) +ENDIF(WIN32) + +TARGET_LINK_LIBRARIES( TestWxGimmickReaderDialog creaImageIO2) + +INSTALL_TARGETS(/bin/ TestWxGimmickReaderDialog ) diff --git a/appli/TestWxGimmickReaderDialog/main.cxx b/appli/TestWxGimmickReaderDialog/main.cxx new file mode 100644 index 0000000..8c22759 --- /dev/null +++ b/appli/TestWxGimmickReaderDialog/main.cxx @@ -0,0 +1,78 @@ +#include +#include +#include + +#include + +class myApp : public wxApp +{ +public: + bool OnInit( ); + int OnExit() { return true; } +}; + +IMPLEMENT_APP(myApp); + +CREA_WXMAIN_WITH_CONSOLE + +bool myApp::OnInit( ) +{ + wxApp::OnInit(); +#ifdef __WXGTK__ + //See http://www.wxwindows.org/faqgtk.htm#locale + setlocale(LC_NUMERIC, "C"); +#endif + wxInitAllImageHandlers(); + + creaImageIO::SetGimmickMessageLevel(9); + creaImageIO::SetGimmickDebugMessageLevel(9); + + int image_type = GIMMICK_3D_IMAGE_SELECTION; + int threads = 1; + + creaImageIO::WxGimmickReaderDialog w(0, + -1, + _T("Select image(s) - Gimmick! (c) CREATIS-LRMN 2008"), + wxDefaultPosition, + wxSize(1200,800), + image_type, + threads); + w.ShowModal(); + + if (w.GetReturnCode() == wxID_OK) + { + std::cout << "$$$$ main : user clicked 'OK' $$$$"< s; + w.GetSelectedFiles(s); + std::vector::iterator i; + for (i=s.begin();i!=s.end();++i) + { + std::cout << *i << std::endl; + } + std::cout << "$$$$ "< images; + w.GetSelectedImages(images); + crea::VtkBasicSlicer(images.front()); + images.front()->Delete(); + + } + else if (w.GetReturnCode() == wxID_CANCEL) + { + std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<LoadChildren(0,0); - g.PrintLocalDatabase(); + g.GetTreeHandler(handler)->LoadChildren(0,0); + g.Print(handler); } g.Finalize(); diff --git a/src2/CMakeLists.txt b/src2/CMakeLists.txt index 41e2ed0..a883634 100644 --- a/src2/CMakeLists.txt +++ b/src2/CMakeLists.txt @@ -29,19 +29,16 @@ SET( SRCS # creaImageIOGimmick -# creaImageIODicomNode -# creaImageIODicomNodeComparators -# creaImageIODicomNodeTypeDescription -# creaImageIODicomDatabaseStructure -# creaImageIODicomDatabase -# creaImageIOField - - # The Gimmick! widgets -# creaImageIOWxGimmick -# creaImageIOWxGimmickSettings -# creaImageIOWxGimmickFieldsView - -# creaImageIOWxGimmickDialog + + # Abstract views + creaImageIOGimmickView + creaImageIOTreeView + + # The wxWidgets-based components + creaImageIOWxGimmickView + creaImageIOWxTreeView + creaImageIOWxGimmickReaderDialog + ) diff --git a/src2/OldcreaImageIOGimmickView.h b/src2/OldcreaImageIOGimmickView.h new file mode 100644 index 0000000..3aa98ac --- /dev/null +++ b/src2/OldcreaImageIOGimmickView.h @@ -0,0 +1,162 @@ +namespace creaImageIO +{ + /** + * \ingroup View + */ + //===================================================================== + + //===================================================================== + ///Abstract class that handles views, attributes and previews (GUI) for Gimmick. + class GimmickView + { + public: + /// Ctor + GimmickView(); + /// Virtual destructor + virtual ~GimmickView(); + + //==================================================================== + // General + //==================================================================== + + /// Returns the size of the current selection + virtual int GetSelectionSize() { return 0; } + /// Returns true if there is a valid selection + virtual bool IsSelectionValid(){ return false; } + /// Returns the vector of full filenames of selected images + virtual void GetSelectedFiles(std::vector&){ return; } + /// Returns the vector of images corresponding to selection + virtual void GetSelectedImages(std::vector&){ return; } + /// Returns the vector of DicomNode corresponding to selection + virtual void GetSelectedDicomNodes(std::vector&){ return; } + /// Returns the DicomNode corresponding to the tree item + virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i); + + + /// Type of list of DicomDatabase + typedef std::vector DicomDatabaseListType; + /// Returns the list of DicomDatabase open + virtual DicomDatabaseListType& GetDicomDatabaseList() + { return null; } + /// Returns the list of DicomDatabase open (const) + virtual const DicomDatabaseListType& GetDicomDatabaseList() const + { return null; } + + protected: + ///Opens an existing database, or else, creates a local database. + virtual void OpenOrNewDatabase(bool open){ return; } + ///Shows the help + virtual void ShowHelp(); + + private: + ///Gets the extension of the database + const std::string& GetDatabaseExtension() { return null; } + ///Sets the extension of the database + virtual void SetDatabaseExtension(const std::string& ext){ return; } + + + //==================================================================== + // Preview Display Related + //==================================================================== + + + ///Shows the image sent as a parameter + private: + virtual void ShowImage(vtkImageData* image){ return; } + + //==================================================================== + // Favorites Related + //==================================================================== + + + public: + ///Loads or creates a favorites database + virtual void LoadOrCreateFavoritesDatabase(){ return; } + private: + ///Creates the user settings directory + void CreateUserSettingsDirectory(){ return; } + ///Obtains the user settings directory + const std::string& GetUserSettingsDirectory(){ return null; } + + //==================================================================== + // Attribute Display Related + //==================================================================== + + + ///Shows the Information regarding the node sent as a parameter + private: + virtual void ShowInformation(DicomNode*){ return; } + + //==================================================================== + // Tree Display Related + //==================================================================== + + protected: + /// Completely rebuilds the view with + /// current DicomDatabaseList + virtual void RebuildView(){ return; } + /// Recursively updates the part of the view corresponding + /// to the DicomDatabase passed + /// i.e. creates items for the DicomNode which do not have + /// deletes obsolete items (whose DicomNode has been deleted) + virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; } + /// Recursively updates the part of the view corresponding + /// to the DicomNode provided. + /// parent is its parent in the tree (where to insert / remove it) + virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; } + + private: + ///Type definition of the data regarding the tree + typedef WxGimmickTreeItemData TreeItemData; + ///Gets the item data of the tree item passed as a parameter + TreeItemData* GetItemData(const TreeItemId& id){ return null; } + ///Type definition of the data insid a node of the tree + typedef WxGimmickDicomNodeData NodeData; + + + //==================================================================== + // Class Attributes + //==================================================================== + + + int mSelectionType; + int mSelectionMaxImageDimension; + int mCurrentSelectionImageSize[4]; + + ///Existent Database List + DicomDatabaseListType mDicomDatabaseList; + ///Favorites database + DicomDatabase* mFavoriteDatabase; + + ///Path to the database list file + std::string mDatabaseListFile; + ///Extension of the database + std::string mDatabaseExtension; + + bool mJustStarted; + + int mFirstDicomDatabaseIconIndex; + + // Previewer + vtkImageViewer2* mViewer; + + int mx1,mx2,my1,my2,mz1,mz2; + double mspx,mspy,mspz; + + // Image preview : + // Multi-thread image reader + MultiThreadImageReader mReader; + // map of images name to node + std::map mImageFileNameToNode; + + //Controller which manages the interaction with the model + Gimmick* controller; + + }; + // EO class GimmickView + //===================================================================== + +} // EO namespace creaImageIO + +// EOF +#endif \ No newline at end of file diff --git a/src2/creaImageIOGimmick.cpp b/src2/creaImageIOGimmick.cpp index 64099e5..21d9cd4 100644 --- a/src2/creaImageIOGimmick.cpp +++ b/src2/creaImageIOGimmick.cpp @@ -8,14 +8,12 @@ namespace creaImageIO { - + + //============================================================== Gimmick::Gimmick() { - crea::MessageManager::RegisterMessageType("Gimmick!", - "Gimmick",1); - crea::MessageManager::RegisterMessageType("Gimmick! DEBUG", - "Gimmick",0); + RegisterGimmickMessageTypes(); } //============================================================== @@ -39,6 +37,9 @@ namespace creaImageIO // Create local database handler mLocalDatabase = new SQLiteTreeHandler(GetLocalDatabasePath()); + // Add it to the TreeHandlerMap + mTreeHandlerMap["Local database"] = mLocalDatabase; + // Create or open local database if (! boost::filesystem::exists( GetLocalDatabasePath() ) ) { @@ -154,7 +155,7 @@ namespace creaImageIO /// Sets message level void Gimmick::SetMessageLevel(int l) { - crea::MessageManager::SetMessageLevel("Gimmick!",l); + SetGimmickMessageLevel(l); } //======================================================================== @@ -162,15 +163,31 @@ namespace creaImageIO /// Sets message level void Gimmick::SetDebugMessageLevel(int l) { - crea::MessageManager::SetMessageLevel("Gimmick! DEBUG",l); + SetGimmickDebugMessageLevel(l); } //======================================================================== //======================================================================== /// Add a file to the local database - void Gimmick::AddFileToLocalDatabase(const std::string& f) + TreeHandler* Gimmick::GetTreeHandler(const std::string& name) const + { + TreeHandlerMapType::const_iterator i; + i = GetTreeHandlerMap().find(name); + if ( i == GetTreeHandlerMap().end() ) + { + GimmickError("TreeHandler '"<second; + } + + + //======================================================================== + /// Add a file to the local database + void Gimmick::AddFile(const std::string& d, const std::string& f) { - ImageFinder finder(mLocalDatabase); + GimmickMessage(2,"Adding file '"<GetTree().Print(); + GetTreeHandler(d)->GetTree().Print(); } //======================================================================== diff --git a/src2/creaImageIOGimmick.h b/src2/creaImageIOGimmick.h index cebcbd5..4911b99 100644 --- a/src2/creaImageIOGimmick.h +++ b/src2/creaImageIOGimmick.h @@ -14,6 +14,9 @@ namespace creaImageIO /** * \defgroup Model Model */ + /** + * \defgroup GUI Top level graphical user interfaces + */ /** * \ingroup Controller @@ -36,22 +39,39 @@ namespace creaImageIO void Finalize(); /// Sets level for messages "Gimmick!" - void SetMessageLevel(int level); - /// Sets level for debug messages "Gimmick! DEBUG" - void SetDebugMessageLevel(int level); + static void SetMessageLevel(int level); + /// Sets level for debug messages "Gimmick! DEBUG" + static void SetDebugMessageLevel(int level); + + /// Type of map from TreeHandler name to TreeHandler* + typedef std::map TreeHandlerMapType; + + /// Returns the TreeHandlerMap (ref) + TreeHandlerMapType& GetTreeHandlerMap() { return mTreeHandlerMap; } + /// Returns the TreeHandlerMap (const ref) + const TreeHandlerMapType& GetTreeHandlerMap() const + { return mTreeHandlerMap; } + - /// Add a file to the local database - void AddFileToLocalDatabase(const std::string&); - /// Add a dir to the local database - void AddDirToLocalDatabase(const std::string&, bool recurse); + /// Add a file to the given TreeHandler + void AddFile(const std::string& handler, const std::string& filename); + /// Add a dir to the given TreeHandler + void AddDir(const std::string& handler, const std::string& path, + bool recurse); - /// - void PrintLocalDatabase(); + /// Prints the tree handled by the handler + void Print(const std::string& handler); + + /// Returns the TreeHandler with a given name + TreeHandler* GetTreeHandler(const std::string& name) const; /// SQLiteTreeHandler* GetLocalDatabase() { return mLocalDatabase; } - const SQLiteTreeHandler* GetLocalDatabase() const { return mLocalDatabase; } + const SQLiteTreeHandler* GetLocalDatabase() const + { return mLocalDatabase; } + + /// const std::string& GetHomeDirectory(); @@ -61,7 +81,8 @@ namespace creaImageIO private: SQLiteTreeHandler* mLocalDatabase; - + TreeHandlerMapType mTreeHandlerMap; + std::string mCurrentDirectory; std::string mHomeDirectory; std::string mUserSettingsDirectory; diff --git a/src2/creaImageIOGimmickView.cpp b/src2/creaImageIOGimmickView.cpp new file mode 100644 index 0000000..d7f04de --- /dev/null +++ b/src2/creaImageIOGimmickView.cpp @@ -0,0 +1,35 @@ +#include +#include + +namespace creaImageIO +{ + // CTor + GimmickView::GimmickView(Gimmick* gimmick) + { + GimmickDebugMessage(1,"GimmickView::GimmickView" + < +#include +//#include +#include + +#define GIMMICK_NO_IMAGE_SELECTION 0 +#define GIMMICK_2D_IMAGE_SELECTION 2 +#define GIMMICK_3D_IMAGE_SELECTION 3 +#define GIMMICK_4D_IMAGE_SELECTION 4 + + namespace creaImageIO { /** @@ -11,10 +25,52 @@ namespace creaImageIO { public: /// Ctor - GimmickView(); + GimmickView(Gimmick* ); /// Virtual destructor virtual ~GimmickView(); + + /// Initializes the view : + /// Creates the TreeViews for all the TreeHandler of the Controller + /// + virtual void Initialize(); + + /// Type of map from View name to TreeView* + /// (This map is equivalent for Views of the TreeHandlerMap of Gimmick) + typedef std::map TreeViewMapType; + + /// Returns the TreeViewMap (ref) + TreeViewMapType& GetTreeViewMap() { return mTreeViewMap; } + /// Returns the TreeViewMap (const ref) + const TreeViewMapType& GetTreeViewMap() const + { return mTreeViewMap; } + + /// Finalize + virtual void Finalize(); + + virtual void GetSelectedImages(std::vector& s) {} + virtual void GetSelectedFiles(std::vector& s) {} + + private: + /// Controller which manages the interaction with the model + Gimmick* mGimmick; + /// The views + TreeViewMapType mTreeViewMap; + + }; + // EO class GimmickView + //===================================================================== + + + /* + + + + + + + + //==================================================================== // General //==================================================================== @@ -148,15 +204,9 @@ namespace creaImageIO MultiThreadImageReader mReader; // map of images name to node std::map mImageFileNameToNode; - - //Controller which manages the interaction with the model - Gimmick* controller; - - }; - // EO class GimmickView - //===================================================================== - + */ + } // EO namespace creaImageIO // EOF -#endif \ No newline at end of file +#endif diff --git a/src2/creaImageIOSQLiteTreeHandler.cpp b/src2/creaImageIOSQLiteTreeHandler.cpp index c35ae61..ef16549 100644 --- a/src2/creaImageIOSQLiteTreeHandler.cpp +++ b/src2/creaImageIOSQLiteTreeHandler.cpp @@ -21,7 +21,6 @@ //#include #include -#include using namespace crea; #include diff --git a/src2/creaImageIOSystem.h b/src2/creaImageIOSystem.h index f56b10b..27ff483 100644 --- a/src2/creaImageIOSystem.h +++ b/src2/creaImageIOSystem.h @@ -15,12 +15,43 @@ #define CREAIMAGEIO_CDECL #endif // defined(_WIN32) - -#define GimmickMessage(LEV,MESS) \ +namespace creaImageIO +{ + //============================================================== + inline void RegisterGimmickMessageTypes() + { + static bool first_time = true; + if (first_time) + { + crea::MessageManager::RegisterMessageType("Gimmick!", + "Gimmick",1); + crea::MessageManager::RegisterMessageType("Gimmick! DEBUG", + "Gimmick",0); + first_time = false; + } + } + //============================================================== + inline void SetGimmickMessageLevel(int l) + { + RegisterGimmickMessageTypes(); + crea::MessageManager::SetMessageLevel("Gimmick!",l); + } + //============================================================== + inline void SetGimmickDebugMessageLevel(int l) + { + RegisterGimmickMessageTypes(); + crea::MessageManager::SetMessageLevel("Gimmick! DEBUG",l); + } + //============================================================== + +#define GimmickMessage(LEV,MESS) \ creaMessage("Gimmick!",LEV,"[Gimmick!] "< #include #include -#include #include namespace creaImageIO diff --git a/src2/creaImageIOTreeView.cpp b/src2/creaImageIOTreeView.cpp new file mode 100644 index 0000000..43cb1ee --- /dev/null +++ b/src2/creaImageIOTreeView.cpp @@ -0,0 +1,30 @@ +#include +#include + +namespace creaImageIO +{ + // CTor + TreeView::TreeView(TreeHandler* handler) + { + GimmickDebugMessage(1,"TreeView::TreeView" + < + +namespace creaImageIO +{ + /** + * \ingroup View + */ + //===================================================================== + + //===================================================================== + /// Abstract class that handles the view of a Tree through its TreeHandler + class TreeView + { + public: + /// Ctor + TreeView(TreeHandler*); + /// Virtual destructor + virtual ~TreeView(); + + + /// Something like that ... + virtual void UpdateView(); + + + private: + /// The TreeHandler with which it corresponds + TreeHandler* mTreeHandler; + }; + // EO class TreeView + //===================================================================== + +} // EO namespace creaImageIO + +// EOF +#endif diff --git a/src2/creaImageIOWxGimmickReaderDialog.cpp b/src2/creaImageIOWxGimmickReaderDialog.cpp new file mode 100644 index 0000000..a6053fa --- /dev/null +++ b/src2/creaImageIOWxGimmickReaderDialog.cpp @@ -0,0 +1,93 @@ +#include +#include + +namespace creaImageIO +{ + // CTor + WxGimmickReaderDialog::WxGimmickReaderDialog(wxWindow *parent, + wxWindowID id, + wxString title, + const wxPoint& pos, + const wxSize& size, + int image_type, + int threads) + : wxDialog( parent, + id, + title, + pos, + size, + wxRESIZE_BORDER | + wxSYSTEM_MENU | + wxCLOSE_BOX | + wxMAXIMIZE_BOX | + wxMINIMIZE_BOX | + wxCAPTION + ), + mGimmick(0), + mView(0) + { + GimmickDebugMessage(1,"WxGimmickReaderDialog::WxGimmickReaderDialog" + <Initialize(); + + + mView = new WxGimmickView(mGimmick, + this, + TVID, + wxDefaultPosition, + size, + image_type, + threads); + mView->Initialize(); + } + catch (crea::Exception e) + { + e.Print(); + return; + } + + topsizer->Add( mView,1,wxGROW,0); + + wxSizer* bsizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); + mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); + mCancelButton = (wxButton*)FindWindowById(GetEscapeId(), this); + + mOkButton->Enable(false); + + topsizer->Add ( bsizer, 0, wxGROW ); + + SetSizer( topsizer ); + Layout(); + } + + /// Destructor + WxGimmickReaderDialog::~WxGimmickReaderDialog() + { + GimmickDebugMessage(1,"WxGimmickReaderDialog::~WxGimmickReaderDialog" + <Finalize(); + delete mGimmick; + } + } + + + //================================================================ + BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog) + END_EVENT_TABLE() + //================================================================ + + +} // EO namespace creaImageIO + + diff --git a/src2/creaImageIOWxGimmickReaderDialog.h b/src2/creaImageIOWxGimmickReaderDialog.h new file mode 100644 index 0000000..1bf53de --- /dev/null +++ b/src2/creaImageIOWxGimmickReaderDialog.h @@ -0,0 +1,70 @@ +#ifndef __creaImageIOWxGimmickReaderDialog_h_INCLUDED__ +#define __creaImageIOWxGimmickReaderDialog_h_INCLUDED__ + +#ifdef USE_WXWIDGETS + +#include +#include + +namespace creaImageIO +{ + /** + * \ingroup GUI + */ + //===================================================================== + //===================================================================== + class /*CREAIMAGEIO_EXPORT*/ WxGimmickReaderDialog : public wxDialog + { + public: + WxGimmickReaderDialog(); + WxGimmickReaderDialog(wxWindow *parent, + const wxWindowID id, + wxString title, + const wxPoint& pos, + const wxSize& size, + int image_type = GIMMICK_3D_IMAGE_SELECTION, + int threads = 0); + + Gimmick* GetGimmick() { return mGimmick; } + // typedef WxGimmick ViewType; + typedef WxGimmickView::EventType EventType; + + ~WxGimmickReaderDialog(); + + void GetSelectedImages(std::vector& s) + { mView->GetSelectedImages(s); } + void GetSelectedFiles(std::vector& s) + { mView->GetSelectedFiles(s); } + + void OnSelChanged(EventType& event); + void OnContextualMenu(EventType& event); + void OnMenuTest(wxCommandEvent& event); + // void OnButtonOk(wxCommandEvent& event); + // void OnButtonCancel(wxCommandEvent& event); + + DECLARE_EVENT_TABLE(); + private : + + Gimmick* mGimmick; + WxGimmickView* mView; + + wxButton* mOkButton; + wxButton* mCancelButton; + + enum + { + TVID = 1 + // OKID = 2, + // CANCELID = 3 + }; + + }; // class WxGimmickReaderDialog + //===================================================================== + + +} // EO namespace creaImageIO + + +#endif // USE_WIDGETS +// EOF +#endif diff --git a/src2/creaImageIOWxGimmickView.cpp b/src2/creaImageIOWxGimmickView.cpp new file mode 100644 index 0000000..b5ee40f --- /dev/null +++ b/src2/creaImageIOWxGimmickView.cpp @@ -0,0 +1,38 @@ +#include +#include + +namespace creaImageIO +{ + // CTor + WxGimmickView::WxGimmickView(Gimmick* gimmick, + wxWindow *parent, + const wxWindowID id, + const wxPoint& pos, const wxSize& size, + int image_type, + int number_of_threads) + : wxPanel(parent,id,pos,size), + GimmickView(gimmick) + { + GimmickDebugMessage(1,"WxGimmickView::WxGimmickView" + < +#include + + +namespace creaImageIO +{ + /** + * \ingroup View + */ + //===================================================================== + + //===================================================================== + /// Concrete derivative of GimmickView which implements a wxWidgets-based view + class WxGimmickView : public wxPanel, virtual public GimmickView + { + public: + typedef int EventType; + + /// Ctor + WxGimmickView(Gimmick*, + wxWindow *parent, + const wxWindowID id, + const wxPoint& pos, const wxSize& size, + int image_type = GIMMICK_3D_IMAGE_SELECTION, + int number_of_threads = 0); + /// Virtual destructor + virtual ~WxGimmickView(); + + + + + private: + + }; + // EO class WxGimmickView + //===================================================================== + + + /* + + + + + + + + + //==================================================================== + // General + //==================================================================== + + /// Returns the size of the current selection + virtual int GetSelectionSize() { return 0; } + /// Returns true if there is a valid selection + virtual bool IsSelectionValid(){ return false; } + /// Returns the vector of full filenames of selected images + virtual void GetSelectedFiles(std::vector&){ return; } + /// Returns the vector of images corresponding to selection + virtual void GetSelectedImages(std::vector&){ return; } + /// Returns the vector of DicomNode corresponding to selection + virtual void GetSelectedDicomNodes(std::vector&){ return; } + /// Returns the DicomNode corresponding to the tree item + virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i); + + + /// Type of list of DicomDatabase + typedef std::vector DicomDatabaseListType; + /// Returns the list of DicomDatabase open + virtual DicomDatabaseListType& GetDicomDatabaseList() + { return null; } + /// Returns the list of DicomDatabase open (const) + virtual const DicomDatabaseListType& GetDicomDatabaseList() const + { return null; } + + protected: + ///Opens an existing database, or else, creates a local database. + virtual void OpenOrNewDatabase(bool open){ return; } + ///Shows the help + virtual void ShowHelp(); + + private: + ///Gets the extension of the database + const std::string& GetDatabaseExtension() { return null; } + ///Sets the extension of the database + virtual void SetDatabaseExtension(const std::string& ext){ return; } + + + //==================================================================== + // Preview Display Related + //==================================================================== + + + ///Shows the image sent as a parameter + private: + virtual void ShowImage(vtkImageData* image){ return; } + + //==================================================================== + // Favorites Related + //==================================================================== + + + public: + ///Loads or creates a favorites database + virtual void LoadOrCreateFavoritesDatabase(){ return; } + private: + ///Creates the user settings directory + void CreateUserSettingsDirectory(){ return; } + ///Obtains the user settings directory + const std::string& GetUserSettingsDirectory(){ return null; } + + //==================================================================== + // Attribute Display Related + //==================================================================== + + + ///Shows the Information regarding the node sent as a parameter + private: + virtual void ShowInformation(DicomNode*){ return; } + + //==================================================================== + // Tree Display Related + //==================================================================== + + protected: + /// Completely rebuilds the view with + /// current DicomDatabaseList + virtual void RebuildView(){ return; } + /// Recursively updates the part of the view corresponding + /// to the DicomDatabase passed + /// i.e. creates items for the DicomNode which do not have + /// deletes obsolete items (whose DicomNode has been deleted) + virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; } + /// Recursively updates the part of the view corresponding + /// to the DicomNode provided. + /// parent is its parent in the tree (where to insert / remove it) + virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; } + + private: + ///Type definition of the data regarding the tree + typedef WxGimmickTreeItemData TreeItemData; + ///Gets the item data of the tree item passed as a parameter + TreeItemData* GetItemData(const TreeItemId& id){ return null; } + ///Type definition of the data insid a node of the tree + typedef WxGimmickDicomNodeData NodeData; + + + //==================================================================== + // Class Attributes + //==================================================================== + + + int mSelectionType; + int mSelectionMaxImageDimension; + int mCurrentSelectionImageSize[4]; + + ///Existent Database List + DicomDatabaseListType mDicomDatabaseList; + ///Favorites database + DicomDatabase* mFavoriteDatabase; + + ///Path to the database list file + std::string mDatabaseListFile; + ///Extension of the database + std::string mDatabaseExtension; + + bool mJustStarted; + + int mFirstDicomDatabaseIconIndex; + + // Previewer + vtkImageViewer2* mViewer; + + int mx1,mx2,my1,my2,mz1,mz2; + double mspx,mspy,mspz; + + // Image preview : + // Multi-thread image reader + MultiThreadImageReader mReader; + // map of images name to node + std::map mImageFileNameToNode; + */ + +} // EO namespace creaImageIO + +#endif // USE_WIDGETS +// EOF +#endif diff --git a/src2/creaImageIOWxTreeView.cpp b/src2/creaImageIOWxTreeView.cpp new file mode 100644 index 0000000..fb6bcf3 --- /dev/null +++ b/src2/creaImageIOWxTreeView.cpp @@ -0,0 +1,34 @@ +#include +#include + +namespace creaImageIO +{ + // CTor + WxTreeView::WxTreeView(TreeHandler* handler, + wxWindow* parent, + const wxWindowID id) + : wxPanel(parent,id), + TreeView(handler) + { + GimmickDebugMessage(1,"WxTreeView::WxTreeView" + < +#include + +namespace creaImageIO +{ + /** + * \ingroup View + */ + //===================================================================== + + //===================================================================== + /// Abstract class that handles the view of a Tree through its TreeHandler + class WxTreeView : public wxPanel, virtual public TreeView + { + public: + /// Ctor + WxTreeView(TreeHandler*, wxWindow* parent, const wxWindowID id); + /// Virtual destructor + virtual ~WxTreeView(); + + + /// Something like that ... + virtual void UpdateView(); + + + private: + + }; + // EO class WxTreeView + //===================================================================== + +} // EO namespace creaImageIO + + +#endif // USE_WIDGETS +// EOF +#endif -- 2.45.1