Cortical surface file conversion

Viewing 7 reply threads
  • Author
    Posts
    • #2958
      grojas
      Participant

      Hi:

      I need to convert the cortical surface from DFS format to another mesh format (STL, OBJ for example)… How can I do it?

      Sincerely,

      Gonzalo Rojas Costa

    • #2959
      Anand Joshi
      Moderator

      You can just save the surface with .obj extension. It will be saved in obj format.
      Another alternative is to import it in matlab or python and then save it back.
      The readers for matlab and python for the dfs format are included in the source code. The file names for them are readdfs.m and dfsio.py.

    • #2961
      grojas
      Participant

      I saved it to obj format using BrainSuite, but I tried to open it using 3DSlicer, but it fails… Why?

      Sincerely,

      Gonzalo Rojas Costa

    • #2962
      David Shattuck
      Keymaster

      hi Gonzalo –

      The obj format used in BrainSuite is the MNI obj format, which was more widely used when we first developed BrainSuite.

      There is a way to get a Wavefront obj file from BrainSuite — if you save out a surface file using .wfo as the extension (I used wfo to represent WaveFront Obj) and then change the extension to .obj, you should be able to use it in programs that read Wavefront Obj files. I do this sometimes when I want to look at BrainSuite surfaces in Meshlab, and it works fine.

      You can also use a .stl extension, and the surface will be saved in STL format. Some of our users have used this to 3D print brain models made in BrainSuite.

      Just one note — both of these formats lose some of the information that BrainSuite uses in its different functions.

      Give it a try and let us know if it works for you.

      thanks,
      David Shattuck

    • #4851
      huizhang1032
      Participant

      Hello, I would like to ask if it is possible to save a surface file in .stl format based on the command line?

    • #4852
      Anand Joshi
      Participant

      You can do it from the gui but not command line that I am aware of.

    • #4856
      David Shattuck
      Keymaster

      hi Huizhang –

      All of the command-line programs in the BrainSuite bin dir that write surface files should save them as .stl files if you use the .stl extension for the output file. The caveat to this is that stl files don’t carry enough information for the BrainSuite pipelines to use them as inputs, so effectively you would need to run a step twice to get a .dfs version and a .stl version. We don’t have a file converter program included with the software, but I will probably add one for the next release.

      You could try this with dfs if you have a mask file. Below is an example on my Mac. You can see it generates a .stl file.


      shattuck:~>/Applications/BrainSuite21a/bin/dfs -i /Applications/BrainSuite21a/svreg/BCI-DNI_brain_atlas/BCI-DNI_brain.cortex.dewisp.mask.nii.gz -o brain.stl
      wrote surface file brain.stl
      shattuck:~>head brain.stl
      solid brain.stl
      facet normal 0 0 0
      outer loop
      vertex 46.5981 106.954 80.565
      vertex 46.1262 106.945 80.6693
      vertex 46.4666 106.725 80.639
      endloop
      endfacet
      facet normal 0 0 0
      outer loop

      thanks,
      David

      • #4858
        huizhang1032
        Participant

        Okay, thanks so much. I’m going to try it.
        I want to get slices.bse.inner.cortex.dfs, slices.bse.inner_skull.dfs, slices.bse.left.inner.cortex.dfs, slices.bse.left.pial.cortex.dfs, slices.bse.outer_skull.dfs, slices.bse.pial.cortex.dfs, slices.bse.right.inner.cortex.dfs, slices.bse.right.pial.cortex.dfs, slices. bse.scalp.dfs and other files in .stl format, then what are the corresponding BCI-DNI_brain.cortex.dewisp.mask.nii.gz? Can I realize all the above file format conversion?

    • #4859
      Anand Joshi
      Participant

      .cortex.dewisp.mask.nii.gz will generate .inner.cortex.dfs

Viewing 7 reply threads
  • You must be logged in to reply to this topic.