]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfMainPanel.cxx
Added ITK Segmentation Algorithm
[creaContours.git] / lib / Interface_Icons_NDimensions / interfMainPanel.cxx
index 5467ccdfe4bd1c8b310d6de77a6738608a4a09a4..518991ae0899dbbbb68f64bdf1265e0614f4ac55 100644 (file)
@@ -29,6 +29,7 @@ interfMainPanel::interfMainPanel(wxWindow * parent, int sizex, int sizey, wxEvtH
        spreadPanel = NULL;
        infoWin=NULL;
        informationPanel=NULL;
+       mirrorPanel=NULL;
        
        splitterwindow = new wxSplitterWindow(this,-1, wxDefaultPosition, wxSize(sizex, sizey), wxSP_3DSASH, wxString(_T("")));
        
@@ -374,7 +375,31 @@ void interfMainPanel::showPanel(wxWindow* panel){
        infoPanel->Refresh();
        this->Layout();
        this->Refresh();
+}
 
+/**
+**     Hide the panel in the 
+**/
+void interfMainPanel::hidePanel( ){
+       wxContourMainFrame::getInstance()->showAxis(false);
+       wxSizer* sizer = infoPanel->GetSizer();
+
+       if(currentWindow != NULL){
+               currentWindow->Hide();
+               sizer->Remove(currentWindow);
+       }
+       wxPanel * emptyPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+       sizer->Add(emptyPanel);
+    currentWindow = emptyPanel;
+       currentWindow->Show(true);
+
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()+1);
+       splitterwindow->SetSashPosition(splitterwindow->GetSashPosition()-1);
+
+       infoPanel->Layout();
+       infoPanel->Refresh();
+       this->Layout();
+       this->Refresh();
 }
 
 /**
@@ -396,6 +421,10 @@ void interfMainPanel::onCreateContourCircle( ){
        wxContourMainFrame::getInstance()->showAxis(false);
     wxContourMainFrame::getInstance()->onCreateContourCircle();
 }
+void interfMainPanel::onCreateContourLine( ){
+       wxContourMainFrame::getInstance()->showAxis(false);
+    wxContourMainFrame::getInstance()->onCreateContourLine();
+}
 void interfMainPanel::onCreateContoursBullEye(wxPanel* panBull){
        wxContourMainFrame::getInstance()->showAxis(false);
        wxContourMainFrame::getInstance()->onCreateContourBullEye(panBull);
@@ -439,10 +468,15 @@ vtkImageData* interfMainPanel::getImageData(){
        return wxContourMainFrame::getInstance()->getImageData();
 }
 
-void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method){
+void interfMainPanel::onSegmentationOneSlice(int isovalue,int sampling,int method)
+{
        wxContourMainFrame::getInstance()->onSegmentationOneSlice(isovalue, sampling, method);
 }
 
+void interfMainPanel::onSegmentationOneSliceITK(wxString distance, wxString sigma, wxString alfa, wxString beta, wxString propagation, wxString iterations, wxString inflation){
+       wxContourMainFrame::getInstance()->onSegmentationOneSliceITK(distance, sigma, alfa, beta, propagation, iterations, inflation);
+}
+
 int interfMainPanel::GetImageDataSizeZ(){
        return wxContourMainFrame::getInstance()->GetImageDataSizeZ();
 }
@@ -455,6 +489,11 @@ void interfMainPanel::onSegmentationAllSlice(int minZ,int maxZ,int isovalue,int
        wxContourMainFrame::getInstance()->onSegmentationAllSlice(minZ, maxZ,isovalue,sampling,method);
 }
 
+void interfMainPanel::onMirror()
+{
+       wxContourMainFrame::getInstance()->onMirror();
+}
+
 void interfMainPanel::setLabelSegmentationPanelVTK(wxString tmpString){        
     ((interfSegmentationPanelVTK*)segmentationPanel)->setLabel(tmpString);
 }
@@ -504,8 +543,8 @@ void interfMainPanel::onSegmentationPressedITK(){
                segmentPanelITK->Layout();
        }
        showPanel(segmentPanelITK);
-       //contourevent->showAxis(true);
-       //axisshown = true;
+       wxContourMainFrame::getInstance()->showAxis(true);
+       axisshown = true;
 }
 
 void interfMainPanel::onRigidPressed(){
@@ -611,7 +650,7 @@ void interfMainPanel::onInformationPressed(){
                infoWin->SetAutoLayout( true );
                infoWin->Layout();
 
-               infoWin->Show();                
+               infoWin->Show();
 
        }else {
 
@@ -673,3 +712,46 @@ wxString interfMainPanel::getCellValue(int j,int i){
 void interfMainPanel::onSnakePressed(){
     wxContourMainFrame::getInstance()->onSnakePressed();
 }
+
+void interfMainPanel::onMirrorPressed(){
+    if(mirrorPanel==NULL){
+
+               mirrorPanel = new wxPanel(interfMainPanel::getInstance()->getInfoPanel(), -1, wxDefaultPosition, wxDefaultSize, wxBORDER_STATIC, wxString(_T("")));
+               wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1);    
+               mirrorPanel->SetSizer(flexsizer, true);
+               mirrorPanel->SetAutoLayout( true );     
+               panelMirror = new interfMirrorPanel(mirrorPanel);
+       
+               wxStaticText* stattext = new wxStaticText(mirrorPanel, -1, wxString(_T("   Mirroring Tool   ")), wxDefaultPosition,
+                       wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T("")));
+
+               flexsizer->Add(stattext,wxALIGN_CENTER | wxALIGN_CENTRE);
+               flexsizer->Add(panelMirror, wxEXPAND);
+               mirrorPanel->Layout();
+
+               refLineShown=true;
+
+               showPanel(mirrorPanel);
+               wxContourMainFrame::getInstance()->referenceLine();
+       }       
+
+       else
+       {
+               if(refLineShown)
+               {
+                       wxContourMainFrame::getInstance()->refLineHide();
+                       refLineShown=false;
+
+                       hidePanel();
+               }
+
+               else if (!refLineShown)
+               {
+                       wxContourMainFrame::getInstance()->refLineShow();
+                       refLineShown=true;
+
+                       showPanel(mirrorPanel);
+               }
+       }
+
+}