# Generate binary file from MarchingCube

**URL:** <https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404>\
**Category:** Development\
**Tags:** file-export\
**Created:** [March 22, 2018, 4:06pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404 "2018-03-22T16:06:06Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MGM](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MGM](https://discourse.slicer.org/u/MGM)\
**Post date:** [March 22, 2018, 4:06pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/1 "2018-03-22T16:06:07Z")

</div>

Hello everyone,

After generating a surface via " vtkMarchingCube " from 3d volume file, I would like to write binary format output files ( point.bin and index.bin), which mean, instead of using " vtkPolyDataWriter " to generate “\*.vtk” file.

I appreciate your help.

Thank you

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 22, 2018, 5:15pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/2 "2018-03-22T17:15:01Z")

</div>

> [@MGM](#):
>
> write binary format output files

I don’t think VTK can write meshes in .bin file format (I’ve never even heard of this bin file format before). You can save in various other file formats (stl, ply, obj, …) instead, which most software should be able to read. If you really need these bin files then you should be able to find free mesh converter software that can generate those from stl/ply/obj.

---

<div class="post-metadata">

**Author:** ![MGM](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MGM](https://discourse.slicer.org/u/MGM)\
**Post date:** [March 22, 2018, 5:58pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/3 "2018-03-22T17:58:51Z")

</div>

Hi @lassoan

Thank you for your fast reply.

Yes, the \*.bin isn’t for mesh file format.

As I mentioned, I’m looking for a way, to use the surface generated by vtkMarchingCubes, in order to get binary files represents the mesh, but others then vtk format.  
which means instead of getting vtk

Thank you again

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 22, 2018, 6:00pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/4 "2018-03-22T18:00:00Z")

</div>

Would you like to save a surface mesh or a binary labelmap? In what file format?

---

<div class="post-metadata">

**Author:** ![MGM](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MGM](https://discourse.slicer.org/u/MGM)\
**Post date:** [March 22, 2018, 6:59pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/5 "2018-03-22T18:59:31Z")

</div>

In fact, I would like to extract point and index from surface mesh, in binary files.  
so, I will not be involved with vtk writers

Thank you @lassoan

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 22, 2018, 8:18pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/6 "2018-03-22T20:18:27Z")

</div>

stl, ply, obj, vtk, vtp files all store point positions and point indexes (for defining cells), so you should be able to use any of these file formats. What software do you use for further processing of this exported data?

---

<div class="post-metadata">

**Author:** ![MGM](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MGM](https://discourse.slicer.org/u/MGM)\
**Post date:** [March 23, 2018, 8:37am UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/7 "2018-03-23T08:37:03Z")

</div>

Hi @lassoan

For the software, I didn’t yet achieve this step.  
but for vtk files, I use Paraview.

Thank you

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 23, 2018, 12:45pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/8 "2018-03-23T12:45:41Z")

</div>

ParaView can load stl, ply, obj, vtk, vtp files, so you can choose any of these formats and you’ll be able to use it in ParaView.

---

<div class="post-metadata">

**Author:** ![MGM](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MGM](https://discourse.slicer.org/u/MGM)\
**Post date:** [March 26, 2018, 2:42pm UTC](https://discourse.slicer.org/t/generate-binary-file-from-marchingcube/2404/9 "2018-03-26T14:42:43Z")

</div>

Thank you @lassoan for your reply 🙂
