<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">&lt;<a href="mailto:rickf@fullspectrumsw.com">rickf@fullspectrumsw.com</a>&gt;</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&lt; PixelType, Dimension &gt;  ITKImageType;<br>
<br>
typedef itk::ImageSeriesReader&lt; ITKImageType &gt; 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 -&gt;SetInputDirectory(path);<br>
<br>
const ImageReaderType::FileNamesContainer &amp; inputFileNames = inputNames<br>
-&gt;GetInputFileNames();<br>
<br>
   imageReader-&gt;SetImageIO( gdcmIO );<br>
   imageReader-&gt;SetFileNames(inputFileNames);<br>
   imageReader-&gt;Update();<br>
   itk::ImageToVTKImageFilter&lt;FixedImageType&gt;::Pointer imageFilter =<br>
itk::ImageToVTKImageFilter&lt;FixedImageType&gt;::New();<br>
<br>
   imageFilter-&gt;SetInput(imageReader-&gt;GetOutput());<br>
<br>
   imageFilter-&gt;Update();<br>
<br>
  vtkImageData *outImage = imageFilter-&gt;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&#39;m using DLLs so it&#39;s hard to trace into<br>
the code -<br>
<br>
<br>
this-&gt;WindowLevel = vtkImageMapToWindowLevelColors::New();<br>
this-&gt;WindowLevel-&gt;SetInputConnection(image-&gt;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-&gt;WindowLevel-&gt;GetInput() right after SetInputConnection<br>
WindowLevel-&gt;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>