ANTsX / ANTsPy

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.
https://antspyx.readthedocs.io
Apache License 2.0
625 stars 161 forks source link

Compatibility with Point Clouds / 3D Meshes? #454

Closed desaibhargav closed 6 months ago

desaibhargav commented 1 year ago

Hi Team, thank you for such an amazing implementation, it's a super job.

I had a question, is the library compatible with running on 3D formats such as point clouds or 3D meshes (.obj / .stl etc?). I couldn't find an example or issue, hence creating a new one here. Please feel free to redirect and close if a thread for this already exists, my apologies for the inconvenience.

My specific use-case is to leverage the image registration algorithms (such as SYN) in order to register 3D organs that currently exist as a mesh objects (.obj, .stl, .glb)

Thank you

ntustison commented 1 year ago

Point-set registration does exist in ANTs proper but I'm pretty sure those capabilities have not migrated to ANTsPy/ANTsR. We do have landmark registration in those packages, though.

desaibhargav commented 1 year ago

Thanks @ntustison for your quick response. If you don't mind could you point me to the documentation / function set for point-set registration algorithms that exist in ANTs proper?

ntustison commented 1 year ago

Examples

sainatarajan commented 1 year ago

@ntustison A question. I've registered two 3D volumes and obtained the transformation. How do I apply this same transformation to a mesh?

ntustison commented 1 year ago

We have tools for transforming individual points. You would have to adapt those tools to warp your meshes in whatever format they exist. Alternatively, as ANTs transforms are ITK-based, you could ask over at the ITK Discourse forum to see if tailored tools exist for your specific meshes.

desaibhargav commented 1 year ago

Examples

Thanks for pointing me here. I checked these files but it looks like it would need a .nii file along with a .txt file that has the points? Is this correct? I ask because I currently do not have a NIFTI file, only points as a .txt file.

Also, could you tell me what algorithms are used to perform the registration?

Thank you for your help, I really appreciate all the work y'all have been doing.

ntustison commented 1 year ago

The use of an image is required to define the physical domain boundary for any deformable registration stage.

desaibhargav commented 1 year ago

The use of an image is required to define the physical domain boundary for any deformable registration stage.

Understood, thanks for clearing that up. Would there be a way to obtain a NIFTI file from a list of points (point cloud)? After some initial reading up, my understanding is that such a conversion is ill-defined but I'd love to know if there was a way.

ntustison commented 1 year ago

Compute the min, max of each coordinate of all the points to get a bounding box. Then specify the spacing based on your desired resolution followed by number of voxels to span the bounding box. And you probably want to add some voxels on both sides to have some padding to avoid any boundary effects. You would then be able to calculate the origin.