]> Creatis software - creaImageIO.git/commitdiff
Cleaned the viewer and deactivated color function
authorcaballero <caballero>
Mon, 23 Mar 2009 10:37:06 +0000 (10:37 +0000)
committercaballero <caballero>
Mon, 23 Mar 2009 10:37:06 +0000 (10:37 +0000)
src2/creaImageIOWxTreeView.cpp
src2/creaImageIOWxTreeView.h
src2/creaImageIOWxViewer.cpp
src2/creaImageIOWxViewer.h

index 1d5663fd83e02f56263fecc49b48c46927845a85..3a24eb49c714ce34db23bb793f7845ee9cd8bcdb 100644 (file)
@@ -306,9 +306,7 @@ namespace creaImageIO
                            <<"'"<<level
                            <<std::endl);
        int _id=1;
-       int colorId=0;
-
-       
+               
 
        //Adds items (other than the first) and sets their attributes 
        GetTreeHandler()->LoadChildren(*i,1);
@@ -342,37 +340,7 @@ namespace creaImageIO
            int n= GetTreeHandler()->GetNumberOfChildren(*j);
            oss << n;
            std::string s(oss.str());
-           item.SetText( crea::std2wx(s));
-       
-               //Setting the color according to the parent
-               if(l==0)
-               {
-               item.SetBackgroundColour
-                 (wxColourDatabase().Find
-                  (crea::std2wx(mColorPalette[colorId]))); 
-               mColorMap.insert
-                 (NodeColorPair
-                  (*j,wxColourDatabase().Find
-                   (crea::std2wx(mColorPalette[colorId]))));
-               if(colorId<64)
-                 {
-                   colorId++;
-                 }
-               else
-                       {
-                         colorId=0;
-                       }
-               }
-               else if(l!=mLevelList.size()-1)
-                 {
-                   item.SetBackgroundColour(mColorMap[*i]); 
-                       mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
-               }
-               else
-               {
-                       item.SetBackgroundColour(mColorMap[*i]); 
-               }
-               
+           item.SetText( crea::std2wx(s));             
 
            item.SetColumn(0);
            GetCtrl(l)->SetItem(item);
@@ -749,6 +717,40 @@ namespace creaImageIO
          }
   }
 
+   //================================================================
+  void WxTreeView::SetColor(int l)
+  {
+         /*
+         int colorId=0;
+         //Setting the color according to the parent
+               if(l==0)
+               {
+               item.SetBackgroundColour
+                 (wxColourDatabase().Find
+                  (crea::std2wx(mColorPalette[colorId]))); 
+               mColorMap.insert
+                 (NodeColorPair
+                  (*j,wxColourDatabase().Find
+                   (crea::std2wx(mColorPalette[colorId]))));
+               if(colorId<64)
+                 {
+                   colorId++;
+                 }
+               else
+                       {
+                         colorId=0;
+                       }
+               }
+               else if(l!=mLevelList.size()-1)
+                 {
+                   item.SetBackgroundColour(mColorMap[*i]); 
+                       mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
+               }
+               else
+               {
+                       item.SetBackgroundColour(mColorMap[*i]); 
+               }*/
+  }
   //================================================================
   void WxTreeView::CreateColorPalette()
   {
index 23325339e94dbeb800a8998bfc56757520d57270..a1d5ed63aa76ce273e2403bcaffc5d96251eed3a 100644 (file)
@@ -79,6 +79,8 @@ namespace creaImageIO
       /// Updates the view of a level given the selected items of upper level
       /// Recursive method
       virtual void RecursiveUpdateLevel( int );
+         ///Sets the color of a selected item
+         void SetColor(int level);
          ///Creates the color palette for the first level
          void CreateColorPalette();
          ///Selects the lowest level (images)
index d6871d9657d822b321eb784487079b0420b0235c..f298a21344ef5e747566684115900248c2f822ca 100644 (file)
@@ -80,8 +80,7 @@ namespace creaImageIO
     mViewer->SetupInteractor ( mInteractor );
     
     mCurrent = 0;
-
-         mPlayer = 0;
+       mPlayer = 0;
          
     topsizer-> Add( mInteractor ,1,wxGROW  ,0);
     SetSizer( topsizer );     
@@ -96,34 +95,12 @@ namespace creaImageIO
     wxMutexLocker lock(mMutex);
     GimmickDebugMessage(1,"WxViewer::~WxViewer"
                        <<std::endl);
-    SetMovieSize(0);
     // TO DO : desallocate cleanly
     //    delete mPlayer;
     //    delete mInteractor;
   }
   //=====================================================================
 
-
-  //================================================================
-
-  void WxViewer::SetImage(int i, vtkImageData* im)
-  {
-    wxMutexLocker lock(mMutex);
-       if(images.size()>0)
-       {
-               GimmickDebugMessage(5,"WxViewer::SetImage "<<i+1<<"/"<<images.size()
-                       <<std::endl);
-               if (i<images.size())
-               {
-               //      if (images[i]!=0) images[i]->UnRegister(NULL);
-               images[i] = im;
-               //      if (im!=0) im->Register(NULL);
-               }
-               
-       }
-    
-  }
-
   //================================================================
   void WxViewer::SetImageVector(std::vector<ImagePointerHolder*>& pointers)
   {
@@ -132,36 +109,6 @@ namespace creaImageIO
        imagePointers=pointers;
   }
 
-
-  //================================================================
-
-  bool WxViewer::ImagesEmpty()
-  {
-    wxMutexLocker lock(mMutex);
-    return images.empty();
-  }
-  //================================================================
-
-  //================================================================
-
-  void WxViewer::SetMovieSize(unsigned int si)
-  {
-    wxMutexLocker lock(mMutex);
-    GimmickDebugMessage(5,"WxViewer::SetMovieSize("<<(int)si<<")"
-                       <<std::endl);
-    for (unsigned int i=0;i<images.size();++i)
-      {
-       if (images[i]!=0) 
-         {
-           //      images[i]->UnRegister(NULL);
-         }
-      }
-    images.clear();
-    for (unsigned int i=0;i<si;++i) images.push_back(0);
-    mCurrent = 0;
-  }
-  //================================================================
-
   //================================================================
 
   void WxViewer::ShowNextImage()
@@ -171,7 +118,7 @@ namespace creaImageIO
     
     GimmickMessage(10,"WxViewer::ShowNextImage() "
                   <<mCurrent+1<<"/"
-                  <<images.size()<<std::endl);
+                  <<imagePointers.size()<<std::endl);
     
     if(imagePointers.size()>0)
        {
@@ -204,9 +151,6 @@ namespace creaImageIO
   }
   //================================================================
 
-
-
-
   //=====================================================================
   void WxViewer::ShowImage(vtkImageData* im)
   {
@@ -261,24 +205,11 @@ namespace creaImageIO
         mViewer->GetRenderer()->ResetCameraClippingRange(bounds);
 
          
-      }
-    
-   //::wxWakeUpIdle();
+         }
 
   } 
   //================================================================
   
-  //==================================================
-  void WxViewer::OnInternalIdle()
-  {
-    //    mInteractor->Refresh();
-       if(images.size()>0)
-       {
-//      mInteractor->Render();
-       }
-    //mViewer->Render();      
-  }
-
    //================================================================
   bool WxViewer::RefreshIfNecessary()
   {
@@ -311,9 +242,6 @@ namespace creaImageIO
                mPlayer->Run();  
        }
        
-       
-       
 
   //  BEGIN_EVENT_TABLE(WxGimmickFrame, wxDialog)
   //    END_EVENT_TABLE()
index e9ea7a193cfd347597047f5cc2059050722d400c..e64704af6c579c452e69aee775bb3483b560fe91 100644 (file)
@@ -26,7 +26,6 @@ namespace creaImageIO
   {
  
   public:
-    //   friend class ThreadedMovie;
     /// Ctor 
     WxViewer();
     WxViewer(wxWindow *parent, 
@@ -36,20 +35,8 @@ namespace creaImageIO
                   const wxSize& size);
     /// Dtor
     virtual ~WxViewer();
-    ///Shows the image in the vector as a movie
-    //void ShowImages();
-    /// Sets the movie size
-    void SetMovieSize(unsigned int);
-    ///Sets the ith image of the movie
-    void SetImage(int i, vtkImageData* im);
-    ///Clears the selection of images
-    //  void ClearImages();
-    ///Returns true if the image vector is empty
-    bool ImagesEmpty();
     /// 
     void ShowNextImage();
-    
-    void OnInternalIdle();
 
        void StartPlayer();
 
@@ -74,8 +61,6 @@ namespace creaImageIO
     /// Current spacing
     double mspx,mspy,mspz;
 
-    /// The vector of images to show
-    std::vector<vtkImageData*> images;
     /// 
     int mCurrent;
     ///The threaded movie player