<jupyter_start><jupyter_text>Curvature Demo in MayaVi The demo code was taken from <NAME>'s blog at http://emmanuelle.github.io/segmentation-of-3-d-tomography-images-with-python-and-scikit-image.html<jupyter_code>!../xvfb_bg start
import os
os.environ['DISPLAY'] = ':1' # use the xvfb backend
from mayavi import mlab
mlab.init_notebook(backend='png') 
mlab.figure(bgcolor=(0, 0, 0))
s = mlab.pipeline.scalar_field((pt_image>0).astype(np.uint8))
contour = mlab.pipeline.contour(s)
smooth = mlab.pipeline.user_defined(contour, filter='SmoothPolyDataFilter')
smooth.filter.number_of_iterations = 400
smooth.filter.relaxation_factor = 0.015
curv = mlab.pipeline.user_defined(smooth, filter='Curvatures')
surf = mlab.pipeline.surface(curv)
module_manager = curv.children[0]
module_manager.scalar_lut_manager.data_range = np.array([-0.6,  0.5])
module_manager.scalar_lut_manager.lut_mode = 'RdBu'
mlab.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13841201716738197, 'fraction_numerical': 0.0203862660944206, 'mean_word_length': 6.906779661016949, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '105779', 'license': 'Apache-2.0', 'n_tokens_mistral': 368, 'n_tokens_neox': 354, 'n_words': 55, 'path': 'notebooks/curvature.ipynb', 'repo_name': '4QuantOSS/mayavi_notebooks', 'size': '946'}