[vtkusers] VolumeRendering Problem

Yusuf OEZBEK nasil122002 at yahoo.de
Mon Jun 1 10:18:19 EDT 2009


Hello!

My CMakeList.cxx :
project (MIRCIT)

#
#FIND ITK
#
FIND_PACKAGE(ITK)
IF (USE_ITK_FILE)
  INCLUDE (${USE_ITK_FILE})
ELSE (USE_ITK_FILE)
  MESSAGE( FATAL_ERROR "This application requires ITK. One of these components is missing. Please verify configuration")
ENDIF (USE_ITK_FILE)


#
#FIND VTK
#
FIND_PACKAGE(VTK)
IF(USE_VTK_FILE)
 INCLUDE(${USE_VTK_FILE})
ELSE (USE_VTK_FILE)
 MESSAGE( FATAL_ERROR "This app. req. VTK. One of these comp. is. missing. Please verify conf.")
ENDIF (USE_VTK_FILE)


#
#FIND FLTK
#
FIND_PACKAGE(FLTK)
  IF (FLTK_FOUND)
  INCLUDE_DIRECTORIES (${FLTK_INCLUDE_DIR})
    LINK_LIBRARIES( ${FLTK_LIBRARIES} ${OPENGL_LIBRARIES} )
  ELSE (FLTK_FOUND)
    MESSAGE( FATAL_ERROR "This application requires FLTK. One of these components is missing. Please verify configuration")
ENDIF (FLTK_FOUND)

add_executable (MIRCIT main.cpp MIRCIT.cpp MIRCIT.h MIRCITGui.cpp MIRCITGui.h info.cpp vtkFlRenderWindowInteractor.cpp)


TARGET_LINK_LIBRARIES(MIRCIT vtkCommon vtkexpat vtkFiltering vtkfreetype vtkftgl vtkGraphics vtkHybrid vtkImaging vtkIO vtkjpeg vtkpng vtkVolumeRendering vtkRendering vtktiff vtkzlib ITKBasicFilters ITKCommon ITKIO ${ITK_LIBRARIES})

Thanks!




________________________________
Von: zhouyu <iconme at 163.com>
An: Yusuf OEZBEK <nasil122002 at yahoo.de>
Gesendet: Montag, den 1. Juni 2009, 10:08:33 Uhr
Betreff: Re: [vtkusers] VolumeRendering Problem

  
You may miss linking some  libraries, I'm not quite sure though. If so, you can add them in the  CMakeList.txt.
 
Yu
 
 
2009-06-01 
________________________________
 
________________________________
  
发件人: Yusuf OEZBEK 
发送时间: 2009-06-01  04:25:14 
收件人: VTK Mailinglist 
抄送: 
主题: [vtkusers] VolumeRendering  Problem 
Hello! 

I wanted my watershed-segmentation result (from ITK)  through vtkVolumeProMapper 3D So make a volume. I have used vtkVolumeProMapper  and vtkVolume. But I always get the error "undefined reference to  vtkVolumeProMapper". Where is my mistake? I would be glad if you can  help. 

Thank you! 

My code:

void  MIRCIT::imageDisplayingWatershed(){

 this->displayImage3D->show();
 this->displayImage3D->redraw();

   typedef unsigned char PixelType;
  const unsigned int Dimension =  3;

  typedef itk::OrientedImage< PixelType, Dimension >  ImageType;
  typedef itk::ImageSeriesReader< ImageType >  ReaderType;
  ReaderType::Pointer reader =  ReaderType::New();

  typedef itk::GDCMImageIO ImageIOType;
   ImageIOType::Pointer dicomIO = ImageIOType::New();
  
   reader->SetImageIO( dicomIO );

  typedef itk::GDCMSeriesFileNames  NamesGeneratorType;
  NamesGeneratorType::Pointer nameGenerator =  NamesGeneratorType::New();

  nameGenerator->SetUseSeriesDetails(  true );
  nameGenerator->AddSeriesRestriction("0008|0021"  );
  nameGenerator->SetDirectory( selectedDirectory);

   typedef std::vector< std::string > SeriesIdContainer;
    
  const SeriesIdContainer & seriesUID =  nameGenerator->GetSeriesUIDs();
  SeriesIdContainer::const_iterator  seriesItr = seriesUID.begin();
  SeriesIdContainer::const_iterator  seriesEnd = seriesUID.end();

  while( seriesItr != seriesEnd  )
  {
  seriesItr++;
  }

  std::string  seriesIdentifier;
  seriesIdentifier =  seriesUID.begin()->c_str();

  typedef std::vector< std::string  > FileNamesContainer;
  FileNamesContainer fileNames;

   fileNames = nameGenerator->GetFileNames( seriesIdentifier );
   reader->SetFileNames( fileNames );
   reader->Update();

  typedef float InternalPixelType;
   typedef itk::RGBPixel<unsigned char> RGBPixelType;
  typedef  itk::Image< RGBPixelType, Dimension > RGBImageType;
  typedef  itk::ImageFileWriter< RGBImageType > WriterType;
  typedef  itk::WatershedImageFilter< ImageType > WatershedFilterType;
   typedef itk::Functor::ScalarToRGBPixelFunctor< unsigned long>  ColorMapFunctorType;
  typedef WatershedFilterType::OutputImageType  LabeledImageType;
  typedef  itk::UnaryFunctorImageFilter<LabeledImageType,RGBImageType,ColorMapFunctorType  > ColorMapFilterType;
  typedef itk::ImageToVTKImageFilter  <LabeledImageType> ConnectorType;
  typedef  itk::GradientMagnitudeImageFilter<ImageType, ImageType>  GradientMagnitudeFilterType;
 
   GradientMagnitudeFilterType::Pointer magnitudeFilter =  GradientMagnitudeFilterType::New();
   magnitudeFilter->SetInput(reader->GetOutput());

   WatershedFilterType::Pointer watershedFilter =  WatershedFilterType::New();
  watershedFilter->SetInput(  magnitudeFilter->GetOutput() );
   watershedFilter->SetLevel(this->sliderLevelWatershed->value());
   watershedFilter->SetThreshold(this->sliderLevelWatershed->value());

   ColorMapFilterType::Pointer colorMapFilter =  ColorMapFilterType::New();
  colorMapFilter->SetInput(  watershedFilter->GetOutput() );

  ConnectorType::Pointer  connector = ConnectorType::New();
   connector->SetInput(watershedFilter->GetOutput());

   vtkImageShiftScale *shift = vtkImageShiftScale::New();
   shift->SetInput(connector->GetOutput());
   shift->SetOutputScalarTypeToUnsignedChar();

  vtkVolumeProMapper  *mapperb = vtkVolumeProMapper::New();
   mapperb->SetInputConnection(shift->GetOutputPort());

   vtkVolume *volumeb = vtkVolume::New();
   volumeb->SetMapper(mapperb);

  camera3D =  vtkCamera::New();
  camera3D->SetViewUp(0, 0, -1);
   camera3D->SetPosition(0, 1, 0);
  camera3D->SetFocalPoint(0, 0,  0);
  camera3D->ComputeViewPlaneNormal();
   camera3D->Azimuth(20);

  renderer3DWaterShed =  vtkRenderer::New();
  renderWindow3DWaterShed =  vtkRenderWindow::New();
   renderWindow3DWaterShed->AddRenderer(renderer3DWaterShed);

   displayImage3D->SetRenderWindow(renderWindow3DWaterShed);
   displayImage3D->SetInteractorStyle(mode3DWaterShed);
   displayImage3D->Initialize();

   renderer3DWaterShed->AddViewProp(volumeb);
   renderer3DWaterShed->SetActiveCamera(camera3D);
   renderer3DWaterShed->ResetCamera();
   camera3D->Dolly(1.3);
   renderer3DWaterShed->ResetCameraClippingRange();
   renderer3DWaterShed->Render();

   this->displayImage3D->show();
   this->displayImage3D->redraw();

  WriterType::Pointer writer =  WriterType::New();
  writer->SetInput( colorMapFilter->GetOutput()  );
  writer->SetFileName("fds.tiff" );
   writer->Update();
}


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090601/67684ea0/attachment.htm>


More information about the vtkusers mailing list