<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:"Times New Roman", serif;font-size:10pt"><DIV><FONT size="3">Hello!<BR> <BR>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. <BR> <BR> <BR><BR>/home/hno4d/Desktop/MIRCIT/MIRCIT.cpp: In member function »virtual void MIRCIT::imageDisplayingWatershed()«:<BR>/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>*)«<BR>/home/hno4d/Desktop/MIRCIT/itkImageToVTKImageFilter.txx:79: Anmerkung: Kandidaten sind: void itk::ImageToVTKImageFilter<TInputImage>::SetInput(const TInputImage*) [with TInputImage =
itk::OrientedImage<unsigned char, 3u>]<BR>make[2]: *** [CMakeFiles/MIRCIT.dir/MIRCIT.o] Fehler 1<BR>make[1]: *** [CMakeFiles/MIRCIT.dir/all] Fehler 2<BR>make: *** [all] Fehler 2<BR><BR> <BR> <BR>How can I use my code with the following ITK VTK connection?<BR> <BR> <BR>My code:<BR> <BR> <BR><BR>typedef unsigned char PixelType;<BR>const unsigned int Dimension = 3;<BR><BR>typedef itk::OrientedImage< PixelType, Dimension > ImageType;<BR>typedef itk::ImageSeriesReader< ImageType > ReaderType;<BR><BR>ReaderType::Pointer reader = ReaderType::New();<BR><BR>typedef itk::GDCMImageIO ImageIOType;<BR>ImageIOType::Pointer dicomIO = ImageIOType::New();<BR><BR>reader->SetImageIO( dicomIO );<BR>typedef itk::GDCMSeriesFileNames NamesGeneratorType;<BR> <BR>NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<BR>nameGenerator->SetUseSeriesDetails( true );<BR>nameGenerator->AddSeriesRestriction("0008|0021"
);<BR>nameGenerator->SetDirectory( selectedDirectory);<BR> <BR>typedef std::vector< std::string > SeriesIdContainer;<BR>const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();<BR>SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<BR>SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<BR>while( seriesItr != seriesEnd )<BR>{<BR>seriesItr++;<BR>}<BR><BR>std::string seriesIdentifier;<BR>seriesIdentifier = seriesUID.begin()->c_str();<BR><BR>typedef std::vector< std::string > FileNamesContainer;<BR>FileNamesContainer fileNames;<BR>fileNames = nameGenerator->GetFileNames( seriesIdentifier );<BR><BR>reader->SetFileNames( fileNames );<BR>reader->Update();<BR><BR>typedef float InternalPixelType;<BR>typedef itk::RGBPixel<unsigned char> RGBPixelType;<BR>typedef itk::Image< RGBPixelType, Dimension > RGBImageType;<BR>// typedef itk::ImageFileWriter< RGBImageType >
WriterType;<BR>typedef itk::WatershedImageFilter< ImageType > WatershedFilterType;<BR>typedef itk::Functor::ScalarToRGBPixelFunctor< unsigned long> ColorMapFunctorType;<BR>typedef WatershedFilterType::OutputImageType LabeledImageType;<BR>typedef itk::UnaryFunctorImageFilter< LabeledImageType,RGBImageType,ColorMapFunctorType > ColorMapFilterType;<BR>typedef itk::ImageToVTKImageFilter <ImageType> ConnectorType;<BR>typedef itk::GradientMagnitudeImageFilter<ImageType, ImageType> GradientMagnitudeFilterType;<BR><BR> <BR>GradientMagnitudeFilterType::Pointer magnitudeFilter = GradientMagnitudeFilterType::New();<BR>magnitudeFilter->SetInput(reader->GetOutput());<BR><BR> <BR>WatershedFilterType::Pointer watershedFilter = WatershedFilterType::New();<BR>watershedFilter->SetInput( magnitudeFilter->GetOutput()
);<BR>watershedFilter->SetThreshold(this->sliderLevelWatershed->value());<BR>watershedFilter->SetLevel(this->sliderThresholdWatershed->value());<BR><BR>ColorMapFilterType::Pointer colorMapFilter = ColorMapFilterType::New();<BR>colorMapFilter->SetInput( watershedFilter->GetOutput() );<BR><BR>ConnectorType::Pointer connector = ConnectorType::New();<BR>connector->SetInput(colorMapFilter->GetOutput());<BR><BR>vtkImageActor* actor = vtkImageActor::New();<BR>actor->SetInput(connector->GetOutput());<BR><BR>vtkInteractorStyleImage * interactorStyle = vtkInteractorStyleImage::New();<BR><BR>vtkRenderer* renderer = vtkRenderer::New();<BR>vtkRenderWindow* renWin = vtkRenderWindow::New();<BR>vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<BR><BR>renWin->SetSize(500, 500);<BR>renWin->AddRenderer(renderer);<BR>iren->SetRenderWindow(renWin);<BR>iren->SetInteractorStyle( interactorStyle
);<BR>renderer->AddActor(actor);<BR><BR>renWin->Render();<BR>iren->Start();<BR><BR>Thank you!</FONT><BR><BR></DIV></div><br>
</body></html>