]> Creatis software - creaImageIO.git/commitdiff
#3218 creaImageIO Feature New Normal - vtk8itk4wx3-mingw64
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Mon, 20 Aug 2018 14:54:26 +0000 (16:54 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Mon, 20 Aug 2018 14:54:26 +0000 (16:54 +0200)
14 files changed:
src/creaImageIODicomImageReader.cpp
src/creaImageIODicomImageReader2.cpp
src/creaImageIOGimmick.cpp
src/creaImageIOGimmickView.cpp
src/creaImageIOImageReader.cpp
src/creaImageIOImageReader.h
src/creaImageIOListener.cpp
src/creaImageIOListener.h
src/creaImageIOMultiThreadImageReader.cpp
src/creaImageIOMultiThreadImageReader.h
src/creaImageIOSystem.h
src/creaImageIOTreeNode.h
src/creaImageIOWxGimmickView.cpp
src/creaImageIOWxViewer.cpp

index 0e92f024b2fa9c4ce74df31f66f4cea4b28c29eb..7f608f016d9815f334e98a15831eeb2599a7b470 100644 (file)
@@ -66,14 +66,14 @@ namespace creaImageIO
     GDCM_NAME_SPACE::Document*doc;
     GDCM_NAME_SPACE::File* file = GDCM_NAME_SPACE::File::New();
     file->SetLoadMode( GDCM_NAME_SPACE::LD_ALL);
-    file->SetFileName(filename.c_str());
+    file->SetFileName( filename );
     file->Load();
     bool ok = file->IsReadable();
        if(!ok)
        {
                doc = (GDCM_NAME_SPACE::Document*)file; 
                ok = doc->IsReadable();
-       }
+       } // if ok
     file->Delete();
     return ok;
   }
@@ -84,17 +84,15 @@ namespace creaImageIO
   {
     vtkImageData* im = 0;
     try
-      {
-       mReader->SetFileName(filename.c_str());
-       mReader->Update();
-       im = vtkImageData::New();
-       im->ShallowCopy(mReader->GetOutput());
-      }
-    catch (...)
-      {
-       if (im!=0) im->Delete();
-         im = 0;
-      }
+    {
+               mReader->SetFileName(filename.c_str());
+               mReader->Update();
+               im = vtkImageData::New();
+               im->ShallowCopy(mReader->GetOutput());
+    } catch (...) {
+               if (im!=0) im->Delete();
+               im = 0;
+    }
     return im;
   }
 
index 5b6861ccf46fc63ce510dfa4f6526c9ba41cbee0..e8ff7e10fc9b4a5e592d1e07a0cd2baf80cafaec 100644 (file)
@@ -267,18 +267,20 @@ void DicomImageReader::ReadAttributes2(const std::string& filename,
 
 const std::string DicomImageReader::GetStringValueFromTag(const gdcm::DataElement& de)
 {
+printf("EED DicomImageReader::GetStringValueFromTag Start\n");
   static std::string buffer;
   buffer = "";  // cleanup previous call
 
 
-    const gdcm::ByteValue *bv = de.GetByteValue();
-    if( bv ) // Can be Type 2
-      {
+  const gdcm::ByteValue *bv = de.GetByteValue();
+  if( bv!=NULL ) // Can be Type 2
+  {
       buffer = std::string( bv->GetPointer(), bv->GetLength() );
       // Will be padded with at least one \0
-      }
+  } // if bv
 
   // Since return is a const char* the very first \0 will be considered
+printf("EED DicomImageReader::GetStringValueFromTag END\n");
   return buffer.c_str();
 }
   //=====================================================================
index 898de344fb7d5ad09037b359f308cb11ed1d22a4..47e5b4f19c6a6e0f854640950056e1fb2027385c 100644 (file)
@@ -150,9 +150,7 @@ namespace creaImageIO
                GimmickError("ERROR CREATING '"<<i_locDB<<"'");
          }
          sqlTreeH->SetAttribute(0,"Name",i_name);
-        }
-        else 
-        {
+        } else {
                /// Open and test it
                
                GimmickDebugMessage(1,"Opening local database '" <<i_locDB<< "' " << std::endl);
@@ -175,8 +173,8 @@ namespace creaImageIO
                                                        ++it)
                {
                        delete it->second;
-               }
-         }
+               } // for
+         } // if
   }
   //==============================================================
 
@@ -361,7 +359,6 @@ path+= mLocalDescpName;
                        const std::vector<std::string>& filenames)
   {
     GimmickMessage(2,"Adding files to '"<<d<<"'"<<std::endl);
        mImageAdder.SetCurrentDatabase(d);
        mImageAdder.SetTreeHandler(GetTreeHandler(d));
        mImageAdder.SetSynchronizer(mSynchronizer);
@@ -374,9 +371,7 @@ path+= mLocalDescpName;
   void Gimmick::AddDir(const std::string& d, const std::string& f, 
                       bool recurse)
   {
-       GimmickMessage(2,"Adding dir '"<<f<<"' to '"<<d<<"' recurse:"
-                        <<recurse<<std::endl);
-
+       GimmickMessage(2,"Adding dir '"<<f<<"' to '"<<d<<"' recurse:" <<recurse<<std::endl);
        TreeHandler * handler=GetTreeHandler(d);
        mImageAdder.SetCurrentDatabase(d);
        mImageAdder.SetTreeHandler(handler);
@@ -462,15 +457,17 @@ path+= mLocalDescpName;
                   {
                           std::map<std::string, std::string>::iterator it = map_attr.begin();
                           for(; it != map_attr.end(); it++)
+                          {
                                   i_res[it->first] = it->second;
-                  }
-                  else
-                  {
+                          } // for        
+                  } else {
                            std::vector<std::string>::iterator it = i_attr.inside.begin();
-                           for(; it != i_attr.inside.end(); it++)
+                           for(; it != i_attr.inside.end(); it++) 
+                               {
                                   i_res[(*it)] = map_attr[(*it)];
-                  }
-          }
+                               } // for   
+                  } // if ALL
+          } // if size
   }
 
 
@@ -556,13 +553,11 @@ void Gimmick::fillVectInfos(std::vector<std::string> i_attr, OutputAttr &infos)
                {
 printf("EED Gimmick::fillVectInfos inside %s\n",(*it).c_str());
                        infos.inside.push_back((*it));
-               }
-               else
-               {
+               } else {
                                infos.outside.push_back((*it)); // Need to scan again the files
 printf("EED Gimmick::fillVectInfos outside %s\n",(*it).c_str());
-               }
-       }
+               } // if
+       } // for
 }
 
 const std::string Gimmick::getSummary()
index 9b4169f571d09d296304fee2f6833fa7e7b2ddff..47aa9cb2f1b817e8ec386fae312d88481f139cf0 100644 (file)
@@ -124,7 +124,6 @@ namespace creaImageIO
   /// Destructor
   GimmickView::~GimmickView()
   {
-         printf("EED GimmickView::~GimmickView  DESTROCTEUR \n");
     GimmickDebugMessage(1,"GimmickView::~GimmickView"
                        <<std::endl);
   }
@@ -529,7 +528,7 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                         OutputAttr i_attr, double i_zspc)
        {
                OutStrGimmick out;
-               vtkImageData* first = mReader.GetImage( im.front());
+               vtkImageData* first = mReader.GetImage( im.front() );
                out.img  = vtkImageData::New();
                int ext[6];
 //EED 2017-01-01 Migration VTK7
@@ -564,7 +563,6 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                out.img->AllocateScalars(first->GetScalarType(), first->GetNumberOfScalarComponents());
 #endif
 
-
                unsigned long imsize = dim[0] * dim[1];
                imsize = imsize * dim[2] ;  // deal with multiframes here
                // differents formats char , short, etc...
@@ -574,12 +572,13 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
                //!!!!out.img->SetSpacing(i_zspc);
                int slice = 0;
                std::vector<std::string>::iterator it;
+               
                for (it=im.begin(); it!=im.end(); ++it) 
                {
                        vtkImageData* cur = mReader.GetImage( (*it) );
                        memcpy(out.img->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize);
                        slice++;
-               }       
+               } // for it     
                
                getAttributes(im.front(),out.infos, i_attr);
                o_output.push_back(out);
@@ -768,7 +767,6 @@ void GimmickView::ReadImagesNotThreaded(std::vector<vtkImageData*>& s, std::vect
 
 //EED UnMosaic step...  
 //How to verifie if is a mosaic file , with how many images inside??
-
        }
 
 
index cdb6cb568c15a3cce4174f2b5522fa94f936d1b7..c3b9070ff9671f736b69dc1a69637dbbe6f3bcb2 100644 (file)
@@ -54,11 +54,11 @@ namespace creaImageIO
   //=====================================================================
   ImageReader::ImageReader()
     :   
-    mUnreadableImage(0),
+    mUnreadableImage(NULL),
     mLastFilename("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
   {
     //    std::cout << "#### ImageReader::ImageReader()"<<std::endl;
-    if (mUnreadableImage!=0) return;
+    if (mUnreadableImage!=NULL) return;
 
 
        Register( boost::shared_ptr<AbstractImageReader>(new VtkImageReader(vtkPNGReader::New() , "PNG", ".png")));
@@ -88,13 +88,18 @@ namespace creaImageIO
 #endif
  
     for (int i=0;i<dim[0];i++) 
-      for (int j=0;j<dim[1];j++) 
-       mUnreadableImage->SetScalarComponentFromFloat(i,j,0,0,0);
+       {
+               for (int j=0;j<dim[1];j++) 
+               {
+                       mUnreadableImage->SetScalarComponentFromFloat(i,j,0,0,0);
+               } // for j
+       } // for i
+       
     for (int i=0;i<dim[0];i++) 
-      {
-       mUnreadableImage->SetScalarComponentFromFloat(i,i,0,0,255);
-       mUnreadableImage->SetScalarComponentFromFloat(dim[0]-1-i,i,0,0,255);
-      }
+    {
+               mUnreadableImage->SetScalarComponentFromFloat(i,i,0,0,255);
+               mUnreadableImage->SetScalarComponentFromFloat(dim[0]-1-i,i,0,0,255);
+    } // for i
   }
   //=====================================================================
 
@@ -107,11 +112,11 @@ namespace creaImageIO
        //delete (*i);
  //     }
 //    mReader.clear();
-    if (mUnreadableImage!=0
-      {
-       mUnreadableImage->Delete();
-       mUnreadableImage = 0;
-      }
+    if (mUnreadableImage!=NULL
+    {
+               mUnreadableImage->Delete();
+               mUnreadableImage = NULL;
+    }
   }
   //=====================================================================
 
@@ -119,7 +124,6 @@ namespace creaImageIO
   void ImageReader::Register(boost::shared_ptr<AbstractImageReader> r)
   {
     mReader.push_back(r);
-
   }
 
   void ImageReader::UnRegister(const std::string i_val)
@@ -139,7 +143,6 @@ namespace creaImageIO
                std::vector<std::string >::iterator i ;
                for (i=mUnReader.begin(); i!=mUnReader.end(); i++)
                {
-                       
                        if ( (*i).c_str() == filename) 
                        {
                                ok = false;
@@ -182,22 +185,22 @@ namespace creaImageIO
   // Reads the file (CanRead must be called before : no test here)
   vtkImageData*  ImageReader::ReadImage( const std::string& filename)
   {
-         if (mLastFilename!=filename)
-      {
-       if (!CanRead(filename))  
-         { 
-           vtkImageData* im = vtkImageData::New();
-           im->ShallowCopy(mUnreadableImage);
-           return im;
-         }
-      }
-    vtkImageData* i = mLastReader->ReadImage(mLastFilename);
-    if (i==0
-      {
-       i = vtkImageData::New();
-       i->ShallowCopy(mUnreadableImage);
-      }
-    return i;
+               if (mLastFilename!=filename)
+               {
+                       if (!CanRead(filename))  
+                       
+                               vtkImageData* im = vtkImageData::New();
+                               im->ShallowCopy(mUnreadableImage);
+                               return im;
+                       } // CanRead
+               } // for mLastFilename
+               vtkImageData* i = mLastReader->ReadImage(mLastFilename);
+               if (i==NULL
+               {
+                       i = vtkImageData::New();
+                       i->ShallowCopy(mUnreadableImage);
+               } // i
+               return i;
   }
   //=====================================================================
   // Another function to read attributes for a file
index 80e30fb08781427cda051380aecc53f8c1c74522..698c011f77019e28c7ad511b332247c5b1d54a72 100644 (file)
@@ -60,17 +60,13 @@ namespace creaImageIO
     /// in a string to string map
     /// On return, the values of the map are the values 
     /// of the attributes (empty string if not available).
-    void ReadAttributes(const std::string& filename, 
-                       tree::AttributeMapType& attr);
+    void ReadAttributes(const std::string& filename,  tree::AttributeMapType& attr);
 
     /// Exclude specific readers 
     /// TO DO...
        /// Another function to read attributes for a file
-       void getAttributes(const std::string filename,
-               std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
+       void getAttributes(const std::string filename, std::map <std::string , std::string> &infos, std::vector<std::string> i_attr);
     
-
-
   protected:
     
     /// Register a reader
index d9085e06222fda2517d5feb9aded892271901cca..288236911d41ec451b5ebbcfa8bd485d9388d6ed 100644 (file)
@@ -43,15 +43,12 @@ namespace creaImageIO
   // CTor
   Listener::Listener()
   {
-
        boost::mutex::scoped_lock lock(mMutex);
-    GimmickDebugMessage(6,"Listener::Listener"
-                       <<std::endl);
-       mDrive="E:";
-       mMounted=false;
-       mAddFiles=false;
-       mRemoveFiles=true;
-
+    GimmickDebugMessage(6,"Listener::Listener"<<std::endl);
+       mDrive                  = "E:";
+       mMounted                = false;
+       mAddFiles               = false;
+       mRemoveFiles    = true;
   }
   //=====================================================================
 
@@ -60,8 +57,7 @@ namespace creaImageIO
   Listener::~Listener()
   {
     boost::mutex::scoped_lock lock(mMutex);
-    GimmickDebugMessage(6,"Listener::~Listener"
-                       <<std::endl);
+    GimmickDebugMessage(6,"Listener::~Listener"<<std::endl);
   }
   //=====================================================================
 
@@ -82,10 +78,7 @@ namespace creaImageIO
                        {
                                mMounted=true;
                        }
-                       
-               }
-               catch (...)
-               {
+               } catch (...) {
                        if(mMounted && mRemoveFiles)
                        {
                          mMounted=false;
@@ -96,7 +89,6 @@ namespace creaImageIO
                                mMounted=false;
                        }
                }
-
                clock_t endwait;
                endwait = clock () + 0.001 * CLOCKS_PER_SEC ;
                while (clock() < endwait ) {}
index 9f5e5d967b10f9331c3d6b075de9ac7ec3af08d8..998db500e5700ad8674f38f7c1d5091f81782aa7 100644 (file)
 
 namespace creaImageIO
 {
+  class wxThreadEED1
+  {
+       public:
+         void Resume() {  printf("EED wxThreadEED1::Resume() \n"); }
+         void Pause() { printf("EED wxThreadEED1::Pause() \n"); }
+         bool TestDestroy() { printf("EED wxThreadEED1::TestDestroy() \n"); return false; }
+  };
 
-  class Listener : public wxThread
+//EED 2018-08-20
+//class Listener : public wxThread
+  class Listener : public wxThreadEED1
   {
   public:
     /// Ctors 
index 7aa60acedeb72adf688478a6af7494b0edbf46e5..e7b023bba7e2ddc75e78d998e4f045036ca6c409 100644 (file)
@@ -31,6 +31,9 @@
 #include <wx/utils.h>
 #include <creaImageIOSystem.h>
 
+       #include <creaImageIODicomImageReader.h>
+
+
 #include <creaImageIOGimmick.h>
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -49,8 +52,22 @@ namespace creaImageIO
   }
   //=====================================================================
 
+  class wxThreadEED2
+  { 
+  public:
+         void Delete() {  printf("EED wxThreadEED2::Delete() \n"); }
+         int Run() { printf("EED wxThreadEED2::Run() \n"); return 0;}
+         void Pause() { printf("EED wxThreadEED2::Pause() \n"); }
+         void Create() { printf("EED wxThreadEED2::Create() \n"); }
+         bool IsAlive() { printf("EED wxThreadEED2::IsAlive() \n"); return false; }
+         bool TestDestroy() { printf("EED wxThreadEED2::TestDestroy() \n"); return false; }
+         int GetCurrentId() { printf("EED wxThreadEED2::GetCurrentId() \n"); return -999; }      
+  };
+  
   //=====================================================================
-  class ThreadedImageReader: public wxThread
+//EED 2018-08-20
+//  class ThreadedImageReader: public wxThread
+  class ThreadedImageReader: public wxThreadEED2
   {
   public:
     ThreadedImageReader(MultiThreadImageReader* tir) :
@@ -79,7 +96,7 @@ namespace creaImageIO
   //=====================================================================
   MultiThreadImageReader::MultiThreadImageReader(int number_of_threads)
     : //mDoNotSignal(false),
-      mReader(0),
+      mReader(NULL),
       mTotalMem(0),
       mTotalMemMax(1000000)
   {
@@ -89,16 +106,13 @@ namespace creaImageIO
          mDone = false;
     // Create the threads
        
-printf("EED MultiThreadImageReader::MultiThreadImageReader %d \n", number_of_threads); 
-
     for (int i=0; i<number_of_threads; i++) 
-      {
-                 //ThreadedImageReader* t = new ThreadedImageReader(this);
-                 boost::shared_ptr<ThreadedImageReader> t(new ThreadedImageReader(this), ThreadedImageReader::deleter());
-       mThreadedImageReaderList.push_back(t);
-        std::cout << "  ===> Thread "<<i
-                     <<" successfully added"<< std::endl;
-      }
+    {
+               //ThreadedImageReader* t = new ThreadedImageReader(this);
+               boost::shared_ptr<ThreadedImageReader> t(new ThreadedImageReader(this), ThreadedImageReader::deleter());
+               mThreadedImageReaderList.push_back(t);
+               std::cout << "  ===> Thread "<<i <<" successfully added"<< std::endl;
+      } // for
     mNumberOfThreadedReadersRunning = 0;
     // Init the queue
     mQueue.set(mComparator);
@@ -116,7 +130,6 @@ printf("EED MultiThreadImageReader::MultiThreadImageReader %d \n", number_of_thr
   //=====================================================================
   bool MultiThreadImageReader::Start()
   {
-printf("EED MultiThreadImageReader::Start  Start\n");
     //    std::cout << "#### MultiThreadImageReader::Start()"
     //               <<std::endl;
          if (mNumberOfThreadedReadersRunning > 0) return true;
@@ -139,7 +152,6 @@ printf("EED MultiThreadImageReader::Start  Start\n");
                wxMutexLocker locker(GetMultiThreadImageReaderUserMutex());
                //    std::cout << "EO Start : #Threads running = "
                //                    << mNumberOfThreadedReadersRunning<<std::endl;
-printf("EED MultiThreadImageReader::Start  Start\n");
     return true;
   }
   //=====================================================================
@@ -147,7 +159,6 @@ printf("EED MultiThreadImageReader::Start  Start\n");
   //=====================================================================
   void MultiThreadImageReader::Stop()
   { 
-printf("EED MultiThreadImageReader::Stop  Start\n");
 //                 std::cout << "#### MultiThreadImageReader::Stop()"
 //           <<std::endl;
   //  std::cout << "Sending stop order to the threads..."<<std::endl;
@@ -194,27 +205,44 @@ printf("EED MultiThreadImageReader::Stop  Start\n");
     while (true);
 //        std::cout << "All threads stopped : OK "<<std::endl;
 
-    ImageMapType::iterator j;
-    for (j =mImages.begin(); j!=mImages.end(); ++j)
-       {
-               delete j->first;
-    } //for 
-    mImages.clear();
+
+       CleanMImagesMap();
+       
        mDone = true;
-printf("EED MultiThreadImageReader::Stop  End\n");
+
   }
   //=====================================================================
 
+  
+   void MultiThreadImageReader::CleanMImagesMap()
+  {
+     ImageMapType::iterator j;
+     for (j=mImages.begin(); j!=mImages.end(); ++j)
+        {
+               delete j->first;
+     } //for 
+     mImages.clear();
+  }
+  
   //=====================================================================
   MultiThreadImageReader::~MultiThreadImageReader()
   {
-printf("EED MultiThreadImageReader::~MultiThreadImageReader  Start\n");
     //    std::cout << "#### MultiThreadImageReader::~MultiThreadImageReader()"
     //       <<std::endl;
     Stop();
     if (mReader) delete mReader;
        mThreadedImageReaderList.clear();
-printf("EED MultiThreadImageReader::~MultiThreadImageReader  End\n");
+
+       CleanMImagesMap();
+       
+/*     
+       ImageMapType::iterator it;
+       for (it=mImages.begin() ; it!=mImages.end(); it++)
+       {
+                       printf("MultiThreadImageReader::~MultiThreadImageReader  %s ", it.first->GetFilename() );
+       } // for it
+*/
+       
   }
   //=====================================================================
 
@@ -359,29 +387,28 @@ printf("EED MultiThreadImageReader::~MultiThreadImageReader  End\n");
        //                if (mNumberOfThreadedReadersRunning==0)
        //      if (mThreadedImageReaderList.size()==0)
        if (true)
-         {
+       {
            ImageToLoad itl(this,filename);
            ImageMapType::iterator i = mImages.find(&itl);
            if (i!=mImages.end())
-             {
-               ImageToLoadPtr pitl = const_cast<ImageToLoadPtr>(i->first);
-               // Already inserted
-               if (pitl->GetImage() != 0)
-                 {
-                   // Already read
-                   UpdateUnloadPriority(pitl,
-                                        GetMaximalPriorityWithoutLocking()+1);
-                   return pitl->GetImage();
-                 }
-             }
+           {
+                       ImageToLoadPtr pitl = const_cast<ImageToLoadPtr>(i->first);
+                       // Already inserted
+                       if (pitl->GetImage() != NULL)
+                       {
+                               // Already read
+                               UpdateUnloadPriority( pitl, GetMaximalPriorityWithoutLocking()+1 );
+                               return pitl->GetImage();
+                       } // if pitl->GetImage()
+           } // if i
+               
            ImageToLoadPtr pitl = new ImageToLoad(this,filename,0);
-           mImages[pitl] = 0;
-           pitl->SetImage(mReader->ReadImage(filename));
-           UpdateUnloadPriority(pitl,
-                                GetMaximalPriorityWithoutLocking()+1);
+           mImages[pitl]               = NULL;
+           pitl->SetImage( mReader->ReadImage(filename) );
+           UpdateUnloadPriority( pitl, GetMaximalPriorityWithoutLocking()+1 );
            return pitl->GetImage();
-         }
-
+       } // if true
+       
        /*      
        mRequestedFilename = filename;
        mRequestedImage = 0;
@@ -448,6 +475,8 @@ printf("EED MultiThreadImageReader::~MultiThreadImageReader  End\n");
     while (true);
     // 
     */
+       printf("EED MultiThreadImageReader::GetImage  END\n");  
+       
   }
   //=====================================================================
   
index f2b5f83c706c1ea53bfb005f20270ac8008527c2..01d91c508566dcbcde755b6b182b7c9f6d57a91f 100644 (file)
@@ -175,17 +175,17 @@ namespace creaImageIO
 
          std::map<std::string, std::string> getAttributes(const std::vector<std::string> i_attr);
     private:
-      MultiThreadImageReaderUsermUser;
-      std::string mFilename;
-      int mPriority;
-      int mIndex;
-      int mUnloadIndex;
-      vtkImageDatamImage;
+      MultiThreadImageReaderUser       *mUser;
+      std::string                                      mFilename;
+      int                                                      mPriority;
+      int                                                      mIndex;
+      int                                                      mUnloadIndex;
+      vtkImageData                                     *mImage;
     };
     // 
 
     /// Type of pointer on an ImageToLoad struct
-    typedef ImageToLoadImageToLoadPtr;
+    typedef ImageToLoad        *ImageToLoadPtr;
 
     /// ImageToLoadPtr comparator on priority (for image queue)
     struct ImageToLoadPtrPriorityComparator
@@ -230,10 +230,13 @@ namespace creaImageIO
 
     /// The callback from threaded readers when an image is read
     void SignalImageRead(ImageToLoadPtr p, bool purge);
-  
+
+       void CleanMImagesMap();
+
+
+       
     /// The type of map of images 
-    typedef std::map<ImageToLoadPtr,vtkImageData*,
-                    ImageToLoadPtrFilenameComparator> ImageMapType;
+    typedef std::map<ImageToLoadPtr,vtkImageData*,   ImageToLoadPtrFilenameComparator> ImageMapType;
     /// The map of images
     ImageMapType mImages;
     /// Comparator for the image to load queue
index bae87fe3adfd8abf7d9b4e7f897edaa721258525..d4699b4861fa32f98cefdb79ca341891c10506dc 100644 (file)
@@ -51,13 +51,12 @@ namespace creaImageIO
   {
     static bool first_time = true;
     if (first_time)
-      {
-       crea::MessageManager::RegisterMessageType("Gimmick!",
-                                                 "Gimmick",1);
-       crea::MessageManager::RegisterMessageType("Gimmick! DEBUG",
-                                                 "Gimmick",0);
-       first_time = false;
-      }
+    {
+printf("EED === System.h === RegisterGimmickMessageTypes   \n");               
+               crea::MessageManager::RegisterMessageType("Gimmick!",  "Gimmick",1);
+               crea::MessageManager::RegisterMessageType("Gimmick! DEBUG",  "Gimmick",0);
+               first_time = false;
+    } // if
   }
   //==============================================================
   inline void SetGimmickMessageLevel(int l)
@@ -83,6 +82,7 @@ namespace creaImageIO
 
 #define GimmickDebugMessage(LEV,MESS)                                  \
   creaDebugMessage("Gimmick! DEBUG",LEV,"[Gimmick!] DEBUG: "<<MESS);
+
 #define GimmickError(MESS)                     \
   creaError("[Gimmick!] "<<MESS);
 
index 5d218261150782177a51413bbec3b1aa01738c11..c38680ba1029dd0e8f37d9dec1bf338d4658efde 100644 (file)
@@ -66,7 +66,6 @@ namespace creaImageIO
     public:
       typedef std::map<std::string,std::string> AttributeMapType;
 
-
       /// Ctor with parent
       Node(Node* parent);
       /// Ctor with parent and attributes map 
@@ -88,7 +87,6 @@ namespace creaImageIO
       /// Returns the level of the node in the tree
       virtual int GetLevel() const { return mParent->GetLevel()+1; }
 
-        
       /// Returns the parent of the node
       Node* GetParent() const { return mParent; }
 
@@ -113,7 +111,6 @@ namespace creaImageIO
 
       /// Remove the given children from the children list
       int RemoveChildrenFromList(Node*);
-
        
          /// Get the Attributes Map
       AttributeMapType& GetAttributeMap() { return mAttributeMap; }
index ea691e387973e3500f5b076de29fcca3ec39f79b..5e706e78976149f4574def0c1ceb9469d0950b8a 100644 (file)
@@ -138,6 +138,7 @@ namespace creaImageIO
       mProgressDialog(NULL),
       mConstructed(false)
   {
+       mViewer=NULL;
     GimmickDebugMessage(1,"WxGimmickView::WxGimmickView" <<std::endl);
     // Sets the current directory to the home dir
     mCurrentDirectory =  std2wx(gimmick->GetHomeDirectory());
@@ -784,15 +785,16 @@ namespace creaImageIO
   //==================================================
    void  WxGimmickView::OnInternalIdle()
    {
-     if (!mConstructed) return;
+       if (!mConstructed) return;
      static bool first_time = true;
+        
      if (false)
      {
        first_time = false;
      }
    //   GimmickMessage(1,"WxGimmickView : Refresh viewer"<<std::endl);
        //  mViewer->StartPlayer();
-     if(mViewer)
+     if(mViewer!=NULL)
      {
         mViewer->RefreshIfNecessary();
      }
@@ -811,14 +813,12 @@ namespace creaImageIO
   //==================================================
    void  WxGimmickView::ClearSelection()
    {
-printf("EED WxGimmickView::ClearSelection Start\n");      
        pointers.clear();
        pointers.push_back(boost::shared_ptr<creaImageIO::ImagePointerHolder>(new ImagePointerHolder(GetDefaultImage())));
        //pointers.push_back(new ImagePointerHolder(GetDefaultImage()));
        mViewer->SetImageVector(pointers);
        mViewer->RefreshIfNecessary();
        ResetExtent();
-printf("EED WxGimmickView::ClearSelection End\n");        
   }
 
   //=================================================
index 0b99b6675b06754e6ed90988671a8d511c012cb9..22e1b3dbe2c6fd919a28f4af747f0a42708f535e 100644 (file)
@@ -43,7 +43,22 @@ namespace creaImageIO
   
   //=====================================================================
 
+  class wxThreadEED3
+  {
+  public:
+         void Delete() {  printf("EED wxThreadEED3::Delete() \n"); }
+         int Run() { printf("EED wxThreadEED3::Run() \n"); return 0;}
+         void Pause() { printf("EED wxThreadEED3::Pause() \n"); }
+         void Create() { printf("EED wxThreadEED3::Create() \n"); }
+         bool IsAlive() { printf("EED wxThreadEED3::IsAlive() \n"); return false; }
+         bool TestDestroy() { printf("EED wxThreadEED3::TestDestroy() \n"); return false; }
+         int GetCurrentId() { printf("EED wxThreadEED3::GetCurrentId() \n"); return -999; }      
+  };
+
+  
   //=====================================================================
+//EED 2018-08-20
+//  class WxViewerPlayer: public wxThreadEED3
   class WxViewerPlayer: public wxThread
   {
   public:
@@ -293,7 +308,7 @@ std::cout << std::endl;
   //================================================================
   bool WxViewer::RefreshIfNecessary()
   {
-    if (mNeedRefresh)
+    if (mNeedRefresh==true)
     {
                GimmickDebugMessage(10,"WxViewer : Refreshing"<<std::endl);
                mInteractor->Render();