]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourMainFrame.cxx
#3145 creaContours Bug New Normal - changeWx28to30
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourMainFrame.cxx
index 5b5f61f822f541564ac1064b67308c1565a59f71..760f5431b8e2618120e0b19db779df4059a8f100 100644 (file)
@@ -96,7 +96,7 @@ char wxContourMainFrame::COPY = 'C';
                _viewColorLayerImagePanel       = NULL;
        }
 
-       wxContourMainFrame :: wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir)
+       wxContourMainFrame::wxContourMainFrame(wxWindow* parent, wxWindowID id,const wxString& title,const wxPoint& pos,const wxSize& size,std::vector<vtkImageData*> images, long style,std::string datadir)
                : wxPanel(parent, id, pos, size, style)
        {
                m_mgr.SetManagedWindow(this);
@@ -233,17 +233,13 @@ void wxContourMainFrame::setVectImages(std::vector<vtkImageData*> imgs)
                        notebook->AddPage( _theViewPanel, wxT("       View       ") );
                        m_mgr.Update();
                }
-
-
                if( configured )
                {
                        notebook->AddPage( _instantPanel, wxT("Instant Page") );
                        m_mgr.Update();
                }
-
                m_mgr.AddPane(notebook, wxAuiPaneInfo().Name(wxT("notebook_content")).CenterPane().PaneBorder(false));
                m_mgr.Update();
-
                SetMinSize(wxSize(300,300));
                m_mgr.Update();
                return configured;
@@ -446,13 +442,15 @@ manualBaseModel * wxContourMainFrame::factoryManualContourModel(wxPanel* panel){
 
        return manModelContour;
 }
-void wxContourMainFrame :: saveState(){
 
+void wxContourMainFrame :: saveState()
+{
        std::string temp = kernelManager->saveState();
        saveFileWithContours(temp);
 }
 
-void wxContourMainFrame::onDeleteContour(){
+void wxContourMainFrame::onDeleteContour()
+{
        //JCP 20-10-08 Undo redo implementation
                saveState();
                //JCP 20-10-08 Undo redo implementation
@@ -513,7 +511,8 @@ void wxContourMainFrame :: deleteContours( std::vector<std::string>  keyNamesVec
        }
 }
 
-void wxContourMainFrame :: deleteContour( std::string theKeyName ){
+void wxContourMainFrame :: deleteContour( std::string theKeyName )
+{
        /*
        manualContourModel                      * cModel;
        manualViewBaseContour           * cViewer;
@@ -602,17 +601,20 @@ void wxContourMainFrame::deleteAllContours(){
 JCP --08-09-2008 */
 }
 
-void wxContourMainFrame::setConceptValue( std::string name, int value ){
+void wxContourMainFrame::setConceptValue( std::string name, int value )
+{
        _instantPanel->setConceptValue(name, value);
 }
 
 
-ConceptDataWrap* wxContourMainFrame::getLastConceptData(){
+ConceptDataWrap* wxContourMainFrame::getLastConceptData()
+{
        return _instantPanel->getLastConceptData();
 }
 
 
-bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos ){
+bool wxContourMainFrame::getIfConceptCheckedAt( std::string name, int pos )
+{
        return _instantPanel->getIfConceptCheckedAt( name, pos );
 }
 
@@ -655,11 +657,10 @@ void wxContourMainFrame::changeInstant()
                std::vector<int> instantVect;
                _instantPanel->getInstant( instantVect );
                int actualSlice = instantVect[1];
-
                kernelManager->setInstant(instantVect);
-
            // Refresh Mask image
-               if(_viewMaskImage!=NULL){
+               if(_viewMaskImage!=NULL)
+               {
                        _viewMaskImage->SetZ(actualSlice);
                        if (_viewMaskImagePanel->IsVisible()==true)
                        {
@@ -667,17 +668,16 @@ void wxContourMainFrame::changeInstant()
                                getMaskValue(&mask,&value, _contourGroup , 0, -1, -1);
                                _viewMaskImage->onThreshold();
                        }
-               }
-
+               } // if _viewMaskImage
        // Refresh Threshold image
-               if(_viewThresholdImage!=NULL){
+               if(_viewThresholdImage!=NULL)
+               {
                        _viewThresholdImage->SetZ(actualSlice);
-                       if (_viewThresholdImagePanel->IsVisible()==true){
+                       if (_viewThresholdImagePanel->IsVisible()==true)
+                       {
                                _viewThresholdImage->onThreshold();
                        }
-               }
-
-
+               } // if _viewThresholdImage
                updateInstantOutlines();
                updateInstantImageData();
                updateInstantAxes();
@@ -685,7 +685,7 @@ void wxContourMainFrame::changeInstant()
 
 
 
-void wxContourMainFrame :: updateInstantOutlines()
+void wxContourMainFrame::updateInstantOutlines()
 {
        _theViewPanel->removeSceneContours();
        _theViewPanel->addNameWrapperToScene();
@@ -696,10 +696,13 @@ void wxContourMainFrame :: updateInstantOutlines()
        //}
 }
 
-int wxContourMainFrame::getNamesWrappingSize(){
+int wxContourMainFrame::getNamesWrappingSize()
+{
        return kernelManager->getNamesWrappingSize();
 }
-std::string wxContourMainFrame::getNameWrapping(int i){
+
+std::string wxContourMainFrame::getNameWrapping(int i)
+{
        return kernelManager->getNameWrapping(i);
 }
 
@@ -731,7 +734,6 @@ void wxContourMainFrame::onChangeDeep(int val){
 
 void wxContourMainFrame::onCopy(){
        std::vector<std::string> currentSelection = _theViewPanel->getSelectedObjects();
-
        std::vector<int> tempVector;
        _instantPanel->getInstant( tempVector );
     _performingOperation->reset();
@@ -740,9 +742,8 @@ void wxContourMainFrame::onCopy(){
        _performingOperation->setKeyNamesOperationElems( currentSelection );
 }
 
-void wxContourMainFrame::onPaste(){
-
-
+void wxContourMainFrame::onPaste()
+{
        char theStartCommand = _performingOperation->getStartCommand();
        if (  theStartCommand == COPY )
        {
@@ -760,7 +761,9 @@ void wxContourMainFrame::onPaste(){
                }
        }
 }
-void wxContourMainFrame::onUndo(){
+
+void wxContourMainFrame::onUndo()
+{
        std::string filename;
        if(kernelManager->onUndoSaveFile(filename)){
                saveFileWithContours(filename);
@@ -829,109 +832,11 @@ void wxContourMainFrame :: createMirrorContourOf ( std::string anExistingKName,
        _theViewPanel->getSceneManager()->createCopyContourOf( anExistingKName, cloneName, manualModel , append );
 }
 
-//EED04
-void wxContourMainFrame ::loadState(std::string filename){
-
+void wxContourMainFrame ::loadState(std::string filename)
+{
        deleteAllContours();
        onLoadContours(filename,false);
-
-       /* EED Borrame
-       char tmp[255];
-       FILE *pFile=fopen(filename.c_str(),"r+");
-
-       fscanf(pFile,"%s",tmp); // --CreaContour--
-
-       fscanf(pFile,"%s",tmp); // Version
-       fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0
-
-       deleteAllContours();
-
-       loadContours(pFile, false);
-       loadContours(pFile, true);
-
-       fclose(pFile);
-       */
-}
-
-
-//EED03
-/*EED Borrame
-void wxContourMainFrame::loadContours( FILE *pFile, bool staticContour )
-{
-       char tmp[255];
-
-       if (staticContour==false)
-       {
-               fscanf(pFile,"%s",tmp); // ImageDimensions
-               fscanf(pFile,"%s",tmp); // X
-               fscanf(pFile,"%s",tmp); // Y
-               fscanf(pFile,"%s",tmp); // Z
-
-               fscanf(pFile,"%s",tmp); // ImageSpacing
-               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<int> instantVector;
-       int typeContourModel;
-       manualBaseModel *manModelContour;
-       int typeView;
-
-       int i;
-       for (i=0;i<numberOfContours;i++)
-       {
-               instantVector.clear();
-               fscanf(pFile,"%s",tmp); // Instant
-               fscanf(pFile,"%s",tmp); // 1
-               instantVector.push_back( atoi(tmp) );
-               fscanf(pFile,"%s",tmp); // 2
-               instantVector.push_back( atoi(tmp) );
-               fscanf(pFile,"%s",tmp); // 3
-               instantVector.push_back( atoi(tmp) );
-               fscanf(pFile,"%s",tmp); // 4
-               instantVector.push_back( atoi(tmp) );
-               fscanf(pFile,"%s",tmp); // 5
-               instantVector.push_back( atoi(tmp) );
-               fscanf(pFile,"%s",tmp); // 6
-               instantVector.push_back( atoi(tmp) );
-
-               fscanf(pFile,"%s",tmp); // TypeContourModel
-               fscanf(pFile,"%s",tmp); // ##
-               typeContourModel = atoi(tmp);
-
-               manModelContour =  kernelManager->factoryManualContourModel(typeContourModel);
-               manModelContour->Open(pFile);
-
-               fscanf(pFile,"%s",tmp); // TypeView
-               fscanf(pFile,"%s",tmp); // ##
-               typeView = atoi(tmp);
-
-               std::string theName;
-               theName = kernelManager->createOutline( manModelContour, instantVector );
-               bool addedModel = theName.compare("") != 0;
-               if( addedModel )
-               {
-                       double spc[3];//Si no hay imagen pero hay contornos que spacing se pone por default
-                       _theViewPanel->getSpacing(spc);
-                       //Adding the manualContourControler to interface objects structure
-                       //Adding the manualViewContour to interface objects structure
-                       //_theViewPanel->getSceneManager()->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
 }
-*/
 
 
 void wxContourMainFrame::onLoad()
@@ -959,10 +864,7 @@ void wxContourMainFrame::onLoad()
 
 void  wxContourMainFrame::SetZForAllContours(int pz)
 {
-       printf("EED wxContourMainFrame::SetZForAllContours\n");
-
        //-- Normal Contours
-
        std::vector< std::string > lstNameThings;       
        int i,sizeLstNameThings;
        int ii,sizeLstPoints;
@@ -1018,17 +920,10 @@ void wxContourMainFrame::onLoadContours(std::string fileNameContourROI, bool int
                        fscanf(pFileData,"%s",tmpD); // NumberOfContours
                        fscanf(pFileData,"%s",tmpD); // #
                }
-
                fscanf(pFile,"%s",tmp); // --CreaContour--
-
                fscanf(pFile,"%s",tmp); // Version
                fscanf(pFile,"%s",tmp); // 1.0.3 || 1.0.2 || 1.0.1 || 1.0.0
                std::string version(tmp);
-
-
-printf("EED wxContourMainFrame::onLoadContours  version%s \n", version.c_str() );
-
-
                //AD:02-06-09
         _tmpReadFileTypeOfTransformation=-1;
                if (version=="1.0.3")
@@ -1037,7 +932,6 @@ printf("EED wxContourMainFrame::onLoadContours  version%s \n", version.c_str() )
                        openContours(pFile,pFileData,false);
                        openContours(pFile,pFileData,true);     //Load StaticContours
                }       
-
                if (version=="1.0.2")
                {
 //EED001
@@ -1047,7 +941,6 @@ printf("EED wxContourMainFrame::onLoadContours  version%s \n", version.c_str() )
                        openContours(pFile,pFileData,true);     // Load StaticContours
                        SetZForAllContours(-900);
                }
-
                //AD:02-06-09
                else if (version=="1.0.1")
                {
@@ -1463,14 +1356,16 @@ void wxContourMainFrame::openContours( FILE *pFile, FILE *pFileData, bool static
 
 }
 
-void wxContourMainFrame::RefreshInterface(){
+void wxContourMainFrame::RefreshInterface()
+{
        changeInstant();
        _theViewPanel->RefreshInterface();
        //wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)this->_theViewPanel->getWxVtkBaseView();
        //wxvtk2dbaseview->Refresh();
 }
 
-vtkImageData* wxContourMainFrame::getImageData(){
+vtkImageData* wxContourMainFrame::getImageData()
+{
        return _theViewPanel->getImageData();
 }
 
@@ -2439,29 +2334,33 @@ int wxContourMainFrame::getWindowLevel()
        return _theViewPanel->getWindowLevel();
 }
 
-void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel){
+void wxContourMainFrame::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel)
+{
        _theViewPanel->onBrigthnessColorWindowLevel(colorwindow, windowlevel);
 
        RefreshInterface();
 }
 
-void wxContourMainFrame::onInterpolation(bool interpolate){
+void wxContourMainFrame::onInterpolation(bool interpolate)
+{
        _theViewPanel->onInterpolation(interpolate);
        RefreshInterface();
 }
 
-void wxContourMainFrame::onChangeInstant(std::string name,int actual){
+void wxContourMainFrame::onChangeInstant(std::string name,int actual)
+{
        _instantPanel->setConceptValue( name, actual );
 }
 
 
-void wxContourMainFrame::resetAppend(){
+void wxContourMainFrame::resetAppend()
+{
        kernelManager->resetAppend();
-
 }
 
 
-void wxContourMainFrame::onSpreadAdd(){
+void wxContourMainFrame::onSpreadAdd()
+{
        std::vector<double> vecX;
        std::vector<double> vecY;
        std::vector<double> vecZ;
@@ -2473,7 +2372,8 @@ void wxContourMainFrame::onSpreadAdd(){
 }
 
 
-void wxContourMainFrame::onSpreadAddAll(){
+void wxContourMainFrame::onSpreadAddAll()
+{
 //EED02
        std::vector<int> tempVector;
        _instantPanel->getInstant( tempVector );
@@ -2511,7 +2411,8 @@ void wxContourMainFrame::onSpreadAddAll(){
 }
 
 
-void wxContourMainFrame::onSpreadGo(int type){
+void wxContourMainFrame::onSpreadGo(int type)
+{
        //JCP 20-10-08 Undo redo implementation
        saveState();
        //JCP 20-10-08 Undo redo implementation
@@ -2566,11 +2467,12 @@ void wxContourMainFrame::onSpreadGo(int type){
        //RefreshInterface();
 }
 
-void wxContourMainFrame::getInstantVector(std::vector<int>& tempVector){
-
+void wxContourMainFrame::getInstantVector(std::vector<int>& tempVector)
+{
 }
 
-std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide){
+std::vector<std::string> wxContourMainFrame::getOutlinesName(int slide)
+{
        std::vector<int> tempVector;
        _instantPanel->getInstant(tempVector);
        //Asignation of slide number should be different ex by name