[Insight-users] VTK to ITK conversion problem
Luis Ibanez
luis.ibanez at kitware.com
Tue Oct 20 19:18:48 EDT 2009
Hi itkvtk123,
Just replace your current expression:
Im3DType::Pointer result = conv->GetOutput();
with
Im3DType::ConstPointer result = conv->GetOutput();
The Outputs of filters are "const" objects, so you should
assign them to ConstPointers ( these are SmartPointers
to const objects).
Regards,
Luis
-------------------------------------------------------------------
On Mon, Oct 19, 2009 at 7:28 PM, <itkvtk123 at gmx.net> wrote:
> Hey,
>
> I can't get the VTK to ITK converter to work.
> I'm always getting
>
> "error C2440: 'initializing' : cannot convert from 'const itk::Image<TPixel,VImageDimension> *' to 'itk::SmartPointer<TObjectType>'"
>
>
> Minimalistic code example:
>
> vtkImageData* vtkData = vtkImageData::New();
>
> //read in some vtk data
>
> //now try to convert to itk
> typedef unsigned short PixTyp;
> typedef itk::Image<PixTyp, 3> Im3DType;
>
> typedef itk::VTKImageToImageFilter<Im3DType> VTKConverter3DType;
> VTKConverter3DType::Pointer conv = VTKConverter3DType::New();
>
> conv->SetInput(vtkData);
> conv->Update();
> Im3DType::Pointer result = conv->GetOutput(); //-> C2440
>
>
> Thanks a lot
> --
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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
>
More information about the Insight-users
mailing list