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::onJumpSlice(int step, int shift)
2420 std::vector<int> tempVector;
2421 _instantPanel->getInstant( tempVector );
2423 int pos = tempVector[1];
2424 int maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
2425 pos=(pos/ss)*ss+step+shift;
2426 if ((pos>=0) && (pos<maxZ))
2429 _instantPanel->setInstant( tempVector );
2434 void wxContourMainFrame::onShowTextContour(bool show)
2436 _theViewPanel->onShowTextContour(show);
2440 void wxContourMainFrame::onChangeInstant(std::string name,int actual)
2442 _instantPanel->setConceptValue( name, actual );
2445 void wxContourMainFrame::resetAppend()
2447 kernelManager->resetAppend();
2450 void wxContourMainFrame::onSpreadAdd()
2452 std::vector<double> vecX;
2453 std::vector<double> vecY;
2454 std::vector<double> vecZ;
2455 _theViewPanel->GetPointsOfActualContour(&vecX , &vecY , &vecZ );
2456 std::vector<int> tempVector;
2457 _instantPanel->getInstant( tempVector );
2458 std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
2459 interfMainPanel::getInstance()->appendStringSpread(val);
2463 void wxContourMainFrame::onSpreadAddAll()
2466 std::vector<int> tempVector;
2467 _instantPanel->getInstant( tempVector );
2470 maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ();
2472 int sizeLstContourThings;
2473 for ( z=minZ ; z<=maxZ ; z++ )
2476 Instant instant(&tempVector);
2477 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
2478 sizeLstContourThings = lstContourThings.size();
2479 if (sizeLstContourThings>=1)
2481 std::vector<double> vecX;
2482 std::vector<double> vecY;
2483 std::vector<double> vecZ;
2484 ContourThing **contourthing = lstContourThings[0];
2485 manualBaseModel *cModel = (*contourthing)->getModel();
2486 int i,size = cModel->GetNumberOfPointsSpline();
2488 for (i=0; i<size; i++)
2490 cModel->GetSpline_i_Point(i, &x, &y, &z);
2495 std::string val = kernelManager->onSpreadAdd(&vecX , &vecY , &vecZ, tempVector);
2496 interfMainPanel::getInstance()->appendStringSpread(val);
2497 }// if sizeLstContourThings
2502 void wxContourMainFrame::onSpreadGo(int type)
2504 //JCP 20-10-08 Undo redo implementation
2506 //JCP 20-10-08 Undo redo implementation
2508 std::vector<double> vecCtrlPointX;
2509 std::vector<double> vecCtrlPointY;
2510 std::vector<double> vecCtrlPointZ;
2514 std::vector<int> tempVector;
2515 _instantPanel->getInstant( tempVector );
2518 kernelManager->getMaxMinZ(&minZ,&maxZ);
2519 //JSTG_16-07-08_----------------------------------------------------------------
2520 //_contourPropagation->setInterpolationNumber(maxZ-minZ+1);
2521 kernelManager->CalculeSplinePropagation();
2523 double totalZ = maxZ-minZ+1;
2526 //--------------------------------------------------------------------
2527 for ( z=(int)minZ ; z<=(int)maxZ ; z++ )
2529 porcent = 100.0* (z-minZ)/totalZ;
2530 int numero = (int)(z-minZ+1)/(int)totalZ;
2531 std::string stringtemp = " "+kernelManager->intToString(porcent)+"% "+kernelManager->intToString(numero)+" "+kernelManager->intToString(z);
2533 interfMainPanel::getInstance()->setStringSpread(stringtemp);
2535 int typeofcontour = 1;
2536 std::string theName;
2537 manualBaseModel* manModelContour = kernelManager->GetPoints(z, type, &vecCtrlPointX,&vecCtrlPointY,&vecCtrlPointZ, theName,typeofcontour, tempVector);
2539 if( manModelContour!=NULL ){
2540 double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
2541 this->_theViewPanel->getSpacing(spc);
2542 //Adding the manualContourControler to interface objects structure
2543 //Adding the manualViewContour to interface objects structure
2544 //_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.
2545 _theViewPanel->configureViewControlTo( theName, manModelContour,spc,typeofcontour ) ;
2550 int numero = (int)(z-minZ+1)/(int)totalZ;
2551 std::string stringtemp = " "+kernelManager->intToString(porcent)+"% "+kernelManager->intToString(numero)+" "+kernelManager->intToString(z);
2553 interfMainPanel::getInstance()->setStringSpread(stringtemp);
2555 //RefreshInterface();
2558 void wxContourMainFrame::getInstantVector(std::vector<int>& tempVector)
2560 _instantPanel->getInstant( tempVector );
2563 std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide)
2565 std::vector<int> tempVector;
2566 _instantPanel->getInstant(tempVector);
2567 //Asignation of slide number should be different ex by name
2568 tempVector[1]=slide;
2569 return kernelManager->getOutlinesNameAtInstant(tempVector);
2573 void wxContourMainFrame::SetScalarRange(int grayRangeMin, int grayRangeMax)
2575 _contourextractdata->SetScalarRange(grayRangeMin,grayRangeMax);
2579 void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax)
2582 wxString tempString;
2583 int maxContourGroup = 0;
2585 _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
2587 std::vector<manualBaseModel*> lstManConMod;
2588 std::vector<manualBaseModel*> lstManConModTmp;
2589 std::vector<manualBaseModel*> lstManConModExp;
2590 std::vector<double> pLstValue;
2591 std::vector<double> pLstValuePosX;
2592 std::vector<double> pLstValuePosY;
2593 std::vector<double> pLstValuePosZ;
2596 int resultGrayRangeCount;
2599 double resultAverage;
2600 double resultStandardeviation;
2602 std::vector<int> tempVector;
2603 _instantPanel->getInstant( tempVector );
2606 int ii,sizeLstContourThings;
2615 if (selection==0 ) // actual slice
2617 int actualSlice = tempVector[1];
2620 } else { // slice range
2626 totalZ = maxZ-minZ+1;
2628 _contourextractdata->InitVolumeStatistics();
2631 for ( z=minZ ; z<=maxZ ; z++ )
2634 porcent = 100.0* (z-minZ)/totalZ;
2635 tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
2637 interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
2638 //_staticTextInformation->SetLabel(tmpString);
2640 //Extraction data from contours of each slice
2641 _contourextractdata->SetZtoBeAnalys(z);
2644 Instant instant(&tempVector);
2645 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
2646 sizeLstContourThings = lstContourThings.size();
2648 lstManConMod.clear();
2649 for (ii=0 ; ii<sizeLstContourThings ; ii++)
2651 ContourThing **contourthing = lstContourThings[ii];
2652 lstManConMod.push_back( (*contourthing)->getModel() );
2655 lstManConModExp = kernelManager->ExploseEachModel( lstManConMod );
2657 tempString.Printf(_T("%d - %d"),z, sizeLstContourThings);
2658 interfMainPanel::getInstance()->setRowLabelInfoPanel(z, tempString);
2659 //_grid->SetRowLabelValue(z, tempString );
2661 int iContourGroup,sizeContourGroup;
2662 if (typeContourGroup==3) // contour separete
2664 sizeContourGroup=lstManConModExp.size();
2665 if ( maxContourGroup<sizeContourGroup )
2667 maxContourGroup=sizeContourGroup;
2669 } else { // contour AND OR XOR
2676 for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
2677 lstManConModTmp.clear();
2681 if (typeContourGroup==3) // contour separete
2683 lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
2684 } else { // contour AND OR XOR
2685 lstManConModTmp = lstManConModExp;
2688 _contourextractdata->SetLstManualContourModel( lstManConModTmp );
2689 _contourextractdata->SetScalarRange(grayRangeMin,grayRangeMax);
2692 pLstValuePosX.clear();
2693 pLstValuePosY.clear();
2694 pLstValuePosZ.clear();
2698 _contourextractdata->GetValuesInsideCrown( &numberOfPixels,
2704 resultSize=numberOfPixels;
2705 // Statistics of each slice.
2706 _contourextractdata->Statistics( &pLstValue,
2709 &resultGrayRangeCount,
2714 &resultStandardeviation);
2716 if (interfMainPanel::getInstance()->getNumberColsInformationPanel()<_numberOfVariablesStatistics*(iContourGroup+1) )
2718 interfMainPanel::getInstance()->appendColsInformationPanel(_numberOfVariablesStatistics);
2721 tmpIntA=_numberOfVariablesStatistics*iContourGroup ;
2723 tempString.Printf(_T("%d"),numberOfPixels);
2725 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA, tempString);
2727 tempString.Printf(_T("%d"),resultGrayRangeCount);
2728 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+1, tempString);
2730 tempString.Printf(_T("%f"),resultMin);
2731 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+2, tempString);
2733 tempString.Printf(_T("%f"),resultMax);
2734 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+3, tempString);
2736 tempString.Printf(_T("%f"),resultAverage);
2737 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+4, tempString);
2739 tempString.Printf(_T("%f"),resultStandardeviation);
2740 interfMainPanel::getInstance()->setCellValueInfoPanel(z, tmpIntA+5, tempString);
2743 } // for iContourGroup
2746 // Print Volume Statistics
2749 int vol_rCountRange;
2751 double vol_minValue;
2752 double vol_maxValue;
2754 double vol_standardeviation;
2756 if (selection!=0 ) // actual slice
2759 _contourextractdata->GetVolumeStatistics(&vol_rCountRange, &vol_rsize,
2760 &vol_minValue, &vol_maxValue,
2761 &vol_average, &vol_standardeviation);
2763 interfMainPanel::getInstance()->setRowLabelInfoPanel(maxZ+2, _T("Total:"));
2765 tempString.Printf(_T("%d"),vol_rsize);
2766 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 0, tempString);
2768 tempString.Printf(_T("%d"),vol_rCountRange);
2769 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 1, tempString);
2771 tempString.Printf(_T("%f"),vol_minValue);
2772 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 2, tempString);
2774 tempString.Printf(_T("%f"),vol_maxValue);
2775 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 3, tempString);
2777 tempString.Printf(_T("%f"),vol_average);
2778 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 4, tempString);
2780 tempString.Printf(_T("%f"),vol_standardeviation);
2781 interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 5, tempString);
2783 //-----------------------------------------
2786 wxString tmpTitleString;
2788 for ( iTitleGroup=0 ; iTitleGroup<maxContourGroup ; iTitleGroup++ )
2790 tmpIntB =_numberOfVariablesStatistics*iTitleGroup;
2791 tmpTitleString.Printf(_T("%d-Size Data"),iTitleGroup);
2792 interfMainPanel::getInstance()->setColLableInfoPanel(tmpIntB + 0, tmpTitleString);
2794 interfMainPanel::getInstance()->setColLableInfoPanel(tmpIntB + 0, tmpTitleString );
2795 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 1, _T("Size Range") );
2796 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 2, _T("Min") );
2797 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 3, _T("Max") );
2798 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 4, _T("Average") );
2799 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 5, _T("St.Dev.") );
2800 interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 6, _T(" ") );
2802 interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
2806 void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename,
2807 int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics)
2811 SaveValuesXYZ( directory , namefile, typeContourGroup );
2816 vtkImageData * mask;
2817 vtkImageData * value;
2818 this->getMaskValue(&mask, &value, typeContourGroup,selection,minZ,maxZ);
2819 this->SaveImageResult( directory , namefile, mask, value);
2824 std::ostringstream name;
2825 name << filename << ".xls";
2828 FILE *pFile=fopen(name.str().c_str(),"w+");
2834 // int sizeZ = _theViewPanel->GetImageDataSizeZ();
2835 // int maxY=sizeZ+2;
2837 maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols();
2840 int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
2841 for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
2843 // fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.c_str() );
2844 fprintf(pFile,"slice\t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle );
2846 fprintf(pFile,"\n\n" );
2850 if (selection==0 ) // actual slice
2852 std::vector<int> tempVector;
2853 _instantPanel->getInstant( tempVector );
2854 int actualSlice = tempVector[1];
2860 for ( j=minZ; j<=maxZ ; j++)
2862 fprintf(pFile,"%d\t" , j );
2863 for (i=0 ; i<maxX ; i++){
2864 tmpString = interfMainPanel::getInstance()->getCellValue(j, i);//_grid->GetCellValue( j , i );
2865 fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
2867 fprintf(pFile,"\n" );
2871 // Total of stadistics.....
2874 fprintf(pFile,"\n Total:\t" );
2875 for (i=0 ; i<maxX ; i++){
2876 tmpString = interfMainPanel::getInstance()->getCellValue(maxZ+2, i);//_grid->GetCellValue( maxZ+2 , i );
2877 fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) );
2879 fprintf(pFile,"\n" );
2887 void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefile,int typeContourGroup)
2891 //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
2892 _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
2894 std::vector<manualBaseModel*> lstManConMod;
2895 std::vector<manualBaseModel*> lstManConModTmp;
2896 std::vector<manualBaseModel*> lstManConModExp;
2897 std::vector<double> pLstValue;
2898 std::vector<double> pLstValuePosX;
2899 std::vector<double> pLstValuePosY;
2900 std::vector<double> pLstValuePosZ;
2902 std::vector<int> tempVector;
2903 _instantPanel->getInstant( tempVector );
2905 int sizeZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ();
2907 int ii,sizeLstContourThings;
2914 minZ = 0;// _mbarrange->GetStart();
2915 maxZ = sizeZ;//_mbarrange->GetEnd();
2916 totalZ = maxZ-minZ+1;
2920 for ( z=0 ; z<sizeZ ; z++)
2923 porcent = 100.0* (z-minZ)/totalZ;
2925 tmpString.Printf(_T("Saving Values"));
2926 tmpString.Printf(_T(" %d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
2927 interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
2928 //_staticTextInformation->SetLabel(tmpString);
2931 //Extraction data from contours of each slice
2932 _contourextractdata->SetZtoBeAnalys( z);
2935 Instant instant(&tempVector);
2936 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant(&instant);//this->_modelManager->getOutlinesAtInstant( &instant );
2937 sizeLstContourThings = lstContourThings.size();
2939 lstManConMod.clear();
2940 for (ii=0 ; ii<sizeLstContourThings ; ii++)
2942 ContourThing **contourthing = lstContourThings[ii];
2943 lstManConMod.push_back( (*contourthing)->getModel() );
2945 lstManConModExp = kernelManager->ExploseEachModel( lstManConMod );
2950 int iContourGroup,sizeContourGroup;
2951 if (typeContourGroup==3) // contour separete
2953 sizeContourGroup=lstManConModExp.size();
2954 } else { // contour AND OR XOR
2958 for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
2959 lstManConModTmp.clear();
2960 if (typeContourGroup==3) // contour separete
2962 lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
2963 } else { // contour AND OR XOR
2964 lstManConModTmp = lstManConModExp;
2967 _contourextractdata->SetLstManualContourModel( lstManConModTmp );
2970 pLstValuePosX.clear();
2971 pLstValuePosY.clear();
2972 pLstValuePosZ.clear();
2974 _contourextractdata->GetValuesInsideCrown( &numberOfPixels,
2980 std::string temp = directory + "/" + namefile + "-slice";
2981 temp = temp + kernelManager->intToString(z) + "-cont" + kernelManager->intToString(iContourGroup);
2982 temp = temp + ".txt";
2984 // LG 14/01/09 : using crea
2985 wxString filename = crea::std2wx(temp);
2986 /*filename.Printf(_T("%s"),directory.c_str());
2987 filename.append(_T("\\"));
2988 filename.append(_T("%s"),namefile.c_str());
2989 filename.append(_T("-slice"));
2990 filename.append(_T("%d"),z);
2991 filename.append(_T("-cont"));
2992 filename.append(_T("%d"),iContourGroup);
2993 filename.append(_T(".txt"));*/
2994 // filename.Printf(temp.c_str());
2998 FILE *pFile=fopen((const char *)filename.mb_str(),"w+");
2999 fprintf(pFile,"value \t x \t y \t z\n" );
3000 int iLstValue,sizeLstValue=pLstValue.size();
3001 for (iLstValue=0 ; iLstValue<sizeLstValue ; iLstValue++ )
3003 fprintf(pFile,"%f\t %f\t %f\t %f\n", (float)pLstValue[iLstValue] , (float)pLstValuePosX[iLstValue], (float)pLstValuePosY[iLstValue], (float)z );
3006 } // for iContourGroup
3008 interfMainPanel::getInstance()->setStringInfoPanel(_T(""));
3009 //_staticTextInformation->SetLabel( _T("") );
3013 void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ){
3016 //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection();
3017 if (typeContourGroup==3)
3021 _contourextractdata ->SetTypeOperation( typeContourGroup % 3 );
3023 std::vector<manualBaseModel*> lstManConMod;
3024 std::vector<manualBaseModel*> lstManConModTmp;
3025 std::vector<manualBaseModel*> lstManConModExp;
3027 std::vector<int> tempVector;
3028 _instantPanel->getInstant( tempVector );
3030 vtkImageData *imagedata = _theViewPanel->getImageData();
3032 imagedata->GetExtent(ext);
3033 int sizeZimage = ext[5]-ext[4]+1;
3035 int ii,sizeLstContourThings;
3043 if (selection==0 ) // actual slice
3045 int actualSlice = tempVector[1];
3053 // cleanning image before range
3054 for (z=0; z<minZ; z++){
3055 _contourextractdata->ResetImageResult(z);
3057 // cleanning image after range
3058 for (z=maxZ+1; z<sizeZimage; z++){
3059 _contourextractdata->ResetImageResult(z);
3064 for ( z=minZ ; z<=maxZ ; z++)
3067 porcent = 100.0* (z-minZ)/totalZ;
3068 tmpString.Printf(_T("Saving Values"));
3069 tmpString.Printf(_T("%d %c %d/%d %d"), (int)porcent , 37 , z-minZ+1, (int)totalZ ,z);
3070 interfMainPanel::getInstance()->setStringInfoPanel(tmpString);
3072 //Extraction data from contours of each slice
3073 _contourextractdata->SetZtoBeAnalys( z);
3076 Instant instant(&tempVector);
3077 std::vector<ContourThing**> lstContourThings = kernelManager->getOutlinesAtInstant( &instant );
3078 sizeLstContourThings = lstContourThings.size();
3080 lstManConMod.clear();
3081 for (ii=0 ; ii<sizeLstContourThings ; ii++)
3083 ContourThing **contourthing = lstContourThings[ii];
3084 lstManConMod.push_back( (*contourthing)->getModel() );
3086 lstManConModExp = kernelManager->ExploseEachModel( lstManConMod );
3089 int iContourGroup,sizeContourGroup;
3090 if (typeContourGroup==3) // contour separete
3092 sizeContourGroup=lstManConModExp.size();
3093 } else { // contour AND OR XOR
3097 for( iContourGroup=0 ; iContourGroup<sizeContourGroup ; iContourGroup++ ){
3098 lstManConModTmp.clear();
3099 if (typeContourGroup==3) // contour separete
3101 lstManConModTmp.push_back( lstManConModExp[iContourGroup]);
3102 } else { // contour AND OR XOR
3103 lstManConModTmp = lstManConModExp;
3106 _contourextractdata->SetLstManualContourModel( lstManConModTmp );
3107 _contourextractdata->CalculateImageResult(); // with actual Z
3109 } // for iContourGroup
3112 (*value) = _contourextractdata->GetVtkImageValueResult();
3113 (*mask) = _contourextractdata->GetVtkImageMaskResult();
3117 std::string wxContourMainFrame::GetStringTypeImage( vtkImageData* image)
3119 std::string result="";
3120 if ( image->GetScalarType()==VTK_CHAR )
3123 } else if ( image->GetScalarType()==VTK_UNSIGNED_CHAR ){
3125 } else if ( image->GetScalarType()==VTK_FLOAT ){
3127 } else if ( image->GetScalarType()==VTK_DOUBLE ){
3129 } else if ( image->GetScalarType()==VTK_INT ){
3131 } else if ( image->GetScalarType()==VTK_UNSIGNED_INT ){
3133 } else if ( image->GetScalarType()==VTK_SHORT ){
3135 } else if ( image->GetScalarType()==VTK_UNSIGNED_SHORT ){
3137 } else if ( image->GetScalarType()==VTK_LONG ){
3139 } else if ( image->GetScalarType()==VTK_UNSIGNED_LONG ){
3145 void wxContourMainFrame::SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value)
3147 std::string stringType;
3149 kernelManager->GetSpacing(spc,0); // returns the spacing of the first image
3150 stringType = GetStringTypeImage(value);
3151 std::string temp = directory + "/" + namefile + "-image-Value-"+stringType+".mhd";
3153 wxString filename = crea::std2wx(temp);
3157 vtkImageChangeInformation *valueChInfo = vtkImageChangeInformation::New();
3158 //EED 2017-01-01 Migration VTK7
3159 #if VTK_MAJOR_VERSION <= 5
3160 valueChInfo->SetInput(value);
3162 valueChInfo->SetInputData(value);
3164 valueChInfo->SetSpacingScale(spc);
3165 valueChInfo->Update();
3166 vtkMetaImageWriter *writerValueImage = vtkMetaImageWriter::New( );
3168 //EED 2017-01-01 Migration VTK7
3169 #if VTK_MAJOR_VERSION <= 5
3170 writerValueImage->SetInput( valueChInfo->GetOutput() );
3172 writerValueImage->SetInputData( valueChInfo->GetOutput() );
3174 writerValueImage->SetFileName( (const char *)filename.mb_str() );
3175 writerValueImage->SetFileDimensionality( 3 );
3176 writerValueImage->SetCompression(false);
3177 writerValueImage->Write( );
3180 stringType = GetStringTypeImage(mask);
3181 temp = directory + "/" + namefile + "-image-Mask-"+stringType+".mhd";
3183 // LG 14/01/09 : using crea
3184 filename = crea::std2wx(temp);
3185 // filename.Printf(_T(temp.c_str()));
3188 vtkImageChangeInformation *maskChInfo = vtkImageChangeInformation::New();
3189 //EED 2017-01-01 Migration VTK7
3190 #if VTK_MAJOR_VERSION <= 5
3191 maskChInfo->SetInput(mask);
3193 maskChInfo->SetInputData(mask);
3195 maskChInfo->SetSpacingScale(spc);
3196 maskChInfo->Update();
3197 vtkMetaImageWriter *writerMaskImage = vtkMetaImageWriter::New( );
3199 //EED 2017-01-01 Migration VTK7
3200 #if VTK_MAJOR_VERSION <= 5
3201 writerMaskImage->SetInput( maskChInfo->GetOutput() );
3203 writerMaskImage->SetInputData( maskChInfo->GetOutput() );
3206 writerMaskImage->SetFileName( (const char *)filename.mb_str() );
3207 writerMaskImage->SetFileDimensionality( 3 );
3208 writerMaskImage->SetCompression(false);
3209 writerMaskImage->Write( );
3211 interfMainPanel::getInstance()->setStringInfoPanel( _T("") );
3217 void wxContourMainFrame::onChangeInstantInstantPanel(std::string name,int value, int minshow, int maxshow){
3218 if( name.compare( _theViewPanel->getVerticalConceptName() ) == 0){
3219 _theViewPanel->setActualVertical( value);
3221 else if( name.compare( _theViewPanel->getHorizontalConceptName() ) == 0|| _instantPanel->getIfConceptCheckedAt( name, 0 ) ) {
3222 _theViewPanel->setHorizontalConcept( name, minshow, maxshow, minshow, maxshow, value);
3228 void wxContourMainFrame::onSnakePressed(){
3229 std::vector<double> vecX;
3230 std::vector<double> vecY;
3231 std::vector<double> vecZ;
3232 _theViewPanel->GetPointsOfActualContour( &vecX , &vecY , &vecZ );
3234 if (vecX.size()!=0){
3235 std::vector<int> tempVector;
3236 _instantPanel->getInstant( tempVector );
3237 int i,size=vecZ.size();
3238 int actualSlice = tempVector[1];
3239 for ( i=0 ; i<size ; i++ )
3241 vecZ[i] = actualSlice;
3244 wxDialog* dialog = new wxDialog(this, -1, wxString(_T("Snake")));
3245 wxPanel* panel = new wxPanel(dialog,-1);
3246 // wxStaticText* sttext = new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
3247 new wxStaticText(panel, -1, wxString(_T("Panel para snake")));
3248 dialog->ShowModal();
3253 void wxContourMainFrame::saveFileWithContoursAutomatique(){
3254 std::string filename = kernelManager->getCurrentFileName();
3255 if(filename.compare("")!=0){
3256 saveFileWithContours(filename);
3261 void wxContourMainFrame::ShowToolsPanel(bool show){
3262 _pannew->Show(show);
3267 void wxContourMainFrame::SetContourGroup(int contourGroup)
3269 _contourGroup = contourGroup;
3273 wxPanel *wxContourMainFrame::getMaskImageViewPanel(wxWindow *parent)
3276 if (_viewMaskImagePanel==NULL)
3278 _contourextractdata = new ContourExtractData(true);
3279 _contourextractdata->SetImage( _theViewPanel->getImageData() );
3281 // _theViewPanel->getImageData()->GetScalarRange(range);
3282 //int min = (int)floor (range[0]);
3283 //int max = (int)ceil (range[1]);
3289 _viewMaskImagePanel = new ThresholdImageViewPanel( parent, -1, -1 , -1,-1, 0);
3290 _viewMaskImage = new ThresholdImageView();
3291 _viewMaskImage->SetImage( _contourextractdata->GetVtkImageMaskResult() );
3292 _viewMaskImage->SetminMaxValue( min, max);
3293 _viewMaskImage->SetBaseColor( 0,0,1 );
3296 std::vector<int> colorbarposition;
3297 colorbarposition.push_back( -999 );
3298 colorbarposition.push_back( -999 );
3299 _viewMaskImage->SetColorBarPosition( colorbarposition );
3301 _viewMaskImage->SetSpcBase( _theViewPanel->getImageData()->GetSpacing() );
3302 _viewMaskImage->SetNewSpacingLayer( _theViewPanel->getImageData()->GetSpacing() );
3304 _viewMaskImagePanel->SetThresholdImageView( _viewMaskImage );
3305 _viewMaskImage->SetwxVtkBaseView( _theViewPanel->getWxVtkBaseView() );
3306 _viewMaskImage->onThresholdChangeOpacity( 25 );
3308 return _viewMaskImagePanel;
3312 wxPanel *wxContourMainFrame::getColorLayerImageViewPanel(wxWindow *parent)
3314 if (_viewColorLayerImagePanel==NULL)
3317 _theViewPanel->getImageData()->GetScalarRange(range);
3318 int min = (int)floor (range[0]);
3319 int max = (int)ceil (range[1]);
3320 _viewColorLayerImagePanel = new ColorLayerImageViewPanel( parent, min, max, 100, 1);
3321 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , _theViewPanel->getWxVtkBaseView() );
3322 // std::vector<double> range = bbGetInputlstRangeForColorBar();
3323 // clivp->GetColorLayerImageViewManager()->SetRangeForColorBar( range );
3324 std::vector<int> colorbarposition;
3325 colorbarposition.push_back( 50 );
3326 colorbarposition.push_back( 105 );
3327 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetColorBarPosition( colorbarposition );
3328 // std::vector<double> base_color;
3329 // _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetBaseColors( base_color );
3330 // std::vector<double> grey_level_boundaries;
3331 // clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
3332 std::vector<double> transparence_level_boundaries;
3333 transparence_level_boundaries.push_back(0);
3334 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetBaseTransparence( transparence_level_boundaries );
3335 _viewColorLayerImagePanel->GetColorLayerImageViewManager()->SetPlainOrGradientColor( false );
3336 // _viewColorLayerImagePanel->SetFittingMode( 3 );
3338 return _viewColorLayerImagePanel;
3342 wxPanel *wxContourMainFrame::getThresholdImageViewPanel(wxWindow *parent)
3344 if (_viewThresholdImagePanel==NULL)
3347 _theViewPanel->getImageData()->GetScalarRange(range);
3348 int min = (int)floor (range[0]);
3349 int max = (int)ceil (range[1]);
3350 int start= (max+min)/2 - (max-min)*0.25;
3351 int end= (max+min)/2 + (max-min)*0.25;
3352 _viewThresholdImagePanel = new ThresholdImageViewPanel( parent, min, max, start, end , 1);
3353 _viewThresholdImage = new ThresholdImageView();
3354 _viewThresholdImage->SetminMaxValue(start,end);
3355 _viewThresholdImage->SetImage( _theViewPanel->getImageData() );
3356 std::vector<int> colorbarposition;
3357 colorbarposition.push_back( 10 );
3358 colorbarposition.push_back( 105 );
3359 _viewThresholdImage->SetColorBarPosition( colorbarposition );
3361 _viewThresholdImage->SetSpcBase( _theViewPanel->getImageData()->GetSpacing() );
3362 _viewThresholdImage->SetNewSpacingLayer( _theViewPanel->getImageData()->GetSpacing() );
3364 _viewThresholdImage->SetBaseColor( 1,0,0 );
3365 _viewThresholdImagePanel->SetThresholdImageView( _viewThresholdImage );
3366 _viewThresholdImage->SetwxVtkBaseView( _theViewPanel->getWxVtkBaseView() );
3367 _viewThresholdImage->onThresholdChangeOpacity( 25 );
3370 return _viewThresholdImagePanel;
3373 //CMRU 17-08-09-----------------------------------------------------------------------------------------------
3374 int wxContourMainFrame::getType ()
3377 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
3379 if(!currentSelection.empty())
3381 std::string cloneName = currentSelection [0];
3382 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);
3383 tipo = manualModel-> GetTypeModel();
3388 double wxContourMainFrame::getContourSizeInPixels()
3390 double contourSize = 0;
3392 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects(); if(!currentSelection.empty())
3393 if(!currentSelection.empty())
3395 std::string cloneName = currentSelection [0];
3397 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
3400 // contourSize = manualModel->GetPathSize();
3405 contourSize = manualModel->GetPathSize( spc );
3410 manualBaseModel * wxContourMainFrame::getContour ()
3412 std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
3414 if(!currentSelection.empty())
3416 std::string cloneName = currentSelection [0];
3417 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(cloneName);//_modelManager->getOutlineByKeyName( cloneName )->getModel();
3422 void wxContourMainFrame::onPrintLabel (wxString label, manualBaseModel* manualModel)
3424 std::string labelAscii(label.ToAscii());
3425 int pos = labelAscii.find(" ");
3429 for (j=0 ; pos != string::npos;j++)
3431 labelAscii.replace( pos, 1, "_" );
3432 pos= labelAscii.find(" ");
3435 manualModel -> SetLabel(labelAscii);
3437 void wxContourMainFrame::onInsertCalculation(manualBaseModel* manualModel)
3440 // double sizeInPixel = manualModel ->GetPathSize( );
3445 double sizeInPixel = manualModel ->GetPathSize( spc );
3447 double onePixelRealSize = interfMainPanel::getInstance()->GetPixelValue();;
3448 double realContourSize = sizeInPixel*onePixelRealSize;
3449 manualModel ->SetRealSize(realContourSize);
3452 double wxContourMainFrame::onePixelSize( double value)
3454 return _onePixelSize = value;
3457 std::string wxContourMainFrame::GetFileLocation()
3459 return _fileLocation;
3462 void wxContourMainFrame::SetFileLocation(std::string newFileLocation)
3464 _fileLocation = newFileLocation;
3465 std::cout<<"GETFILELOCATION:"<<_fileLocation<<std::endl;
3467 //------------------------------------------------------------------------------------------------------------
3476 void wxContourMainFrame::FlipSelectedContours(int flipDirection)
3479 (std::vector<std::string>)_theViewPanel->getSceneManager()->getSelectedObjects() ,
3485 void wxContourMainFrame::FlipActualSliceContours(int flipDirection)
3488 (std::vector<std::string>)_theViewPanel->getSceneManager()->GetlstContoursNameActualSlice() ,
3493 void wxContourMainFrame::FlipAllContours(int flipDirection)
3496 kernelManager->GetLstNameThings() ,
3501 void wxContourMainFrame::FlipLstOfContours(std::vector<std::string> lstNameThings, int flipDirection)
3504 getImageData()->GetExtent(ext);
3505 int sizeX = ext[1]-ext[0];
3506 int sizeY = ext[3]-ext[2];
3509 int i,sizeLstNameThings;
3510 int ii,sizeLstPoints;
3512 sizeLstNameThings = lstNameThings.size();
3513 for (i=0 ; i<sizeLstNameThings ; i++)
3515 printf("EED wxContourMainFrame::FlipAllContours contour=%d \n", i );
3516 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
3517 if (flipDirection==0)
3519 manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 );
3521 manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY );
3523 }// for i list of Things
3525 //-- Static Contours
3527 lstNameThings = kernelManager->GetLstNameThingsStatic();
3528 sizeLstNameThings = lstNameThings.size();
3529 for (i=0 ; i<sizeLstNameThings ; i++)
3531 manualBaseModel * manualModel = kernelManager->getOutlineByKeyName(lstNameThings[i]);
3532 if (flipDirection==0)
3534 manualModel->Transform_Ax_Plus_B(-1,sizeX,1,0 );
3536 manualModel->Transform_Ax_Plus_B(1,0,-1,sizeY );
3538 }// for i list of static things
3541 void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection)
3543 printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection );
3547 if (typeContourFlip==0) //
3549 FlipSelectedContours(flipDirection);
3552 if (typeContourFlip==1) //
3554 FlipActualSliceContours(flipDirection);
3557 if (typeContourFlip==2) //
3559 FlipAllContours(flipDirection);
3565 void wxContourMainFrame::SetXY(int x, int y)
3567 _theViewPanel->SetXY(x,y);