[Insight-users] ITK to VTK image

Dženan Zukić dzenanz at gmail.com
Mon Nov 14 04:59:46 EST 2011


Take a look at this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/VolumeRendering/itkVtkImageConvert

HTH

On Sat, Nov 12, 2011 at 04:22, Rick Frank <rickf at fullspectrumsw.com> wrote:

>
> I am having a strange problem after converting a DICOM image from
> ITK-VTK.
>  Below is my code.
>
> const    unsigned int    Dimension = 3;
> typedef  short           PixelType;
> typedef itk::Image< PixelType, Dimension >  ITKImageType;
>
> typedef itk::ImageSeriesReader< ITKImageType > ImageReaderType;
>
> typedef itk::GDCMImageIO ImageIOType;
> typedef itk::GDCMSeriesFileNames InputNamesGeneratorType;
> typedef itk::NumericSeriesFileNames OutputNamesGeneratorType;
>  ImageReaderType::Pointer  imageReader  = ImageReaderType::New();
>
> ImageIOType::Pointer gdcmIO = ImageIOType::New();
> InputNamesGeneratorType::Pointer inputNames =
> InputNamesGeneratorType::New();
> inputNames ->SetInputDirectory(path);
>
> const ImageReaderType::FileNamesContainer & inputFileNames = inputNames
> ->GetInputFileNames();
>
>   imageReader->SetImageIO( gdcmIO );
>   imageReader->SetFileNames(inputFileNames);
>   imageReader->Update();
>   itk::ImageToVTKImageFilter<FixedImageType>::Pointer imageFilter =
> itk::ImageToVTKImageFilter<FixedImageType>::New();
>
>   imageFilter->SetInput(imageReader->GetOutput());
>
>   imageFilter->Update();
>
>  vtkImageData *outImage = imageFilter->GetOutput();
>
> *******At this point the image seems to be ok *************
>
> A little later when I pass the image into
> vtkImageMapToWindowLevelColors:: SetInputConnection()
>  it seems to just ignore it. I'm using DLLs so it's hard to trace into
> the code -
>
>
> this->WindowLevel = vtkImageMapToWindowLevelColors::New();
> this->WindowLevel->SetInputConnection(image->GetProducerPort());
>
> I get the following error
> ERROR: In
> C:\Projects\Civco\AccuLoc-InView\trunk\vtk-5.8.0\Filtering\vtkDemandDriv
> enPipeline.cxx, line 802
> vtkStreamingDemandDrivenPipeline (10AA6B78): Input for connection index
> 0 on input port index 0 for algorithm
> vtkImageMapToWindowLevelColors(0BF63040
>
>
> if I call
> this->WindowLevel->GetInput() right after SetInputConnection
> WindowLevel->GetInput() returns null.
>
> I would think a debug assert or something would fire if the
> SetInputConnection() failed?
>
> Does this look familiar? Is there a better way to bring in an image from
> ITK to VTK?
>
>
> Thanks
>
> Rick
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111114/d5e2497a/attachment.htm>


More information about the Insight-users mailing list