seung-lab / igneous

Scalable Neuroglancer compatible Downsampling, Meshing, Skeletonizing, Contrast Normalization, Transfers and more.
GNU General Public License v3.0
40 stars 16 forks source link

Examples of using mulitres mesh? #142

Open eddyod opened 1 year ago

eddyod commented 1 year ago

Is there any example code for using the multi resolution mesh creation with scripting?

william-silversmith commented 1 year ago

Hi Edward,

I would just follow along with the code in the CLI module. You need to do the initial mesh forging tasks as "sharded" then you need to call sharded mesh merge.

Let me know if you need more help!

eddyod commented 1 year ago

Something like this?

tasks = tc.create_meshing_tasks(layer_path, mip=0, sharded=True)
tq.insert(tasks)
tq.execute()

tasks = tc.create_sharded_multires_mesh_tasks(layer_path, num_lod=2)
tq.insert(tasks)    
tq.execute()
william-silversmith commented 1 year ago

That looks like it works!

eddyod commented 1 year ago

Must we use the sharded=True parameter? When I use this, I get: python3.10/site-packages/cloudvolume/lib.py:297: RuntimeWarning: overflow encountered in scalar multiply return reduce(operator.mul, self)

And then this file is not created: mesh_mip_0_err_40/0.shard

I'm using int8 as the data type by the way.

Thanks!

william-silversmith commented 1 year ago

That's a pretty odd error. That makes me think the bounding box is being manipulated incorrectly for some reason. What are the dimensions of your dataset?

If you're working with a reasonably small dataset, then (I forgot this existed for a sec) you can use the unsharded multi-res. Omit the sharded flag and use this function, create_unsharded_multires_mesh_tasks, to create the merging tasks.

https://github.com/seung-lab/igneous/blob/master/igneous/task_creation/mesh.py#L449-L513

eddyod commented 1 year ago

Thanks, I'm having better luck with the unsharded process and it appears to be working!