STLWriter producing pixelated images?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

STLWriter producing pixelated images?

Hp07
Hi all,

I am using CT image scans rendered into a 3d graphic. When the image is displayed in OpenGL the 3d image is smooth and clear - im happy with the image. When i however try to read the saved .stl file in wxpython, the image is more pixelated compared to the orignally displayed image in vtk.
Is there paramters that i may need to inlcude to reproduce a similar image to the orginal?

any advice will be much appreciated.

Many thanks in advance.

The code i used to open a .STL files using 3d rendered images from vtk is found on:

https://sukhbinder.wordpress.com/2013/12/24/lights-cameras-action-a-simple-example-to-embed-vtk-with-wxpython/

Reply | Threaded
Open this post in threaded view
|

Re: STLWriter producing pixelated images?

Cory Quammen-2
I think you mean that the surface from the STL file appears to not be
smooth. This is because STL does not store surface normal information
at the vertices, so your geometry is being rendered with flat shading
of the triangles.

To get a smoother appearance, generate surface normals with the
vtkPolyDataNormals filter. See, for example,

http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataExtractNormals

HTH,
Cory


On Tue, Jun 14, 2016 at 1:30 PM, Hp07 <[hidden email]> wrote:

> Hi all,
>
> I am using CT image scans rendered into a 3d graphic. When the image is
> displayed in OpenGL the 3d image is smooth and clear - im happy with the
> image. When i however try to read the saved .stl file in wxpython, the image
> is more pixelated compared to the orignally displayed image in vtk.
> Is there paramters that i may need to inlcude to reproduce a similar image
> to the orginal?
>
> any advice will be much appreciated.
>
> Many thanks in advance.
>
> The code i used to open a .STL files using 3d rendered images from vtk is
> found on:
>
> https://sukhbinder.wordpress.com/2013/12/24/lights-cameras-action-a-simple-example-to-embed-vtk-with-wxpython/
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



--
Cory Quammen
R&D Engineer
Kitware, Inc.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: STLWriter producing pixelated images?

Hp07
Hi Cory,

Many thanks for the reply.

I looked into vtkPolyDataNormals as you mentioned. Can you please see below the images generated from VTK (right) and wxpython (left) which was generated using the vtkPolyDataNormals data and saving it in STL.

Is that wat you were referring too? writing the STL using the vtkPolyDataNormals?

norm = vtk.vtkPolyDataNormals()
        norm.SetInputConnection(DicomMC.GetOutputPort())
        norm.Update()

writer = vtk.vtkSTLWriter()
        writer.SetFileName(stlfilePath)
        writer.SetInputConnection(normals.GetOutputPort())
        writer.SetFileTypeToBinary()
        writer.Write()






Reply | Threaded
Open this post in threaded view
|

Re: STLWriter producing pixelated images?

Cory Quammen-2
Sorry, I should have been more specific. Add the vtkPolyDataNormals
filter after you load the STL file with the vtkSTLReader.

Cory

On Tue, Jun 14, 2016 at 3:45 PM, Hp07 <[hidden email]> wrote:

> Hi Cory,
>
> Many thanks for the reply.
>
> I looked into vtkPolyDataNormals as you mentioned. Can you please see below
> the images generated from VTK (right) and wxpython (left) which was
> generated using the vtkPolyDataNormals data and saving it in STL.
>
> Is that wat you were referring too? writing the STL using the
> vtkPolyDataNormals?
>
> norm = vtk.vtkPolyDataNormals()
>         norm.SetInputConnection(DicomMC.GetOutputPort())
>         norm.Update()
>
> writer = vtk.vtkSTLWriter()
>         writer.SetFileName(stlfilePath)
>         writer.SetInputConnection(normals.GetOutputPort())
>         writer.SetFileTypeToBinary()
>         writer.Write()
>
>
>
> <http://vtk.1045678.n5.nabble.com/file/n5738659/wxpythonvsvtk.png>
>
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653p5738659.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



--
Cory Quammen
R&D Engineer
Kitware, Inc.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: STLWriter producing pixelated images?

Hp07
Hi Cory,

Thanks a million, with your help i got the desired output.

Thanks again,
hp
Reply | Threaded
Open this post in threaded view
|

Re: STLWriter producing pixelated images?

Cory Quammen-2
Great, I'm glad it works, hp. Thanks for letting us know.

Cory

On Tue, Jun 14, 2016 at 4:36 PM, Hp07 <[hidden email]> wrote:

> Hi Cory,
>
> Thanks a million, with your help i got the desired output.
>
> Thanks again,
> hp
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/STLWriter-producing-pixelated-images-tp5738653p5738662.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers



--
Cory Quammen
R&D Engineer
Kitware, Inc.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers