}else if (w.GetReturnCode() == wxID_CANCEL){
vtkMetaImageReader *reader = vtkMetaImageReader::New();
- reader->SetFileName( "data/hola.mhd" );
+ reader->SetFileName( "D:/CAT08/Datos/Imagenes/image06.mhd"); //"data/hola.mhd" );
reader->Update();
images.push_back(reader->GetOutput());
}else{
std::vector<wxObjectEventFunction> funct;
path.push_back(datadir + "/copy.png");
- nom.push_back("Copy the selected contour");
+ nom.push_back("Copy the selected contour ctrl + c");
funct.push_back((wxObjectEventFunction) &interfEditMenu:: onCopy);
path.push_back(datadir + "/paste.png");
- nom.push_back("Paste the copied contour");
+ nom.push_back("Paste the copied contour ctrl + v");
funct.push_back((wxObjectEventFunction) &interfEditMenu:: onPaste);
path.push_back(datadir + "/undo.png");
- nom.push_back("Undo");
+ nom.push_back("Undo ctrl + z");
funct.push_back((wxObjectEventFunction) &interfEditMenu:: onUndo);
path.push_back(datadir + "/redo.png");
- nom.push_back("Redo");
+ nom.push_back("Redo ctrl + y");
funct.push_back((wxObjectEventFunction) &interfEditMenu:: onRedo);
this->addButtons(path, nom);
std::vector<wxObjectEventFunction> funct;
path.push_back(datadir + "/Open.png");
- nom.push_back("Open a previously saved file that contains contours information");
+ nom.push_back("Open a previously saved file that contains contours information ctrl + o");
funct.push_back((wxObjectEventFunction) &interfIOMenu:: onLoad);
path.push_back(datadir + "/Save.png");
- nom.push_back("Save all contours created");
+ nom.push_back("Save all contours created ctrl + s");
funct.push_back((wxObjectEventFunction) &interfIOMenu:: onSave);
this->addButtons(path, nom);
infoWin->SetAutoLayout( true );
infoWin->Layout();
- infoWin->Show();
+ infoWin->Show();
}else {
_theViewPanel = NULL;
// _modelManager = NULL;
_instantPanel = NULL;
- _buttonsBar = NULL;
- _gridPanel = NULL;
- _drawToolsPanel = NULL;
- _operationsToolsPanel = NULL;
- _autoFormsPanel = NULL;
- _standardToolsPanel = NULL;
- _editionToolsPanel = NULL;
- _listViewPanel = NULL;
- _sceneManager = NULL;
+// _buttonsBar = NULL;
+// _gridPanel = NULL;
+// _drawToolsPanel = NULL;
+// _operationsToolsPanel = NULL;
+ //_autoFormsPanel = NULL;
+// _standardToolsPanel = NULL;
+// _editionToolsPanel = NULL;
+// _listViewPanel = NULL;
+// _sceneManager = NULL;
//_actualInstant = NULL;
_numberOfVariablesStatistics = 6+1;
// set up default notebook style
- m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
- m_notebook_theme = 0;
+// m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
+// m_notebook_theme = 0;
//wxContour_ActionCommandsID a;
}
_theViewPanel = NULL;
// _modelManager = NULL;
_instantPanel = NULL;
- _buttonsBar = NULL;
- _gridPanel = NULL;
- _drawToolsPanel = NULL;
- _operationsToolsPanel = NULL;
- _autoFormsPanel = NULL;
- _standardToolsPanel = NULL;
- _editionToolsPanel = NULL;
- _listViewPanel = NULL;
- _sceneManager = NULL;
+// _buttonsBar = NULL;
+// _gridPanel = NULL;
+// _drawToolsPanel = NULL;
+// _operationsToolsPanel = NULL;
+// _autoFormsPanel = NULL;
+// _standardToolsPanel = NULL;
+// _editionToolsPanel = NULL;
+// _listViewPanel = NULL;
+// _sceneManager = NULL;
//_actualInstant = NULL;
// set up default notebook style
m_mgr.AddPane(theNoteBook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
m_mgr.Update();
- configured &= _buttonsBar!=NULL;
+/* configured &= _buttonsBar!=NULL;
if( _buttonsBar!=NULL )
{
m_mgr.AddPane(_buttonsBar, wxAuiPaneInfo().
ToolbarPane().Top().
LeftDockable( ).RightDockable( false ).CloseButton(false));
m_mgr.Update();
- }
+ }*/
//CreateStatusBar();
SetMinSize(wxSize(300,300));
_instantPanel = theInstantChooserPanel;
}
- void wxContourMainFrame :: setButtonsBar( wxContour_ButtonsBar * theButtonsBar )
- {
- _buttonsBar = theButtonsBar;
- }
+// void wxContourMainFrame :: setButtonsBar( wxContour_ButtonsBar * theButtonsBar )
+// {
+// _buttonsBar = theButtonsBar;
+// }
- void wxContourMainFrame :: setGrid( wxContour_Grid * theGridPanel )
- {
- _gridPanel = theGridPanel;
- }
+// void wxContourMainFrame :: setGrid( wxContour_Grid * theGridPanel )
+// {
+// _gridPanel = theGridPanel;
+// }
- void wxContourMainFrame :: setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel )
- {
- _drawToolsPanel = theDrawToolsPanel;
- }
+// void wxContourMainFrame :: setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel )
+// {
+// _drawToolsPanel = theDrawToolsPanel;
+// }
- void wxContourMainFrame :: setOperationsToolsPanel( wxContour_OperationsToolsPanel * theOperationsToolsPanel )
- {
- _operationsToolsPanel = theOperationsToolsPanel;
- }
+// void wxContourMainFrame :: setOperationsToolsPanel( wxContour_OperationsToolsPanel * theOperationsToolsPanel )
+// {
+// _operationsToolsPanel = theOperationsToolsPanel;
+// }
- void wxContourMainFrame :: setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
- {
- _autoFormsPanel = theAutoFormsPanel;
- }
+// void wxContourMainFrame :: setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
+// {
+// _autoFormsPanel = theAutoFormsPanel;
+// }
- void wxContourMainFrame :: setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel )
- {
- _standardToolsPanel= theStandardToolsPanel;
- }
+// void wxContourMainFrame :: setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel )
+// {
+// _standardToolsPanel= theStandardToolsPanel;
+// }
- void wxContourMainFrame :: setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel )
- {
- _editionToolsPanel = theEditionToolsPanel;
- }
+// void wxContourMainFrame :: setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel )
+// {
+// _editionToolsPanel = theEditionToolsPanel;
+// }
- void wxContourMainFrame :: setListViewPanel( wxContour_ListViewPanel * theListViewPanel )
- {
- _listViewPanel = theListViewPanel;
- }
+// void wxContourMainFrame :: setListViewPanel( wxContour_ListViewPanel * theListViewPanel )
+// {
+// _listViewPanel = theListViewPanel;
+// }
vtkImageData* img = kernelManager->getImageAtInstant(inst);
if(img!=NULL){
_theViewPanel->changeImage(img);
+ showAxis(false);
}else{
int z = _instantPanel->getConceptDataOf("Axe Depth")->getActualValue();
_theViewPanel->setImageSlice(z);
if (dialog.ShowModal() == wxID_OK)
{
std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
+ kernelManager->setCurrentFileName(fileNameContourROI);
saveFileWithContours( fileNameContourROI );
}
}
} // if
}
+
+void wxContourMainFrame::saveFileWithContoursAutomatique(){
+ std::string filename = kernelManager->getCurrentFileName();
+ if(filename.compare("")!=0){
+ saveFileWithContours(filename);
+ }else{
+ onSave();
+ }
+}
\ No newline at end of file
#include "wx/aui/aui.h"
#include "interfMainPanel.h"
+#include "KernelManagerContour.h"
-#include "wxVtkBaseView_SceneManager.h"
+//#include "wxVtkBaseView_SceneManager.h"
#include "wxInstantChooserPanel.h"
#include "wxContourViewPanel.h"
-#include "KernelManagerContour.h"
-
-#include "ContourWorkspace.h"
-#include "ContourExtractData.h"
-
-
+//#include "ContourWorkspace.h"
+#include "ContourExtractData.h"
#include "PerformingOperation.h"
//#include "ImageSectionThing.h"
//#include "InstantMembersNameList.h"
//#include "OutlineGroup.h"
-#include "SomeEnvironment.h"
-#include "ContourWorkspace.h"
-#include "ContourWrap_ViewControl.h"
-#include "Instant.h"
-#include "PerformingOperation.h"
+//#include "SomeEnvironment.h"
+//#include "ContourWorkspace.h"
+//#include "ContourWrap_ViewControl.h"
+//#include "Instant.h"
+//#include "PerformingOperation.h"
-#include "ContourThing.h"
+//#include "ContourThing.h"
//#include "OutlineModelManager.h"
-#include "wxContour_ButtonsBar.h"
-#include "wxContour_ControlPanel.h"
+//#include "wxContour_ButtonsBar.h"
+//#include "wxContour_ControlPanel.h"
-#include "wxContour_Grid.h"
-#include "wxContour_DrawToolsPanel.h"
-#include "wxContour_OperationsToolsPanel.h"
-#include "wxContour_AutomaticFormsToolsPanel.h"
-#include "wxContour_StandardToolsPanel.h"
-#include "wxContour_EdtionToolsPanel.h"
-#include "wxContour_ListViewPanel.h"
+//#include "wxContour_Grid.h"
+//#include "wxContour_DrawToolsPanel.h"
+//#include "wxContour_OperationsToolsPanel.h"
+//#include "wxContour_AutomaticFormsToolsPanel.h"
+//#include "wxContour_StandardToolsPanel.h"
+//#include "wxContour_EdtionToolsPanel.h"
+//#include "wxContour_ListViewPanel.h"
#include "vtkImageReslice.h"
#include "vtkMetaImageWriter.h"
#include "vtkImageData.h"
-#include "vtkMetaImageReader.h"
+//#include "vtkMetaImageReader.h"
//------------------------------------------------------------------------------------------------------------
// Events declaration
void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel );
- void setButtonsBar( wxContour_ButtonsBar * theButtonsBar );
+// void setButtonsBar( wxContour_ButtonsBar * theButtonsBar );
- void setGrid( wxContour_Grid * theGridPanel );
+// void setGrid( wxContour_Grid * theGridPanel );
- void setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel );
+// void setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel );
- void setOperationsToolsPanel( wxContour_OperationsToolsPanel * theDrawToolsPanel );
+// void setOperationsToolsPanel( wxContour_OperationsToolsPanel * theDrawToolsPanel );
- void setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
+// void setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel );
- void setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel );
+// void setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel );
- void setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel );
+// void setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel );
- void setListViewPanel( wxContour_ListViewPanel * theListViewPanel );
+// void setListViewPanel( wxContour_ListViewPanel * theListViewPanel );
////------------------------------------------------------------------------------------------------------------
void onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow);
void onSnakePressed();
+
+ void saveFileWithContoursAutomatique();
private:
//------------------------------------------------------------------------------------------------------------
// Private methods
wxContourViewPanel* _theViewPanel;
+ wxInstantChooserPanel * _instantPanel;
+
wxAuiManager m_mgr;
/*
//OutlineModelManager * _modelManager;
- wxInstantChooserPanel * _instantPanel;
+
- wxContour_ButtonsBar * _buttonsBar;
+ //wxContour_ButtonsBar * _buttonsBar;
- wxContour_Grid * _gridPanel;
+ //wxContour_Grid * _gridPanel;
- wxContour_DrawToolsPanel * _drawToolsPanel;
+ //wxContour_DrawToolsPanel * _drawToolsPanel;
- wxContour_OperationsToolsPanel * _operationsToolsPanel;
+ //wxContour_OperationsToolsPanel * _operationsToolsPanel;
- wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
+ //wxContour_AutomaticFormsToolsPanel * _autoFormsPanel;
- wxContour_StandardToolsPanel *_standardToolsPanel;
+ //wxContour_StandardToolsPanel *_standardToolsPanel;
- wxContour_EdtionToolsPanel * _editionToolsPanel;
+ //wxContour_EdtionToolsPanel * _editionToolsPanel;
- wxContour_ListViewPanel * _listViewPanel;
+ //wxContour_ListViewPanel * _listViewPanel;
- wxVtkBaseView_SceneManager * _sceneManager;
+ //wxVtkBaseView_SceneManager * _sceneManager;
//Instant * _actualInstant;
//----------------------------------------------------------------------------------------------------------------
// Other includes
//----------------------------------------------------------------------------------------------------------------
-#include "ConceptDataWrap.h"
+//#include "ConceptDataWrap.h"
//this should be eliminated at some point
//#include "wxContourEventHandler.h"
setActualVertical( (int)val );
}
void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
+
+
+ std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
+ int elementsSelected = currentSelection.size();
+ bool ctrlKey = _sceneManager->isCtrlPressed();
+ char toolCommand = _sceneManager->getLastKeyCode();
+
+
+ if ( toolCommand == 3 && ctrlKey ) //'C' || 'c'
+ {
+ wxContourMainFrame::getInstance()->onCopy();
+ }
+ else if( toolCommand == 22 && ctrlKey ) //'V' || 'v'
+ {
+ wxContourMainFrame::getInstance()->onPaste();
+ }
+ else if( toolCommand == 8 || (toolCommand==127) ) // backspace Delete
+ {
+ wxContourMainFrame::getInstance()->onDeleteContour();
+ }
+ else if( toolCommand == 14 && ctrlKey ) //'N' || 'n'
+ {
+ //toolCommand = &(CREATE_CONTOUR_KEY);
+ }
+ else if( toolCommand == 15 && ctrlKey ) //'O' || 'o'
+ {
+ wxContourMainFrame::getInstance()->onLoad();
+ }
+ else if( toolCommand == 19 && ctrlKey ) //'S' || 's'
+ {
+ wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
+ }else if( toolCommand == 26 ){
+ wxContourMainFrame::getInstance()->onUndo();
+ }else if( toolCommand == 25 ){
+ wxContourMainFrame::getInstance()->onRedo();
+ }
}
void wxContourViewPanel::removeSceneContours(){
_creatingROI = false;
_drawingSelectionROI = false;
+
_wxVtk_BaseView = theWxBaseViewToManage;
if( _wxVtk_BaseView!=NULL )
{
// Inherited Methods
//------------------------------------------------------------------------------------------------------------
+ bool wxVtkBaseView_SceneManager :: isCtrlPressed()
+ {
+ return _ctrlKey;
+ }
+ bool wxVtkBaseView_SceneManager :: isShiftPressed()
+ {
+ return _shiftKey;
+ }
+ char wxVtkBaseView_SceneManager :: getLastKeyCode()
+ {
+ return _lastKeyCode;
+ }
bool wxVtkBaseView_SceneManager :: OnChar()
{
- bool ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1;
- bool shiftKey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey() == 1;
+ _ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1;
+ _shiftKey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey() == 1;
_lastKeyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+
+ wxCommandEvent cevent( wxEVT_COMMAND_BUTTON_CLICKED );
+ _eventHandler->ProcessEvent( cevent );
-
- if( _eventHandler!=NULL )
+
+ /*if( _eventHandler!=NULL )
{
- const char * toolCommand = NULL;
+ char * toolCommand = NULL;
if ( _lastKeyCode == 3 && ctrlKey ) //'C' || 'c'
{
- toolCommand = &(wxContour_ActionCommandsID::COPY_TOOL);
+ toolCommand = &(COPY_TOOL);
}
else if( _lastKeyCode == 22 && ctrlKey ) //'V' || 'v'
{
- toolCommand = &(wxContour_ActionCommandsID::PASTE_TOOL);
+ toolCommand = &(PASTE_TOOL);
}
else if( _lastKeyCode == 8 || (_lastKeyCode==127) ) // Delete
{
- toolCommand = &(wxContour_ActionCommandsID::DELETE_KEY);
+ toolCommand = &(DELETE_KEY);
}
else if( _lastKeyCode == 14 && ctrlKey ) //'N' || 'n'
{
- toolCommand = &(wxContour_ActionCommandsID::CREATE_CONTOUR_KEY);
+ toolCommand = &(CREATE_CONTOUR_KEY);
}
else if( _lastKeyCode == 15 && ctrlKey ) //'O' || 'o'
{
- toolCommand = &(wxContour_ActionCommandsID::OPEN_TOOL);
+ toolCommand = &(OPEN_TOOL);
}
else if( _lastKeyCode == 19 && ctrlKey ) //'S' || 's'
{
- toolCommand = &(wxContour_ActionCommandsID::SAVE_KEY);
+ toolCommand = &(SAVE_KEY);
}
if ( toolCommand!=NULL )
{
+ currentkey = toolCommand;
wxCommandEvent cevent( wxEVT_COMMAND_BUTTON_CLICKED );
cevent.SetClientData( (void *) toolCommand);
_eventHandler->ProcessEvent( cevent );
}
- }
+ }*/
// long int endtime = clock();
//JCP 21 - 09 - 08
bool isEditableCControler(std::string theKeyName);
void deleteCViewerCControler(std::string theKeyName);
+ bool isCtrlPressed();
+ bool isShiftPressed();
+ char getLastKeyCode();
private:
//------------------------------------------------------------------------------------------------------------
// Private methods
manualViewRoi *_viewerSelectionROI;
manualContourModel *_modelSelectionROI;
double _widthOfContour;
-
+
+ bool _ctrlKey;
+ bool _shiftKey;
};
#endif // __wxVtkBaseView_SceneManager_HEADER_FILE__
return vectimages[index];
}
return NULL;
+}
+
+std::string KernelManagerContour::getCurrentFileName(){
+ return filename;
+}
+
+void KernelManagerContour::setCurrentFileName(std::string filenam){
+ this->filename = filenam;
}
\ No newline at end of file
//------------------------------------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------------------------------------
-#include "ImageSourceThing.h"
-#include "ImageSectionThing.h"
-#include "AxeThing.h"
-#include "ContourThing.h"
+//#include "ImageSourceThing.h"
+//#include "ImageSectionThing.h"
+//#include "AxeThing.h"
+//#include "ContourThing.h"
#include "OutlineModelManager.h"
#include "OutlineModelBuilder.h"
// Constants
//------------------------------------------------------------------------------------------------------------
+ void setCurrentFileName(std::string filenam);
+ std::string getCurrentFileName();
private:
//------------------------------------------------------------------------------------------------------------
// Attributes
//Temporary attribute should be removed
OutlineModelManager * modelManager;
+ std::string filename;
+
int inredo;
int inundo;
int _currentIndex;