]> Creatis software - creaImageIO.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Tue, 17 Mar 2009 11:14:09 +0000 (11:14 +0000)
committerguigues <guigues>
Tue, 17 Mar 2009 11:14:09 +0000 (11:14 +0000)
src2/creaImageIOMultiThreadImageReader.cpp
src2/creaImageIOWxTreeView.cpp

index fd76051ab7fbf4704e7baee893d3e9ae5fe26cc7..717b09cb89699f7adf87afb3f5be9f79e1719d72 100644 (file)
@@ -1,6 +1,7 @@
 #include <creaImageIOMultiThreadImageReader.h>
 #include <creaImageIOImageReader.h>
 #include <wx/utils.h>
+#include <creaImageIOSystem.h>
 
 namespace creaImageIO
 {
@@ -42,7 +43,7 @@ namespace creaImageIO
     : //mDoNotSignal(false),
       mReader(0),
       mTotalMem(0),
-      mTotalMemMax(10000)
+      mTotalMemMax(100000)
   {
     //    std::cout << "#### MultiThreadImageReader::MultiThreadImageReader("
     //       << " #threads= " << number_of_threads <<" )"<<std::endl;
@@ -382,7 +383,8 @@ namespace creaImageIO
   void MultiThreadImageReader::SignalImageRead(ImageToLoadPtr p, 
                                               bool purge)
   {
-    //    std::cout << "MultiThreadImageReader::SignalImageRead" <<std::endl;
+    
+//    std::cout << "MultiThreadImageReader::SignalImageRead" <<std::endl;
     //    std::cout << "this="<<this <<std::endl;
     //    std::cout << "user="<<p->GetUser() <<std::endl;
 
@@ -399,6 +401,7 @@ namespace creaImageIO
       BUGGY : TO FIX 
     */
     if (!purge)  return;
+    GimmickMessage(5,"Image '"<<p->GetFilename()<<"' read"<<std::endl);
 
     //    wxMutexLocker lock(GetMultiThreadImageReaderUserMutex());
           
@@ -407,19 +410,25 @@ namespace creaImageIO
     p->GetImage()->PropagateUpdateExtent();
     long ImMem = p->GetImage()->GetEstimatedMemorySize();
     mTotalMem += ImMem;
-    //    std::cout << " ==> Total mem = "<<mTotalMem<<" Ko"<<std::endl;
+
+    GimmickMessage(5,"==> Image in memory = "<<mUnloadQueue.size()<<std::endl);
+    GimmickMessage(5,"==> Total mem       = "<<mTotalMem<<" Ko"<<std::endl);
+
+    //  return;
+
     while (mTotalMem > mTotalMemMax)
       {
-       //      std::cout 
-       //                <<"   ! Exceeded max of "
-       //                << mTotalMemMax << " : unloading oldest image ... "
-       //                << std::endl;
+       GimmickMessage(5,
+                      "   ! Exceeded max of "
+                      << mTotalMemMax << " Ko : unloading oldest image ... "
+                      << std::endl);
        if ( mUnloadQueue.size() <= 1 ) 
          {
-           //      std::cout << "Only one image : cannot load AND unload it !!"
-           //                <<std::endl;
+            GimmickMessage(5,
+                           "   Only one image : cannot load AND unload it !!"
+                           <<std::endl);
            break; 
-
+           
          }
        ImageToLoadPtr unload = mUnloadQueue.remove_top();
        MultiThreadImageReaderUser* user = unload->GetUser();
@@ -430,15 +439,16 @@ namespace creaImageIO
          }
 
 
-       //      std::cout << "'" << unload->GetFilename() << "'" << std::endl;
+       GimmickMessage(5,"'" << unload->GetFilename() << "'" << std::endl);
        mTotalMem -= unload->GetImage()->GetEstimatedMemorySize();
-       //      std::cout << " ==> Total mem = "<<mTotalMem<<" Ko "<<std::endl;
+
+       GimmickMessage(5," ==> Total mem = "<<mTotalMem<<" Ko "<<std::endl);
        
 
        std::string filename = unload->GetFilename();
        if (unload->Index()>=0)
          {
-           //   std::cout << "still in queue"<<std::endl;
+           // GimmickMessage(5,"still in queue"<<std::endl);
          }
        unload->Index() = -1;
 
index 7a948f5194c8218dd472dae123d0fb0c0b4a1ffa..4066315d60cabc1158890932f09fd9e93fd0b017 100644 (file)
@@ -111,23 +111,26 @@ namespace creaImageIO
        level.wxCtrl = ctrl;
        level.wxSplitter->Initialize(ctrl);
 
+       // Create the first column : number of children
+       
+       std::string title = "#";
+       if (i<handler->GetTree().GetNumberOfLevels()-1)
+         {
+           title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
+           if (title[title.size()-1]!='s')
+             title += "s";
+         }
+       ctrl->InsertColumn(0,crea::std2wx(title),col_style);
+                 
+
        // Create the columns : one for each attribute of the level
-       int col = 0;
+       int col = 1;
        tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
        for (a  = handler->GetTree().GetAttributeDescriptorList(i).begin();
             a != handler->GetTree().GetAttributeDescriptorList(i).end();
             ++a)
          {
-                 if(col==0)
-                 {
-                   wxListItem it;
-                   it.SetTextColour(*wxRED);
-                   it.SetText(_T("#C"));
-               
-                   ctrl->InsertColumn(col,it);
-                   col++;
-                 }
-                 
+       
                GimmickDebugMessage(5,"Creating column "<<col<<" : "
                                <<a->GetName()
                                <<std::endl);