A fake shadow is put on the stone mesh to give the mesh depth values. The stone object is placed within a sphere using IcosphereFromObject. The object and the icosphere is then given to the CinemaImaging filter. It generates multiple images of the stone object, and the images are taken from cameras placed on the vertices of the icosphere.
An approximation of the geometry is calculated from the images using DepthImageBasedGeometryApproximation. The approximated geometry can be extracted using the Threshold filter.
#!/usr/bin/env pythonfromparaview.simpleimport*# create a new 'XML PolyData Reader'stonevtp=XMLPolyDataReader(FileName=["GroundWater.cdb/stone.vtp"])# create a new 'Elevation'fakeShadow=Elevation(Input=stonevtp)fakeShadow.LowPoint=[0.13294358695786565,0.08882809227819845,-0.018024881743751362]fakeShadow.HighPoint=[0.06742407365289238,0.018398674549435334,0.138207120609427]# create a new 'TTK IcosphereFromObject'tTKIcosphereFromObject1=TTKIcosphereFromObject(Object=stonevtp)# create a new 'TTK CinemaImaging'tTKCinemaImaging1=TTKCinemaImaging(Dataset=fakeShadow,SamplingGrid=tTKIcosphereFromObject1)# create a new 'TTK DepthImageBasedGeometryApproximation'tTKDepthImageBasedGeometryApproximation1=TTKDepthImageBasedGeometryApproximation(Input=tTKCinemaImaging1)tTKDepthImageBasedGeometryApproximation1.DepthArray=["POINTS","Depth"]# create a new 'Threshold'threshold1=Threshold(Input=tTKDepthImageBasedGeometryApproximation1)threshold1.Scalars=["CELLS","TriangleDistortion"]threshold1.ThresholdMethod="Between"threshold1.LowerThreshold=-999999999threshold1.UpperThreshold=0.02SaveData("CinemaImages.vtm",tTKCinemaImaging1)SaveData("GeometryApproximatedStone.vtm",threshold1)
To run the above Python script, go to your ttk-data directory and enter the following command: