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

SUTRISNO SUTRISNO sutrisno_link at yahoo.com
Fri May 7 04:56:22 EDT 2010



 Hi luis,

I already knew how to write polydata. 
now the problem is how to extract  surface of the image. is my code true?
There is no problem when I compile, but when I display the surface (bone.vtk) it's not appear as a surface.

 
my code :

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( "bone.vtk" ); 
    writer->SetInput( meshSource->GetOutput() ); 
    writer->Update();

Regards,

 Sutrisno



________________________________
Dari: Luis Ibanez <luis.ibanez at kitware.com>
Kepada: SUTRISNO SUTRISNO <sutrisno_link at yahoo.com>
Cc: itk <Insight-users at itk.org>
Terkirim: Kam, 6 Mei, 2010 22:46:44
Judul: Re: how to write *.vtk file


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/20100507/4884eb48/attachment.htm>


More information about the Insight-users mailing list