This example computes the ascending and descending Morse segmentations from an electronic density of the Adenine-Thymine molecular complex.
The descending segmentation separators (red) represent the influence areas of maxima, giving each atom its own pocket since they are the most dense points in the dataset. The ascending segmentation separators (blue) represent the influence area of minima, providing the interactions (covalent and non-covalent) between the atoms in this example.
#!/usr/bin/env pythonfromparaview.simpleimport*# create a new 'XML Image Data Reader'atvti=XMLImageDataReader(FileName=["at.vti"])# create a new 'Calculator'calculator1=Calculator(registrationName="Calculator1",Input=atvti)calculator1.ResultArrayName="negdensity"calculator1.Function="-density"# create a new 'TTK PathCompression'tTKPathCompression1=TTKPathCompression(registrationName="TTKPathCompression1",Input=calculator1)tTKPathCompression1.ScalarField=["POINTS","negdensity"]# create a new 'TTK MarchingTetrahedra'tTKMarchingTetrahedra1=TTKMarchingTetrahedra(registrationName="TTKMarchingTetrahedra1",Input=tTKPathCompression1)tTKMarchingTetrahedra1.ScalarField=["POINTS","negdensity_DescendingManifold"]# create a new 'Clean to Grid'cleantoGrid1=CleantoGrid(registrationName="CleantoGrid1",Input=tTKMarchingTetrahedra1)# create a new 'TTK GeometrySmoother'tTKGeometrySmoother1=TTKGeometrySmoother(registrationName="TTKGeometrySmoother1",Input=cleantoGrid1)tTKGeometrySmoother1.IterationNumber=20# create a new 'TTK MarchingTetrahedra'tTKMarchingTetrahedra2=TTKMarchingTetrahedra(registrationName="TTKMarchingTetrahedra2",Input=tTKPathCompression1)tTKMarchingTetrahedra2.ScalarField=["POINTS","negdensity_AscendingManifold"]# create a new 'Clean to Grid'cleantoGrid2=CleantoGrid(registrationName="CleantoGrid2",Input=tTKMarchingTetrahedra2)# create a new 'TTK GeometrySmoother'tTKGeometrySmoother2=TTKGeometrySmoother(registrationName="TTKGeometrySmoother2",Input=cleantoGrid2)tTKGeometrySmoother2.IterationNumber=20SaveData("descendingSeparatorAt.vtu",tTKGeometrySmoother1)SaveData("ascendingSeparatorAt.vtu",tTKGeometrySmoother2)
To run the above Python script, go to your ttk-data directory and enter the following command: