[Insight-users] how to write *.vtk file

Luis Ibanez luis.ibanez at kitware.com
Thu May 6 11:46:44 EDT 2010


Hi Sutrisno,

The problem is that you are passing an
Image as the input to the PolyData writer.

The Writer expects that its input will be
an itkMesh.

Please look at the following files, as
examples of usage:

  Insight/Testing/Code/Review/
      itkVTKPolyDataWriterTest2.cxx
      itkVTKPolyDataWriterTest.cxx


   Regards,


        Luis


-------------------------------------------------------------------
On Thu, May 6, 2010 at 11:38 AM, SUTRISNO SUTRISNO
<sutrisno_link at yahoo.com>wrote:

>
> Hi luis,
>
> You said that If I want to save surface
>  I must extract an itkMesh out of the image.
> When I try extract surface from image (use SurfaceExtraction.cxx)
> there was error :
>
> error: no matching function for call to
> ‘itk::VTKPolyDataWriter<itk::Mesh<double, 3u,
> itk::DefaultStaticMeshTraits<double, 3u, 3u, float, float, double> >
> >::SetInput(itk::OrientedImage<short int, 3u>*)’
> /usr/local/include/InsightToolkit/Review/itkVTKPolyDataWriter.txx:54: note:
> candidates are: void itk::VTKPolyDataWriter<TInputMesh>::SetInput(const
> TInputMesh*) [with TInputMesh = itk::Mesh<double, 3u,
> itk::DefaultStaticMeshTraits<double, 3u, 3u, float, float, double> >]
>
> my Listing :
>
>   typedef itk::Mesh<double>                         MeshType;
>   typedef itk::BinaryMask3DMeshSource< ImageType, MeshType >
> MeshSourceType;
>     MeshSourceType::Pointer meshSource = MeshSourceType::New();
>     const PixelType objectValue = static_cast<PixelType>( 1250
> );
>     meshSource->SetObjectValue( objectValue );
>     meshSource->SetInput( reader->GetOutput() );
>
>   typedef itk::VTKPolyDataWriter< MeshType > WriterType;
>     WriterType::Pointer writer = WriterType::New();
>     writer->SetFileName( argv[2] );
>     writer->SetInput( reader->GetOutput() );
>     writer->Update();
>
> Regards,
>
>
>          Sutrisno
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100506/37fba6e3/attachment.htm>


More information about the Insight-users mailing list