Neural-Systems-at-UIO / MeshView-for-Brain-Atlases

WebGL based mesh viewer with solid slicing and point cloud support. User documentation https://meshview-for-brain-atlases.readthedocs.io
MIT License
7 stars 2 forks source link

Cutting feature bug? #60

Closed SakuraHoshizaki closed 1 month ago

SakuraHoshizaki commented 1 month ago

I would like to cut both the mesh and point cloud generated by quint workflow and take some screenshots of the cross-section. But the online tools seems not supporting this so I downloaded the source code to run locally and to modify the cutting behavior in the Javascript. However in the original main.js, line 345:

if(!document.getElementById("cut_cloud").checked){

            cutCloud(flatrf,(maxx+minx)/2,(maxy+miny)/2,(maxz+minz)/2,maxx-minx,maxy-miny,maxz-minz);

            cutMesh(flatrf,flatnrm,(maxx+minx)/2,(maxy+miny)/2,(maxz+minz)/2,maxx-minx,maxy-miny,maxz-minz);

            cutSurface(flatrf,nrm,(maxx+minx)/2,(maxy+miny)/2,(maxz+minz)/2,maxx-minx,maxy-miny,maxz-minz);

        } else {

            solidMesh(flatrf,flatnrm);

            cutCloud(flatrf,(maxx+minx)/2,(maxy+miny)/2,(maxz+minz)/2,maxx-minx,maxy-miny,maxz-minz);

            transparentMesh(flatrf);

}

which seems to actually trying to do the cut as what I needed. When I comment out this:

cutMesh(flatrf,flatnrm,(maxx+minx)/2,(maxy+miny)/2,(maxz+minz)/2,maxx-minx,maxy-miny,maxz-minz);

cutSurface(flatrf,nrm,(maxx+minx)/2,(maxy+miny)/2,(maxz+minz)/2,maxx-minx,maxy-miny,maxz-minz);

Then the cloud cutting started working, but from the opposite side of the cutting axis.

I'm not familiar with the tool or WebGL, but I guess this may be a not expected behavior of the cutting tool.

Also for my project, I'm trying to read the code and figure out what's happening. If I have more information I will update this thread.

SakuraHoshizaki commented 1 month ago

AHHH Sorry for my misunderstanding I learned about how the program working, and that's what it is supposed to do. The cutxxx function is to draw the cutted object, not to cut the object.

I got what I need by inverting the axis.

Also for the enhancement advise, a cross-section image series generator from any angle will be very helpful for making customized demonstration animations