]> Creatis software - creaMaracasVisu.git/commitdiff
changes to viewer qt
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Mon, 27 Jun 2011 09:43:29 +0000 (09:43 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Mon, 27 Jun 2011 09:43:29 +0000 (09:43 +0000)
appli/QtVTKViewer/CMakeLists.txt
appli/QtVTKViewer/qtvtkviewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.h

index 4ce2af6f9f5991f326dab78fac2efc388670f7c9..1c18fd5170602e3c7fb661222be5fbd02a080755 100644 (file)
@@ -33,11 +33,11 @@ INCLUDE_DIRECTORIES (
 # DEPENDENCIES (LIBRARIES TO LINK WITH)
 SET ( ${EXE_NAME}_LINK_LIBRARIES
     GUIQtViewers    
-    GUIQtVolumeRenderer    
-    ITKVTKImport
+    GUIQtVolumeRenderer
     #${VTK_LIBRARIES}
     ${QT_LIBRARIES}
-    QVTK    
+    QVTK
+    creaMaracasVisu
   #    ${WXWIDGETS_LIBRARIES}
   #    ${KWWidgets_LIBRARIES}
   #    ${VTK_LIBRARIES}
index a4388d079d3b9d23bc8807fcda716de087931815..1b531816e953d2b9e9704b0d67690561338823f1 100644 (file)
 #include <QMainWindow>
 #include <QApplication>
 
-#include "itktovtkimageimport.h"
-#include "itkImage.h"
-#include "itkRGBPixel.h"
-#include "itkImageFileReader.h"
 
 
-#include "itkvtkcolortransferfunction.h"
-
 
 #include "iostream"
 
 
+#include "OpenImageDialog.h"
 
-
-
-using namespace std;                                   // make std:: accessible
+using namespace std;
+using namespace creaMaracasVisuKernel;
 
 
 int main(int argc, char **argv)
@@ -50,77 +44,22 @@ int main(int argc, char **argv)
 
 
 
+    vtkImageData* img = 0;
 
-    if (argc < 2)
-      {
-        std::cout << "ERROR: Image filename missing, Filename RGB Image 2D"
-                  << std::endl ;
-        return EXIT_FAILURE;
-      }
-
-    std::string inputFilename = argv[1];
-    //std::string inputFilename2 = argv[2];
-
-
-    typedef unsigned char PixelType;
-    typedef itk::RGBPixel< PixelType > RGBPixelType;
-    typedef itk::Image< RGBPixelType, 2 > RGBImageType;
-
-    typedef itk::ImageFileReader< RGBImageType > ImageReaderType ;
-    ImageReaderType::Pointer imageReader = ImageReaderType::New() ;
-    imageReader->SetFileName(inputFilename.c_str());
-    imageReader->Update();
-    RGBImageType::Pointer imagergb = imageReader->GetOutput();
-
-
-    typedef itk::ITKToVTKImageImport< RGBImageType > ITKToVTKRGBType;
-    ITKToVTKRGBType::Pointer itktovtkrgb = ITKToVTKRGBType::New();
-    itktovtkrgb->SetITKImage(imagergb);
-
-
-
+    if (argc < 2){
 
-    typedef itk::Image< RGBPixelType, 3> RGBImage3DType;
-    RGBImage3DType::Pointer image = RGBImage3DType::New();
-    RGBImage3DType::RegionType region;
-    region.SetSize(0, 256);
-    region.SetSize(1, 256);
-    region.SetSize(2, 256);
-    region.SetIndex(0,0);
-    region.SetIndex(1,0);
-    region.SetIndex(2,0);
+        OpenImageDialog open(true);
+        img = open.getImageData();
 
-    image->SetRegions(region);
-    image->Allocate();
+        if(img == 0){
+            std::cout << "ERROR: Image filename missing. usage qtvtkviewer <image filename>"
+                      << std::endl ;
+            return EXIT_FAILURE;
+         }
+    }else{
+        std::string inputFilename = argv[1];
+    }
 
-    typedef itk::ITKToVTKImageImport< RGBImage3DType > ITKToVTKType;
-    ITKToVTKType::Pointer itktovtk = ITKToVTKType::New();
-    itktovtk->SetITKImage(image);
-
-
-    typedef itk::Image< unsigned char, 2 > LuminanceImageType;
-    typedef itk::RGBToLuminanceImageFilter< RGBImageType, LuminanceImageType> RGBToLumType;
-    RGBToLumType::Pointer rgbtolum = RGBToLumType::New();
-    rgbtolum->SetInput(imagergb);
-    rgbtolum->Update();
-    LuminanceImageType::Pointer lumimage =  rgbtolum->GetOutput();
-
-
-    typedef itk::ITKToVTKImageImport< LuminanceImageType > ITKToVTKLuminanceType;
-    ITKToVTKLuminanceType::Pointer itktovtklum = ITKToVTKLuminanceType::New();
-    itktovtklum->SetITKImage(lumimage);
-
-
-    vtkImageData* vtkimage =itktovtklum->GetOutputVTKImage();
-
-
-
-    typedef itk::VTKColorTransferFunction< RGBImageType > VTKColorTransferType;
-    VTKColorTransferType::Pointer vtkcolortransfer = VTKColorTransferType::New();
-
-    vtkcolortransfer->SetInput(imagergb);
-    vtkcolortransfer->Update();
-    vtkColorTransferFunction* colortransfer = vtkcolortransfer->GetOutput();
 
     QApplication app(argc, argv);
 
@@ -134,12 +73,8 @@ int main(int argc, char **argv)
 
     mainwindow->show();
 
-    viewer->setImage(vtkimage);
-    viewer->SetLookupTable((vtkLookupTable*)colortransfer);
-    int scalnum = vtkimage->GetNumberOfScalarComponents();
-
-    cout<<scalnum<<endl;
-
+    viewer->setImage(img);
+    //viewer->SetLookupTable((vtkLookupTable*)colortransfer);
 
 
 
index 40fc3636c8a838e3ba9dfb1db629d50a1097cc88..dc60805335ec7f943d9e55ccd8794087eb87db1c 100644 (file)
@@ -4,7 +4,6 @@
 #include "marTypes.h"
 #include "vtkImageData.h"
 #include "vtkMetaImageReader.h"
-#include "wx/wx.h"
 
 namespace creaMaracasVisuKernel{