<font size="2"><font face="verdana,sans-serif">Take a look at this example:<br><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/itkVtkImageConvert">http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/itkVtkImageConvert</a><br>
<br>HTH<br></font></font><br><div class="gmail_quote">On Sat, Nov 12, 2011 at 04:22, Rick Frank <span dir="ltr"><<a href="mailto:rickf@fullspectrumsw.com">rickf@fullspectrumsw.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
I am having a strange problem after converting a DICOM image from<br>
ITK-VTK.<br>
Below is my code.<br>
<br>
const unsigned int Dimension = 3;<br>
typedef short PixelType;<br>
typedef itk::Image< PixelType, Dimension > ITKImageType;<br>
<br>
typedef itk::ImageSeriesReader< ITKImageType > ImageReaderType;<br>
<br>
typedef itk::GDCMImageIO ImageIOType;<br>
typedef itk::GDCMSeriesFileNames InputNamesGeneratorType;<br>
typedef itk::NumericSeriesFileNames OutputNamesGeneratorType;<br>
ImageReaderType::Pointer imageReader = ImageReaderType::New();<br>
<br>
ImageIOType::Pointer gdcmIO = ImageIOType::New();<br>
InputNamesGeneratorType::Pointer inputNames =<br>
InputNamesGeneratorType::New();<br>
inputNames ->SetInputDirectory(path);<br>
<br>
const ImageReaderType::FileNamesContainer & inputFileNames = inputNames<br>
->GetInputFileNames();<br>
<br>
imageReader->SetImageIO( gdcmIO );<br>
imageReader->SetFileNames(inputFileNames);<br>
imageReader->Update();<br>
itk::ImageToVTKImageFilter<FixedImageType>::Pointer imageFilter =<br>
itk::ImageToVTKImageFilter<FixedImageType>::New();<br>
<br>
imageFilter->SetInput(imageReader->GetOutput());<br>
<br>
imageFilter->Update();<br>
<br>
vtkImageData *outImage = imageFilter->GetOutput();<br>
<br>
*******At this point the image seems to be ok *************<br>
<br>
A little later when I pass the image into<br>
vtkImageMapToWindowLevelColors:: SetInputConnection()<br>
it seems to just ignore it. I'm using DLLs so it's hard to trace into<br>
the code -<br>
<br>
<br>
this->WindowLevel = vtkImageMapToWindowLevelColors::New();<br>
this->WindowLevel->SetInputConnection(image->GetProducerPort());<br>
<br>
I get the following error<br>
ERROR: In<br>
C:\Projects\Civco\AccuLoc-InView\trunk\vtk-5.8.0\Filtering\vtkDemandDriv<br>
enPipeline.cxx, line 802<br>
vtkStreamingDemandDrivenPipeline (10AA6B78): Input for connection index<br>
0 on input port index 0 for algorithm<br>
vtkImageMapToWindowLevelColors(0BF63040<br>
<br>
<br>
if I call<br>
this->WindowLevel->GetInput() right after SetInputConnection<br>
WindowLevel->GetInput() returns null.<br>
<br>
I would think a debug assert or something would fire if the<br>
SetInputConnection() failed?<br>
<br>
Does this look familiar? Is there a better way to bring in an image from<br>
ITK to VTK?<br>
<br>
<br>
Thanks<br>
<br>
Rick<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br>