From: donadio Date: Wed, 17 Jun 2009 17:30:59 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~12 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8f2bd3952065a2028ae345188c3493f82eda2b27;p=creaContours.git *** empty log message *** --- diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index fe241cc..0cf8b41 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -557,7 +557,7 @@ void interfMainPanel::setStringSpread(std::string stringtemp){ void interfMainPanel::onInformationPressed(){ if(infoWin ==NULL){ - infoWin = new wxFrame (this, -1,_T(" Spread "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER ); + infoWin = new wxFrame (this, -1,_T(" Statistics "), wxDefaultPosition, wxDefaultSize, wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER ); infoWin->SetSize( wxSize(825,650) ); wxSize sizepanel(825,675); diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index a71b57f..0fa3d18 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -211,18 +211,17 @@ void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) interfMirrorPanel::interfMirrorPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show Axis"), wxDefaultPosition, wxSize(200,35) ); - wxButton *axisHideBtn = new wxButton(this,wxID_ANY,_T("Hide Axis"), wxDefaultPosition, wxSize(200,35) ); + _axisStatus = true; + + wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Axis"), wxDefaultPosition, wxSize(200,35) ); wxButton *mirrorGoBtn = new wxButton(this,wxID_ANY,_T("Mirror Contour"), wxDefaultPosition, wxSize(200,35) ); _thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); Connect( axisShowBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisShow ); - Connect( axisHideBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisHide ); Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); wxFlexGridSizer * sizer = new wxFlexGridSizer(1); sizer -> Add( axisShowBtn, 1, wxGROW ); - sizer -> Add( axisHideBtn, 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T("Thickness")) , 1, wxGROW ); sizer -> Add( _thickness, 1, wxGROW ); @@ -238,17 +237,25 @@ interfMirrorPanel::~interfMirrorPanel(){ void interfMirrorPanel::onAxisShow(wxCommandEvent& event) { - interfMainPanel::getInstance()->onMirrorAxisShow(); -} - -void interfMirrorPanel::onAxisHide(wxCommandEvent& event) -{ - interfMainPanel::getInstance()->onMirrorAxisHide(); + + if (!_axisStatus) + { + interfMainPanel::getInstance()->onMirrorAxisShow(); + _axisStatus=true; + } + else + { + interfMainPanel::getInstance()->onMirrorAxisHide(); + _axisStatus=false; + } } void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) { - interfMainPanel::getInstance()->onMirror(); + if (_axisStatus) + { + interfMainPanel::getInstance()->onMirror(); + } } void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h index e544d84..55c74b8 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.h @@ -89,9 +89,9 @@ private: wxSlider* _thickness; - void onAxisShow(wxCommandEvent& event); + bool _axisStatus; - void onAxisHide(wxCommandEvent& event); + void onAxisShow(wxCommandEvent& event); void onMirrorGo(wxCommandEvent& event); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 7d2b694..89f6c39 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -99,7 +99,6 @@ char wxContourMainFrame::COPY = 'C'; if(images.size() > 0) { - this->setVectImages(images); } @@ -109,6 +108,7 @@ void wxContourMainFrame::setVectImages(std::vector imgs) { _images = imgs; + #if defined(__GNUC__) std::string str_home(getenv("HOME")); #elif defined(_WIN32) @@ -756,43 +756,21 @@ void wxContourMainFrame ::loadState(std::string filename){ fscanf(pFile,"%s",tmp); // Version fscanf(pFile,"%s",tmp); // 1.0.2 || 1.0.1 || 1.0.0 - std::string version(tmp); deleteAllContours(); - //AD:02-06-09 - if (version=="1.0.2") - { - loadContours(pFile); - } - - //AD:02-06-09 - else if (version=="1.0.1") - { - loadContours(pFile); - } - - //AD:02-06-09 - else if (version=="1.0.0") - { - loadContours(pFile); - } + loadContours(pFile, false); + loadContours(pFile, true); fclose(pFile); } -void wxContourMainFrame ::loadContours( FILE *pFile ) +void wxContourMainFrame ::loadContours( FILE *pFile, bool staticContour ) { char tmp[255]; - fscanf(pFile,"%s",tmp); // NumberOfContours - fscanf(pFile,"%s",tmp); // ## - int numberOfContours = atoi(tmp); - std::vector instantVector; - int typeContourModel; - manualContourModel *manModelContour; - int typeView; - + if (staticContour==false) + { fscanf(pFile,"%s",tmp); // ImageDimensions fscanf(pFile,"%s",tmp); // X fscanf(pFile,"%s",tmp); // Y @@ -802,6 +780,16 @@ void wxContourMainFrame ::loadContours( FILE *pFile ) fscanf(pFile,"%s",tmp); // X fscanf(pFile,"%s",tmp); // Y fscanf(pFile,"%s",tmp); // Z + } + + fscanf(pFile,"%s",tmp); // NumberOfContours + fscanf(pFile,"%s",tmp); // ## + int numberOfContours = atoi(tmp); + + std::vector instantVector; + int typeContourModel; + manualContourModel *manModelContour; + int typeView; int i; for (i=0;igetSceneManager()->setControlActiveStateOfALL( false );//This call is being done here because if the ROI is created underneath the previously created ROIS will still be active. _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ; } + + if (staticContour==true) + { + Instant instant(&instantVector); + kernelManager->changeContourOfManager( theName , &instant ); + } }// for numberOfContours } @@ -865,19 +859,21 @@ void wxContourMainFrame::onLoad() //AD:02-06-09 if (version=="1.0.2") { - openContours(pFile,2); + openContours(pFile,2,false); + openContours(pFile,2,true); //Load StaticContours } //AD:02-06-09 else if (version=="1.0.1") { - openContours(pFile,1); + openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing + openContours(pFile,1,true); //Load StaticContours, skips ImageDimensions and ImageSpacing } //AD:02-06-09 else if (version=="1.0.0") { - openContours(pFile,0); + openContours(pFile,1,false); //Skips ImageDimensions and ImageSpacing } fclose(pFile); @@ -907,12 +903,7 @@ void wxContourMainFrame::saveFileWithContours( std::string filename ) fprintf(pFile,"--CreaContour--\n"); fprintf(pFile,"Version %s\n", "1.0.2" ); - - // Normal Contours - lstNameThings = kernelManager->GetLstNameThings(); - sizeLstNameThings = lstNameThings.size(); - fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings ); - + vtkImageData *image = _images[0]; int dimRange[3]; @@ -925,13 +916,24 @@ void wxContourMainFrame::saveFileWithContours( std::string filename ) fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] ); + // Normal Contours + + lstNameThings = kernelManager->GetLstNameThings(); + sizeLstNameThings = lstNameThings.size(); + fprintf(pFile,"NumberOfContours %d\n", sizeLstNameThings ); + for (i=0 ; iSaveThingName( pFile, lstNameThings[i] ); _theViewPanel->getSceneManager()->SaveThingName( pFile, lstNameThings[i] ); }// for i - //-- Contours Statics + //-- Static Contours + + fprintf(pFile,"ImageDimensions %d %d %d\n", dimRange[0], dimRange[1], dimRange[2] ); + + fprintf(pFile,"ImageSpacing %f %f %f\n", spaRange[0], spaRange[1], spaRange[2] ); + lstNameThings = kernelManager->GetLstNameThingsStatic(); sizeLstNameThings = lstNameThings.size(); fprintf(pFile,"NumberOfContoursStatic %d\n", sizeLstNameThings ); @@ -944,18 +946,10 @@ void wxContourMainFrame::saveFileWithContours( std::string filename ) } //AD:04-06-09 -void wxContourMainFrame::openContours( FILE *pFile, int version ) +void wxContourMainFrame::openContours( FILE *pFile, int version, bool staticContour ) { char tmp[255]; - fscanf(pFile,"%s",tmp); // NumberOfContours - fscanf(pFile,"%s",tmp); // ## - int numberOfContours = atoi(tmp); - - std::vector instantVector; - int typeContourModel; - manualContourModel *manModelContour; - int typeView; - + vtkImageData *image = _images[0]; int imageDim[3]; double imageSpac[3]; @@ -986,12 +980,21 @@ void wxContourMainFrame::openContours( FILE *pFile, int version ) fscanf(pFile,"%s",tmp); // Z tempSpac[2] = atof(tmp); - //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 3 + //Compare Spacing and Dims in X and Y (Necessary in Z?) - Just for Version 2 if (imageDim[0]!=tempDim[0] || imageDim[1]!=tempDim[1] || imageSpac[0]!=tempSpac[0] || imageSpac[1]!=tempSpac[1]) { compatible = false; } } + + fscanf(pFile,"%s",tmp); // NumberOfContours + fscanf(pFile,"%s",tmp); // ## + int numberOfContours = atoi(tmp); + + std::vector instantVector; + int typeContourModel; + manualContourModel *manModelContour; + int typeView; if (compatible==true) { @@ -1039,7 +1042,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version ) _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ; } - if (version==0) //StaticContours (will appear in all slices) + if (staticContour) //StaticContours (will appear in all slices) { Instant instant(&instantVector); kernelManager->changeContourOfManager( theName , &instant ); @@ -1139,7 +1142,7 @@ void wxContourMainFrame::openContours( FILE *pFile, int version ) _theViewPanel->getSceneManager()->configureViewControlTo( theName, manModelContour,spc , typeView) ; } - if (version==0) //StaticContours (will appear in all slices) + if (staticContour) //StaticContours (will appear in all slices) { Instant instant(&instantVector); kernelManager->changeContourOfManager( theName , &instant ); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 46b6a2a..a217f4a 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -238,7 +238,7 @@ class wxContourMainFrame : public wxPanel { void onLoad(); void onSave(); - void openContours( FILE *pFile, int version ); + void openContours( FILE *pFile, int version, bool staticContour ); void RefreshInterface(); @@ -396,7 +396,7 @@ private: void saveState(); void loadState(std::string filename); - void loadContours( FILE *pFile ); + void loadContours( FILE *pFile, bool staticContour ); void saveFileWithContours( std::string filename );