]> Creatis software - creaMaracasVisu.git/commitdiff
open image dialog
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Mon, 3 May 2010 13:46:48 +0000 (13:46 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Mon, 3 May 2010 13:46:48 +0000 (13:46 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h

index 6b635e1388d06f958bc2485e69eead78f4ba6fc1..bffcd1f22735165b01d2c516fd037c35ac72bb62 100644 (file)
@@ -14,7 +14,7 @@ namespace creaMaracasVisuKernel{
        OpenImageDialog::OpenImageDialog(bool usegimmick)
        {
                img = NULL;             
-               
+               _filename = "";
                bool gimmickfound = false;
 
                if(usegimmick){
@@ -82,6 +82,7 @@ namespace creaMaracasVisuKernel{
                                vtkMetaImageReader* reader =  vtkMetaImageReader::New();
                                reader->SetFileName(path.c_str());
                                reader->Update();
+                               _filename = path;
                                img = vtkImageData::New();
                                img->DeepCopy(reader->GetOutput());
                                //reader->GetOutput()->Delete();
@@ -105,7 +106,7 @@ namespace creaMaracasVisuKernel{
                                        }
                                }*/
                                
-                               std::cout<<"image reference count "<<img->GetReferenceCount()<<std::endl;
+                               /*std::cout<<"image reference count "<<img->GetReferenceCount()<<std::endl;*/
                        }
                        //delete FD;
                }
@@ -120,4 +121,7 @@ namespace creaMaracasVisuKernel{
        vtkImageData* OpenImageDialog::getImageData(){          
                return img;
        }
+       std::string OpenImageDialog::getFilename(){
+               return _filename;
+       }
 }
index 7ae3fd33911a1281b6f78ea62219b28735ca235b..40fc3636c8a838e3ba9dfb1db629d50a1097cc88 100644 (file)
@@ -14,10 +14,13 @@ public:
        ~OpenImageDialog();
 
        vtkImageData* getImageData();
+       
+       std::string getFilename();
 protected:
 
 private:
-       vtkImageData* img;      
+       vtkImageData* img;
+       std::string _filename;
 };
 
 }
index 59716654f322010789873f7a2fe87665f0ce2eb4..4e6cd1923c56611ed93c62e348ed11d4031cdcd5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/03/26 14:52:24 $
-  Version:   $Revision: 1.16 $
+  Date:      $Date: 2010/05/03 13:46:48 $
+  Version:   $Revision: 1.17 $
 
   Copyright: (c) 2002, 2003
   License:
 
 //-----------------------------------------------------------------------------------
 double wxMaracas_N_ViewersWidget :: GetX()
-{
+{      
+       invariant();
        return mvtkmprbasedata->GetX();
 //     return wxwindow1->GetX();
 }
@@ -274,6 +275,7 @@ double wxMaracas_N_ViewersWidget :: GetX()
 //-----------------------------------------------------------------------------------
 double wxMaracas_N_ViewersWidget :: GetY()
 {
+       invariant();
        return mvtkmprbasedata->GetY();
 //     return wxwindow1->GetY();
 }
@@ -282,10 +284,17 @@ double wxMaracas_N_ViewersWidget :: GetY()
 //-----------------------------------------------------------------------------------
 double wxMaracas_N_ViewersWidget :: GetZ()
 {
+       invariant();
        return mvtkmprbasedata->GetZ();
 //     return wxwindow1->GetZ();
 }
 
+void wxMaracas_N_ViewersWidget :: invariant(){
+       if(mvtkmprbasedata == 0){
+               throw "The image has not been set in the viewer";
+       }
+}
+
 void wxMaracas_N_ViewersWidget::setColorTransferFunction(vtkColorTransferFunction* colortable){
     if (wxwindow1!=NULL) {
                wxwindow1->setColorTransferFunction(colortable);
index 0a624e7620da2c0aae763504b2e8879d8811b7b9..f938a381cd2b097a909b1c5861edfb57ae0ec602 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.h,v $
   Language:  C++
-  Date:      $Date: 2009/11/30 20:52:51 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2010/05/03 13:46:48 $
+  Version:   $Revision: 1.10 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -101,7 +101,8 @@ class creaMaracasVisu_EXPORT wxMaracas_N_ViewersWidget : public wxPanel
        std::vector<int> *nTypeView;
 
        vtkMPRBaseData* mvtkmprbasedata;  
-         
+        
+       void invariant();
   DECLARE_EVENT_TABLE( );
   };