1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 //----------------------------------------------------------------------------------------------------------------
27 // Class definition include
28 //----------------------------------------------------------------------------------------------------------------
29 #include "wxContourMainFrame.h"
33 //----------------------------------------------------------------------------------------------------------------
35 //----------------------------------------------------------------------------------------------------------------
38 #include "NameWrapper.h"
39 #include "wx/artprov.h"
40 #include "ConceptDataWrap.h"
46 //----------------------------------------------------------------------------------------------------------------
47 // Class implementation
48 //----------------------------------------------------------------------------------------------------------------
49 /** @file wxContourMainFrame.cxx */
51 //------------------------------------------------------------------------------------------------------------
52 // Constructors & Destructors
53 //------------------------------------------------------------------------------------------------------------
55 wxContourMainFrame* wxContourMainFrame:: instance = NULL;
56 char wxContourMainFrame::COPY = 'C';
58 wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style)
59 //: wxPanel(parent, id, title, pos, size, style)
60 //: wxWindow(parent, id, pos, size, style)
61 : wxPanel(parent, id, pos, size, style)
63 m_mgr.SetManagedWindow(this);
65 _creatingContoursActive = false;
67 // _modelManager = NULL;
69 // _buttonsBar = NULL;
71 // _drawToolsPanel = NULL;
72 // _operationsToolsPanel = NULL;
73 //_autoFormsPanel = NULL;
74 // _standardToolsPanel = NULL;
75 // _editionToolsPanel = NULL;
76 // _listViewPanel = NULL;
77 // _sceneManager = NULL;
78 //_actualInstant = NULL;
79 _numberOfVariablesStatistics= 6+1;
81 _refLineControl = NULL;
84 // _actorPresent = false;
86 // set up default notebook style
87 // m_notebook_style =wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
88 // m_notebook_theme = 0;
89 //wxContour_ActionCommandsID a;
91 _contourextractdata = NULL;
92 _viewMaskImage = NULL;
93 _viewMaskImagePanel = NULL;
94 _viewThresholdImage = NULL;
95 _viewThresholdImagePanel = NULL;
96 _viewColorLayerImagePanel = NULL;
98 _frameShowResultImages = NULL;
101 wxContourMainFrame::wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir)
102 : wxPanel(parent, id, pos, size, style)
104 m_mgr.SetManagedWindow(this);
106 _creatingContoursActive = false;
107 _theViewPanel = NULL;
108 _instantPanel = NULL;
109 _refLineControl = NULL;
110 _refLineModel = NULL;
112 // _actorPresent = false;
113 _viewMaskImage = NULL;
114 _viewMaskImagePanel = NULL;
115 _viewThresholdImage = NULL;
116 _viewThresholdImagePanel = NULL;
117 _viewColorLayerImagePanel = NULL;
118 // set up default notebook style
119 m_notebook_style = wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
120 m_notebook_theme = 0;
121 //wxContour_ActionCommandsID a;
122 _numberOfVariablesStatistics= 7;
126 _pannew = interfMainPanel::getInstance(this,datadir+"/data/Icons");//, eventHandler);
127 _performingOperation = new PerformingOperation();
128 if(images.size() > 0)
130 this->setVectImages(images);
132 _contourextractdata = NULL;
135 void wxContourMainFrame::setVectImages(std::vector<vtkImageData*> imgs)
139 std::string str_home(getenv("USERPROFILE"));
140 #elif defined(__GNUC__)
141 std::string str_home(getenv("HOME"));
143 std::string strCreaContourDataTmp = str_home + "/.creaContourDataTemp/";
144 std::vector<std::string> conceptNameVect;
145 std::vector<int> conceptSizeVect;
146 notebook = this->createNotebook();
147 kernelManager = new KernelManagerContour( imgs , _datadir+"/data/" , strCreaContourDataTmp );
148 _instantPanel = new wxInstantChooserPanel( notebook, "Instant Chooser", true, false, "c" );
149 _theViewPanel = new wxContourViewPanel( kernelManager->getSourceImage(), notebook );
150 //-------------------------------------------------------------
151 kernelManager->getConceptsInformation(conceptNameVect, conceptSizeVect);
152 _instantPanel->addConcepts(conceptNameVect, conceptSizeVect);
153 double val = _theViewPanel->getCurrentDeep();
154 _instantPanel->setConceptValue( "Axe Depth", (int)val );
155 //JCP _instantPanel->setConceptValue("time", num de imagenes);
156 ConceptDataWrap * data = _instantPanel->getConceptDataOf( "Axe Depth" );
157 //*******************changeInstant();
158 _theViewPanel->setVerticalConcept( "Axe Depth", data->getMinValue(), data->getMaxValue(), data->getMinShowedValue(), data->getMaxShowedValue(), data->getActualValue() );
159 this->configurePanels( );
163 wxContourMainFrame* wxContourMainFrame :: getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir )
165 if(instance == NULL){
166 instance = new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir);
171 std::vector<vtkImageData*> wxContourMainFrame ::getVectImages()
173 return kernelManager->getVectImages();
176 wxContourMainFrame* wxContourMainFrame :: getInstance()
181 void wxContourMainFrame :: resetInstance()
186 wxContourMainFrame :: ~wxContourMainFrame()
188 delete _contourextractdata;
191 interfMainPanel::resetInstance();
192 delete kernelManager;
194 //_pannew->Destroy();
200 //El problema al cerrar la aplicacion puede estar asociado
201 //a que wxAUINotebook esta en la aplicacion
202 //principal (wxContourGUIExample)tambien
203 //EED???? delete _theViewPanel;
204 //EED???? delete _instantPanel;
205 //EED???? delete _buttonsBar;
206 //EED???? delete _actualInstant;
207 //EED???? delete _sceneManager;
211 //------------------------------------------------------------------------------------------------------------
212 // Creational and initialization methods using WxAui
213 //------------------------------------------------------------------------------------------------------------
215 wxAuiNotebook * wxContourMainFrame :: createNotebook()
217 wxSize client_size = GetClientSize();
218 wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style);
219 wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
224 //------------------------------------------------------------------------------------------------------------
225 // Creational and initialization methods
226 //------------------------------------------------------------------------------------------------------------
227 bool wxContourMainFrame :: configurePanels( )
229 bool configured = _theViewPanel!=NULL;
231 configured &= _theViewPanel!=NULL;
232 if( _theViewPanel!=NULL )
234 notebook->AddPage( _theViewPanel, wxT(" View ") );
239 notebook->AddPage( _instantPanel, wxT("Instant Page") );
242 m_mgr.AddPane(notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
244 SetMinSize(wxSize(300,300));
250 bool wxContourMainFrame::addNewPanel(wxPanel* panel)
252 bool configured = panel!=NULL;
253 configured &= panel!=NULL;
257 notebook->AddPage( panel, wxT(" Viewer "), true );
263 //------------------------------------------------------------------------------------------------------------
264 // Attributes getters and setters
265 //------------------------------------------------------------------------------------------------------------
269 void wxContourMainFrame :: setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel )
271 _instantPanel = theInstantChooserPanel;
274 // void wxContourMainFrame :: setButtonsBar( wxContour_ButtonsBar * theButtonsBar )
276 // _buttonsBar = theButtonsBar;
279 // void wxContourMainFrame :: setGrid( wxContour_Grid * theGridPanel )
281 // _gridPanel = theGridPanel;
284 // void wxContourMainFrame :: setDrawToolsPanel( wxContour_DrawToolsPanel * theDrawToolsPanel )
286 // _drawToolsPanel = theDrawToolsPanel;
289 // void wxContourMainFrame :: setOperationsToolsPanel( wxContour_OperationsToolsPanel * theOperationsToolsPanel )
291 // _operationsToolsPanel = theOperationsToolsPanel;
294 // void wxContourMainFrame :: setAutomaticFormsPanel( wxContour_AutomaticFormsToolsPanel * theAutoFormsPanel )
296 // _autoFormsPanel = theAutoFormsPanel;
299 // void wxContourMainFrame :: setStandardToolsPanel( wxContour_StandardToolsPanel * theStandardToolsPanel )
301 // _standardToolsPanel= theStandardToolsPanel;
304 // void wxContourMainFrame :: setEditionToolsPanel( wxContour_EdtionToolsPanel * theEditionToolsPanel )
306 // _editionToolsPanel = theEditionToolsPanel;
309 // void wxContourMainFrame :: setListViewPanel( wxContour_ListViewPanel * theListViewPanel )
311 // _listViewPanel = theListViewPanel;
316 void wxContourMainFrame::onCreateContourSpline( ){
318 //JCP 20-10-08 Undo redo implementation
320 //JCP 20-10-08 Undo redo implementation
325 void wxContourMainFrame::onCreateContourRectangle( )
327 //JCP 20-10-08 Undo redo implementation
329 //JCP 20-10-08 Undo redo implementation
333 void wxContourMainFrame::onCreateContourCircle( )
335 //JCP 20-10-08 Undo redo implementation
337 //JCP 20-10-08 Undo redo implementation
341 void wxContourMainFrame::onCreateContourLine( )
343 //JCP 20-10-08 Undo redo implementation
345 //JCP 20-10-08 Undo redo implementation
349 // RaC 09-09 --------------------------------------
350 void wxContourMainFrame::onCreateContourPoints( )
352 //JCP 20-10-08 Undo redo implementation
354 //JCP 20-10-08 Undo redo implementation
357 // RaC 09-09 --------------------------------------
359 // RaC 10-09 --------------------------------------
360 void wxContourMainFrame::onCreateContourPolygon( )
362 //JCP 20-10-08 Undo redo implementation
364 //JCP 20-10-08 Undo redo implementation
367 // RaC 10-09 --------------------------------------
369 //------------------------------------------------------------------------------------------------------------
371 void wxContourMainFrame :: onCreateContourBullEye(wxPanel* panel )
373 //Creating the manualBaseModel and including in the model
374 manualBaseModel * manModelContour = factoryManualContourModel(panel );
376 std::vector<int> instantVector;
377 _instantPanel->getInstant( instantVector );
378 std::string theName = kernelManager->createOutline(manModelContour, instantVector);
380 /*std::vector<int> instantVector;
381 _instantPanel->getInstant( instantVector );
383 theName= _modelManager->createOutline( manModelContour, instantVector );*/
384 bool addedModel = theName.compare("") != 0;//??
388 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
389 _theViewPanel->getSpacing(spc);
390 //Adding the manualContourControler to interface objects structure
391 //Adding the manualViewContour to interface objects structure
392 //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
393 _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , 4) ;
397 void wxContourMainFrame::createContour( int typeContour )
399 //Creating the manualContourModel and including in the model
400 manualBaseModel * manModelContour = kernelManager->factoryManualContourModel(typeContour);
401 std::vector<int> instantVector;
402 _instantPanel->getInstant( instantVector );
404 std::vector<int> tempVector;
405 getInstantVector( tempVector );
406 manModelContour->SetLabel2( std::to_string(tempVector[1]) );
408 std::string theName = kernelManager->createOutline(manModelContour, instantVector);
409 /*std::vector<int> instantVector;
410 _instantPanel->getInstant( instantVector );
412 theName= _modelManager->createOutline( manModelContour, instantVector );*/
413 bool addedModel = theName.compare("") != 0;//??
416 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
417 _theViewPanel->getSpacing(spc);
418 //Adding the manualContourControler to interface objects structure
419 //Adding the manualViewContour to interface objects structure
420 //_sceneManager->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
421 _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeContour) ;
425 manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){
427 manualContourModelBullEye *manModelContourBullEye = new manualContourModelBullEye();
428 manualBaseModel *manModelContour=NULL;
429 manModelContour = manModelContourBullEye;
431 int iCrown,sizeCrowns,iSector,sizeSectors;
432 double radioA,radioB,ang,angDelta ;
433 sizeCrowns = ((PanelBullEyeOptions*)panel)->GetNumberOfCrowns();
434 for ( iCrown=0 ; iCrown<sizeCrowns ; iCrown++ )
436 sizeSectors = ((PanelBullEyeOptions*)panel)->GetNumberOfSections(iCrown);
437 radioB = ((PanelBullEyeOptions*)panel)->GetRadioOfCrown(iCrown);
438 if (iCrown==sizeCrowns-1)
442 radioA = ((PanelBullEyeOptions*)panel)->GetRadioOfCrown(iCrown+1);
446 for ( iSector=0 ; iSector<sizeSectors ; iSector++ )
448 ang = ((PanelBullEyeOptions*)panel)->GetAngOfCrownSection(iCrown,iSector);
449 angDelta= ((PanelBullEyeOptions*)panel)->GetAngDeltaOfCrownSection(iCrown);
450 manModelContourBullEye->AddSector(radioA,radioB,ang,angDelta);
453 } // if _panelBullEyeOptions
455 return manModelContour;
458 void wxContourMainFrame :: saveState()
460 std::string temp = kernelManager->saveState();
461 saveFileWithContours(temp);
464 void wxContourMainFrame::onDeleteContour()
466 //JCP 20-10-08 Undo redo implementation
468 //JCP 20-10-08 Undo redo implementation
470 std::vector<std::string> lstKeyNameToBeErase;
471 lstKeyNameToBeErase = _theViewPanel->getSceneManager()->getSelectedObjects();
472 deleteContours( lstKeyNameToBeErase );
474 int i,size=_sceneManager->getSelectedObjects().size();
477 std::string keyName = _sceneManager->getSelectedObjects()[i];
478 int ispartofstaticlist = this->_modelManager->IsPartOfStaticList( keyName );
479 if ( ispartofstaticlist>=0 )
481 std::vector<int> tempVector;
482 _instantPanel->getInstant( tempVector );
483 Instant instant(&tempVector);
484 this->_modelManager->ChangeContourOfList(keyName, &instant);
488 std::vector<std::string> lstKeyName;
489 std::vector<std::string> lstKeyNameActualSlice;
490 std::vector<std::string> lstKeyNameToBeErase;
492 lstKeyNameToBeErase = _sceneManager->getSelectedObjects();
493 lstKeyNameActualSlice = _sceneManager->GetlstContoursNameActualSlice();
494 int k,kSize=lstKeyNameToBeErase.size();
495 int j,jSize=lstKeyNameActualSlice.size();
497 for (k=0;k<kSize; k++)
500 for (j=0;j<jSize; j++)
502 if (lstKeyNameToBeErase[k]==lstKeyNameActualSlice[j])
509 lstKeyName.push_back( lstKeyNameToBeErase[k] );
513 deleteContours( lstKeyName );
517 void wxContourMainFrame :: deleteContours( std::vector<std::string> keyNamesVector )
519 int i,size=keyNamesVector.size();
522 deleteContour( keyNamesVector[i] );
526 void wxContourMainFrame :: deleteContour( std::string theKeyName )
529 manualContourModel * cModel;
530 manualViewBaseContour * cViewer;
531 manualContourBaseControler * cControler;
533 ContourWrap_ViewControl *conwrapviewControl = _theViewPanel->getSceneManager()->getContourWrap_ViewControlOf( theKeyName );
534 cControler = conwrapviewControl->getControler();*/
537 bool isedit = _theViewPanel->isEditableCControler(theKeyName);
538 bool ispartofstaticlst = kernelManager->IsPartOfStaticList(theKeyName);
540 if (isedit && ispartofstaticlst)
542 _theViewPanel->removeFromScene(theKeyName);
544 kernelManager->deleteCModel(theKeyName);
545 //_theViewPanel->getSceneManager()->removeFromScene( theKeyName );
546 //cViewer = conwrapviewControl->getViewer();
547 //_theViewPanel->getSceneManager()->removeWrap( theKeyName );
548 //cControler* conwrapviewControl->getControler();
551 // delete cControler;
556 void wxContourMainFrame::onDeleteContoursActSlice()
558 //JCP 20-10-08 Undo redo implementation
560 //JCP 20-10-08 Undo redo implementation
562 std::vector<int> tempVector;
563 getInstantVector( tempVector );
564 deleteContours( getOutlinesName( tempVector[1] ) );
565 // deleteContours( (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() );
568 void wxContourMainFrame::onDeleteAllContours(){
569 //JCP 20-10-08 Undo redo implementation
573 void wxContourMainFrame::deleteAllContours(){
574 //JCP 20-10-08 Undo redo implementation
577 std::vector<int> tempVector;
578 _instantPanel->getInstant( tempVector );
580 //JCP --08-09-2008 When using a diferent interface the _mbarrangeDeleteAll might not be initialize
581 // the values in GetStart and GetEnd will then not be initialize also.
582 // We use instead the values given when initializing the _deletepanel.
584 //int minZ = _mbarrangeDeleteAll->GetStart();
585 //int maxZ = _mbarrangeDeleteAll->GetEnd();
589 maxZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ();
593 _theViewPanel->getSceneManager()->removeSceneContours( );
594 _theViewPanel->getSceneManager()->removeAllOutlines();
595 kernelManager->removeAllOutlines();
598 if ( (minZ==0) && (maxZ==_mbarrangeDeleteAll->GetMax() ))
600 _theViewPanel->getSceneManager()->removeSceneContours( );
601 _modelManager->removeAllOutlines();
602 _theViewPanel->getSceneManager()->removeAllOutlines();
605 for ( z=minZ ; z<=maxZ ; z++)
608 Instant instant(&tempVector);
609 std::vector<ContourThing**> lstContourThings = this->_modelManager->getOutlinesAtInstant( &instant );
611 sizeLstContourThings = lstContourThings.size();
612 for (ii=0 ; ii<sizeLstContourThings ; ii++)
614 ContourThing **contourthing = lstContourThings[ii];
615 deleteContour( (*contourthing)->getName() );
622 void wxContourMainFrame::setConceptValue( std::string name, int value )
624 _instantPanel->setConceptValue(name, value);
628 ConceptDataWrap* wxContourMainFrame::getLastConceptData()
630 return _instantPanel->getLastConceptData();
634 bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos )
636 return _instantPanel->getIfConceptCheckedAt( name, pos );
641 void wxContourMainFrame::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ)
644 vtkImageData * value;
645 this->getMaskValue(&mask, &value, typeContourGroup, selection, minZ, maxZ);
647 std::vector<int> nTypeView;
648 nTypeView.push_back(5);
649 nTypeView.push_back(1);
650 nTypeView.push_back(2);
651 nTypeView.push_back(0);
653 if (_frameShowResultImages==NULL)
655 // wxFrame *_frameShowResultImages = new wxFrame(this, -1,_T("Result image extracted.."),wxDefaultPosition,wxSize(600,600), wxDEFAULT_FRAME_STYLE|wxSTAY_ON_TOP);
656 _frameShowResultImages = new wxFrame(this, -1,_T("Result image extracted.."),wxDefaultPosition,wxSize(600,600),
657 wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER );
659 wxAuiManager *m_mgr_noteBookViewerResult = new wxAuiManager();
660 m_mgr_noteBookViewerResult->SetManagedWindow(_frameShowResultImages);
662 wxAuiNotebook* noteBookViewerResult = new wxAuiNotebook(_frameShowResultImages, -1, wxPoint(600, 600), wxSize(430,200), m_notebook_style);
663 m_mgr_noteBookViewerResult->AddPane(noteBookViewerResult, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
665 wxPanel *panelViewer1 = new wxMaracas_N_ViewersWidget(noteBookViewerResult, value,&nTypeView);
666 wxPanel *panelViewer2 = new wxMaracas_N_ViewersWidget(noteBookViewerResult, mask,&nTypeView);
669 noteBookViewerResult->AddPage( panelViewer1, wxT("Image result") );
670 noteBookViewerResult->AddPage( panelViewer2, wxT("Mask result") );
671 m_mgr_noteBookViewerResult->Update();
672 _frameShowResultImages->Show();
673 } // if _frameShowResultImages
679 void wxContourMainFrame::changeInstant()
681 std::vector<int> instantVect;
682 _instantPanel->getInstant( instantVect );
683 int actualSlice = instantVect[1];
684 kernelManager->setInstant(instantVect);
685 // Refresh Mask image
686 if(_viewMaskImage!=NULL)
688 _viewMaskImage->SetZ(actualSlice);
689 if (_viewMaskImagePanel->IsVisible()==true)
691 vtkImageData *mask, *value;
692 getMaskValue(&mask,&value, _contourGroup , 0, -1, -1);
693 _viewMaskImage->onThreshold();
695 } // if _viewMaskImage
696 // Refresh Threshold image
697 if(_viewThresholdImage!=NULL)
699 _viewThresholdImage->SetZ(actualSlice);
700 if (_viewThresholdImagePanel->IsVisible()==true)
702 _viewThresholdImage->onThreshold();
704 } // if _viewThresholdImage
705 updateInstantOutlines();
706 updateInstantImageData();
712 void wxContourMainFrame::updateInstantOutlines()
714 _theViewPanel->removeSceneContours();
715 _theViewPanel->addNameWrapperToScene();
717 //for( int i=0; i<size; i++)
719 // _theViewPanel->getSceneManager()->addToScene(namesWrapping[i]->getKeyName(), true, true, true, false, false );
723 int wxContourMainFrame::getNamesWrappingSize()
725 return kernelManager->getNamesWrappingSize();
728 std::string wxContourMainFrame::getNameWrapping(int i)
730 return kernelManager->getNameWrapping(i);
733 void wxContourMainFrame::updateInstantImageData()
735 std::vector<int> inst;
736 _instantPanel->getInstant(inst);
738 vtkImageData* img = kernelManager->getImageAtInstant(inst);
741 _theViewPanel->changeImage(img);
744 int z = _instantPanel->getConceptDataOf("Axe Depth")->getActualValue();
745 _theViewPanel->setImageSlice(z);
749 void wxContourMainFrame::updateInstantAxes()
754 void wxContourMainFrame::onChangeDeep(int val){
755 _instantPanel->setConceptValue( "Axe Depth", (int)val );
760 void wxContourMainFrame::onCopy(){
761 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
762 std::vector<int> tempVector;
763 _instantPanel->getInstant( tempVector );
764 _performingOperation->reset();
765 _performingOperation->setStartCommand( COPY );
766 _performingOperation->setStartOperationInstantVector( tempVector );
767 _performingOperation->setKeyNamesOperationElems( currentSelection );
770 void wxContourMainFrame::onPaste()
772 char theStartCommand = _performingOperation->getStartCommand();
773 if ( theStartCommand == COPY )
775 //JCP 20-10-08 Undo redo implementation
777 //JCP 20-10-08 Undo redo implementation
778 std::vector<int> tempVector;
779 _instantPanel->getInstant( tempVector );
780 _performingOperation->setEndOperationInstantVector ( tempVector );
781 std::vector<std::string> elems = _performingOperation->getKeyNamesOperationElems();
782 int i,size = elems.size();
783 for( i=0; i<size; i++ )
785 createCopyContourOf( elems[i], tempVector, i>0 );
790 void wxContourMainFrame::onUndo()
792 std::string filename;
793 if(kernelManager->onUndoSaveFile(filename)){
794 saveFileWithContours(filename);
796 if(kernelManager->onUndo(filename)){
800 void wxContourMainFrame::onRedo(){
801 std::string filename;
802 if(kernelManager->onRedo(filename)){
807 void wxContourMainFrame :: createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
809 std::string cloneName = kernelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
810 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
811 _theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
814 ///AD: 03-09 Copy the object and apply the given transformation
815 void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData, bool append )
817 std::string cloneName = kernelManager->createCopyContourOf( anExistingKName, instantNoTouchData );
818 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
820 manualPoint * refPoint1 = _refLineModel->GetManualPoint(0);
821 manualPoint * refPoint2 = _refLineModel->GetManualPoint(1);
823 double pnt1X = refPoint1->GetX();
824 double pnt1Y = refPoint1->GetY();
825 // double pnt1Z = refPoint1->GetZ();
826 double pnt2X = refPoint2->GetX();
827 double pnt2Y = refPoint2->GetY();
828 // double pnt2Z = refPoint2->GetZ();
830 double angle = (atan2(pnt2Y - pnt1Y, pnt2X - pnt1X) * 180 / 3.1415926535897932384626433832795)+90;
831 vtkTransform *t = vtkTransform::New();
835 t->Translate(-pnt1X, -pnt1Y, 0);
839 t->Translate(pnt1X, pnt1Y, 0);
842 int i,size=manualModel->GetSizeLstPoints();
845 manualPoint * mp = manualModel->GetManualPoint(i);
851 t->TransformPoint( vecIn, vecOut );
852 mp->SetPointX( vecOut[0] );
853 mp->SetPointY( vecOut[1] );
854 mp->SetPointZ( vecOut[2] );
857 _theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
860 void wxContourMainFrame ::loadState(std::string filename)
863 onLoadContours(filename,false);
867 void wxContourMainFrame::onLoad()
869 std::string fileNameContourROI = GetFileLocation();
870 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
871 if(GetFileLocation().empty())
873 //------------------------------------------------------------------------------------------------------------
874 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
875 #if wxMAJOR_VERSION <= 2
876 wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxOPEN );
878 wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_OPEN );
880 if (dialog.ShowModal() == wxID_OK)
882 fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
886 onLoadContours(fileNameContourROI,true);
890 void wxContourMainFrame::SetZForAllContours(int pz)
893 std::vector< std::string > lstNameThings;
894 int i,sizeLstNameThings;
895 int ii,sizeLstPoints;
897 lstNameThings = kernelManager->GetLstNameThings();
898 sizeLstNameThings = lstNameThings.size();
899 for (i=0 ; i<sizeLstNameThings ; i++)
901 printf("EED wxContourMainFrame::SetZForAllContours contour=%d \n", i );
902 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
903 sizeLstPoints = manualModel->GetSizeLstPoints();
904 for (ii=0 ; ii<sizeLstPoints ; ii++)
906 manualModel->GetManualPoint(ii)->SetPointZ(-900);
907 }// for ii list of points
908 }// for i list of Things
912 lstNameThings = kernelManager->GetLstNameThingsStatic();
913 sizeLstNameThings = lstNameThings.size();
914 for (i=0 ; i<sizeLstNameThings ; i++)
916 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
917 sizeLstPoints = manualModel->GetSizeLstPoints();
918 for (ii=0 ; ii<sizeLstPoints ; ii++)
920 manualModel->GetManualPoint(ii)->SetPointZ(-900);
921 }// for ii list of points
922 }// for i list of static things
925 void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool interactiveInterface)
929 FILE *pFile =fopen(fileNameContourROI.c_str(),"r+");
930 //CMRU 03-09-09- ----------------------------------------------------------------------------------------------
933 //------------------------------------------------------------------------------------------------------------
934 fileNameContourROI.append("data");
935 FILE *pFileData=fopen(fileNameContourROI.c_str(),"r+");
936 if(pFileData != NULL)
938 fscanf(pFileData,"%s",tmpD); // --CreaContour--
939 fscanf(pFileData,"%s",tmpD); // Version
940 fscanf(pFileData,"%s",tmpD); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0
942 fscanf(pFileData,"%s",tmpD); // onePixelSize
943 fscanf(pFileData,"%s",tmpD); // #
944 _onePixelSize = atof(tmpD);
945 fscanf(pFileData,"%s",tmpD); // NumberOfContours
946 fscanf(pFileData,"%s",tmpD); // #
948 fscanf(pFile,"%s",tmp); // --CreaContour--
949 fscanf(pFile,"%s",tmp); // Version
950 fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0
951 std::string version(tmp);
953 _tmpReadFileTypeOfTransformation=-1;
954 if (version=="1.0.3")
956 readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON
957 openContours(pFile,pFileData,false);
958 openContours(pFile,pFileData,true); //Load StaticContours
960 if (version=="1.0.2")
963 readDimSpc(pFile,interactiveInterface); // DimSpc interactive ON
964 openContours(pFile,pFileData,false);
965 readDimSpc(pFile,false); // DimSpc interactive OFF
966 openContours(pFile,pFileData,true); // Load StaticContours
967 SetZForAllContours(-900);
970 else if (version=="1.0.1")
972 openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
973 openContours(pFile,pFileData,true); //Load StaticContours, skips ImageDimensions and ImageSpacing
977 else if (version=="1.0.0")
979 openContours(pFile,pFileData,false); //Skips ImageDimensions and ImageSpacing
984 if(pFileData != NULL)
989 _theViewPanel->getSceneManager()->removeSceneContours();
994 void wxContourMainFrame::onImport()
996 std::string filename, filenamecontours;
997 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
998 #if wxMAJOR_VERSION <= 2
999 wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxOPEN );
1001 wxFileDialog dialog(NULL, _T("Choose a XML Osirix File"), _T(""), _T(""), _T("*.xml"), wxFD_OPEN );
1003 if (dialog.ShowModal() == wxID_OK)
1005 filename = dialog.GetPath().mb_str();
1006 filenamecontours = kernelManager->parseOsirixFile(filename);
1008 if(filenamecontours.compare("") != 0){
1009 onLoadContours(filenamecontours,true);
1014 void wxContourMainFrame::onTest()
1016 std::string filename, filenamecontours;
1017 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1018 #if wxMAJOR_VERSION <= 2
1019 wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxOPEN );
1021 wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN );
1024 if (dialog.ShowModal() == wxID_OK)
1026 filename = dialog.GetPath().mb_str();
1027 std::cout << "This is the filename: " << filename << std::endl;
1033 void wxContourMainFrame::onSave(){
1034 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1035 if(GetFileLocation().empty())
1037 //------------------------------------------------------------------------------------------------------------
1038 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
1039 #if wxMAJOR_VERSION <= 2
1040 wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxSAVE );
1042 wxFileDialog dialog(NULL, _T("Choose a file"), _T(""), _T(""), _T("*.roi"), wxFD_SAVE );
1044 if (dialog.ShowModal() == wxID_OK)
1046 std::string fileNameContourROI = (const char *)(dialog.GetPath().mb_str());
1047 kernelManager->setCurrentFileName(fileNameContourROI);
1048 saveFileWithContours( fileNameContourROI );
1051 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1054 std::cout<<"Nombre del archivo: "<<GetFileLocation()<<std::endl;
1055 std::string fileNameContourROI = GetFileLocation();
1056 std::cout<<"Nombre del archivo: "<<fileNameContourROI<<std::endl;
1057 kernelManager->setCurrentFileName(fileNameContourROI);
1058 saveFileWithContours( fileNameContourROI);
1060 //------------------------------------------------------------------------------------------------------------
1064 void wxContourMainFrame::saveFileWithContours( std::string filename )
1067 FILE *pFile=fopen(filename.c_str(),"w+");
1069 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1070 filename.append("data");
1071 std::cout<<"Nombre del archivo: "<<filename<<std::endl;
1072 FILE *pFileData=fopen(filename.c_str(),"w+");
1073 //------------------------------------------------------------------------------------------------------------
1075 std::vector< std::string > lstNameThings;
1076 int i,sizeLstNameThings;
1078 fprintf(pFile,"--CreaContour--\n");
1079 fprintf(pFile,"Version %s\n", "1.0.3" );
1081 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1082 fprintf(pFileData,"--CreaContour--\n");
1083 fprintf(pFileData,"Version %s\n", "1.0.3" );
1084 fprintf(pFileData,"OnePixelSize %f\n", _onePixelSize);
1086 //------------------------------------------------------------------------------------------------------------
1088 vtkImageData *image = _images[0];
1091 image->GetDimensions(dimRange);
1093 fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
1096 image->GetSpacing(spaRange);
1098 fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
1102 lstNameThings = kernelManager->GetLstNameThings();
1103 sizeLstNameThings = lstNameThings.size();
1104 fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings );
1106 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1107 fprintf(pFileData,"NumberOfContours %d\n", sizeLstNameThings );
1108 //------------------------------------------------------------------------------------------------------------
1117 for (i=0 ; i<sizeLstNameThings ; i++)
1119 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1120 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
1123 // double sizeInPixel = manualModel ->GetPathSize( );
1124 double sizeInPixel = manualModel ->GetPathSize( spc );
1126 double realContourSize = sizeInPixel*_onePixelSize;
1127 manualModel ->SetRealSize(realContourSize);
1128 //------------------------------------------------------------------------------------------------------------
1130 //int size= kernelManager->GetLstNameThings().size();
1132 kernelManager->SaveThingName( pFile, pFileData, lstNameThings[i] );
1133 _theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] );
1136 //-- Static Contours
1138 // fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] );
1139 // fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] );
1141 lstNameThings = kernelManager->GetLstNameThingsStatic();
1142 sizeLstNameThings = lstNameThings.size();
1143 fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings );
1145 //CMRU 03-09-09-----------------------------------------------------------------------------------------------
1146 fprintf(pFileData,"NumberOfContoursStatic %d\n", sizeLstNameThings );
1147 //------------------------------------------------------------------------------------------------------------
1149 for (i=0 ; i<sizeLstNameThings ; i++)
1151 kernelManager->SaveThingName( pFile, pFileData, lstNameThings[i] );
1152 _theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] );
1160 void wxContourMainFrame::readDimSpc(FILE *pFile, bool interactiveOption)
1164 double imageSpac[3];
1165 vtkImageData *image = _images[0];
1166 image->GetDimensions(imageDim);
1167 image->GetSpacing(imageSpac);
1169 fscanf(pFile,"%s",tmp); // ImageDimensions
1170 fscanf(pFile,"%s",tmp); // X
1171 _tmpReadFileImageDim[0] = atoi(tmp);
1172 fscanf(pFile,"%s",tmp); // Y
1173 _tmpReadFileImageDim[1] = atoi(tmp);
1174 fscanf(pFile,"%s",tmp); // Z
1175 _tmpReadFileImageDim[2] = atoi(tmp);
1177 fscanf(pFile,"%s",tmp); // ImageSpacing
1178 fscanf(pFile,"%s",tmp); // X
1179 _tmpReadFileImageSpac[0] = atof(tmp);
1180 fscanf(pFile,"%s",tmp); // Y
1181 _tmpReadFileImageSpac[1] = atof(tmp);
1182 fscanf(pFile,"%s",tmp); // Z
1183 _tmpReadFileImageSpac[2] = atof(tmp);
1186 if (interactiveOption==true)
1188 //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 2
1189 if (imageDim[0]!=_tmpReadFileImageDim[0] || imageDim[1]!=_tmpReadFileImageDim[1] || imageSpac[0]!=_tmpReadFileImageSpac[0] || imageSpac[1]!=_tmpReadFileImageSpac[1])
1191 wxDialog* dial = new wxDialog (this,-1,_T("Tools"),wxDefaultPosition, wxSize(460,360));
1192 wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
1193 wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL);
1195 wxString lstOptOperation[2];
1196 lstOptOperation[0]=_T("By Dimension");
1197 lstOptOperation[1]=_T("By Spacing");
1198 wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 2 , lstOptOperation, 2, wxRA_SPECIFY_COLS);
1200 dialSizer->Add( new wxStaticText(dial,-1,_T("The image resolution is not compatible with the ")) , 0, wxGROW );
1201 dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW );
1202 dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW );
1203 dialSizer->Add(radioOpts,0,wxGROW);
1204 dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW );
1205 dialSizer->Add(buttonsSizer,0,wxGROW);
1206 dial->SetSizer(dialSizer, true);
1210 int _tmpReadFileTypeOfTransformation = -1;
1211 //EED bool transform = false;
1213 if (dial->GetReturnCode() == wxID_OK)
1215 _tmpReadFileTypeOfTransformation = radioOpts->GetSelection();
1219 } // if interactiveOption
1226 void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool staticContour )
1231 vtkImageData *image = _images[0];
1234 double imageSpac[3];
1235 image->GetDimensions(imageDim);
1236 image->GetSpacing(imageSpac);
1239 fscanf(pFile,"%s",tmp); // NumberOfContours
1240 fscanf(pFile,"%s",tmp); // ##
1241 int numberOfContours = atoi(tmp);
1243 std::vector<int> instantVector;
1244 int typeContourModel;
1245 manualBaseModel *manModelContour;
1249 if (compatible==true)
1252 for (i=0;i<numberOfContours;i++)
1254 instantVector.clear();
1255 fscanf(pFile,"%s",tmp); // Instant
1257 fscanf(pFile,"%s",tmp); // 1
1258 instantVector.push_back( atoi(tmp) );
1259 fscanf(pFile,"%s",tmp); // 2
1260 instantVector.push_back( atoi(tmp) );
1261 fscanf(pFile,"%s",tmp); // 3
1262 instantVector.push_back( atoi(tmp) );
1263 fscanf(pFile,"%s",tmp); // 4
1264 instantVector.push_back( atoi(tmp) );
1265 fscanf(pFile,"%s",tmp); // 5
1266 instantVector.push_back( atoi(tmp) );
1267 fscanf(pFile,"%s",tmp); // 6
1268 instantVector.push_back( atoi(tmp) );
1271 fscanf(pFile,"%s",tmp); // TypeContourModel
1272 fscanf(pFile,"%s",tmp); // ##
1273 typeContourModel = atoi(tmp);
1275 manModelContour = kernelManager->factoryManualContourModel(typeContourModel);
1276 manModelContour->Open(pFile);
1277 if(pFileData != NULL)
1279 manModelContour->OpenData(pFileData);
1282 fscanf(pFile,"%s",tmp); // TypeView
1283 fscanf(pFile,"%s",tmp); // ##
1284 typeView = atoi(tmp);
1286 std::string theName;
1287 theName = kernelManager->createOutline( manModelContour, instantVector );
1288 bool addedModel = theName.compare("") != 0;
1291 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
1292 _theViewPanel->getSpacing(spc);
1293 //Adding the manualContourControler to interface objects structure
1294 //Adding the manualViewContour to interface objects structure
1295 //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
1296 _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
1299 if (staticContour) //StaticContours (will appear in all slices)
1301 Instant instant(&instantVector);
1302 kernelManager->changeContourOfManager( theName , &instant );
1305 }// for numberOfContours
1308 else if (compatible==false)
1313 for (i=0;i<numberOfContours;i++)
1315 instantVector.clear();
1316 fscanf(pFile,"%s",tmp); // Instant
1318 fscanf(pFile,"%s",tmp); // 1
1319 instantVector.push_back( atoi(tmp) );
1320 fscanf(pFile,"%s",tmp); // 2
1321 instantVector.push_back( atoi(tmp) );
1322 fscanf(pFile,"%s",tmp); // 3
1323 instantVector.push_back( atoi(tmp) );
1324 fscanf(pFile,"%s",tmp); // 4
1325 instantVector.push_back( atoi(tmp) );
1326 fscanf(pFile,"%s",tmp); // 5
1327 instantVector.push_back( atoi(tmp) );
1328 fscanf(pFile,"%s",tmp); // 6
1329 instantVector.push_back( atoi(tmp) );
1331 fscanf(pFile,"%s",tmp); // TypeContourModel
1332 fscanf(pFile,"%s",tmp); // ##
1333 typeContourModel = atoi(tmp);
1335 manModelContour = kernelManager->factoryManualContourModel(typeContourModel);
1336 manModelContour->Open(pFile);
1337 if(pFileData != NULL)
1339 manModelContour->OpenData(pFileData);
1342 if (_tmpReadFileTypeOfTransformation==-1){
1344 } else if (_tmpReadFileTypeOfTransformation==0){
1345 double transX, transY;
1346 transX = (double) imageDim[0]/_tmpReadFileImageDim[0];
1347 transY = (double) imageDim[1]/_tmpReadFileImageDim[1];
1348 manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
1349 } else if (_tmpReadFileTypeOfTransformation==1) {
1350 double transX, transY;
1351 transX = (double) _tmpReadFileImageSpac[0]/imageDim[0];
1352 transY = (double) _tmpReadFileImageSpac[1]/imageDim[1];
1353 manModelContour->Transform_Ax_Plus_B(transX,0,transY,0);
1356 fscanf(pFile,"%s",tmp); // TypeView
1357 fscanf(pFile,"%s",tmp); // ##
1358 typeView = atoi(tmp);
1360 std::string theName;
1361 theName = kernelManager->createOutline( manModelContour, instantVector );
1362 bool addedModel = theName.compare("") != 0;
1365 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
1366 _theViewPanel->getSpacing(spc);
1367 //Adding the manualContourControler to interface objects structure
1368 //Adding the manualViewContour to interface objects structure
1369 //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
1370 _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ;
1373 if (staticContour) //StaticContours (will appear in all slices)
1375 Instant instant(&instantVector);
1376 kernelManager->changeContourOfManager( theName , &instant );
1378 }// for numberOfContours
1384 void wxContourMainFrame::RefreshInterface()
1387 _theViewPanel->RefreshInterface();
1388 //wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
1389 //wxvtk2dbaseview->Refresh();
1392 vtkImageData* wxContourMainFrame::getImageData()
1394 return _theViewPanel->getImageData();
1397 void wxContourMainFrame::onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation)
1399 //JCP 20-10-08 Undo redo implementation
1401 //JCP 20-10-08 Undo redo implementation
1404 int x = _theViewPanel->GetX();
1405 int y = _theViewPanel->GetY();
1406 int z = _theViewPanel->GetZ();
1407 SegmentationOneSliceITK( x,y,z,distance, sigma, alfa, beta, propagation, iterations, inflation);
1411 void wxContourMainFrame::SegmentationOneSliceITK(int x, int y, int z, wxString distanc, wxString sigm, wxString alf, wxString bet, wxString prop, wxString iter, wxString inflation)
1413 int typeofcontour = 1;
1415 vtkImageData *imagedata = getImageData();
1417 //Tipo de pixeles a utilizar internamente en ITK
1418 typedef float InternalPixelType;
1419 const unsigned int Dimension = 2;
1420 typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
1422 //Tipo de pixeles de salida 1
1423 typedef unsigned char OutputPixelType;
1424 typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
1426 //Tipo de pixeles de salida 2
1427 typedef unsigned short OutputPixelType2;
1428 typedef itk::Image< OutputPixelType2, Dimension > OutputImageType2;
1430 //DefiniciÛn del thresholder
1431 typedef itk::BinaryThresholdImageFilter<
1433 OutputImageType > ThresholdingFilterType;
1435 //DefiniciÛn del primer filtro de conversiÛn de pixeles
1436 typedef itk::CastImageFilter<
1437 OutputImageType, OutputImageType2 > CastFilterType;
1439 //DefiniciÛn del segundo tipo de conversiÛn de pixeles
1440 typedef itk::CastImageFilter<
1441 OutputImageType2, InternalImageType > CastFilterType2;
1443 //Tercer tipo de conversiÛn
1444 typedef itk::RescaleIntensityImageFilter<
1446 OutputImageType > CastFilterType3;
1448 //Cuarto tipo de conversiÛn
1449 typedef itk::RescaleIntensityImageFilter<
1451 OutputImageType > CastFilterType4;
1453 ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();
1455 thresholder->SetLowerThreshold( 0.0 );
1456 thresholder->SetUpperThreshold( 128 );
1458 thresholder->SetOutsideValue( 255 );
1459 thresholder->SetInsideValue( 0 );
1461 //DefinciÛn de conexiÛnes entre VTK e ITK y el writer
1462 typedef itk::VTKImageToImageFilter<OutputImageType2> ConnectorType;
1463 typedef itk::ImageToVTKImageFilter<OutputImageType> ConnectorType2;
1464 //EED10JUIN2011 typedef itk::ImageFileWriter< OutputImageType > WriterType;
1466 ConnectorType::Pointer connector= ConnectorType::New();
1467 ConnectorType2::Pointer connector2= ConnectorType2::New();
1470 CastFilterType::Pointer filter=CastFilterType::New();
1471 CastFilterType2::Pointer filter2=CastFilterType2::New();
1473 connector->SetInput( imagedata );
1474 filter2->SetInput(connector->GetOutput());
1476 typedef itk::CurvatureAnisotropicDiffusionImageFilter<
1478 InternalImageType > SmoothingFilterType;
1480 SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();
1482 typedef itk::GradientMagnitudeRecursiveGaussianImageFilter<
1484 InternalImageType > GradientFilterType;
1486 typedef itk::SigmoidImageFilter<
1488 InternalImageType > SigmoidFilterType;
1490 GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();
1492 SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();
1494 sigmoid->SetOutputMinimum( 0.0 );
1495 sigmoid->SetOutputMaximum( 255.0 );
1498 typedef itk::FastMarchingImageFilter<
1500 InternalImageType > FastMarchingFilterType;
1503 FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();
1505 printf("EED wxContourMainFrame::SegmentationOneSliceITK Skypping this code. Not compiling GeodesicActiveContourLevelSetImageFilter in fedora 17 with ITK 3.20.1 \n ");
1507 > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - Not compiling GeodesicActiveContourLevelSetImageFilter in fedora 17 with ITK 3.20.1
1510 typedef itk::GeodesicActiveContourLevelSetImageFilter< InternalImageType,
1511 InternalImageType > GeodesicActiveContourFilterType;
1512 GeodesicActiveContourFilterType::Pointer geodesicActiveContour =
1513 GeodesicActiveContourFilterType::New();
1515 typedef itk::ZeroCrossingImageFilter<
1517 InternalImageType > ZeroCrossingFilterType;
1518 ZeroCrossingFilterType::Pointer zeroCrossing =
1519 ZeroCrossingFilterType::New();
1521 const double propagationScaling = atof( crea::wx2std(prop).c_str() );
1523 geodesicActiveContour->SetPropagationScaling( propagationScaling );
1524 geodesicActiveContour->SetCurvatureScaling( 1.0 );
1525 geodesicActiveContour->SetAdvectionScaling( 1.0 );
1527 geodesicActiveContour->SetMaximumRMSError( 0.02 );
1528 int it=atoi( crea::wx2std(iter).c_str() );
1529 geodesicActiveContour->SetNumberOfIterations( it );
1531 smoothing->SetInput( filter2->GetOutput() );
1532 gradientMagnitude->SetInput( smoothing->GetOutput() );
1533 sigmoid->SetInput( gradientMagnitude->GetOutput() );
1534 fastMarching->SetInput( sigmoid->GetOutput() );
1535 geodesicActiveContour->SetInput( fastMarching->GetOutput() );
1536 geodesicActiveContour->SetFeatureImage( sigmoid->GetOutput() );
1538 zeroCrossing->SetInput( geodesicActiveContour->GetOutput() );
1539 //thresholder->SetInput( zeroCrossing->GetOutput() );
1540 thresholder->SetInput( geodesicActiveContour->GetOutput() );
1541 connector2->SetInput( thresholder->GetOutput() );
1543 < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < - < -
1549 smoothing->SetTimeStep( 0.125 );
1550 smoothing->SetNumberOfIterations( 5 );
1551 smoothing->SetConductanceParameter( 9.0 );
1554 const double sigma = atof( crea::wx2std(sigm).c_str() );
1555 gradientMagnitude->SetSigma( sigma );
1557 const double alpha = atof( crea::wx2std(alf).c_str() );
1558 const double beta = atof( crea::wx2std(bet).c_str() );
1560 sigmoid->SetAlpha( alpha );
1561 sigmoid->SetBeta( beta );
1563 typedef FastMarchingFilterType::NodeContainer NodeContainer;
1564 typedef FastMarchingFilterType::NodeType NodeType;
1566 NodeContainer::Pointer seeds = NodeContainer::New();
1568 InternalImageType::IndexType seedPosition;
1569 seedPosition[0] = x;
1570 seedPosition[1] = y;
1572 const double initialDistance = atof( crea::wx2std(distanc).c_str() );
1576 const double seedValue = - initialDistance;
1578 node.SetValue( seedValue );
1579 node.SetIndex( seedPosition );
1581 seeds->Initialize();
1582 seeds->InsertElement( 0, node );
1584 fastMarching->SetTrialPoints( seeds );
1586 fastMarching->SetSpeedConstant( 1.0 );
1588 fastMarching->SetOutputSize(
1589 connector->GetOutput()->GetBufferedRegion().GetSize() );
1591 fastMarching->SetStoppingValue( 800 );
1595 connector2->Update();
1596 vtkImageData *idata = connector2->GetOutput();
1598 vtkMarchingContourFilter* cntVTK = vtkMarchingContourFilter::New( );
1600 cntVTK->SetNumberOfContours( 1 );
1601 cntVTK->SetValue( 0, 255 );
1602 //EED 2017-01-01 Migration VTK7
1603 #if VTK_MAJOR_VERSION <= 5
1604 cntVTK->SetInput( idata );
1606 cntVTK->UpdateInformation();
1608 cntVTK->SetInputData( idata );
1611 vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
1613 //EED 2017-01-01 Migration VTK7
1614 #if VTK_MAJOR_VERSION <= 5
1615 cpd->SetInput( cntVTK->GetOutput( ) );
1617 cpd->UpdateInformation();
1619 cpd->SetInputData( cntVTK->GetOutput( ) );
1623 vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
1624 conn->SetExtractionModeToLargestRegion( );
1625 //EED 2017-01-01 Migration VTK7
1626 #if VTK_MAJOR_VERSION <= 5
1627 conn->SetInput( cpd->GetOutput( ) );
1629 conn->UpdateInformation();
1631 conn->SetInputData( cpd->GetOutput( ) );
1635 vtkStripper* vtkstripper = vtkStripper::New( );
1637 //EED 2017-01-01 Migration VTK7
1638 #if VTK_MAJOR_VERSION <= 5
1639 vtkstripper->SetInput( conn->GetOutput() );
1640 vtkstripper->Update();
1641 vtkstripper->UpdateInformation();
1643 vtkstripper->SetInputData( conn->GetOutput() );
1647 vtkPolyData* polyDataResult = cntVTK->GetOutput();
1648 //std::cout<<"Points "<<polyDataResult->GetNumberOfPoints()<<std::endl;
1650 //EED 2017-01-01 Migration VTK7
1651 #if VTK_MAJOR_VERSION <= 5
1652 polyDataResult->Update( );
1653 polyDataResult->UpdateInformation();
1661 myfile.open ("C:/Creatis/example.txt");
1663 polyDataResult->Print(myfile);
1664 myfile << "-------------------------------------\n";
1665 polyDataResult->GetLines()->Print(myfile);
1673 //--Calculating control points
1675 std::vector<double> vecX;
1676 std::vector<double> vecY;
1677 std::vector<double> vecXo;
1678 std::vector<double> vecYo;
1679 std::vector<double>::iterator vecXoi;
1680 std::vector<double>::iterator vecYoi;
1681 std::vector<double> vecZ;
1683 std::vector<double> vecCtrlPointX;
1684 std::vector<double> vecCtrlPointY;
1685 std::vector<double> vecCtrlPointZ;
1691 int ii,size=polyDataResult->GetNumberOfPoints();
1693 myfile.open ("C:/Creatis/example2.txt");
1695 size=polyDataResult->GetNumberOfPoints();
1696 for (ii=0;ii<size;ii++)
1703 p = polyDataResult->GetPoint(ii);
1706 /*if(fabs(yAct-y)>20)
1708 if((xAct-x)>1 || (xAct-x)<-1)
1710 vecX.push_back( p[0] );
1711 vecY.push_back( p[1] );
1712 myfile <<p[0]<<","<<p[1]<<"\n";
1713 std::cout<<" x Anterior "<<xAct<<" x actual "<<x<<std::endl;
1714 std::cout<<" y Anterior "<<yAct<<" y actual "<<y<<std::endl;
1715 std::cout<<" x "<<p[0]<<" y "<<p[1]<<std::endl;
1716 vecZ.push_back( 900 );
1722 vecXo.push_back(p[0]);
1723 vecYo.push_back(p[1]);
1727 else*/ if(fabs(xAct-x)>11)
1729 vecXo.push_back(p[0]);
1730 vecYo.push_back(p[1]);
1732 vecX.push_back( p[0] );
1733 myfile <<p[0]<<","<<p[1]<<"\n";
1734 //std::cout<<" x Anterior "<<xAct<<" x actual "<<x<<std::endl;
1735 //std::cout<<" y Anterior "<<yAct<<" y actual "<<y<<std::endl;
1736 //std::cout<<" x "<<p[0]<<" y "<<p[1]<<std::endl;
1737 vecY.push_back( p[1] );
1739 vecZ.push_back( -900 );
1747 while(!vecXo.empty())
1749 vecX.push_back(vecXo.back());
1750 //std::cout<<" x Siguiente "<<vecXo.back();
1753 vecZ.push_back( -900 );
1755 while(!vecYo.empty())
1757 vecY.push_back(vecYo.back());
1762 /*for(int l=0;l<vecX.size();l++)
1766 vecXo.push_back(p[0]);
1767 vecYo.push_back(p[1]);
1778 ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
1780 extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
1784 extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
1786 else if (method==1){
1787 extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
1789 else if (method==2){
1790 extractcontrolpoints2d->SetSamplingControlPoints( 15 );
1791 extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
1793 //--Adding contour to the system
1795 std::vector<int> actualInstantVector;
1796 _instantPanel->getInstant( actualInstantVector );
1797 actualInstantVector[1]=z;
1799 int j,sizeCtrPt = vecCtrlPointX.size();
1801 manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
1802 manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 );
1804 for (j=0 ; j<sizeCtrPt ; j++)
1806 manModelContour->AddPoint( vecCtrlPointX[j] , vecCtrlPointY[j] , vecCtrlPointZ[j] );
1808 std::string theName;
1809 //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
1810 theName = kernelManager->createOutline( manModelContour, actualInstantVector );
1811 bool addedModel = theName.compare("") != 0;
1814 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
1815 _theViewPanel->getSpacing(spc);
1816 //Adding the manualContourControler to interface objects structure
1817 //Adding the manualViewContour to interface objects structure
1818 //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
1819 _theViewPanel->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
1820 //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
1827 WriterType::Pointer writer = WriterType::New();
1828 CastFilterType3::Pointer caster = CastFilterType3::New();
1830 caster->SetInput( gradientMagnitude->GetOutput() );
1831 writer->SetInput( caster->GetOutput() );
1832 writer->SetFileName("Gradient Magnitude.png");
1833 caster->SetOutputMinimum( 0 );
1834 caster->SetOutputMaximum( 255 );
1837 CastFilterType3::Pointer caster2 = CastFilterType3::New();
1838 WriterType::Pointer writer2 = WriterType::New();
1840 caster2->SetInput( sigmoid->GetOutput() );
1841 writer2->SetInput( caster2->GetOutput() );
1842 writer2->SetFileName("Sigmoid.png");
1843 caster2->SetOutputMinimum( 0 );
1844 caster2->SetOutputMaximum( 255 );
1847 CastFilterType3::Pointer caster3 = CastFilterType3::New();
1848 WriterType::Pointer writer3 = WriterType::New();
1850 caster3->SetInput( fastMarching->GetOutput() );
1851 writer3->SetInput( caster3->GetOutput() );
1852 writer3->SetFileName("FastMarching.bmp");
1853 caster3->SetOutputMinimum( 0 );
1854 caster3->SetOutputMaximum( 255 );
1857 CastFilterType3::Pointer caster4 = CastFilterType3::New();
1858 WriterType::Pointer writer4 = WriterType::New();
1860 caster4->SetInput( geodesicActiveContour->GetOutput() );
1861 writer4->SetInput( caster4->GetOutput() );
1862 writer4->SetFileName("GeodesicActiveContour.png");
1863 caster4->SetOutputMinimum( 0 );
1864 caster4->SetOutputMaximum( 255 );
1867 CastFilterType3::Pointer caster5 = CastFilterType3::New();
1868 WriterType::Pointer writer5 = WriterType::New();
1870 caster5->SetInput( zeroCrossing->GetOutput() );
1871 writer5->SetInput( caster5->GetOutput() );
1872 writer5->SetFileName("ZeroCrossing.bmp");
1873 caster5->SetOutputMinimum( 0 );
1874 caster5->SetOutputMaximum( 255 );
1878 catch( itk::ExceptionObject & excep )
1880 std::cerr << "Exception caught !" << std::endl;
1881 std::cerr << excep << std::endl;
1885 void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int method){
1887 //JCP 20-10-08 Undo redo implementation
1889 //JCP 20-10-08 Undo redo implementation
1892 int x = _theViewPanel->GetX();
1893 int y = _theViewPanel->GetY();
1894 int z = _theViewPanel->GetZ();
1895 SegmentationOneSlice( x,y,z,isovalue, sampling, method );
1900 void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method )
1902 int typeofcontour = 1;
1903 //--Extracting Contour
1904 vtkImageData *imagedata = getImageData();
1906 vtkImageReslice *imageReslice = vtkImageReslice::New();
1909 imagedata->GetSpacing(spc);
1914 //EED 2017-01-01 Migration VTK7
1915 #if VTK_MAJOR_VERSION <= 5
1916 imageReslice->SetInput( imagedata );
1918 imageReslice->SetInputData( imagedata );
1920 imageReslice->SetInformationInput(imagedata);
1921 imageReslice->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
1922 imageReslice->SetResliceAxesOrigin(0,0,z*spc[2]);
1923 imageReslice->SetOutputDimensionality(2);
1924 imageReslice->SetInterpolationModeToLinear();
1926 //EED 2017-01-01 Migration VTK7
1927 #if VTK_MAJOR_VERSION <= 5
1930 imageReslice->Update();
1933 imagedata = imageReslice->GetOutput();
1934 //EED 2017-01-01 Migration VTK7
1935 #if VTK_MAJOR_VERSION <= 5
1936 imagedata->Update();
1937 imagedata->UpdateInformation();
1942 vtkContourFilter* cntVTK = vtkContourFilter::New( );
1943 //EED 2017-01-01 Migration VTK7
1944 #if VTK_MAJOR_VERSION <= 5
1945 cntVTK->SetInput( imagedata );
1947 cntVTK->SetInputData( imagedata );
1950 cntVTK->SetNumberOfContours( 1 );
1951 //cntVTK->SetValue( 0, vmin );
1952 // cntVTK->SetValue( 0, (range[1]*thr/100) );
1953 cntVTK->SetValue( 1, isovalue );
1954 // cntVTK->SetValue( 1, vmax );
1956 cntVTK->UpdateInformation();
1958 vtkCleanPolyData* cpd = vtkCleanPolyData::New( );
1959 //EED 2017-01-01 Migration VTK7
1960 #if VTK_MAJOR_VERSION <= 5
1961 cpd->SetInput( cntVTK->GetOutput( ) );
1963 cpd->SetInputData( cntVTK->GetOutput( ) );
1965 cpd->ConvertLinesToPointsOff( );
1967 cpd->UpdateInformation();
1969 vtkPolyDataConnectivityFilter* conn = vtkPolyDataConnectivityFilter::New( );
1971 // conn->SetExtractionModeToPointSeededRegions();
1972 // conn->SetExtractionModeToCellSeededRegions();
1973 // conn->SetExtractionModeToSpecifiedRegions();
1974 // conn->SetExtractionModeToLargestRegion();
1975 // conn->SetExtractionModeToAllRegions();
1977 conn->SetExtractionModeToClosestPointRegion();
1979 //conn->SetMaxRecursionDepth( 3000 );
1981 //EED 2017-01-01 Migration VTK7
1982 #if VTK_MAJOR_VERSION <= 5
1983 conn->SetInput( cpd->GetOutput( ) );
1985 conn->SetInputData( cpd->GetOutput( ) );
1988 conn->SetClosestPoint( x, y, 0 );
1990 conn->UpdateInformation();
1992 vtkCleanPolyData* cpd2 = vtkCleanPolyData::New( );
1993 //EED 2017-01-01 Migration VTK7
1994 #if VTK_MAJOR_VERSION <= 5
1995 cpd2->SetInput( conn->GetOutput( ) );
1997 cpd2->SetInputData( conn->GetOutput( ) );
2000 cpd2->UpdateInformation();
2002 vtkStripper* vtkstripper = vtkStripper::New( );
2003 vtkstripper->SetJoinContiguousSegments(true);
2004 vtkstripper->SetMaximumLength(20000);
2005 //EED 2017-01-01 Migration VTK7
2006 #if VTK_MAJOR_VERSION <= 5
2007 vtkstripper->SetInput( cpd2->GetOutput() );
2009 vtkstripper->SetInputData( cpd2->GetOutput() );
2010 // vtkstripper->SetInputData( cntVTK->GetOutput() );
2013 vtkstripper->Update();
2014 vtkstripper->UpdateInformation();
2017 vtkPolyData* polyDataResult = vtkstripper->GetOutput();
2019 //EED 2017-01-01 Migration VTK7
2020 #if VTK_MAJOR_VERSION <= 5
2021 polyDataResult->Update( );
2022 polyDataResult->UpdateInformation();
2029 myfile.open ("c:/temp/example.txt");
2031 polyDataResult->Print(myfile);
2032 myfile << "-------------------------------------\n";
2033 polyDataResult->GetLines()->Print(myfile);
2041 //--Calculating control points
2042 std::vector<double> vecX;
2043 std::vector<double> vecY;
2044 std::vector<double> vecZ;
2045 std::vector<double> vecCtrlPointX;
2046 std::vector<double> vecCtrlPointY;
2047 std::vector<double> vecCtrlPointZ;
2049 printf("EED wxContourMainFrame::SegmentationOneSlice GetNumberOfLines=%d \n",polyDataResult->GetNumberOfLines() );
2051 int numberOfPointsInCell;
2052 int numberOfcells=polyDataResult->GetNumberOfCells();
2053 for (int jj=0; jj<numberOfcells ; jj++)
2055 vtkCell* vtkcell = polyDataResult->GetCell( jj );
2056 numberOfPointsInCell=vtkcell->GetNumberOfPoints();
2057 printf("EED wxContourMainFrame::SegmentationOneSlice cell=%d points=%d \n",jj,numberOfPointsInCell );
2060 printf("EED wxContourMainFrame::SegmentationOneSlice PrintSelf \n");
2062 polyDataResult->PrintSelf( std::cout, vtkIndent(0) );
2065 if (polyDataResult->GetNumberOfCells()>0)
2068 printf("EED wxContourMainFrame::SegmentationOneSlice A \n");
2069 vtkCell* vtkcell = polyDataResult->GetCell( 0 );
2070 printf("EED wxContourMainFrame::SegmentationOneSlice B \n");
2071 // int ii,size=polyDataResult->GetNumberOfPoints();
2072 int ii,size=vtkcell->GetNumberOfPoints();
2073 printf("EED wxContourMainFrame::SegmentationOneSlice C \n");
2075 for (ii=1;ii<=size;ii++)
2077 // id = polyDataResult->GetLines()->GetData()->GetValue(ii);
2078 // p = polyDataResult->GetPoint(id);
2079 p = vtkcell->GetPoints()->GetPoint(ii);
2081 printf("EED wxContourMainFrame::SegmentationOneSlice (%d) id=%d px=%f py=%f\n",ii,id, p[0],p[1]);
2084 vecX.push_back( p[0] );
2085 vecY.push_back( p[1] );
2087 vecZ.push_back( -900 );
2088 // vecZ.push_back( p[2] );
2091 ExtractControlPoints2D *extractcontrolpoints2d = new ExtractControlPoints2D();
2092 extractcontrolpoints2d->SetContour( &vecX , &vecY , &vecZ );
2095 /*if (methodRadiobox->GetSelection()==0){
2096 extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
2098 if (methodRadiobox->GetSelection()==1){
2099 extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
2101 if (methodRadiobox->GetSelection()==2){
2102 extractcontrolpoints2d->SetSamplingControlPoints( sampling );
2103 extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
2108 extractcontrolpoints2d->GetInitialControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
2109 } else if (method==1){
2110 extractcontrolpoints2d->GetControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
2111 } else if (method==2){
2112 extractcontrolpoints2d->SetSamplingControlPoints( sampling );
2113 extractcontrolpoints2d->GetSamplingControlPoints( &vecCtrlPointX , &vecCtrlPointY , &vecCtrlPointZ );
2116 //--Adding contour to the system
2117 std::vector<int> actualInstantVector;
2118 _instantPanel->getInstant( actualInstantVector );
2119 actualInstantVector[1]=z;
2121 int j,sizeCtrPt = vecCtrlPointX.size();
2122 manualBaseModel *manModelContour = kernelManager->factoryManualContourModel( typeofcontour );
2123 manModelContour->SetNumberOfPointsSpline( ((sizeCtrPt/100)+1)*100 *2 );
2124 manModelContour->SetLabel2( std::to_string(z) );
2127 for (j=0 ; j<sizeCtrPt ; j++)
2129 manModelContour->AddPoint( vecCtrlPointX[j] / spc[0], vecCtrlPointY[j] / spc[1], vecCtrlPointZ[j] );
2131 std::string theName;
2132 //theName = _modelManager->createOutline( manModelContour, actualInstantVector );
2133 theName = kernelManager->createOutline( manModelContour, actualInstantVector );
2134 bool addedModel = theName.compare("") != 0;
2137 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
2138 _theViewPanel->getSpacing(spc);
2139 //Adding the manualContourControler to interface objects structure
2140 //Adding the manualViewContour to interface objects structure
2141 //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
2142 _theViewPanel->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
2143 //_theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc, typeofcontour ) ;
2146 } // if NumberOfCells > 0
2148 printf("EED wxContourMainFrame::SegmentationOneSlice End\n");
2151 int wxContourMainFrame::GetImageDataSizeZ()
2153 return _theViewPanel->GetImageDataSizeZ();
2156 void wxContourMainFrame::GetImageDataRange(double *range)
2158 _theViewPanel->GetImageDataRange(range);
2161 void wxContourMainFrame::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int sampling,int method)
2163 //JCP 20-10-08 Undo redo implementation
2165 //JCP 20-10-08 Undo redo implementation
2168 int x = _theViewPanel->GetX();
2169 int y = _theViewPanel->GetY();
2173 double totalZ = maxZ-minZ+1;
2174 for( z=minZ ; z<=maxZ ; z++ )
2176 porcent = 100.0* (z-minZ)/totalZ;
2177 tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ,z );
2178 interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(tmpString);
2179 //_staticTextSegmentation->SetLabel(tmpString);
2180 SegmentationOneSlice( x,y,z,isovalue, sampling,method );
2182 interfMainPanel::getInstance()->setLabelSegmentationPanelVTK(_T(" "));
2187 //Creates a reference line to be used as the axis of the mirroring
2188 void wxContourMainFrame::referenceLine()
2190 if (_refLineControl==NULL)
2195 vtkImageData *vtkimagedata = _theViewPanel->getImageData();
2196 vtkimagedata->GetSpacing(spc);
2198 wxVtkBaseView * viewer2D = _theViewPanel->getWxVtkBaseView();
2200 _refLineControl = new manualLineControler();
2201 _refLineModel = new manualContourModelLine();
2202 _refLineView = new manualViewLine();
2203 _refLineView->SetModel( _refLineModel );
2204 _refLineView->SetWxVtkBaseView( viewer2D );
2205 _refLineView->SetRange( 2 );
2206 _refLineView->SetZ( 1200 );
2208 _refLineView->SetSpacing(spc);
2210 _refLineView->SetColorNormalContour(0, 0, 1);
2211 _refLineView->SetColorEditContour(0, 0.5, 0.5);
2212 _refLineView->SetWidthLine(4);
2214 _refLineControl->SetModelView( _refLineModel , _refLineView );
2215 vtkInteractorStyleBaseView* style = (vtkInteractorStyleBaseView*)viewer2D->GetInteractorStyleBaseView();
2216 style->AddInteractorStyleMaracas( _refLineControl );
2217 _refLineModel->SetCloseContour(false);
2218 _refLineControl->CreateNewManualContour();
2220 //AD: Inicializar el mirroring con una linea ya pintada
2222 double z = _refLineControl->GetZ();
2225 image->GetDimensions(imageDim);
2226 double x = (double) imageDim[0]/2;
2227 double y1 = (double) (imageDim[1]/2)+15;
2228 double y2 = (double) (imageDim[1]/2)-15;
2230 _refLineControl->AddPoint(x,y1,z);
2231 _refLineControl->AddPoint(x,y2,z);
2232 _refLineControl->SetCompleteCreation(true);
2234 _refLineModel->AddPoint(x,y1,z);
2235 _refLineModel->AddPoint(x,y2,z);
2236 _refLineModel->UpdateSpline();
2238 _refLineView->UpdateViewPoint(0);
2239 _refLineView->UpdateViewPoint(1);
2242 _refLineControl->SetActive(true);
2243 _refLineView->RefreshContour();
2247 //Hides the referenceLine
2248 void wxContourMainFrame::refLineHide()
2250 if (_refLineControl!=NULL)
2252 if (_refLineControl->GetActive())
2254 _refLineView->RemoveCompleteContourActor();
2255 _refLineControl->SetEditable(false);
2256 _refLineControl->SetActive(false);
2263 //Shows the referenceLine
2264 void wxContourMainFrame::refLineShow()
2266 if (_refLineControl!=NULL)
2268 if (_refLineControl->GetActive()==false)
2270 wxVtkBaseView * viewer2D = _theViewPanel->getWxVtkBaseView();
2272 _refLineView->SetModel( _refLineModel );
2273 _refLineView->SetWxVtkBaseView( viewer2D );
2274 _refLineView->SetRange( 2 );
2275 _refLineView->SetZ( 1200 );
2277 _refLineControl->SetModelView( _refLineModel , _refLineView );
2278 vtkInteractorStyleBaseView* style = (vtkInteractorStyleBaseView*)viewer2D->GetInteractorStyleBaseView();
2279 style->AddInteractorStyleMaracas( _refLineControl );
2280 _refLineControl->CreateNewManualContour();
2281 _refLineControl->SetActive(true);
2282 _refLineView->RefreshContour();
2289 void wxContourMainFrame::refLineChangeWidth(int width)
2291 _refLineView->SetWidthLine(width);
2292 _refLineView->RefreshContour();
2298 void wxContourMainFrame::onMirror()
2301 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
2302 std::vector<std::string> filterCurrentSelection;
2304 std::vector<int> tempVector;
2305 _instantPanel->getInstant( tempVector );
2306 _performingOperation->reset();
2307 _performingOperation->setStartCommand( COPY );
2308 _performingOperation->setStartOperationInstantVector( tempVector );
2309 _performingOperation->setKeyNamesOperationElems( currentSelection );
2311 char theStartCommand = _performingOperation->getStartCommand();
2312 if ( theStartCommand == COPY )
2314 //JCP 20-10-08 Undo redo implementation
2316 //JCP 20-10-08 Undo redo implementation
2317 std::vector<int> tempVector;
2318 _instantPanel->getInstant( tempVector );
2319 _performingOperation->setEndOperationInstantVector ( tempVector );
2320 std::vector<std::string> elems = _performingOperation->getKeyNamesOperationElems();
2321 int i,size = elems.size();
2322 for( i=0; i<size; i++ )
2324 createMirrorContourOf( elems[i], tempVector, i>0 );
2328 //deleteContour( _refName );
2333 void wxContourMainFrame::showAxis(bool show)
2335 _theViewPanel->SetVisibleAxis(show);
2336 _theViewPanel->Refresh();
2340 void wxContourMainFrame::onRigidPressed(){
2341 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
2342 int elementsSelected = currentSelection.size();
2344 if ( elementsSelected >= 1 ){
2345 //JCP 20-10-08 Undo redo implementation
2347 //JCP 20-10-08 Undo redo implementation
2349 std::vector<int> tempVector;
2350 _instantPanel->getInstant( tempVector );
2351 Instant instant(&tempVector);
2353 int i , size=currentSelection.size();
2354 for ( i=0 ; i<size ; i++ )
2356 kernelManager->changeContourOfManager(currentSelection[i], &instant);
2361 void wxContourMainFrame::onWidthOfContour(double width){
2363 _theViewPanel->removeSceneContours();
2364 _theViewPanel->SetWidthContour(width);
2366 //_theViewPanel->getSceneManager()->SetWidthContour( width );
2371 int wxContourMainFrame::getColorWindow()
2375 vtkImageData * img = getImageData();
2376 img->GetScalarRange(range);
2378 std::cout<<"Val 1: "<<range[0]<<" Val 2: "<<range[1]<<std::endl;
2380 return (int)range[1];
2382 return _theViewPanel->getColorWindow();
2385 int wxContourMainFrame::getWindowLevel()
2389 vtkImageData * img = getImageData();
2390 img->GetScalarRange(range);
2392 std::cout<<"Val 1: "<<range[0]<<" Val 2: "<<range[1]<<std::endl;
2394 return (int)range[1];
2396 return _theViewPanel->getWindowLevel();
2399 void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
2401 _theViewPanel->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
2406 void wxContourMainFrame::onInterpolation(bool interpolate)
2408 _theViewPanel->onInterpolation(interpolate);
2412 void wxContourMainFrame::onBeforeAfterContour(bool before,bool after)
2414 _theViewPanel->onBeforeAfterContour(before,after);
2418 void wxContourMainFrame::onShowTextContour(bool show)
2420 _theViewPanel->onShowTextContour(show);
2424 void wxContourMainFrame::onChangeInstant(std::string name,int actual)
2426 _instantPanel->setConceptValue( name, actual );
2429 void wxContourMainFrame::resetAppend()
2431 kernelManager->resetAppend();
2434 void wxContourMainFrame::onSpreadAdd()
2436 std::vector<double> vecX;
2437 std::vector<double> vecY;
2438 std::vector<double> vecZ;
2439 _theViewPanel->GetPointsOfActualContour(&vecX , &vecY , &vecZ );
2440 std::vector<int> tempVector;
2441 _instantPanel->getInstant( tempVector );
2442 std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
2443 interfMainPanel::getInstance()->appendStringSpread(val);
2447 void wxContourMainFrame::onSpreadAddAll()
2450 std::vector<int> tempVector;
2451 _instantPanel->getInstant( tempVector );
2454 maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
2456 int sizeLstContourThings;
2457 for ( z=minZ ; z<=maxZ ; z++ )
2460 Instant instant(&tempVector);
2461 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
2462 sizeLstContourThings = lstContourThings.size();
2463 if (sizeLstContourThings>=1)
2465 std::vector<double> vecX;
2466 std::vector<double> vecY;
2467 std::vector<double> vecZ;
2468 ContourThing **contourthing = lstContourThings[0];
2469 manualBaseModel *cModel = (*contourthing)->getModel();
2470 int i,size = cModel->GetNumberOfPointsSpline();
2472 for (i=0; i<size; i++)
2474 cModel->GetSpline_i_Point(i, &x, &y, &z);
2479 std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
2480 interfMainPanel::getInstance()->appendStringSpread(val);
2481 }// if sizeLstContourThings
2486 void wxContourMainFrame::onSpreadGo(int type)
2488 //JCP 20-10-08 Undo redo implementation
2490 //JCP 20-10-08 Undo redo implementation
2492 std::vector<double> vecCtrlPointX;
2493 std::vector<double> vecCtrlPointY;
2494 std::vector<double> vecCtrlPointZ;
2498 std::vector<int> tempVector;
2499 _instantPanel->getInstant( tempVector );
2502 kernelManager->getMaxMinZ(&minZ,&maxZ);
2503 //JSTG_16-07-08_----------------------------------------------------------------
2504 //_contourPropagation->setInterpolationNumber(maxZ-minZ+1);
2505 kernelManager->CalculeSplinePropagation();
2507 double totalZ = maxZ-minZ+1;
2510 //--------------------------------------------------------------------
2511 for ( z=(int)minZ ; z<=(int)maxZ ; z++ )
2513 porcent = 100.0* (z-minZ)/totalZ;
2514 int numero = (int)(z-minZ+1)/(int)totalZ;
2515 std::string stringtemp = " "+kernelManager->intToString(porcent)+"% "+kernelManager->intToString(numero)+" "+kernelManager->intToString(z);
2517 interfMainPanel::getInstance()->setStringSpread(stringtemp);
2519 int typeofcontour = 1;
2520 std::string theName;
2521 manualBaseModel* manModelContour = kernelManager->GetPoints(z, type, &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ, theName,typeofcontour, tempVector);
2523 if( manModelContour!=NULL ){
2524 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
2525 this->_theViewPanel->getSpacing(spc);
2526 //Adding the manualContourControler to interface objects structure
2527 //Adding the manualViewContour to interface objects structure
2528 //_theViewPanel->getSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active.
2529 _theViewPanel->configureViewControlTo( theName, manModelContour,spc,typeofcontour ) ;
2534 int numero = (int)(z-minZ+1)/(int)totalZ;
2535 std::string stringtemp = " "+kernelManager->intToString(porcent)+"% "+kernelManager->intToString(numero)+" "+kernelManager->intToString(z);
2537 interfMainPanel::getInstance()->setStringSpread(stringtemp);
2539 //RefreshInterface();
2542 void wxContourMainFrame::getInstantVector(std::vector<int>& tempVector)
2544 _instantPanel->getInstant( tempVector );
2547 std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide)
2549 std::vector<int> tempVector;
2550 _instantPanel->getInstant(tempVector);
2551 //Asignation of slide number should be different ex by name
2552 tempVector[1]=slide;
2553 return kernelManager->getOutlinesNameAtInstant(tempVector);
2557 void wxContourMainFrame::SetScalarRange(int grayRangeMin, int grayRangeMax)
2559 _contourextractdata->SetScalarRange(grayRangeMin,grayRangeMax);
2563 void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax)
2566 wxString tempString;
2567 int maxContourGroup = 0;
2569 _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
2571 std::vector<manualBaseModel*> lstManConMod;
2572 std::vector<manualBaseModel*> lstManConModTmp;
2573 std::vector<manualBaseModel*> lstManConModExp;
2574 std::vector<double> pLstValue;
2575 std::vector<double> pLstValuePosX;
2576 std::vector<double> pLstValuePosY;
2577 std::vector<double> pLstValuePosZ;
2580 int resultGrayRangeCount;
2583 double resultAverage;
2584 double resultStandardeviation;
2586 std::vector<int> tempVector;
2587 _instantPanel->getInstant( tempVector );
2590 int ii,sizeLstContourThings;
2599 if (selection==0 ) // actual slice
2601 int actualSlice = tempVector[1];
2604 } else { // slice range
2610 totalZ = maxZ-minZ+1;
2612 _contourextractdata->InitVolumeStatistics();
2615 for ( z=minZ ; z<=maxZ ; z++ )
2618 porcent = 100.0* (z-minZ)/totalZ;
2619 tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
2621 interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
2622 //_staticTextInformation->SetLabel(tmpString);
2624 //Extraction data from contours of each slice
2625 _contourextractdata->SetZtoBeAnalys(z);
2628 Instant instant(&tempVector);
2629 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
2630 sizeLstContourThings = lstContourThings.size();
2632 lstManConMod.clear();
2633 for (ii=0 ; ii<sizeLstContourThings ; ii++)
2635 ContourThing **contourthing = lstContourThings[ii];
2636 lstManConMod.push_back( (*contourthing)->getModel() );
2639 lstManConModExp = kernelManager->ExploseEachModel( lstManConMod );
2641 tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
2642 interfMainPanel::getInstance()->setRowLabelInfoPanel(z, tempString);
2643 //_grid->SetRowLabelValue(z, tempString );
2645 int iContourGroup,sizeContourGroup;
2646 if (typeContourGroup==3) // contour separete
2648 sizeContourGroup=lstManConModExp.size();
2649 if ( maxContourGroup<sizeContourGroup )
2651 maxContourGroup=sizeContourGroup;
2653 } else { // contour AND OR XOR
2660 for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
2661 lstManConModTmp.clear();
2665 if (typeContourGroup==3) // contour separete
2667 lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
2668 } else { // contour AND OR XOR
2669 lstManConModTmp = lstManConModExp;
2672 _contourextractdata->SetLstManualContourModel( lstManConModTmp );
2673 _contourextractdata->SetScalarRange(grayRangeMin,grayRangeMax);
2676 pLstValuePosX.clear();
2677 pLstValuePosY.clear();
2678 pLstValuePosZ.clear();
2682 _contourextractdata->GetValuesInsideCrown( &numberOfPixels,
2688 resultSize=numberOfPixels;
2689 // Statistics of each slice.
2690 _contourextractdata->Statistics( &pLstValue,
2693 &resultGrayRangeCount,
2698 &resultStandardeviation);
2700 if (interfMainPanel::getInstance()->getNumberColsInformationPanel()<_numberOfVariablesStatistics*(iContourGroup+1) )
2702 interfMainPanel::getInstance()->appendColsInformationPanel(_numberOfVariablesStatistics);
2705 tmpIntA=_numberOfVariablesStatistics*iContourGroup ;
2707 tempString.Printf(_T("%d"),numberOfPixels);
2709 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA, tempString);
2711 tempString.Printf(_T("%d"),resultGrayRangeCount);
2712 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+1, tempString);
2714 tempString.Printf(_T("%f"),resultMin);
2715 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+2, tempString);
2717 tempString.Printf(_T("%f"),resultMax);
2718 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+3, tempString);
2720 tempString.Printf(_T("%f"),resultAverage);
2721 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+4, tempString);
2723 tempString.Printf(_T("%f"),resultStandardeviation);
2724 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+5, tempString);
2727 } // for iContourGroup
2730 // Print Volume Statistics
2733 int vol_rCountRange;
2735 double vol_minValue;
2736 double vol_maxValue;
2738 double vol_standardeviation;
2740 if (selection!=0 ) // actual slice
2743 _contourextractdata->GetVolumeStatistics(&vol_rCountRange, &vol_rsize,
2744 &vol_minValue, &vol_maxValue,
2745 &vol_average, &vol_standardeviation);
2747 interfMainPanel::getInstance()->setRowLabelInfoPanel(maxZ+2, _T("Total:"));
2749 tempString.Printf(_T("%d"),vol_rsize);
2750 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 0, tempString);
2752 tempString.Printf(_T("%d"),vol_rCountRange);
2753 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 1, tempString);
2755 tempString.Printf(_T("%f"),vol_minValue);
2756 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 2, tempString);
2758 tempString.Printf(_T("%f"),vol_maxValue);
2759 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 3, tempString);
2761 tempString.Printf(_T("%f"),vol_average);
2762 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 4, tempString);
2764 tempString.Printf(_T("%f"),vol_standardeviation);
2765 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 5, tempString);
2767 //-----------------------------------------
2770 wxString tmpTitleString;
2772 for ( iTitleGroup=0 ; iTitleGroup<maxContourGroup ; iTitleGroup++ )
2774 tmpIntB =_numberOfVariablesStatistics*iTitleGroup;
2775 tmpTitleString.Printf(_T("%d-Size Data"),iTitleGroup);
2776 interfMainPanel::getInstance()->setColLableInfoPanel(tmpIntB + 0, tmpTitleString);
2778 interfMainPanel::getInstance()->setColLableInfoPanel(tmpIntB + 0, tmpTitleString );
2779 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 1, _T("Size Range") );
2780 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 2, _T("Min") );
2781 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 3, _T("Max") );
2782 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 4, _T("Average") );
2783 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 5, _T("St.Dev.") );
2784 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 6, _T(" ") );
2786 interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
2790 void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename,
2791 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics)
2795 SaveValuesXYZ( directory , namefile, typeContourGroup );
2800 vtkImageData * mask;
2801 vtkImageData * value;
2802 this->getMaskValue(&mask, &value, typeContourGroup,selection,minZ,maxZ);
2803 this->SaveImageResult( directory , namefile, mask, value);
2808 std::ostringstream name;
2809 name << filename << ".xls";
2812 FILE *pFile=fopen(name.str().c_str(),"w+");
2818 // int sizeZ = _theViewPanel->GetImageDataSizeZ();
2819 // int maxY=sizeZ+2;
2821 maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols();
2824 int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
2825 for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
2827 // fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.c_str() );
2828 fprintf(pFile,"slice\t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle );
2830 fprintf(pFile,"\n\n" );
2834 if (selection==0 ) // actual slice
2836 std::vector<int> tempVector;
2837 _instantPanel->getInstant( tempVector );
2838 int actualSlice = tempVector[1];
2844 for ( j=minZ; j<=maxZ ; j++)
2846 fprintf(pFile,"%d\t" , j );
2847 for (i=0 ; i<maxX ; i++){
2848 tmpString = interfMainPanel::getInstance()->getCellValue(j, i);//_grid->GetCellValue( j , i );
2849 fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
2851 fprintf(pFile,"\n" );
2855 // Total of stadistics.....
2858 fprintf(pFile,"\n Total:\t" );
2859 for (i=0 ; i<maxX ; i++){
2860 tmpString = interfMainPanel::getInstance()->getCellValue(maxZ+2, i);//_grid->GetCellValue( maxZ+2 , i );
2861 fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
2863 fprintf(pFile,"\n" );
2871 void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefile,int typeContourGroup)
2875 //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
2876 _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
2878 std::vector<manualBaseModel*> lstManConMod;
2879 std::vector<manualBaseModel*> lstManConModTmp;
2880 std::vector<manualBaseModel*> lstManConModExp;
2881 std::vector<double> pLstValue;
2882 std::vector<double> pLstValuePosX;
2883 std::vector<double> pLstValuePosY;
2884 std::vector<double> pLstValuePosZ;
2886 std::vector<int> tempVector;
2887 _instantPanel->getInstant( tempVector );
2889 int sizeZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ();
2891 int ii,sizeLstContourThings;
2898 minZ = 0;// _mbarrange->GetStart();
2899 maxZ = sizeZ;//_mbarrange->GetEnd();
2900 totalZ = maxZ-minZ+1;
2904 for ( z=0 ; z<sizeZ ; z++)
2907 porcent = 100.0* (z-minZ)/totalZ;
2909 tmpString.Printf(_T("Saving Values"));
2910 tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
2911 interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
2912 //_staticTextInformation->SetLabel(tmpString);
2915 //Extraction data from contours of each slice
2916 _contourextractdata->SetZtoBeAnalys( z);
2919 Instant instant(&tempVector);
2920 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant(&instant);//this->_modelManager->getOutlinesAtInstant( &instant );
2921 sizeLstContourThings = lstContourThings.size();
2923 lstManConMod.clear();
2924 for (ii=0 ; ii<sizeLstContourThings ; ii++)
2926 ContourThing **contourthing = lstContourThings[ii];
2927 lstManConMod.push_back( (*contourthing)->getModel() );
2929 lstManConModExp = kernelManager->ExploseEachModel( lstManConMod );
2934 int iContourGroup,sizeContourGroup;
2935 if (typeContourGroup==3) // contour separete
2937 sizeContourGroup=lstManConModExp.size();
2938 } else { // contour AND OR XOR
2942 for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
2943 lstManConModTmp.clear();
2944 if (typeContourGroup==3) // contour separete
2946 lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
2947 } else { // contour AND OR XOR
2948 lstManConModTmp = lstManConModExp;
2951 _contourextractdata->SetLstManualContourModel( lstManConModTmp );
2954 pLstValuePosX.clear();
2955 pLstValuePosY.clear();
2956 pLstValuePosZ.clear();
2958 _contourextractdata->GetValuesInsideCrown( &numberOfPixels,
2964 std::string temp = directory + "/" + namefile + "-slice";
2965 temp = temp + kernelManager->intToString(z) + "-cont" + kernelManager->intToString(iContourGroup);
2966 temp = temp + ".txt";
2968 // LG 14/01/09 : using crea
2969 wxString filename = crea::std2wx(temp);
2970 /*filename.Printf(_T("%s"),directory.c_str());
2971 filename.append(_T("\\"));
2972 filename.append(_T("%s"),namefile.c_str());
2973 filename.append(_T("-slice"));
2974 filename.append(_T("%d"),z);
2975 filename.append(_T("-cont"));
2976 filename.append(_T("%d"),iContourGroup);
2977 filename.append(_T(".txt"));*/
2978 // filename.Printf(temp.c_str());
2982 FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
2983 fprintf(pFile,"value \t x \t y \t z\n" );
2984 int iLstValue,sizeLstValue=pLstValue.size();
2985 for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
2987 fprintf(pFile,"%f\t %f\t %f\t %f\n", (float)pLstValue[iLstValue] , (float)pLstValuePosX[iLstValue], (float)pLstValuePosY[iLstValue], (float)z );
2990 } // for iContourGroup
2992 interfMainPanel::getInstance()->setStringInfoPanel(_T(""));
2993 //_staticTextInformation->SetLabel( _T("") );
2997 void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ){
3000 //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
3001 if (typeContourGroup==3)
3005 _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
3007 std::vector<manualBaseModel*> lstManConMod;
3008 std::vector<manualBaseModel*> lstManConModTmp;
3009 std::vector<manualBaseModel*> lstManConModExp;
3011 std::vector<int> tempVector;
3012 _instantPanel->getInstant( tempVector );
3014 vtkImageData *imagedata = _theViewPanel->getImageData();
3016 imagedata->GetExtent(ext);
3017 int sizeZimage = ext[5]-ext[4]+1;
3019 int ii,sizeLstContourThings;
3027 if (selection==0 ) // actual slice
3029 int actualSlice = tempVector[1];
3037 // cleanning image before range
3038 for (z=0; z<minZ; z++){
3039 _contourextractdata->ResetImageResult(z);
3041 // cleanning image after range
3042 for (z=maxZ+1; z<sizeZimage; z++){
3043 _contourextractdata->ResetImageResult(z);
3048 for ( z=minZ ; z<=maxZ ; z++)
3051 porcent = 100.0* (z-minZ)/totalZ;
3052 tmpString.Printf(_T("Saving Values"));
3053 tmpString.Printf(_T("%d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
3054 interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
3056 //Extraction data from contours of each slice
3057 _contourextractdata->SetZtoBeAnalys( z);
3060 Instant instant(&tempVector);
3061 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
3062 sizeLstContourThings = lstContourThings.size();
3064 lstManConMod.clear();
3065 for (ii=0 ; ii<sizeLstContourThings ; ii++)
3067 ContourThing **contourthing = lstContourThings[ii];
3068 lstManConMod.push_back( (*contourthing)->getModel() );
3070 lstManConModExp = kernelManager->ExploseEachModel( lstManConMod );
3073 int iContourGroup,sizeContourGroup;
3074 if (typeContourGroup==3) // contour separete
3076 sizeContourGroup=lstManConModExp.size();
3077 } else { // contour AND OR XOR
3081 for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
3082 lstManConModTmp.clear();
3083 if (typeContourGroup==3) // contour separete
3085 lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
3086 } else { // contour AND OR XOR
3087 lstManConModTmp = lstManConModExp;
3090 _contourextractdata->SetLstManualContourModel( lstManConModTmp );
3091 _contourextractdata->CalculateImageResult(); // with actual Z
3093 } // for iContourGroup
3096 (*value) = _contourextractdata->GetVtkImageValueResult();
3097 (*mask) = _contourextractdata->GetVtkImageMaskResult();
3101 std::string wxContourMainFrame::GetStringTypeImage( vtkImageData* image)
3103 std::string result="";
3104 if ( image->GetScalarType()==VTK_CHAR )
3107 } else if ( image->GetScalarType()==VTK_UNSIGNED_CHAR ){
3109 } else if ( image->GetScalarType()==VTK_FLOAT ){
3111 } else if ( image->GetScalarType()==VTK_DOUBLE ){
3113 } else if ( image->GetScalarType()==VTK_INT ){
3115 } else if ( image->GetScalarType()==VTK_UNSIGNED_INT ){
3117 } else if ( image->GetScalarType()==VTK_SHORT ){
3119 } else if ( image->GetScalarType()==VTK_UNSIGNED_SHORT ){
3121 } else if ( image->GetScalarType()==VTK_LONG ){
3123 } else if ( image->GetScalarType()==VTK_UNSIGNED_LONG ){
3129 void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value)
3131 std::string stringType;
3133 kernelManager->GetSpacing(spc,0); // returns the spacing of the first image
3134 stringType = GetStringTypeImage(value);
3135 std::string temp = directory + "/" + namefile + "-image-Value-"+stringType+".mhd";
3137 wxString filename = crea::std2wx(temp);
3141 vtkImageChangeInformation *valueChInfo = vtkImageChangeInformation::New();
3142 //EED 2017-01-01 Migration VTK7
3143 #if VTK_MAJOR_VERSION <= 5
3144 valueChInfo->SetInput(value);
3146 valueChInfo->SetInputData(value);
3148 valueChInfo->SetSpacingScale(spc);
3149 valueChInfo->Update();
3150 vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
3152 //EED 2017-01-01 Migration VTK7
3153 #if VTK_MAJOR_VERSION <= 5
3154 writerValueImage->SetInput( valueChInfo->GetOutput() );
3156 writerValueImage->SetInputData( valueChInfo->GetOutput() );
3158 writerValueImage->SetFileName( (const char *)filename.mb_str() );
3159 writerValueImage->SetFileDimensionality( 3 );
3160 writerValueImage->SetCompression(false);
3161 writerValueImage->Write( );
3164 stringType = GetStringTypeImage(mask);
3165 temp = directory + "/" + namefile + "-image-Mask-"+stringType+".mhd";
3167 // LG 14/01/09 : using crea
3168 filename = crea::std2wx(temp);
3169 // filename.Printf(_T(temp.c_str()));
3172 vtkImageChangeInformation *maskChInfo = vtkImageChangeInformation::New();
3173 //EED 2017-01-01 Migration VTK7
3174 #if VTK_MAJOR_VERSION <= 5
3175 maskChInfo->SetInput(mask);
3177 maskChInfo->SetInputData(mask);
3179 maskChInfo->SetSpacingScale(spc);
3180 maskChInfo->Update();
3181 vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
3183 //EED 2017-01-01 Migration VTK7
3184 #if VTK_MAJOR_VERSION <= 5
3185 writerMaskImage->SetInput( maskChInfo->GetOutput() );
3187 writerMaskImage->SetInputData( maskChInfo->GetOutput() );
3190 writerMaskImage->SetFileName( (const char *)filename.mb_str() );
3191 writerMaskImage->SetFileDimensionality( 3 );
3192 writerMaskImage->SetCompression(false);
3193 writerMaskImage->Write( );
3195 interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
3201 void wxContourMainFrame::onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow){
3202 if( name.compare( _theViewPanel->getVerticalConceptName() ) == 0){
3203 _theViewPanel->setActualVertical( value);
3205 else if( name.compare( _theViewPanel->getHorizontalConceptName() ) == 0|| _instantPanel->getIfConceptCheckedAt( name, 0 ) ) {
3206 _theViewPanel->setHorizontalConcept( name, minshow, maxshow, minshow, maxshow, value);
3212 void wxContourMainFrame::onSnakePressed(){
3213 std::vector<double> vecX;
3214 std::vector<double> vecY;
3215 std::vector<double> vecZ;
3216 _theViewPanel->GetPointsOfActualContour( &vecX , &vecY , &vecZ );
3218 if (vecX.size()!=0){
3219 std::vector<int> tempVector;
3220 _instantPanel->getInstant( tempVector );
3221 int i,size=vecZ.size();
3222 int actualSlice = tempVector[1];
3223 for ( i=0 ; i<size ; i++ )
3225 vecZ[i] = actualSlice;
3228 wxDialog* dialog = new wxDialog(this, -1, wxString(_T("Snake")));
3229 wxPanel* panel = new wxPanel(dialog,-1);
3230 // wxStaticText* sttext = new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
3231 new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
3232 dialog->ShowModal();
3237 void wxContourMainFrame::saveFileWithContoursAutomatique(){
3238 std::string filename = kernelManager->getCurrentFileName();
3239 if(filename.compare("")!=0){
3240 saveFileWithContours(filename);
3245 void wxContourMainFrame::ShowToolsPanel(bool show){
3246 _pannew->Show(show);
3251 void wxContourMainFrame::SetContourGroup(int contourGroup)
3253 _contourGroup = contourGroup;
3257 wxPanel *wxContourMainFrame::getMaskImageViewPanel(wxWindow *parent)
3260 if (_viewMaskImagePanel==NULL)
3262 _contourextractdata = new ContourExtractData(true);
3263 _contourextractdata->SetImage( _theViewPanel->getImageData() );
3265 // _theViewPanel->getImageData()->GetScalarRange(range);
3266 //int min = (int)floor (range[0]);
3267 //int max = (int)ceil (range[1]);
3273 _viewMaskImagePanel = new ThresholdImageViewPanel( parent, -1, -1 , -1,-1, 0);
3274 _viewMaskImage = new ThresholdImageView();
3275 _viewMaskImage->SetImage( _contourextractdata->GetVtkImageMaskResult() );
3276 _viewMaskImage->SetminMaxValue( min, max);
3277 _viewMaskImage->SetBaseColor( 0,0,1 );
3280 std::vector<int> colorbarposition;
3281 colorbarposition.push_back( -999 );
3282 colorbarposition.push_back( -999 );
3283 _viewMaskImage->SetColorBarPosition( colorbarposition );
3285 _viewMaskImage->SetSpcBase( _theViewPanel->getImageData()->GetSpacing() );
3286 _viewMaskImage->SetNewSpacingLayer( _theViewPanel->getImageData()->GetSpacing() );
3288 _viewMaskImagePanel->SetThresholdImageView( _viewMaskImage );
3289 _viewMaskImage->SetwxVtkBaseView( _theViewPanel->getWxVtkBaseView() );
3290 _viewMaskImage->onThresholdChangeOpacity( 25 );
3292 return _viewMaskImagePanel;
3296 wxPanel *wxContourMainFrame::getColorLayerImageViewPanel(wxWindow *parent)
3298 if (_viewColorLayerImagePanel==NULL)
3301 _theViewPanel->getImageData()->GetScalarRange(range);
3302 int min = (int)floor (range[0]);
3303 int max = (int)ceil (range[1]);
3304 _viewColorLayerImagePanel = new ColorLayerImageViewPanel( parent, min, max, 100, 1);
3305 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , _theViewPanel->getWxVtkBaseView() );
3306 // std::vector<double> range = bbGetInputlstRangeForColorBar();
3307 // clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
3308 std::vector<int> colorbarposition;
3309 colorbarposition.push_back( 50 );
3310 colorbarposition.push_back( 105 );
3311 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
3312 // std::vector<double> base_color;
3313 // _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetBaseColors( base_color );
3314 // std::vector<double> grey_level_boundaries;
3315 // clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
3316 std::vector<double> transparence_level_boundaries;
3317 transparence_level_boundaries.push_back(0);
3318 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
3319 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetPlainOrGradientColor( false );
3320 // _viewColorLayerImagePanel->SetFittingMode( 3 );
3322 return _viewColorLayerImagePanel;
3326 wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
3328 if (_viewThresholdImagePanel==NULL)
3331 _theViewPanel->getImageData()->GetScalarRange(range);
3332 int min = (int)floor (range[0]);
3333 int max = (int)ceil (range[1]);
3334 int start= (max+min)/2 - (max-min)*0.25;
3335 int end= (max+min)/2 + (max-min)*0.25;
3336 _viewThresholdImagePanel = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
3337 _viewThresholdImage = new ThresholdImageView();
3338 _viewThresholdImage->SetminMaxValue(start,end);
3339 _viewThresholdImage->SetImage( _theViewPanel->getImageData() );
3340 std::vector<int> colorbarposition;
3341 colorbarposition.push_back( 10 );
3342 colorbarposition.push_back( 105 );
3343 _viewThresholdImage->SetColorBarPosition( colorbarposition );
3345 _viewThresholdImage->SetSpcBase( _theViewPanel->getImageData()->GetSpacing() );
3346 _viewThresholdImage->SetNewSpacingLayer( _theViewPanel->getImageData()->GetSpacing() );
3348 _viewThresholdImage->SetBaseColor( 1,0,0 );
3349 _viewThresholdImagePanel->SetThresholdImageView( _viewThresholdImage );
3350 _viewThresholdImage->SetwxVtkBaseView( _theViewPanel->getWxVtkBaseView() );
3351 _viewThresholdImage->onThresholdChangeOpacity( 25 );
3354 return _viewThresholdImagePanel;
3357 //CMRU 17-08-09-----------------------------------------------------------------------------------------------
3358 int wxContourMainFrame::getType ()
3361 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
3363 if(!currentSelection.empty())
3365 std::string cloneName = currentSelection [0];
3366 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
3367 tipo = manualModel-> GetTypeModel();
3372 double wxContourMainFrame::getContourSizeInPixels()
3374 double contourSize = 0;
3376 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects(); if(!currentSelection.empty())
3377 if(!currentSelection.empty())
3379 std::string cloneName = currentSelection [0];
3381 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
3384 // contourSize = manualModel->GetPathSize();
3389 contourSize = manualModel->GetPathSize( spc );
3394 manualBaseModel * wxContourMainFrame::getContour ()
3396 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
3398 if(!currentSelection.empty())
3400 std::string cloneName = currentSelection [0];
3401 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
3406 void wxContourMainFrame::onPrintLabel (wxString label, manualBaseModel* manualModel)
3408 std::string labelAscii(label.ToAscii());
3409 int pos = labelAscii.find(" ");
3413 for (j=0 ; pos != string::npos;j++)
3415 labelAscii.replace( pos, 1, "_" );
3416 pos= labelAscii.find(" ");
3419 manualModel -> SetLabel(labelAscii);
3421 void wxContourMainFrame::onInsertCalculation(manualBaseModel* manualModel)
3424 // double sizeInPixel = manualModel ->GetPathSize( );
3429 double sizeInPixel = manualModel ->GetPathSize( spc );
3431 double onePixelRealSize = interfMainPanel::getInstance()->GetPixelValue();;
3432 double realContourSize = sizeInPixel*onePixelRealSize;
3433 manualModel ->SetRealSize(realContourSize);
3436 double wxContourMainFrame::onePixelSize( double value)
3438 return _onePixelSize = value;
3441 std::string wxContourMainFrame::GetFileLocation()
3443 return _fileLocation;
3446 void wxContourMainFrame::SetFileLocation(std::string newFileLocation)
3448 _fileLocation = newFileLocation;
3449 std::cout<<"GETFILELOCATION:"<<_fileLocation<<std::endl;
3451 //------------------------------------------------------------------------------------------------------------
3460 void wxContourMainFrame::FlipSelectedContours(int flipDirection)
3463 (std::vector<std::string>)_theViewPanel->getSceneManager()->getSelectedObjects() ,
3469 void wxContourMainFrame::FlipActualSliceContours(int flipDirection)
3472 (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() ,
3477 void wxContourMainFrame::FlipAllContours(int flipDirection)
3480 kernelManager->GetLstNameThings() ,
3485 void wxContourMainFrame::FlipLstOfContours(std::vector<std::string> lstNameThings, int flipDirection)
3488 getImageData()->GetExtent(ext);
3489 int sizeX = ext[1]-ext[0];
3490 int sizeY = ext[3]-ext[2];
3493 int i,sizeLstNameThings;
3494 int ii,sizeLstPoints;
3496 sizeLstNameThings = lstNameThings.size();
3497 for (i=0 ; i<sizeLstNameThings ; i++)
3499 printf("EED wxContourMainFrame::FlipAllContours contour=%d \n", i );
3500 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
3501 if (flipDirection==0)
3503 manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 );
3505 manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY );
3507 }// for i list of Things
3509 //-- Static Contours
3511 lstNameThings = kernelManager->GetLstNameThingsStatic();
3512 sizeLstNameThings = lstNameThings.size();
3513 for (i=0 ; i<sizeLstNameThings ; i++)
3515 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
3516 if (flipDirection==0)
3518 manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 );
3520 manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY );
3522 }// for i list of static things
3525 void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
3527 printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection );
3531 if (typeContourFlip==0) //
3533 FlipSelectedContours(flipDirection);
3536 if (typeContourFlip==1) //
3538 FlipActualSliceContours(flipDirection);
3541 if (typeContourFlip==2) //
3543 FlipAllContours(flipDirection);
3549 void wxContourMainFrame::SetXY(int x, int y)
3551 _theViewPanel->SetXY(x,y);