]> Creatis software - creaImageIO.git/blobdiff - src/creaImageIOWxViewer.cpp
Merge remote-tracking branch 'origin/changeWx28to30' into vtk7itk4wx3
[creaImageIO.git] / src / creaImageIOWxViewer.cpp
index 92ec86c6a1de26819b32894642df172a5902a662..ee2258aa2ea73d8b4b921e1e3dba275799a261dd 100644 (file)
@@ -1,11 +1,36 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+#                        pour la Santé)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and 
+#  abiding by the rules of distribution of free software. You can  use, 
+#  modify and/ or redistribute the software under the terms of the CeCILL-B 
+#  license as circulated by CEA, CNRS and INRIA at the following URL 
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability. 
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
 
 #include <creaImageIOWxViewer.h>
-#include <creaImageIOSystem.h>
+
 #include <fstream>
 #include <vtkCamera.h>
 #include <vtkRenderer.h>
 #include <vtkImageData.h>
-#include <creawxVTKRenderWindowInteractor.h>
 #include <creaMessageManager.h>
 #include <stdio.h>
 #include <time.h>
@@ -60,7 +85,7 @@ namespace creaImageIO
     mLastImageShown = NULL;
        
        // previewer    
-    mInteractor = new crea::creawxVTKRenderWindowInteractor(this,-1);
+    mInteractor = new crea::wxVTKRenderWindowInteractor(this,-1);
     mInteractor->UseCaptureMouseOn();  
  
     mViewer    = vtkImageViewer2::New();
@@ -119,7 +144,8 @@ namespace creaImageIO
        GimmickDebugMessage(6,"WxViewer::SetImageVector"<<std::endl);
        imagePointers=pointers;
        
-       mslide->SetMax(pointers.size());
+       mslide->SetMax((int)pointers.size());
+       mslide->SetMin(1);
        // Refresh don't work, TO MODIFY
        mslide->Refresh();
        mslide->ClearTicks();
@@ -136,7 +162,6 @@ namespace creaImageIO
        
          mMutex.Unlock();
        wxMutexLocker lock(mMutex);
-       
            
     GimmickMessage(2,"WxViewer::ShowNextImage() "
                   <<mCurrent+1<<"/"
@@ -182,20 +207,40 @@ namespace creaImageIO
                        <<std::endl);
     if (im==0) return;
 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     mViewer->SetInput(im);
+#else
+    mViewer->SetInputData(im);
+#endif
 
     mViewer->SetSlice( 0 );
 
     int x1,x2,y1,y2,z1,z2;
     double spx,spy,spz;
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     im->Update();
+#else
+       // ...
+#endif
+
 
 //std::cout << "in WxViewer::ShowImage PrintSelf() =";
 //im->PrintSelf(std::cout, vtkIndent(2));
 
     im->GetSpacing(spx,spy,spz);
     //im->GetExtent (x1,x2,y1,y2,z1,z2);  // JPR
+
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     im->GetWholeExtent (x1,x2,y1,y2,z1,z2); 
+#else
+    im->GetExtent (x1,x2,y1,y2,z1,z2); 
+#endif
+
+
 /*       
 std::cout << "in WxViewer::ShowImage GetWholeExtent ext =";
        std::cout << "   [x1]=" << x1;
@@ -232,6 +277,15 @@ std::cout << std::endl;
        mViewer->SetColorLevel(0.5 * (range[1] + range[0]));
 
        mViewer->GetRenderer()->ResetCamera();
+                 
+       //EED 21 mars 2012  FLIP problem  ..PLOP..
+       vtkCamera *camera =mViewer->GetRenderer()->GetActiveCamera();             
+       camera->SetViewUp               (       0               ,       -1              ,       0       );
+       camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     , -10000);
+       camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       );
+       camera->SetParallelScale( (x2-x1)/3.0 );
+                 
+                 
        double bounds[6];
 
        mViewer->GetRenderer()->ComputeVisiblePropBounds(bounds);
@@ -306,7 +360,7 @@ std::cout << std::endl;
        
        void WxViewer::OnSlide(wxCommandEvent &Event)
         {
-                mCurrent = mslide->GetValue();
+                mCurrent = mslide->GetValue() -1;
                 StartPlayer();
         }
         //================================================================