IF (BUILD_V2)
SUBDIRS(gimmick)
+ SUBDIRS(TestWxGimmickReaderDialog)
ELSE (BUILD_V2)
SUBDIRS(TestWxGimmickDialog)
ENDIF (BUILD_V2)
--- /dev/null
+
+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 )
--- /dev/null
+#include <creaImageIOSystem.h>
+#include <creaWx.h>
+#include <creaImageIOWxGimmickReaderDialog.h>
+
+#include <creaVtkBasicSlicer.h>
+
+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' $$$$"<<std::endl;
+ std::cout << "$$$$ selected files : "<<std::endl;
+ std::vector<std::string> s;
+ w.GetSelectedFiles(s);
+ std::vector<std::string>::iterator i;
+ for (i=s.begin();i!=s.end();++i)
+ {
+ std::cout << *i << std::endl;
+ }
+ std::cout << "$$$$ "<<std::endl;
+
+ std::vector<vtkImageData*> images;
+ w.GetSelectedImages(images);
+ crea::VtkBasicSlicer(images.front());
+ images.front()->Delete();
+
+ }
+ else if (w.GetReturnCode() == wxID_CANCEL)
+ {
+ std::cout << "$$$$ main : user clicked 'CANCEL' $$$$"<<std::endl;
+ }
+ else
+ {
+ std::cout << "$$$$ main : dialog ended without return code ! $$$$"
+ <<std::endl;
+
+ }
+
+ // std::cout << "$$$$ main : deleting dialog"<<std::endl;
+ // delete w;
+ std::cout << "$$$$$$$$$$$$$$$$$$$$ main ended "<<std::endl;
+ return false;
+}
+
+
exit(0);
}
+ std::string handler("Local database");
try
{
g.Initialize();
if (args.file_given)
{
- g.AddFileToLocalDatabase(args.file_arg);
+ g.AddFile(handler,args.file_arg);
}
if (args.dir_given)
{
- g.AddDirToLocalDatabase(args.dir_arg, args.recurse_given);
+ g.AddDir(handler,args.dir_arg, args.recurse_given);
}
if (args.print_given)
{
- g.GetLocalDatabase()->LoadChildren(0,0);
- g.PrintLocalDatabase();
+ g.GetTreeHandler(handler)->LoadChildren(0,0);
+ g.Print(handler);
}
g.Finalize();
#
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
+
)
--- /dev/null
+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<std::string>&){ return; }
+ /// Returns the vector of images corresponding to selection
+ virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
+ /// Returns the vector of DicomNode corresponding to selection
+ virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
+ /// Returns the DicomNode corresponding to the tree item
+ virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
+
+
+ /// Type of list of DicomDatabase
+ typedef std::vector<DicomDatabase*> 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<std::string,DicomNode*> 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
namespace creaImageIO
{
-
+
+
//==============================================================
Gimmick::Gimmick()
{
- crea::MessageManager::RegisterMessageType("Gimmick!",
- "Gimmick",1);
- crea::MessageManager::RegisterMessageType("Gimmick! DEBUG",
- "Gimmick",0);
+ RegisterGimmickMessageTypes();
}
//==============================================================
// 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() ) )
{
/// Sets message level
void Gimmick::SetMessageLevel(int l)
{
- crea::MessageManager::SetMessageLevel("Gimmick!",l);
+ SetGimmickMessageLevel(l);
}
//========================================================================
/// 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 '"<<name<<"' does not exist");
+ }
+ return i->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 '"<<f<<"' to '"<<d<<"'"<<std::endl);
+
+ ImageFinder finder(GetTreeHandler(d));
if (finder.IsHandledFile(f))
{
finder.AddFile(f);
//========================================================================
/// Add a dir to the local database
- void Gimmick::AddDirToLocalDatabase(const std::string& f, bool recurse)
+ void Gimmick::AddDir(const std::string& d, const std::string& f,
+ bool recurse)
{
- ImageFinder finder(mLocalDatabase);
+ GimmickMessage(2,"Adding dir '"<<f<<"' to '"<<d<<"' recurse:"
+ <<recurse<<std::endl);
+
+ ImageFinder finder(GetTreeHandler(d));
finder.AddDirectory(f,recurse);
//========================================================================
///
- void Gimmick::PrintLocalDatabase()
+ void Gimmick::Print(const std::string& d)
{
- mLocalDatabase->GetTree().Print();
+ GetTreeHandler(d)->GetTree().Print();
}
//========================================================================
/**
* \defgroup Model Model
*/
+ /**
+ * \defgroup GUI Top level graphical user interfaces
+ */
/**
* \ingroup Controller
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<std::string, TreeHandler*> 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();
private:
SQLiteTreeHandler* mLocalDatabase;
-
+ TreeHandlerMapType mTreeHandlerMap;
+
std::string mCurrentDirectory;
std::string mHomeDirectory;
std::string mUserSettingsDirectory;
--- /dev/null
+#include <creaImageIOGimmickView.h>
+#include <creaImageIOSystem.h>
+
+namespace creaImageIO
+{
+ // CTor
+ GimmickView::GimmickView(Gimmick* gimmick)
+ {
+ GimmickDebugMessage(1,"GimmickView::GimmickView"
+ <<std::endl);
+ }
+
+ /// Destructor
+ GimmickView::~GimmickView()
+ {
+ GimmickDebugMessage(1,"GimmickView::~GimmickView"
+ <<std::endl);
+ }
+
+
+ /// Initializes the view :
+ /// Creates the TreeViews for all the TreeHandler of the Controller
+ ///
+ void GimmickView::Initialize()
+ {
+ }
+
+ /// Finalize
+ void GimmickView::Finalize()
+ {
+ }
+
+} // EO namespace creaImageIO
+
+
+#ifndef __creaImageIOGimmickView_h_INCLUDED__
+#define __creaImageIOGimmickView_h_INCLUDED__
+
+#include <creaImageIOGimmick.h>
+#include <creaImageIOTreeView.h>
+//#include <map>
+#include <vtkImageData.h>
+
+#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
{
/**
{
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<std::string, TreeView*> 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<vtkImageData*>& s) {}
+ virtual void GetSelectedFiles(std::vector<std::string>& s) {}
+
+ private:
+ /// Controller which manages the interaction with the model
+ Gimmick* mGimmick;
+ /// The views
+ TreeViewMapType mTreeViewMap;
+
+ };
+ // EO class GimmickView
+ //=====================================================================
+
+
+ /*
+
+
+
+
+
+
+
+
//====================================================================
// General
//====================================================================
MultiThreadImageReader mReader;
// map of images name to node
std::map<std::string,DicomNode*> 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
//#include <icons/close.xpm>
#include <creaWx.h>
-#include <creaMessageManager.h>
using namespace crea;
#include <boost/filesystem.hpp>
#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!] "<<MESS);
-#define GimmickDebugMessage(LEV,MESS) \
+#define GimmickDebugMessage(LEV,MESS) \
creaDebugMessage("Gimmick! DEBUG",LEV,"[Gimmick!] DEBUG: "<<MESS);
-#define GimmickError(MESS) \
+#define GimmickError(MESS) \
creaError("[Gimmick!] "<<MESS);
+
+} // namespace
+
#endif
#include <creaImageIOTreeNode.h>
#include <creaImageIOTree.h>
#include <creaImageIOSystem.h>
-#include <creaMessageManager.h>
#include <algorithm>
namespace creaImageIO
--- /dev/null
+#include <creaImageIOTreeView.h>
+#include <creaImageIOSystem.h>
+
+namespace creaImageIO
+{
+ // CTor
+ TreeView::TreeView(TreeHandler* handler)
+ {
+ GimmickDebugMessage(1,"TreeView::TreeView"
+ <<std::endl);
+ }
+
+ /// Destructor
+ TreeView::~TreeView()
+ {
+ GimmickDebugMessage(1,"TreeView::~TreeView"
+ <<std::endl);
+ }
+
+
+ ///
+ void TreeView::UpdateView()
+ {
+ }
+
+
+
+} // EO namespace creaImageIO
+
+
--- /dev/null
+#ifndef __creaImageIOTreeView_h_INCLUDED__
+#define __creaImageIOTreeView_h_INCLUDED__
+
+#include <creaImageIOTreeHandler.h>
+
+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
--- /dev/null
+#include <creaImageIOWxGimmickReaderDialog.h>
+#include <creaImageIOSystem.h>
+
+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"
+ <<std::endl);
+ wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
+
+ try {
+
+ mGimmick = new Gimmick();
+ mGimmick->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"
+ <<std::endl);
+ if (mView)
+ {
+ delete mView;
+ }
+ if (mGimmick)
+ {
+ mGimmick->Finalize();
+ delete mGimmick;
+ }
+ }
+
+
+ //================================================================
+ BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog)
+ END_EVENT_TABLE()
+ //================================================================
+
+
+} // EO namespace creaImageIO
+
+
--- /dev/null
+#ifndef __creaImageIOWxGimmickReaderDialog_h_INCLUDED__
+#define __creaImageIOWxGimmickReaderDialog_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+
+#include <creaImageIOWxGimmickView.h>
+#include <creaWx.h>
+
+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<vtkImageData*>& s)
+ { mView->GetSelectedImages(s); }
+ void GetSelectedFiles(std::vector<std::string>& 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
--- /dev/null
+#include <creaImageIOWxGimmickView.h>
+#include <creaImageIOSystem.h>
+
+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"
+ <<std::endl);
+
+ // Global sizer
+ wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
+ // Notebook
+ mNotebook = new wxNotebook(this,
+ -1,wxDefaultPosition, wxDefaultSize, 0);
+
+ }
+
+ /// Destructor
+ WxGimmickView::~WxGimmickView()
+ {
+ GimmickDebugMessage(1,"WxGimmickView::~WxGimmickView"
+ <<std::endl);
+ }
+
+
+
+} // EO namespace creaImageIO
+
+
--- /dev/null
+#ifndef __creaImageIOWxGimmickView_h_INCLUDED__
+#define __creaImageIOWxGimmickView_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+
+#include <creaImageIOGimmickView.h>
+#include <creaWx.h>
+
+
+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<std::string>&){ return; }
+ /// Returns the vector of images corresponding to selection
+ virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
+ /// Returns the vector of DicomNode corresponding to selection
+ virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
+ /// Returns the DicomNode corresponding to the tree item
+ virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
+
+
+ /// Type of list of DicomDatabase
+ typedef std::vector<DicomDatabase*> 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<std::string,DicomNode*> mImageFileNameToNode;
+ */
+
+} // EO namespace creaImageIO
+
+#endif // USE_WIDGETS
+// EOF
+#endif
--- /dev/null
+#include <creaImageIOWxTreeView.h>
+#include <creaImageIOSystem.h>
+
+namespace creaImageIO
+{
+ // CTor
+ WxTreeView::WxTreeView(TreeHandler* handler,
+ wxWindow* parent,
+ const wxWindowID id)
+ : wxPanel(parent,id),
+ TreeView(handler)
+ {
+ GimmickDebugMessage(1,"WxTreeView::WxTreeView"
+ <<std::endl);
+ }
+
+ /// Destructor
+ WxTreeView::~WxTreeView()
+ {
+ GimmickDebugMessage(1,"WxTreeView::~WxTreeView"
+ <<std::endl);
+ }
+
+
+ ///
+ void WxTreeView::UpdateView()
+ {
+ }
+
+
+
+} // EO namespace creaImageIO
+
+
--- /dev/null
+#ifndef __creaImageIOWxTreeView_h_INCLUDED__
+#define __creaImageIOWxTreeView_h_INCLUDED__
+
+#ifdef USE_WXWIDGETS
+
+#include <creaImageIOTreeView.h>
+#include <creaWx.h>
+
+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