[Insight-users] From a binary image over vtk to blender

Luis Ibanez luis.ibanez at kitware.com
Sat Aug 8 11:22:29 EDT 2009


Frederic, Lynx,


Yes a two step process will bring your itkMeshes in to Blender:


  A) Step 1: use the itkVTKPolyDataWriter.h class in
       Insight/Code/Review   to save your ITK Mesh as a vtkPolyData
       in a .vtk legacy file.

  B) Step 2: use a small VTK program to read the .vtk files
       and write it as an STL file



The code of (A) will look like:

  typedef itk::VTKPolyDataWriter<MeshType>   WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetInput( mesh );
  writer->SetFileName( "myFile.vtk" );
  writer->Write();



The code of (B) will look like:

   vtkPolyDataReader * reader = vtkPolyDataReader::New();
   reader->SetFileName( "myFile.vtk");
   vtkSTLWriter * writer = vtkSTLWriter::New();
    writer->SetFileName( "myFile.stl" );
    writer->SetInput( reader->GetOutput() );
    wirter->Write();


STL files can be read directly into Blender.


    Regards,


         Luis


--------------------------------------------------------------
On Thu, Aug 6, 2009 at 12:49 PM, Frederic Perez <fredericpcx at gmail.com>wrote:

> Hello Lynx,
>
> How can I get a nice render from blender of my watershed labeled 3D blobs?
>> I found a python script that allows to import VTK poly data
>> (VTKBlender.PolyDataMapperToBlender() at
>> http://www.ualberta.ca/CNS/RESEARCH/Vis/VTKBlender/)
>> and  I found itk::BinaryMask3DMeshSource which seems to create a surface
>> for a
>> label. So I could iterate over all labels and create a mesh for each blob.
>> Now I'm stuck on how to get these itk-meshes over vtk to blender?
>> I couldn't find any examples in the itk or vtk  docs.  Has  anyone  done
>>  this
>> before?
>
>
> I regret I know nothing about VTKBlender, but a few years ago I tackled a
> similar problem, and I took the time to write about it in my now possibly
> obsolete web pages. You might still consider the section "Importing VTK
> Isosurfaces" in http://imagingshots.com/ResearchInterest/onBlender.html(The "trick" was using STL files.) Hope it helps.
>
> Good luck,
>
> Frederic Perez
>
>
>
> _____________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090808/f3b39855/attachment.htm>


More information about the Insight-users mailing list