From: Juan Prieto Date: Mon, 27 Jun 2011 09:43:29 +0000 (+0000) Subject: changes to viewer qt X-Git-Tag: v1.0.4~95 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cecf61997249f6e44a9ce798cb0cf54085473af6;p=creaMaracasVisu.git changes to viewer qt --- diff --git a/appli/QtVTKViewer/CMakeLists.txt b/appli/QtVTKViewer/CMakeLists.txt index 4ce2af6..1c18fd5 100644 --- a/appli/QtVTKViewer/CMakeLists.txt +++ b/appli/QtVTKViewer/CMakeLists.txt @@ -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} diff --git a/appli/QtVTKViewer/qtvtkviewer.cxx b/appli/QtVTKViewer/qtvtkviewer.cxx index a4388d0..1b53181 100644 --- a/appli/QtVTKViewer/qtvtkviewer.cxx +++ b/appli/QtVTKViewer/qtvtkviewer.cxx @@ -23,22 +23,16 @@ #include #include -#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 " + << 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<setImage(img); + //viewer->SetLookupTable((vtkLookupTable*)colortransfer); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.h index 40fc363..dc60805 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/OpenImageDialog.h @@ -4,7 +4,6 @@ #include "marTypes.h" #include "vtkImageData.h" #include "vtkMetaImageReader.h" -#include "wx/wx.h" namespace creaMaracasVisuKernel{