From: donadio Date: Fri, 29 May 2009 08:25:20 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: EED.02Oct2009~24 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ae4e82199b7c2de2c149f84be5a10edcce7596e0;p=creaContours.git *** empty log message *** --- diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 4f75c89..8750c4f 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -562,9 +562,9 @@ 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->SetSize( wxSize(500,450) ); + infoWin->SetSize( wxSize(825,650) ); - wxSize sizepanel(200,300); + wxSize sizepanel(825,675); informationPanel = new interfInformationPanel(infoWin);//contourevent->getInformationPanel(infoWin); wxBoxSizer * sizerPanel = new wxBoxSizer(wxHORIZONTAL); @@ -627,8 +627,11 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString){ } -void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){ - wxContourMainFrame::getInstance()->onSaveResults(directory, namefile,filename, typeContourGroup); +void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, + int typeContourGroup, bool XYZValues, bool contourImage, bool statistics) +{ + wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename, + typeContourGroup, XYZValues, contourImage, statistics); } wxString interfMainPanel::getCellValue(int j,int i){ diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index e9663c2..8f5224c 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -202,7 +202,8 @@ public: void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString); - void onSaveResults(std::string directory,std::string namefile, std::string filename,int typeContourGroup); + void onSaveResults(std::string directory,std::string namefile, std::string filename, + int typeContourGroup, bool XYZValues, bool contourImage, bool statistics); wxString getCellValue(int j,int i); diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index ea46142..08f7360 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -179,8 +179,8 @@ void interfSpreadPanel::setStringSpread(std::string stringtemp){ ** Begin of information panel **/ interfInformationPanel::interfInformationPanel(wxWindow * parent) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN){ - +: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) +{ //wxPanel *panel = new wxPanel(parent,-1,wxDefaultPosition, wxDefaultSize,wxTAB_TRAVERSAL); wxString lstOptions[4]; lstOptions[0]=_T("Current Slice"); @@ -195,6 +195,15 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) lstOptContOperation[3]=_T("ALL"); _radiolstboxContourGroup = new wxRadioBox(this, -1, _T("Contour group"), wxDefaultPosition, wxSize(270,45), 4 , lstOptContOperation, 4, wxRA_SPECIFY_COLS); + _XYZValues = new wxCheckBox(this, -1, _T("Save Contour Values") ); + _XYZValues->SetValue(true); + + _contourImage = new wxCheckBox(this, -1, _T("Extract Contours as Images") ); + _contourImage->SetValue(true); + + _statistics = new wxCheckBox(this, -1, _T("Save Statistics") ); + _statistics->SetValue(true); + wxButton *informationContourLabelsBtn = new wxButton(this,-1,_T("Contour labels"),wxDefaultPosition, wxSize(140,35) ); informationContourLabelsBtn->SetEventHandler( this ); Connect( informationContourLabelsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onInformationContourLabels ); @@ -203,7 +212,7 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) statisticsContourBtn->SetEventHandler( this ); Connect( statisticsContourBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onExtractInformation ); - wxButton *saveResultsBtn = new wxButton(this,-1,_T("Save statistics results"),wxDefaultPosition, wxSize(140,35) ); + wxButton *saveResultsBtn = new wxButton(this,-1,_T("Save Results"),wxDefaultPosition, wxSize(140,35) ); saveResultsBtn->SetEventHandler( this ); Connect( saveResultsBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfInformationPanel::onSaveResults ); @@ -240,19 +249,12 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) _mbarrangeRangeInformation-> SetStart( (int)range[0] ); _mbarrangeRangeInformation-> SetEnd( (int)range[1] ); - - _staticTextInformation = new wxStaticText(this,-1,_T(" ")); - - -// wxButton *XXXXXXXBtn = new wxButton(this,-1,_T("Statistics"),wxDefaultPosition, wxSize(180,35) ); -// XXXXXXXBtn->SetEventHandler( this ); -// Connect( XXXXXXXBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxContourEventHandler::onXXXXX ); - + _staticTextInformation = new wxStaticText(this,-1,_T(" ")); _grid = new wxGrid( this, wxID_ANY, wxPoint( 0, 0 ), - wxSize( 100, 100 ) ); + wxSize( 200, 500 ) ); int i,gridCol=10,gridRow=sizeZ; _grid->CreateGrid( 0, 0 ); @@ -268,29 +270,33 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) FillGridWithContoursInformation(); + wxFlexGridSizer * sizerSave = new wxFlexGridSizer(2,2); + sizerSave -> Add( new wxStaticText(this,-1,_T("Save Options: ")) , 1, wxGROW ); + sizerSave->Add( _XYZValues, 1, wxALL ,2 ); + sizerSave->Add( _statistics, 1, wxALL ,2 ); + sizerSave->Add( _contourImage, 1, wxALL ,2 ); + wxFlexGridSizer * sizerA = new wxFlexGridSizer(10); sizerA->Add( _informationRadiobox , 1, wxALL ,2 ); sizerA->Add( _radiolstboxContourGroup , 1, wxALL ,2 ); + sizerA->Add( sizerSave , 1, wxALL ,2 ); + wxFlexGridSizer * sizerB = new wxFlexGridSizer(10); - sizerB->Add( informationContourLabelsBtn , 1, wxALL ,2 ); - sizerB->Add( statisticsContourBtn , 1, wxALL ,2 ); - sizerB->Add( saveResultsBtn , 1, wxALL ,2 ); + sizerB->Add( informationContourLabelsBtn, 1, wxALL ,2 ); + sizerB->Add( statisticsContourBtn, 1, wxALL ,2 ); + sizerB->Add( saveResultsBtn, 1, wxALL ,2 ); - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); - sizer->AddGrowableCol(0); - sizer->AddGrowableRow(7); + wxFlexGridSizer * sizer = new wxFlexGridSizer(1,8); sizer->Add( sizerA , 1, wxALL , 0 ); sizer->Add( new wxStaticText(this ,-1,_T("Slice Range")) , 1, wxALL , 0 ); sizer->Add( _mbarrangeSliceInformation , 1, wxALL|wxGROW , 2 ); sizer->Add( new wxStaticText(this ,-1,_T("Gray Range")) , 1, wxALL , 0 ); sizer->Add( _mbarrangeRangeInformation , 1, wxALL|wxGROW , 2 ); - sizer->Add( sizerB , 1, wxALL , 0 ); - sizer->Add( _staticTextInformation , 1, wxALL , 0 ); + sizer->Add( sizerB , 1, wxEXPAND , 0 ); + sizer->Add( _staticTextInformation , 1, wxEXPAND , 0 ); sizer->Add( _grid , 1, wxEXPAND , 0 ); - - this->SetSizer( sizer ); this->SetSize( wxSize(1500,1500) ); //this->SetBackgroundColour( wxColour(100,100,100) ); @@ -318,7 +324,8 @@ void interfInformationPanel::onExtractInformation(wxCommandEvent& event){ } -void interfInformationPanel::onSaveResults(wxCommandEvent& event){ +void interfInformationPanel::onSaveResults(wxCommandEvent& event) +{ wxFileDialog dialog(this, _T("Choose a file"), _T(""), _T(""), _T("*.txt"), wxSAVE ); if (dialog.ShowModal() == wxID_OK) { @@ -327,7 +334,8 @@ void interfInformationPanel::onSaveResults(wxCommandEvent& event){ std::string namefile=(const char *)(dialog.GetFilename().mb_str()); std::string filename = (const char *)(dialog.GetPath().mb_str() ); int typeContourGroup = _radiolstboxContourGroup->GetSelection(); - interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename, typeContourGroup); + interfMainPanel::getInstance()->onSaveResults(directory, namefile, filename, + typeContourGroup, _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue()); } } diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.h b/lib/Interface_Icons_NDimensions/interfToolsPanels.h index c26d5dd..396579b 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.h +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.h @@ -75,7 +75,10 @@ private: wxRadioBox* _informationRadiobox; wxRadioBox* _radiolstboxContourGroup; wxStaticText* _staticTextInformation; - + wxCheckBox* _XYZValues; + wxCheckBox* _contourImage; + wxCheckBox* _statistics; + void onInformationContourLabels(wxCommandEvent& event); void onExtractInformation(wxCommandEvent& event); void onSaveResults(wxCommandEvent& event); diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 80caa58..4261ef1 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -2054,7 +2054,8 @@ std::vector wxContourMainFrame::getOutlinesName(int slide){ return kernelManager->getOutlinesNameAtInstant(tempVector); } -void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ){ +void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ) +{ int maxContourGroup = 0; ContourExtractData *contourextractdata = new ContourExtractData(); @@ -2126,7 +2127,7 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel //_staticTextInformation->SetLabel(tmpString); //Extraction data from contours of each slice - contourextractdata->SetZtoBeAnalys( z); + contourextractdata->SetZtoBeAnalys(z); tempVector[1]=z; Instant instant(&tempVector); @@ -2245,43 +2246,54 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel delete contourextractdata; } -void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup){ - SaveValuesXYZ( directory , namefile, typeContourGroup ); - - vtkImageData* mask, *value; - this->getMaskValue(mask, value, typeContourGroup); - this->SaveImageResult( directory , namefile, mask, value); +void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, + int typeContourGroup, bool XYZValues, bool contourImage, bool statistics) +{ + if (XYZValues) + { + SaveValuesXYZ( directory , namefile, typeContourGroup ); + } + if (contourImage) + { + vtkImageData * mask; + vtkImageData * value; + this->getMaskValue(&mask, &value, typeContourGroup); + this->SaveImageResult( directory , namefile, mask, value); + } - FILE *pFile=fopen(filename.c_str(),"w+"); + if (statistics) + { + FILE *pFile=fopen(filename.c_str(),"w+"); - int sizeZ = _theViewPanel->GetImageDataSizeZ(); + int sizeZ = _theViewPanel->GetImageDataSizeZ(); - wxString tmpString; - int i,j,maxX,maxY=sizeZ; - maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols(); + wxString tmpString; + int i,j,maxX,maxY=sizeZ; + maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols(); - int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics); - for ( iTitle=0; iTitlegetCellValue(j, i);//_grid->GetCellValue( j , i ); - fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) ); - } // for i - fprintf(pFile,"\n" ); - } // for j + for ( j=0; jgetCellValue(j, i);//_grid->GetCellValue( j , i ); + fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) ); + } // for i + fprintf(pFile,"\n" ); + } // for j - fclose(pFile); + fclose(pFile); + } } void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefile,int typeContourGroup) @@ -2410,7 +2422,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil delete contourextractdata; } -void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup){ +void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup){ wxBusyCursor wait; ContourExtractData *contourextractdata = new ContourExtractData( true ); //int typeContourGroup = this->_radiolstboxContourGroup->GetSelection(); @@ -2494,8 +2506,8 @@ void wxContourMainFrame::getMaskValue(vtkImageData* mask,vtkImageData* value,int } // for iContourGroup } // for z - value = contourextractdata->GetVtkImageValueResult(); - mask = contourextractdata->GetVtkImageMaskResult(); + (*value) = contourextractdata->GetVtkImageValueResult(); + (*mask) = contourextractdata->GetVtkImageMaskResult(); delete contourextractdata; } diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h index 4f34fdb..91eac83 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.h @@ -153,7 +153,7 @@ class wxContourMainFrame : public wxPanel { void setInstantChooserPanel( wxInstantChooserPanel * theInstantChooserPanel ); - void getMaskValue(vtkImageData* mask,vtkImageData* value,int typeContourGroup); + void getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup); void SaveImageResult(std::string directory,std::string namefile, vtkImageData* mask,vtkImageData* value); @@ -296,7 +296,8 @@ class wxContourMainFrame : public wxPanel { void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ); - void onSaveResults(std::string directory,std::string namefile, std::string filename, int typeContourGroup); + void onSaveResults(std::string directory,std::string namefile, std::string filename, + int typeContourGroup, bool XYZValues, bool contourImage, bool statistics); void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup);