<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:10pt"><DIV>Hello!</DIV>
<DIV> </DIV>
<DIV>
<DIV id=result_box dir=ltr>I wanted my 3D watershed segmentation combine with VTK and to show it in a VTK window. For the connection between ITK and VTK, I used itkImageToVTKImageFilter. But it gives following error. </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><SPAN lang=DE-AT><SPAN lang=DE-AT>
<P>/home/hno4d/Desktop/MIRCIT/MIRCIT.cpp: In member function »virtual void MIRCIT::imageDisplayingWatershed()«:</P>
<P>/home/hno4d/Desktop/MIRCIT/MIRCIT.cpp:1719: Fehler: keine passende Funktion für Aufruf von »itk::ImageToVTKImageFilter<itk::OrientedImage<unsigned char, 3u> >::SetInput(itk::Image<itk::RGBPixel<unsigned char>, 3u>*)«</P>
<P>/home/hno4d/Desktop/MIRCIT/itkImageToVTKImageFilter.txx:79: Anmerkung: Kandidaten sind: void itk::ImageToVTKImageFilter<TInputImage>::SetInput(const TInputImage*) [with TInputImage = itk::OrientedImage<unsigned char, 3u>]</P>
<P>make[2]: *** [CMakeFiles/MIRCIT.dir/MIRCIT.o] Fehler 1</P>
<P>make[1]: *** [CMakeFiles/MIRCIT.dir/all] Fehler 2</P>
<P>make: *** [all] Fehler 2</P>
<P> </P></SPAN></SPAN></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>How can I use my code with the following ITK VTK connection?</DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>My code:</DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><SPAN lang=DE-AT>
<P>typedef unsigned char PixelType;</P>
<P>const unsigned int Dimension = 3;</P>
<P> </P>
<P>typedef itk::OrientedImage< PixelType, Dimension > ImageType;</P>
<P>typedef itk::ImageSeriesReader< ImageType > ReaderType;</P>
<P> </P>
<P>ReaderType::Pointer reader = ReaderType::New();</P>
<P> </P>
<P>typedef itk::GDCMImageIO ImageIOType;</P>
<P>ImageIOType::Pointer dicomIO = ImageIOType::New();</P>
<P> </P>
<P></P>
<P>reader->SetImageIO( dicomIO );</P>
<P>typedef itk::GDCMSeriesFileNames NamesGeneratorType;</P>
<P> </P>
<P>NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();</P>
<P>nameGenerator->SetUseSeriesDetails( true );</P>
<P>nameGenerator->AddSeriesRestriction("0008|0021" );</P>
<P>nameGenerator->SetDirectory( selectedDirectory);</P>
<P> </P>
<P>typedef std::vector< std::string > SeriesIdContainer;</P>
<P></P>
<P>const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();</P>
<P></P>
<P>SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();</P>
<P>SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();</P>
<P>while( seriesItr != seriesEnd )</P>
<P>{</P>
<P>seriesItr++;</P>
<P>}</P>
<P>std::string seriesIdentifier;</P>
<P>seriesIdentifier = seriesUID.begin()->c_str();</P>
<P>typedef std::vector< std::string > FileNamesContainer;</P>
<P>FileNamesContainer fileNames;</P>
<P>fileNames = nameGenerator->GetFileNames( seriesIdentifier );</P>
<P>reader->SetFileNames( fileNames );</P>
<P>reader->Update();</P>
<P> </P>
<P> </P>
<P> </P>
<P>typedef float InternalPixelType;</P>
<P>typedef itk::RGBPixel<unsigned char> RGBPixelType;</P>
<P>typedef itk::Image< RGBPixelType, Dimension > RGBImageType;</P>
<P>// typedef itk::ImageFileWriter< RGBImageType > WriterType;</P>
<P>typedef itk::WatershedImageFilter< ImageType > WatershedFilterType;</P>
<P>typedef itk::Functor::ScalarToRGBPixelFunctor< unsigned long> ColorMapFunctorType;</P>
<P>typedef WatershedFilterType::OutputImageType LabeledImageType;</P>
<P>typedef itk::UnaryFunctorImageFilter< LabeledImageType,RGBImageType,ColorMapFunctorType > ColorMapFilterType;</P>
<P>typedef itk::ImageToVTKImageFilter <ImageType> ConnectorType;</P>
<P>typedef itk::GradientMagnitudeImageFilter<ImageType, ImageType> GradientMagnitudeFilterType;</P>
<P> </P>
<P></P>
<P>GradientMagnitudeFilterType::Pointer magnitudeFilter = GradientMagnitudeFilterType::New();</P>
<P>magnitudeFilter->SetInput(reader->GetOutput());</P>
<P> </P>
<P>WatershedFilterType::Pointer watershedFilter = WatershedFilterType::New();</P>
<P>watershedFilter->SetInput( magnitudeFilter->GetOutput() );</P>
<P>watershedFilter->SetThreshold(this->sliderLevelWatershed->value());</P>
<P>watershedFilter->SetLevel(this->sliderThresholdWatershed->value());</P>
<P> </P>
<P>ColorMapFilterType::Pointer colorMapFilter = ColorMapFilterType::New();</P>
<P>colorMapFilter->SetInput( watershedFilter->GetOutput() );</P>
<P> </P>
<P>ConnectorType::Pointer connector = ConnectorType::New();</P>
<P>connector->SetInput(colorMapFilter->GetOutput());</P>
<P> </P>
<P>vtkImageActor* actor = vtkImageActor::New();</P>
<P>actor->SetInput(connector->GetOutput());</P>
<P> </P>
<P>vtkInteractorStyleImage * interactorStyle = vtkInteractorStyleImage::New();</P>
<P> </P>
<P>vtkRenderer* renderer = vtkRenderer::New();</P>
<P>vtkRenderWindow* renWin = vtkRenderWindow::New();</P>
<P>vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();</P>
<P> </P>
<P>renWin->SetSize(500, 500);</P>
<P>renWin->AddRenderer(renderer);</P>
<P>iren->SetRenderWindow(renWin);</P>
<P>iren->SetInteractorStyle( interactorStyle );</P>
<P>renderer->AddActor(actor);</P>
<P> </P>
<P>renWin->Render();</P>
<P>iren->Start();</P>
<P> </P>
<P> </P>
<P>Thank you!</P></SPAN></DIV></DIV></div><br>
</body></html>