#include <creaImageIODicomDatabase.h>
// wx
-#include "wx/wx.h"
-#include "wx/image.h"
-#include "wx/imaglist.h"
+#include <creaWx.h>
+#include <wx/image.h>
+#include <wx/imaglist.h>
#include <wx/splitter.h>
+#include <wx/notebook.h>
#include "treelistctrl.h"
// dicom fields view panel
// For image preview
// vtk and wxvtk classes
-#include "wxVTKRenderWindowInteractor.h"
+#include "creawxVTKRenderWindowInteractor.h"
#include "vtkImageViewer2.h"
// multi-thread image reader
#include <creaImageIOMultiThreadImageReader.h>
class WxGimmickDicomNodeData;
//====================================================================
+#define GIMMICK_NO_IMAGE_SELECTION 0
+#define GIMMICK_2D_IMAGE_SELECTION 2
+#define GIMMICK_3D_IMAGE_SELECTION 3
+#define GIMMICK_4D_IMAGE_SELECTION 4
+
//====================================================================
class CREAIMAGEIO_EXPORT WxGimmick : public wxPanel,
- public MultiThreadImageReaderUser
+ public MultiThreadImageReaderUser
{
public:
+ /// Ctor
WxGimmick(wxWindow *parent, const wxWindowID id,
- const wxPoint& pos, const wxSize& size,
- int number_of_threads = 0);
-
+ const wxPoint& pos, const wxSize& size,
+ int image_type = GIMMICK_3D_IMAGE_SELECTION,
+ int number_of_threads = 0);
+ /// Dtor
virtual ~WxGimmick();
+ /// Returns the size of the current selection
+ int GetSelectionSize() { return mTreeListCtrl->GetSelectionSize(); }
+ /// Returns true if there is a valid selection
+ bool IsSelectionValid();
+ /// Returns the vector of full filenames of selected images
+ void GetSelectedFiles(std::vector<std::string>&);
+ /// Returns the vector of images corresponding to selection
+ void GetSelectedImages(std::vector<vtkImageData*>&);
+ /// Returns the vector of DicomNode corresponding to selection
+ void GetSelectedDicomNodes(std::vector<DicomNode*>&);
+ /// Returns the vector of wxTreeItemId corresponding to selection
+ void GetSelectedItems(std::vector<wxTreeItemId>&);
+
+ /// Returns the DicomNode corresponding to the tree item
+ DicomNode* GetDicomNodeOfItem(const wxTreeItemId& i);
+
+ /// Stores the first id of user menu
+ static const int UserMenuFirstId;
+
+ /// The class storing WxGimmick settings
+ typedef WxGimmickSettings Settings;
+ /// Returns the settings (const)
+ const Settings& GetSettings() const { return mSettings; }
+ /// Returns the settings
+ Settings& GetSettings() { return mSettings; }
+
+
+ /// The type of event sent by WxGimmick
+ typedef WxGimmickEvent EventType;
+
+ /// The type of list of DicomDatabase
typedef std::vector<DicomDatabase*> DicomDatabaseListType;
- DicomDatabaseListType& GetDicomDatabaseList() { return mDicomDatabaseList; }
- const DicomDatabaseListType& GetDicomDatabaseList() const { return mDicomDatabaseList; }
+ /// Returns the list of DicomDatabase open
+ DicomDatabaseListType& GetDicomDatabaseList()
+ { return mDicomDatabaseList; }
+ /// Returns the list of DicomDatabase open (const)
+ const DicomDatabaseListType& GetDicomDatabaseList() const
+ { return mDicomDatabaseList; }
+ /// Returns the wxTreeListCtrl of the main view
wxTreeListCtrl* GetTreeListCtrl() { return mTreeListCtrl; }
+ /// Returns the wxTreeListCtrl of the main view (const)
const wxTreeListCtrl* GetTreeListCtrl() const { return mTreeListCtrl; }
+ ///
void SetConfigurationFile(const std::string& filename)
- {
- mConfigurationFile = filename;
- }
+ { mConfigurationFile = filename;}
void LoadConfiguration();
void SaveConfiguration();
void SetSaveConfigurationOnClose(bool v)
{ mSaveConfigurationOnClose = v; }
+ void LoadOrCreateFavoritesDatabase();
- void GetSelectedImages(std::vector<std::string>&);
- void GetSelectedDicomNodes(std::vector<DicomNode*>&);
- void GetSelectedItems(std::vector<wxTreeItemId>&);
- DicomNode* GetDicomNodeOfItem(const wxTreeItemId& i);
-
-
- static const int UserMenuFirstId;
-
- typedef WxGimmickSettings Settings;
- const Settings& GetSettings() const { return mSettings; }
- Settings& GetSettings() { return mSettings; }
-
- typedef WxGimmickEvent EventType;
-
protected:
+
+ /// Completely rebuilds the view (i.e. the wxTreeListCtrl) with
+ /// current DicomDatabaseList
void RebuildView();
+ /// 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)
void UpdateDicomDatabaseView(DicomDatabase*);
+ /// Recursively updates the part of the view corresponding
+ /// to the DicomNode provided.
+ /// parent is its parent in the tree (where to insert / remove it)
void UpdateDicomNodeView(DicomNode* n, const wxTreeItemId& parent);
+ /// Recursively deletes
void DeleteObsoleteChildren(wxTreeItemId& id);
+ /// Create the column titles of the children of the item
wxTreeItemId CreateChildrenColumnsTitles(wxTreeItemId& item,
DicomNode::Type t);
+ ///
void UpdateColumnsTitles(wxTreeItemId& item, DicomNode::Type t);
+ ///
void UpdateColumns(wxTreeItemId& item, bool only_first = false);
+
+
+
+ /// General entry point for
void OpenOrNewDatabase(bool open);
void InsertDicomDatabase(wxTreeItemId& id, DicomDatabase* r);
void DeleteDicomDatabase(wxTreeItemId& id, DicomDatabase* r);
+ void LoadChildren( wxTreeItemId& id );
friend class WxGimmickEvent;
+ void ShowHelp();
+
private:
WxGimmick() { }
WxGimmick(const WxGimmick& ) { }
+ int mSelectionType;
+ int mSelectionMaxImageDimension;
+ int mCurrentSelectionImageSize[4];
+
DicomDatabaseListType mDicomDatabaseList;
+ DicomDatabase* mFavoriteDatabase;
wxTreeListCtrl* mTreeListCtrl;
wxTreeItemId mTreeRootId;
const std::string& GetDatabaseExtension() { return mDatabaseExtension; }
void SetDatabaseExtension(const std::string& ext)
{ mDatabaseExtension = ext; }
+
+
+ /// Settings
Settings mSettings;
+
+ // Help
+ WxGimmickHelp* mHelp;
+ bool mJustStarted;
+
int mFirstDicomDatabaseIconIndex;
// Id of the item which activated the popup menu
wxTreeItemId mItemOfMenu;
WxGimmickFieldsView* mFieldsView;
+ wxNotebook* mwxNotebook;
+
wxSplitterWindow *mSplitter1;
wxSplitterWindow *mSplitter2;
// Previewer
vtkImageViewer2* mViewer;
// Associated wxvtk interactor
- crea::wxVTKRenderWindowInteractor *mInteractor;
+ crea::creawxVTKRenderWindowInteractor *mInteractor;
int mx1,mx2,my1,my2,mz1,mz2;
double mspx,mspy,mspz;
void OnItemCollapsing(wxTreeEvent& event);
void OnSelChanged(wxTreeEvent& event);
void OnSelChanging(wxTreeEvent& event);
+ bool IsImageSelectable(DicomNode* node);
void OnTreeKeyDown(wxTreeEvent& event);
void OnItemActivated(wxTreeEvent& event);
void OnItemRightClick(wxTreeEvent& event);
void OnPopUpAddFile(wxCommandEvent& event);
void OnPopUpAddRawFile(wxCommandEvent& event);
void OnPopUpAddDirectory(wxCommandEvent& event);
+ void OnPopUpAddToFavorites(wxCommandEvent& event);
void OnPopUpRemove(wxCommandEvent& event);
void OnPopUpSettings(wxCommandEvent& event);
void OnPopUpAbout(wxCommandEvent& event);