reading/plotting hxsurf and amiramesh files

31 views
Skip to first unread message

Meredith Peterson

unread,
Nov 14, 2016, 3:21:09 PM11/14/16
to nat-user
I am able to read Amira HxSurface (.surf) files into R with the read .hxsurf function but the large hxsurf object that is created does not appear in the rgl window when I use the plot3d function. Has anyone run into this issue? Could it be read instead as an amiramesh object and plotted that way? 

Regardless, all I want to do for now is plot a transparent ventral nervous system standard around my neurons of interest; if there is an hxsurf file out there already I'd be satisfied with that, though I'd prefer to be able to use my own Amira surfaces.

Secondly, does specifying the alpha in plot3d only work for surfaces? When I lower the alpha while plotting dotprops objects, the object remains opaque. 

Gregory Jefferis

unread,
Nov 15, 2016, 12:40:59 PM11/15/16
to Meredith Peterson


Sent from my iPhone

On 14 Nov 2016, at 23:24, Meredith Peterson <smer....@gmail.com> wrote:

It appears to be read in successfully; it doesn't throw and error and here is what happens when I look at the object elements:

> str(surf)
List of 3
 $ Vertices        :'data.frame': 35060 obs. of  4 variables:
  ..$ X      : num [1:35060] 162 167 167 172 172 ...
  ..$ Y      : num [1:35060] 408 408 403 404 408 ...
  ..$ Z      : num [1:35060] 35.5 33.3 35.6 35.6 34.5 ...
  ..$ PointNo: int [1:35060] 1 2 3 4 5 6 7 8 9 10 ...
 $ Regions         : list()
 $ RegionColourList: logi(0) 
 - attr(*, "class")= chr [1:2] "hxsurf" "list"

When I attempt plot3d(surf), the rgl window opens but is a solid gray. If I do this while the window is open and other objects are already plotted, nothing happens and still no errors are thrown. 

Your surface object has vertices but no triangles because the reader has not established which material contains the surface. Older versions of nat sometimes had problems with Amira's default material names. 

However, when I try your next suggestion, I get an error that the as.mesh3d function that doesn't exist at all!

> wire3d(as.mesh3d(surf))
Error in wire3d(as.mesh3d(surf)) : could not find function "as.mesh3d"

You have an older version of nat installed. It would be best to update to the latest CRAN version or to get the development version from GitHub. You could send me the output of sessionInfo() to confirm this. 

Upgrading will probably solve the first issue and definitely solve the second. 

I'm sure that the nat and rgl libraries have been imported because otherwise I wouldn't be able to plot my dotprops objects or read the surf object in the first place. 

As for the surf object complexity, I've already downsampled the isosurface by 5 in Amira. However, if my intuition is correct the 35060 observations in surf correspond to the number of triangles, so I'll downsample a bit more and try again.

The number of vertices will be less than the number of faces. 35,000 vertices is more than I would use and I would suggest downsampling further in Amira but it should still be displayable. 

In the meantime, I'll have a go at the files on github to see if it's an issue with my file formatting or something else. Thanks!

On Mon, Nov 14, 2016 at 5:13 PM, Gregory Jefferis <jeff...@gmail.com> wrote:


Sent from my iPhone

On 14 Nov 2016, at 20:21, Meredith Peterson <smer....@gmail.com> wrote:

I am able to read Amira HxSurface (.surf) files into R with the read .hxsurf function but the large hxsurf object that is created does not appear in the rgl window when I use the plot3d function. Has anyone run into this issue?

Do you know that the object has been read in successfully? Is there an error message when you try to plot it. Does R hang? Or do you just not see anything?

Maybe you could send the output of 

str(mysurface)

Replacing mysurface with the name of your surface object.

You can also try plotting like so

wire3d(as.mesh3d(mysurface))

Which should show a wireframe model. 

Could it be read instead as an amiramesh object and plotted that way? 

No.

Regardless, all I want to do for now is plot a transparent ventral nervous system standard around my neurons of interest; if there is an hxsurf file out there already I'd be satisfied with that, though I'd prefer to be able to use my own Amira surfaces.

Of course you should be able to use your own surfaces. However plotting a transparent surface is quite demanding. You may need to reduce the number of triangles in your surface model. You can do this in Amira or meshlab. In Amira search the help for how to simplify a surface model. I normally aim for around 25k faces. Smoothing the surface model may help to give a good appearance.

We have a VNC model for the VNC included in the nat.flybrains package:


Which you can install from GitHub, see:


Of course this is not going to be so much use to you unless it is warped to your template space or vice versa. 

The corresponding template brain stack can be found on zenodo by googling VNCIS1. 



Secondly, does specifying the alpha in plot3d only work for surfaces? When I lower the alpha while plotting dotprops objects, the object remains opaque. 

That is correct as far as I remember. 

Best,

Greg. 

--
You received this message because you are subscribed to the Google Groups "nat-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nat-user+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/nat-user.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nat-user/f2b7adc8-bc1c-4396-9328-e94128f7f7f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Meredith C. Peterson

The Mann Laboratory
Department of Biochemistry and Biophysics
Columbia University Medical Center 
701 W 168th Street HHSC 1104
New York, NY 10032


Gregory Jefferis

unread,
Nov 15, 2016, 12:41:06 PM11/15/16
to Meredith Peterson, nat-user

On 15 Nov 2016, at 17:14, Meredith Peterson <smer....@gmail.com> wrote:

Thanks so much! It works beautifully, even without downsampling.

Excellent.

mymesh=as.mesh3d(mysurface)
wire3d(mymesh)
points3d(mymesh)

can also be useful alternatives.

Best,

Greg.

--
Gregory Jefferis, PhD
Division of Neurobiology
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge, CB2 OQH, UK


Reply all
Reply to author
Forward
0 new messages