From 8e43346f916bb1b027660dd175241d5d611ba9a0 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Mon, 29 Jun 2009 11:05:56 +0000 Subject: [PATCH] no message --- .../interfMainPanel.cxx | 12 +- .../interfMainPanel.h | 6 +- .../interfToolsPanels.cxx | 42 ++++-- .../wxContourMainFrame.cxx | 137 +++++++++++++----- .../wxContourMainFrame.h | 9 +- .../GeneralArchitecture/128002 | 4 +- .../GeneralArchitecture/2.session | 12 +- 7 files changed, 150 insertions(+), 72 deletions(-) diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx index 7bf581d..1597c26 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.cxx +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.cxx @@ -592,8 +592,8 @@ std::vector interfMainPanel::getOutlinesName(int slide){ return wxContourMainFrame::getInstance()->getOutlinesName(slide); } -void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ){ - wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ); +void interfMainPanel::onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax){ + wxContourMainFrame::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax); } void interfMainPanel::setStringInfoPanel(wxString tmpString){ @@ -624,10 +624,10 @@ void interfMainPanel::setColLableInfoPanel(int tmpIntB,wxString tmpTitleString){ } void interfMainPanel::onSaveResults(std::string directory,std::string namefile, std::string filename, - int typeContourGroup, bool XYZValues, bool contourImage, bool statistics) + int typeContourGroup, int selection, int minZ, int maxZ ,bool XYZValues, bool contourImage, bool statistics) { wxContourMainFrame::getInstance()->onSaveResults(directory, namefile, filename, - typeContourGroup, XYZValues, contourImage, statistics); + typeContourGroup, selection, minZ,maxZ, XYZValues, contourImage, statistics); } wxString interfMainPanel::getCellValue(int j,int i){ @@ -756,9 +756,9 @@ void interfMainPanel::onThresholdPressed() showPanel(thresholdPanel); } -void interfMainPanel::ShowResultImages(int typeContourGroup) +void interfMainPanel::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ) { - wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup); + wxContourMainFrame::getInstance()->ShowResultImages(typeContourGroup, selection, minZ, maxZ); } diff --git a/lib/Interface_Icons_NDimensions/interfMainPanel.h b/lib/Interface_Icons_NDimensions/interfMainPanel.h index 6e9f6f3..0e85143 100644 --- a/lib/Interface_Icons_NDimensions/interfMainPanel.h +++ b/lib/Interface_Icons_NDimensions/interfMainPanel.h @@ -186,7 +186,7 @@ public: std::vector getOutlinesName(int slide); - void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ); + void onInformationContourLabels(int typeContourGroup,int selection,int minZ,int maxZ,int grayRangeMin,int grayRangeMax); void setStringInfoPanel(wxString tmpString); @@ -201,7 +201,7 @@ public: void setColLableInfoPanel(int tmpIntB ,wxString tmpTitleString); void onSaveResults(std::string directory,std::string namefile, std::string filename, - int typeContourGroup, bool XYZValues, bool contourImage, bool statistics); + int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics); wxString getCellValue(int j,int i); @@ -209,7 +209,7 @@ public: virtual bool Show(bool show); - void ShowResultImages(int typeContourGroup); + void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ); private: diff --git a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx index 145d511..5b2b1c2 100644 --- a/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfToolsPanels.cxx @@ -188,8 +188,8 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) wxString lstOptions[4]; lstOptions[0]=_T("Current Slice"); lstOptions[1]=_T("Range Slices"); - lstOptions[2]=_T("All Slices"); - _informationRadiobox = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 3 , lstOptions, 3, wxRA_SPECIFY_COLS); +// lstOptions[2]=_T("All Slices"); + _informationRadiobox = new wxRadioBox(this, -1, _T("Slice analysis"), wxDefaultPosition, wxSize(270,45), 2 , lstOptions, 2, wxRA_SPECIFY_COLS); wxString lstOptContOperation[5]; lstOptContOperation[0]=_T("AND"); @@ -266,7 +266,7 @@ interfInformationPanel::interfInformationPanel(wxWindow * parent) wxPoint( 0, 0 ), wxSize( 200, 500 ) ); - int i,gridCol=10,gridRow=sizeZ; + int i,gridCol=10,gridRow=sizeZ+2; _grid->CreateGrid( 0, 0 ); _grid->AppendRows(gridRow); _grid->AppendCols(gridCol); @@ -327,8 +327,11 @@ void interfInformationPanel::onInformationContourLabels(wxCommandEvent& event){ void interfInformationPanel::onShowResultImages(wxCommandEvent& event) { // onExtractInformation( event ); + int selection = _informationRadiobox->GetSelection(); + int minZ = _mbarrangeSliceInformation->GetStart(); + int maxZ = _mbarrangeSliceInformation->GetEnd(); int typeContourGroup = _radiolstboxContourGroup->GetSelection(); - interfMainPanel::getInstance()->ShowResultImages( typeContourGroup ); + interfMainPanel::getInstance()->ShowResultImages( typeContourGroup , selection, minZ, maxZ); } @@ -337,11 +340,13 @@ void interfInformationPanel::onExtractInformation(wxCommandEvent& event){ _grid->ClearGrid(); int typeContourGroup = this->_radiolstboxContourGroup->GetSelection(); - int selection = _informationRadiobox->GetSelection(); - int minZ = _mbarrangeSliceInformation->GetStart(); - int maxZ = _mbarrangeSliceInformation->GetEnd(); - - interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ); + int selection = _informationRadiobox->GetSelection(); + int minZ = _mbarrangeSliceInformation->GetStart(); + int maxZ = _mbarrangeSliceInformation->GetEnd(); + int grayRangeMin = _mbarrangeRangeInformation->GetStart(); + int grayRangeMax = _mbarrangeRangeInformation->GetEnd(); + + interfMainPanel::getInstance()->onInformationContourLabels(typeContourGroup, selection, minZ, maxZ,grayRangeMin,grayRangeMax); } void interfInformationPanel::onSaveResults(wxCommandEvent& event) @@ -350,12 +355,17 @@ void interfInformationPanel::onSaveResults(wxCommandEvent& event) if (dialog.ShowModal() == wxID_OK) { onExtractInformation( event ); + int selection = _informationRadiobox->GetSelection(); + int minZ = _mbarrangeSliceInformation->GetStart(); + int maxZ = _mbarrangeSliceInformation->GetEnd(); std::string directory=(const char *)(dialog.GetDirectory().mb_str()); 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, _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue()); + typeContourGroup, + selection,minZ,maxZ, + _XYZValues->GetValue(), _contourImage->GetValue(), _statistics->GetValue()); } } @@ -390,8 +400,16 @@ void interfInformationPanel::FillGridWithContoursInformation(){ //tempString = wxString((*contourthing)->getName().c_str(),wxConvUTF8) ; tempString = wxString(lstContourThings[ii].c_str(),wxConvUTF8) ; _grid->SetCellValue( z, ii, tempString ); - } - } + } // for ii + }// for z + + // Last line + _grid->SetRowLabelValue(sizeZ, _T(" ") ); + for (ii=0 ; iiSetCellValue( sizeZ, ii, _T(" ") ); + } // for ii + } void interfInformationPanel::setStringInfoPanel(wxString tmpString){ diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 58c3ec6..aef8ba2 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -593,11 +593,11 @@ bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ){ -void wxContourMainFrame::ShowResultImages(int typeContourGroup) +void wxContourMainFrame::ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ) { vtkImageData * mask; vtkImageData * value; - this->getMaskValue(&mask, &value, typeContourGroup); + this->getMaskValue(&mask, &value, typeContourGroup, selection, minZ, maxZ); std::vector nTypeView; nTypeView.push_back(5); @@ -2374,12 +2374,12 @@ void wxContourMainFrame::GenerateContourExtractData() } -void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ) +void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax) { GenerateContourExtractData(); + wxString tempString; int maxContourGroup = 0; - _contourextractdata ->SetTypeOperation( typeContourGroup % 3 ); @@ -2402,7 +2402,7 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel _instantPanel->getInstant( tempVector ); vtkImageData *imagedata = _theViewPanel->getImageData(); - int sizeZ = _theViewPanel->GetImageDataSizeZ(); +// int sizeZ = _theViewPanel->GetImageDataSizeZ(); int z; int ii,sizeLstContourThings; @@ -2412,23 +2412,14 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel double porcent; wxString tmpString; - +//????? if (selection==0 ) // actual slice { - std::vector tempVector; - _instantPanel->getInstant( tempVector ); int actualSlice = tempVector[1]; minZ = actualSlice; maxZ = actualSlice; - } - else if (selection==2 ) // All slices - { - minZ = 0; - maxZ = sizeZ-1; - } - else if (selection==1 ) // slice range - { + } else { // slice range minZ = minimumZ; maxZ = maximumZ; } @@ -2437,6 +2428,8 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel totalZ = maxZ-minZ+1; _contourextractdata->SetImage( imagedata); + _contourextractdata->InitVolumeStatistics(); + // For each slice.. for ( z=minZ ; z<=maxZ ; z++ ) { @@ -2464,7 +2457,6 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel lstManConModExp = kernelManager->ExploseEachModel( lstManConMod ); - wxString tempString; tempString.Printf(_T("%d - %d"),z, sizeLstContourThings); interfMainPanel::getInstance()->setRowLabelInfoPanel(z, tempString); //_grid->SetRowLabelValue(z, tempString ); @@ -2507,8 +2499,8 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel &pLstValuePosZ); // Statistics of each slice. _contourextractdata->Statistics( &pLstValue, - minimumZ, - maximumZ, + grayRangeMin, + grayRangeMax, &resultGrayRangeCount, &resultSize, &resultMin, @@ -2545,6 +2537,45 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel } // for iContourGroup } // for z + // Print Volume Statistics + + + int vol_rCountRange; + int vol_rsize; + double vol_minValue; + double vol_maxValue; + double vol_average; + double vol_standardeviation; + + if (selection!=0 ) // actual slice + { + + _contourextractdata->GetVolumeStatistics(&vol_rCountRange, &vol_rsize, + &vol_minValue, &vol_maxValue, + &vol_average, &vol_standardeviation); + + interfMainPanel::getInstance()->setRowLabelInfoPanel(maxZ+2, _T("Total:")); + + tempString.Printf(_T("%d"),vol_rsize); + interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 0, tempString); + + tempString.Printf(_T("%d"),vol_rCountRange); + interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 1, tempString); + + tempString.Printf(_T("%f"),vol_minValue); + interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 2, tempString); + + tempString.Printf(_T("%f"),vol_maxValue); + interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 3, tempString); + + tempString.Printf(_T("%f"),vol_average); + interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 4, tempString); + + tempString.Printf(_T("%f"),vol_standardeviation); + interfMainPanel::getInstance()->setCellValueInfoPanel(maxZ+2, 5, tempString); + } + //----------------------------------------- + int iTitleGroup; wxString tmpTitleString; int tmpIntB; @@ -2561,14 +2592,13 @@ void wxContourMainFrame::onInformationContourLabels(int typeContourGroup,int sel interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 4, _T("Average") ); interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 5, _T("St.Dev.") ); interfMainPanel::getInstance()->setColLableInfoPanel( tmpIntB + 6, _T(" ") ); - } - + }// for title interfMainPanel::getInstance()->setStringInfoPanel( _T("") ); } //AD: 29-05-09 void wxContourMainFrame::onSaveResults(std::string directory,std::string namefile, std::string filename, - int typeContourGroup, bool XYZValues, bool contourImage, bool statistics) + int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics) { if (XYZValues) { @@ -2579,7 +2609,7 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil { vtkImageData * mask; vtkImageData * value; - this->getMaskValue(&mask, &value, typeContourGroup); + this->getMaskValue(&mask, &value, typeContourGroup,selection,minZ,maxZ); this->SaveImageResult( directory , namefile, mask, value); } @@ -2591,23 +2621,38 @@ void wxContourMainFrame::onSaveResults(std::string directory,std::string namefil FILE *pFile=fopen(name.str().c_str(),"w+"); - int sizeZ = _theViewPanel->GetImageDataSizeZ(); wxString tmpString; - int i,j,maxX,maxY=sizeZ; + int i,j,maxX; + +// int sizeZ = _theViewPanel->GetImageDataSizeZ(); +// int maxY=sizeZ+2; + maxX= interfMainPanel::getInstance()->getNumberColsInformationPanel();//this->_grid->GetNumberCols(); + // -- Title -- int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics); for ( iTitle=0; iTitle tempVector; + _instantPanel->getInstant( tempVector ); + int actualSlice = tempVector[1]; + minZ = actualSlice; + maxZ = actualSlice; + } + + // Stadistics... + for ( j=minZ; j<=maxZ ; j++) { fprintf(pFile,"%d\t" , j ); for (i=0 ; igetCellValue(maxZ+2, i);//_grid->GetCellValue( maxZ+2 , i ); + fprintf(pFile,"%s\t" , (const char *)(tmpString.mb_str()) ); + } // for i + fprintf(pFile,"\n" ); + } + fclose(pFile); } } @@ -2749,7 +2806,7 @@ void wxContourMainFrame::SaveValuesXYZ(std::string directory,std::string namefil } -void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup){ +void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value,int typeContourGroup, int selection, int minZ, int maxZ){ wxBusyCursor wait; GenerateContourExtractData(); @@ -2768,25 +2825,29 @@ void wxContourMainFrame::getMaskValue(vtkImageData ** mask,vtkImageData ** value _instantPanel->getInstant( tempVector ); vtkImageData *imagedata = _theViewPanel->getImageData(); - int sizeZ = _theViewPanel->GetImageDataSizeZ(); int z; int ii,sizeLstContourThings; - int minZ,maxZ; double totalZ; double porcent; wxString tmpString; - - minZ = 0;// _mbarrange->GetStart(); - maxZ = sizeZ;//_mbarrange->GetEnd(); - totalZ = maxZ-minZ+1; + + + if (selection==0 ) // actual slice + { + int actualSlice = tempVector[1]; + minZ = actualSlice; + maxZ = actualSlice; + } + + totalZ = maxZ-minZ; _contourextractdata->SetImage( imagedata); // For each slice.. - for ( z=0 ; z getOutlinesName(int slide); - void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ); + void onInformationContourLabels(int typeContourGroup,int selection,int minimumZ,int maximumZ,int grayRangeMin, int grayRangeMax); void onSaveResults(std::string directory,std::string namefile, std::string filename, - int typeContourGroup, bool XYZValues, bool contourImage, bool statistics); + int typeContourGroup, int selection, int minZ, int maxZ, bool XYZValues, bool contourImage, bool statistics); void SaveValuesXYZ(std::string directory,std::string namefile, int typeContourGroup); @@ -309,7 +308,7 @@ class wxContourMainFrame : public wxPanel { void saveFileWithContoursAutomatique(); - void ShowResultImages(int typeContourGroup); + void ShowResultImages(int typeContourGroup, int selection, int minZ, int maxZ ); private: diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/128002 b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/128002 index ea4ad49..31932cd 100644 --- a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/128002 +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/128002 @@ -1,6 +1,6 @@ format 66 "GeneralArchitecture" // GeneralArchitecture - revision 4 + revision 6 modified_by 2 "davila" // class settings //class diagram settings @@ -786,7 +786,7 @@ ${inlines} end end - sequencediagram 129154 "Sequence diagram btnLabels" + sequencediagram 129154 "Sequence diagram btnStatistics" show_full_operations_definition default write_horizontally default class_drawing_mode default drawing_language default draw_all_relations default shadow default show_stereotype_properties default overlapping_bars size A4 end diff --git a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/2.session b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/2.session index 4ac2592..89cddb2 100644 --- a/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/2.session +++ b/lib/doxygen/bouml/GeneralArchitecture/GeneralArchitecture/2.session @@ -1,13 +1,13 @@ -window_sizes 1005 825 189 810 698 70 +window_sizes 1070 859 329 735 732 70 diagrams active classdiagram_ref 128002 // GeneralArchitecture - 806 678 100 4 556 0 - sequencediagram_ref 129154 // Sequence diagram btnLabels - 531 558 100 4 0 161 + 731 712 100 4 420 11 + sequencediagram_ref 129154 // Sequence diagram btnStatistics + 664 712 100 4 0 7 sequencediagram_ref 129282 // Sequnce diagram btnSave - 560 558 100 4 0 161 + 560 558 100 4 0 0 sequencediagram_ref 129410 // Sequence diagram btnShowImageResult - 560 558 100 4 0 51 + 990 709 100 4 0 0 end show_stereotypes selected classdiagram_ref 128002 // GeneralArchitecture -- 2.47.1