X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_ManagerContour_NDimensions%2FwxContourMainFrame.cxx;h=793e05d9ebf18b600e7363c163ef7dbeaa1edb89;hb=6b1e60b233628dde72721c9fac669f2fcf7eb49b;hp=0e7bff41f9cd3939a1ef3ab49906833ce1c6ac99;hpb=ef966ac5e14dc46db8fc657c7892c9af975eb2a3;p=creaContours.git diff --git a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx index 0e7bff4..793e05d 100644 --- a/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx +++ b/lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx @@ -52,7 +52,7 @@ using namespace std; // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ -wxContourMainFrame* wxContourMainFrame:: instance = NULL; +wxContourMainFrame* wxContourMainFrame::instance=NULL; char wxContourMainFrame::COPY = 'C'; wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,long style) @@ -94,7 +94,6 @@ char wxContourMainFrame::COPY = 'C'; _viewThresholdImage = NULL; _viewThresholdImagePanel = NULL; _viewColorLayerImagePanel = NULL; - _frameShowResultImages = NULL; } @@ -162,28 +161,29 @@ void wxContourMainFrame::setVectImages(std::vector imgs) wxContourMainFrame* wxContourMainFrame :: getInstance(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector images, long style,std::string datadir ) { - if(instance == NULL){ - instance = new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir); + if(instance == NULL) + { + instance=new wxContourMainFrame(parent, id, title, pos, size, images, style,datadir); } return instance; } - std::vector wxContourMainFrame ::getVectImages() + std::vector wxContourMainFrame::getVectImages() { return kernelManager->getVectImages(); } - wxContourMainFrame* wxContourMainFrame :: getInstance() + wxContourMainFrame* wxContourMainFrame::getInstance() { return instance; } - void wxContourMainFrame :: resetInstance() + void wxContourMainFrame::resetInstance() { instance->Destroy(); } - wxContourMainFrame :: ~wxContourMainFrame() + wxContourMainFrame::~wxContourMainFrame() { delete _contourextractdata; deleteAllContours(); @@ -212,7 +212,7 @@ void wxContourMainFrame::setVectImages(std::vector imgs) // Creational and initialization methods using WxAui //------------------------------------------------------------------------------------------------------------ // - wxAuiNotebook * wxContourMainFrame :: createNotebook() + wxAuiNotebook * wxContourMainFrame::createNotebook() { wxSize client_size = GetClientSize(); wxAuiNotebook* noteBook = new wxAuiNotebook(this, -1, wxPoint(client_size.x, client_size.y), wxSize(430,200), m_notebook_style); @@ -224,7 +224,7 @@ void wxContourMainFrame::setVectImages(std::vector imgs) //------------------------------------------------------------------------------------------------------------ // Creational and initialization methods //------------------------------------------------------------------------------------------------------------ - bool wxContourMainFrame :: configurePanels( ) + bool wxContourMainFrame::configurePanels( ) { bool configured = _theViewPanel!=NULL; @@ -852,7 +852,7 @@ void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName, mp->SetPointX( vecOut[0] ); mp->SetPointY( vecOut[1] ); mp->SetPointZ( vecOut[2] ); - } + } // for i _theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append ); } @@ -863,7 +863,6 @@ void wxContourMainFrame ::loadState(std::string filename) onLoadContours(filename,false); } - void wxContourMainFrame::onLoad() { std::string fileNameContourROI = GetFileLocation(); @@ -880,20 +879,17 @@ void wxContourMainFrame::onLoad() if (dialog.ShowModal() == wxID_OK) { fileNameContourROI = (const char *)(dialog.GetPath().mb_str()); - } - } - + } // if dialog + } // if FileLocation onLoadContours(fileNameContourROI,true); } - void wxContourMainFrame::SetZForAllContours(int pz) { //-- Normal Contours std::vector< std::string > lstNameThings; int i,sizeLstNameThings; - int ii,sizeLstPoints; - + int ii,sizeLstPoints; lstNameThings = kernelManager->GetLstNameThings(); sizeLstNameThings = lstNameThings.size(); for (i=0 ; igetSceneManager()->removeSceneContours(); changeInstant(); } @@ -1005,7 +992,8 @@ void wxContourMainFrame::onImport() filename = dialog.GetPath().mb_str(); filenamecontours = kernelManager->parseOsirixFile(filename); - if(filenamecontours.compare("") != 0){ + if(filenamecontours.compare("") != 0) + { onLoadContours(filenamecontours,true); } // if } // if @@ -1020,7 +1008,6 @@ void wxContourMainFrame::onTest() #else wxFileDialog dialog(NULL, _T("Choose a File"), _T(""), _T(""), _T("*.*"), wxFD_OPEN ); #endif - if (dialog.ShowModal() == wxID_OK) { filename = dialog.GetPath().mb_str(); @@ -1028,9 +1015,9 @@ void wxContourMainFrame::onTest() } // if } - //AD: 29-05-09 -void wxContourMainFrame::onSave(){ +void wxContourMainFrame::onSave() +{ //CMRU 03-09-09----------------------------------------------------------------------------------------------- if(GetFileLocation().empty()) { @@ -1047,10 +1034,7 @@ void wxContourMainFrame::onSave(){ kernelManager->setCurrentFileName(fileNameContourROI); saveFileWithContours( fileNameContourROI ); } - } -//CMRU 03-09-09----------------------------------------------------------------------------------------------- - else - { + } else {//CMRU 03-09-09----------------------------------------------------------------------------------------------- std::cout<<"Nombre del archivo: "<CreateSeparatedButtonSizer(wxOK|wxCANCEL); - wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL); +// wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL); + wxFlexGridSizer *dialSizer = new wxFlexGridSizer(1); wxString lstOptOperation[2]; lstOptOperation[0]=_T("By Dimension"); lstOptOperation[1]=_T("By Spacing"); - wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 2 , lstOptOperation, 2, wxRA_SPECIFY_COLS); + wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,90), 2 , lstOptOperation, 2, wxRA_SPECIFY_COLS); dialSizer->Add( new wxStaticText(dial,-1,_T("The image resolution is not compatible with the ")) , 0, wxGROW ); dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW ); @@ -1899,6 +1884,10 @@ void wxContourMainFrame::onSegmentationOneSlice(int isovalue,int sampling,int me void wxContourMainFrame::SegmentationOneSlice( int x, int y, int z, int isovalue, int sampling, int method ) { + +printf("EED wxContourMainFrame::SegmentationOneSlice Start=%d %d\n",sampling,method ); +printf("EED wxContourMainFrame::SegmentationOneSlice %d %d %d \n",x,y,z ); + int typeofcontour = 1; //--Extracting Contour vtkImageData *imagedata = getImageData(); @@ -2072,7 +2061,7 @@ polyDataResult->PrintSelf( std::cout, vtkIndent(0) ); int ii,size=vtkcell->GetNumberOfPoints(); printf("EED wxContourMainFrame::SegmentationOneSlice C \n"); int id; - for (ii=1;ii<=size;ii++) + for (ii=0;iiGetLines()->GetData()->GetValue(ii); // p = polyDataResult->GetPoint(id); @@ -2415,6 +2404,22 @@ void wxContourMainFrame::onBeforeAfterContour(bool before,bool after) RefreshInterface(); } +void wxContourMainFrame::onJumpSlice(int step, int shift) +{ + std::vector tempVector; + _instantPanel->getInstant( tempVector ); + int ss = abs(step); + int pos = tempVector[1]; + int maxZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); + pos=(pos/ss)*ss+step+shift; + if ((pos>=0) && (possetInstant( tempVector ); + RefreshInterface(); + } // if pos +} + void wxContourMainFrame::onShowTextContour(bool show) { _theViewPanel->onShowTextContour(show); @@ -3234,7 +3239,9 @@ void wxContourMainFrame::onSnakePressed(){ } -void wxContourMainFrame::saveFileWithContoursAutomatique(){ +void wxContourMainFrame::saveFileWithContoursAutomatique() +{ +printf("EED wxContourMainFrame::saveFileWithContoursAutomatique \n"); std::string filename = kernelManager->getCurrentFileName(); if(filename.compare("")!=0){ saveFileWithContours(filename); @@ -3242,7 +3249,8 @@ void wxContourMainFrame::saveFileWithContoursAutomatique(){ onSave(); } } -void wxContourMainFrame::ShowToolsPanel(bool show){ +void wxContourMainFrame::ShowToolsPanel(bool show) +{ _pannew->Show(show); } @@ -3447,6 +3455,9 @@ void wxContourMainFrame::SetFileLocation(std::string newFileLocation) { _fileLocation = newFileLocation; std::cout<<"GETFILELOCATION:"<<_fileLocation<setCurrentFileName(_fileLocation); } //------------------------------------------------------------------------------------------------------------ @@ -3496,7 +3507,6 @@ void wxContourMainFrame::FlipLstOfContours(std::vector lstNameThing sizeLstNameThings = lstNameThings.size(); for (i=0 ; igetOutlineByKeyName(lstNameThings[i]); if (flipDirection==0) { @@ -3524,8 +3534,6 @@ void wxContourMainFrame::FlipLstOfContours(std::vector lstNameThing void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection) { - printf("EED wxContourMainFrame::FlipContours( %d , %d ) \n",typeContourFlip, flipDirection ); - saveState(); if (typeContourFlip==0) // @@ -3545,7 +3553,6 @@ void wxContourMainFrame::FlipContours(int typeContourFlip, int flipDirection) RefreshInterface(); } - void wxContourMainFrame::SetXY(int x, int y) { _theViewPanel->SetXY(x,y);