Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viz surfaces #1034

Merged
merged 8 commits into from Oct 13, 2016
Merged

Viz surfaces #1034

merged 8 commits into from Oct 13, 2016

Conversation

StongeEtienne
Copy link
Contributor

Surface visualization tools
Load/Save surface (polydata)
vtk polydata numpy support
surfaces tutorial

@arokem
Copy link
Contributor

arokem commented May 4, 2016

This is cool -- thanks for including this! Any chance to show an example of how this can be used to visualize some brain data? There are some VTK files in the mindboggle data-sets that might lend themselves to this, or we could create VTK files of brain surfaces for the Stanford HARDI data-set. I am curious to see how you would suggest using this together with streamlines.

@StongeEtienne
Copy link
Contributor Author

Hello Ariel, I added an example file "doc/examples/viz_surfaces.py" to show how to
Generate, Read (load) and Write a vtkPolyData (".vtk"), it also support some other mesh/surface files format (".ply",".stl",".obj").
If you use FreeSurfer, you can use "mris_convert" to convert freesurfer mesh to ".vtk"
mris_convert lh.pial lh.pial.vtk

Once you have a vtkPolyData you can generate a vtkActor and use it in a scene/windows exactly like the streamlines actor.

Later on, I could add a tutorial with surface and streamlines visualization.
I also wanted to add Coloring tools interaction in-between streamlines and surface !
but I need to do some work on my own python library before (TriMeshPy)

@arokem
Copy link
Contributor

arokem commented May 4, 2016

On Wed, May 4, 2016 at 10:15 AM, StongeEtienne notifications@github.com
wrote:

Hello Ariel, I added an example file "doc/examples/viz_surfaces.py" to
show how to
Generate, Read (load) and Write a vtkPolyData (".vtk"), it also support
some other mesh/surface files format (".ply",".stl",".obj").
If you use FreeSurfer, you can use "mris_convert" to convert freesurfer
mesh to ".vtk"
mris_convert lh.pial lh.pial.vtk

Once you have a vtkPolyData you can generate a vtkActor and use it in a
scene/windows exactly like the streamlines actor.

Later on, I could add a tutorial with surface and streamlines
visualization.

I propose that we add this on this PR, if that's not too much to ask. The
cube example is compact, but it doesn't really show a user what they would
do with this functionality in the context of diffusion MRI analysis.

I also wanted to add Coloring tools interaction in-between streamlines and
surface !
but I need to do some work on my own python library before (TriMeshPy
https://github.com/StongeEtienne/trimeshpy)

Yep. Looks like you have your work cut out for you :-)


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#1034 (comment)

@StongeEtienne
Copy link
Contributor Author

StongeEtienne commented May 5, 2016

I think, for basic surface feature, I shouldn't add more details.
Because that would be an exact copy of the current tutorial, but with different file name.
In example to visualize a brain surface :

file_name = "my_brain.vtk"  # "my_cube.vtk"
polydata = io_vtk.load_polydata(file_name)
actor = ut_vtk.get_actor_from_polydata(polydata)

renderer = window.Renderer()
renderer.add(actor)

window.show(renderer, reset_camera=False)

Also I didn't want to add a brain_mesh files in your data, and I don't know how your data fetching system works.

@StongeEtienne
Copy link
Contributor Author

@Garyfallidis Do you think you will have some time to look at this ?

@Garyfallidis
Copy link
Contributor

Yes, will do asap. Hold on there!

@@ -228,3 +228,251 @@ def lines_to_vtk_polydata(lines, colors=None):
poly_data.SetLines(vtk_lines)
poly_data.GetPointData().SetScalars(vtk_colors)
return poly_data, is_colormap


##########################################
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-standard comment style.

Visualize surfaces; load/save, get/set and update vtkPolyData.
========================================

import usefull functions and dipy utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from dipy.viz.utils

@@ -0,0 +1,99 @@
"""
========================================
Visualize surfaces; load/save, get/set and update vtkPolyData.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just write
Visualize surfaces or Surface visualization

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StongeEtienne have you seen this?


"""
generate a empty vtkPolyData
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an empty line between comments and code. Otherwise the tutorial will not render correctly.

"""
ut_vtk.set_polydata_vertices(my_polydata, my_vetices)
ut_vtk.set_polydata_triangles(my_polydata, my_triangles)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One empty line between code.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 5a78436 on StongeEtienne:viz_surfaces into * on nipy:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 5a78436 on StongeEtienne:viz_surfaces into * on nipy:master*.

@codecov-io
Copy link

Current coverage is 80.82% (diff: 15.94%)

No coverage report found for master at 7b6ce30.

Powered by Codecov. Last update 7b6ce30...5a78436

@Garyfallidis
Copy link
Contributor

Okay thanks. Merging this and making a PR with some updates for the website.

@Garyfallidis Garyfallidis merged commit 8afb032 into dipy:master Oct 13, 2016
@arokem
Copy link
Contributor

arokem commented Oct 13, 2016

For future reference: you might want to give a couple of days warning before you merge PRs. Something like "I will merge this in a couple of days, unless I hear from everyone" would be helpful. For example, my suggestion from May (#1034 (comment)) has been ignored in the revision.

@StongeEtienne
Copy link
Contributor Author

StongeEtienne commented Oct 13, 2016

Thanks Elef for the merge, @arokem I don't mind for the "warning before merge", but I already answer ( #1034 (comment) ) to your request in a comment right after, and this branch wasn't touch for a whole 5 months.

@arokem
Copy link
Contributor

arokem commented Oct 13, 2016

Sure - I was wrong about your answer. It has been a while...

Still - the principle still applies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants