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);
}
-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){
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);
** 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");
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 );
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 );
_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 );
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) );
}
-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)
{
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());
}
}
wxRadioBox* _informationRadiobox;
wxRadioBox* _radiolstboxContourGroup;
wxStaticText* _staticTextInformation;
-
+ wxCheckBox* _XYZValues;
+ wxCheckBox* _contourImage;
+ wxCheckBox* _statistics;
+
void onInformationContourLabels(wxCommandEvent& event);
void onExtractInformation(wxCommandEvent& event);
void onSaveResults(wxCommandEvent& event);
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();
//_staticTextInformation->SetLabel(tmpString);
//Extraction data from contours of each slice
- contourextractdata->SetZtoBeAnalys( z);
+ contourextractdata->SetZtoBeAnalys(z);
tempVector[1]=z;
Instant instant(&tempVector);
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; iTitle<sizeTitle ; iTitle++)
- {
- // fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.c_str() );
- fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle );
- }
- fprintf(pFile,"\n" );
+ int iTitle,sizeTitle = (maxX / _numberOfVariablesStatistics);
+ for ( iTitle=0; iTitle<sizeTitle ; iTitle++)
+ {
+ // fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle,tmpString.c_str() );
+ fprintf(pFile,"-- \t %d-Size \t SizeRange \t Min \t Max \t Ave \t StDv \t" , iTitle );
+ }
+ fprintf(pFile,"\n" );
- for ( j=0; j<maxY ; j++)
- {
- fprintf(pFile,"%d\t" , j );
- for (i=0 ; i<maxX ; i++){
- tmpString = interfMainPanel::getInstance()->getCellValue(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; j<maxY ; j++)
+ {
+ fprintf(pFile,"%d\t" , j );
+ for (i=0 ; i<maxX ; i++){
+ tmpString = interfMainPanel::getInstance()->getCellValue(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)
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();
} // for iContourGroup
} // for z
- value = contourextractdata->GetVtkImageValueResult();
- mask = contourextractdata->GetVtkImageMaskResult();
+ (*value) = contourextractdata->GetVtkImageValueResult();
+ (*mask) = contourextractdata->GetVtkImageMaskResult();
delete contourextractdata;
}
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);
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);