Пример #1
0
 def test_threshold_filter_threhsold(self):
     src = self.make_src()
     self.e.add_source(src)
     threshold = Threshold()
     self.e.add_filter(threshold)
     threshold.upper_threshold = 20.
     self.assertTrue(
         20 >= np.nanmax(threshold.outputs[0].point_data.scalars.to_array())
     )
     return
Пример #2
0
 def test_threshold_filter_threhsold(self):
     src = self.make_src()
     self.e.add_source(src)
     threshold = Threshold()
     self.e.add_filter(threshold) 
     threshold.upper_threshold = 20.
     self.assertTrue(20 >=
                      np.nanmax(
                         threshold.outputs[0].point_data.scalars.to_array()
                      ))
     return
# <codecell>

from enthought.mayavi.modules.iso_surface import IsoSurface

from enthought.mayavi.filters.threshold import Threshold

# <markdowncell>

# then, set the threshold values:
#
# <codecell>

thh = Threshold()
script.add_filter(thh)
thh.lower_threshold = 0.4
thh.upper_threshold = 0.6
isosurf = IsoSurface()
thh.add_module(isosurf)
isosurf.contour.contours = [0.5]
isosurf.compute_normals = True
isosurf.actor.property.opacity = 0.2
isosurf.module_manager.scalar_lut_manager.data_range = [0, 1]

# <markdowncell>

# and you're done !
#
# This should look like this:
#
# ![](files/MayaVi(2f)ScriptingMayavi2(2f)Filters_attachments/filter_thrld2.png
#
from enthought.mayavi.modules.iso_surface import IsoSurface

from enthought.mayavi.filters.threshold import Threshold

# <markdowncell>

# then, set the threshold values:
# 
# <codecell>


thh = Threshold()
script.add_filter(thh)
thh.lower_threshold = 0.4
thh.upper_threshold = 0.6
isosurf = IsoSurface()
thh.add_module(isosurf)
isosurf.contour.contours = [0.5]
isosurf.compute_normals = True
isosurf.actor.property.opacity = 0.2
isosurf.module_manager.scalar_lut_manager.data_range = [0, 1]

# <markdowncell>

# and you're done !
# 
# This should look like this:
# 
# ![](files/MayaVi(2f)ScriptingMayavi2(2f)Filters_attachments/filter_thrld2.png
#