natverse / nat

NeuroAnatomy Toolbox: An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons.
https://natverse.org/nat/
64 stars 29 forks source link

Bad triangle numbers #445

Closed PostPreAndCleft closed 4 years ago

PostPreAndCleft commented 4 years ago

I'm getting an error when I reading ascii surface files from one tomography set produced in amira 2019.2, the error reads:

Input: dfx<-read.hxsurf("myamirafile.surf") Output: Error in read.hxsurf("myamirafile.surf") : Bad triangle number: 650952

I have a loop pulling in all datasets in a folder, but none from these sets reads. I've tested older sets, and they read in fine, so I'm a little worried about this. Any help is appreciated.

I've attached two surface files from two different tomographic EM projects, both give bad triangles error but different triangle number. The surface file comprises around a hundred small materials. I push the limits of amira's material number max in the field files.

I appreciate any help.

Andy A. Cole Reese Neurobiology Lab

problematic surfaces.zip

jefferis commented 4 years ago

Dear Andy, I've taken a quick look and I can recapitulate the bug. As a workaround for the time being, can you consider resaving in HxSurface binary format (as opposed to HxSurface ascii). I have activated a feature in nat that should allow multi object files like yours to be read in from this binary format. You will need to update to the latest github version of nat (see README on landing page).

I've attached a zip with your 2 sample surfaces in this format problematic.surfaces.bin.zip and the result of plotting in R

library(nat)
s2=read.hxsurf('problematic.surfaces/HS-Bridges-1-CF-01-to-051.bin.surf')
plot3d(s2)

problem-mesh2

jefferis commented 4 years ago

Incidentally I suspect that binary format will load much faster, but it has not been tested extensively so you could encounter additional problems.

PostPreAndCleft commented 4 years ago

Excellent! I'm really glad to have a solution so quickly. If I have any problems I'll check in.