[vtkusers] VTKboolean smoothes the results! Any other libraries for boolean operation on polydata?

Cory Quammen cory.quammen at kitware.com
Tue Jul 18 09:21:42 EDT 2017


Hmm, now I wonder if the boolean operations filter is simply removing the
normals filter. The code has changed from the original, which did preserve
normals. It looks like the current code should preserve normals as well,
but I'm not 100% sure if that is the case.

In the output of the boolean operation filter, could you check that there
is a normals array in the pointdata?

vtkDataArray* normals = output->GetPointData()->GetNormals();

If "normals" is NULL, then the normals are not being copied to the output.

Thanks,
Cory



On Mon, Jul 17, 2017 at 11:47 AM, Majid Mohammad sadeghi <
majid.msadeghi at yahoo.com> wrote:

> Dear Cory,
>
> All you said was exactly what I have done. I tested your method to check
> the data and I could see only one of the objects. So If I understand right,
> during the boolean operation the vtkPolyDataNormals are recalculated and
> that is the reason the polydata is shown smoothed. Is there a way not to
> let boolean recalculate it? Or more generally is there a way to keep the
> bumps. That kind of is the norm in the medical field and some doctors might
> not feel very good about the smooth data.
>
> Thanks.
>
>
>
>
>
> On Monday, July 17, 2017, 7:33:19 PM GMT+3, Cory Quammen <
> cory.quammen at kitware.com> wrote:
>
>
> What I think you are seeing with the rough surface is surface normals
> generated from an image volume. I am assuming a lot here, so please correct
> me if I am wrong. It looks like you have a geometry of a bone extracted
> from a CT scan. The extraction algorithm was probably a variant of marching
> cubes or a similar algorithm. The surface normals estimated from the
> surface extraction algorithm were probably computed from the intensity
> gradient of the CT scan. This is a reasonable approach, but noise in the CT
> scan will affect the gradient calculation and may perturb the surface
> normals in the geometry a little. When this happens, you can get a rough
> appearing surface from the surface lighting calculation. Google "bump
> mapping" for how this can be used for a nice graphics effect - I think
> roughly the same thing is happening with your original data.
>
> When you use vtkPolyDataNormals, the normals are computed from the surface
> data, which was smooth to begin with. Hence, the normals are not perturbed,
> so you don't get a bumpy appearance.
>
> In any case, the measurements you want to take are not dependent on the
> surface normals. As long as the points on the surface are not smooth, which
> they should not be, your measurement procedure should be fine.
>
> To convince yourself the geometry is the same, you can display both the
> original "bumpy" surface and the smoothed surface at the same time with
> different colors. You should see just one surface or the other, probably
> the one you added to the vtkRenderer last. If the geometry is different,
> you will see some of one surface color and some of the other depending on
> which geometry is closer to the camera. I suspect you will see just one
> surface.
>
> HTH,
> Cory
>
> On Mon, Jul 17, 2017 at 11:22 AM, Majid Mohammad sadeghi <
> majid.msadeghi at yahoo.com> wrote:
>
> Dear Cory,
>
> As I applied vtkPolyDataNormals to the polydata before the boolean
> operation I got the smoothed object, so you were right. But I dont
> understand exactly what is happening here? Since the geometry dimentions
> are very important for my application, Can I have the noisy version? Is
> there any way I do not get it smoothed?
>
> Thanks,
>
>
>
>
> On Monday, July 17, 2017, 6:48:58 PM GMT+3, Cory Quammen <
> cory.quammen at kitware.com> wrote:
>
>
> There shouldn't be any geometry smoothing going on in this filter. Can you
> verify that the geometry has changed in the smoothed version?
>
> This is speculation, but one possibility is that the surface normals in
> your original surface come from a gradient computation in the volume from
> which the surface was extracted and noise in the volume result in the bumpy
> appearance. You can check this by applying the vtkPolyDataNormals filter to
> your original surface and looking at the result.
>
> HTH,
> Cory
>
> On Mon, Jul 17, 2017 at 10:21 AM, Majid Mohammad sadeghi <
> majid.msadeghi at yahoo.com> wrote:
>
> Dear Cory,
>
> Thanks for the reply, I set the actors property to  SetInterpolationToFlat
> (); as you said, but the result is the same I put a picture before and
> after boolean operation here. Any suggestion? Are you familier with any
> other library? Current boolean operation takes about 150 seconds on my
> system, do you think this is normal?
>
> [image: Inline image]
>
>
>
>
> On Monday, July 17, 2017, 6:00:50 PM GMT+3, Cory Quammen <
> cory.quammen at kitware.com> wrote:
>
>
> What do you mean by smooth? The lighting is smooth? I think the filter
> may be adding surface normals, in which case any actor for the data
> will turn on Gouraud shading (or maybe Phong) by default, which will
> make your surface look smooth. You can turn off smooth lighting as
> shown in this example:
>
> http://www.vtk.org/Wiki/VTK/ Examples/Cxx/Visualization/ FlatShading
> <http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/FlatShading>
>
> On Mon, Jul 17, 2017 at 9:49 AM, Majid Mohammad sadeghi via vtkusers
> <vtkusers at vtk.org> wrote:
> > Hi everyone,
> >
> > I am using vtkBooleanOperationPolyDataFil ter, and it works fine except
> after
> > the operation it smoothes the polydata, which I dont want. Is there a
> way to
> > stop that? Or is there another library for boolean operations on
> polydata?
> >
> > Thanks.
> >
> >
> > ______________________________ _________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/ opensource/opensource.html
> <http://www.kitware.com/opensource/opensource.html>
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_ FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
> >
> > Search the list archives at: http://markmail.org/search/?q= vtkusers
> <http://markmail.org/search/?q=vtkusers>
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/ mailman/listinfo/vtkusers
> <http://public.kitware.com/mailman/listinfo/vtkusers>
>
> >
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
>
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
>
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
>



-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170718/e1258a6a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Untitled-8.jpg
Type: image/jpeg
Size: 261587 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170718/e1258a6a/attachment-0001.jpg>


More information about the vtkusers mailing list