[vtkusers] Scalars from 3D PolyData to 2D Image for image processing
David Doria
daviddoria at gmail.com
Mon Oct 29 19:55:13 EDT 2012
On Mon, Oct 29, 2012 at 7:31 PM, Mark K. Batesole, DDS, MS
<mbatesole at yahoo.com> wrote:
> Hi David,
>
> Thanks for your response. Also thank you so much for contributing to this
> group. I've really learned a lot from all of your postings.
>
> Unfortunately I don't think that will either as there are too many
> "undercuts" in the data. I'm trying to find the points that delineate the
> tooth/gums. It can be visualized as the red line in the attached images:
>
> http://static.inky.ws/image/3339/image.jpg
> http://static.inky.ws/image/3340/image.jpg
>
> Thanks again,
> Mark
If you know the plane that is defined by the camera normal in your
3339/image.jpg, perhaps you could use something like my
OrthogonalProjection function from here:
https://github.com/daviddoria/PTXTools/blob/master/PTXImage.cpp
I believe it basically does what I think you're going for - it creates
an (ITK) image from 3D points by projecting them onto a plane and then
defining a coordinate system on the projected points and sampling them
into an image. Please forgive the lack of comments - this was just a
prototype idea. You could create an array on the PolyData indicating
which pixel in the new image each point corresponds to so you have the
bidirectional correspondence map.
As far as I know there is no built-in way to do this, probably because
there are many things are are quite undefined (what happens if two
points project to the same pixel? what happens if a point projects to
a pixel but it would have had to go "through" the surface to get
there? how to define the coordinate system of the image, etc.)
If you're feeling really brave, you can look through
https://github.com/daviddoria/PTXTools/blob/master/Resectioning/Resectioning.cpp
- it has a couple of (very preliminary) ideas of how to handle these
cases. Resection_MeshIntersection() computes if there is an
intersection between the point and the projected point.
Resection_ProjectionSorting() keeps track of the possible multiple
points that gets projected and keeps the closest one.
Hopefully someone else will have a more canned solution for you, but
if you have to do it manually, hopefully these things will help point
you in the right direction.
Good luck,
David
More information about the vtkusers
mailing list