在我的应用程序中,用户与 3D 体积渲染进行交互。数据非常嘈杂,但噪声中隐藏着感兴趣的对象。我的用户可以通过旋转和平移场景来获得这些对象的良好几何感。
分辨率仍然至关重要,我可能愿意为了交互的流畅性而牺牲它。我可以禁用或至少修改伴随场景交互的这种下采样/降低分辨率吗?
我被要求展示我的代码。我会展示一些片段。
class Display(HasTraits)
def __init__(self, list_of_MySourceObjects , list_of_corresponding_MyScenes )
...
def default_traits_view(self):
traits_view=View(HGroup( *list_ofMyScenes ) ##Allows variable number of scenes in view
...
class SomeSensibleCoordinateClass(HasTraits):
#Some logic for coordinate callbacks and manipulation
...
####Custom class that knows how to plot on scenes####
class MySourceObject(SomeSensibleCoordinateClass):
...
###I'll show a sample plotting function
def display_on_small_scene(self,scene):
self.origin=-self.radius.__array__()*self.spacing
print 'origin is',self.origin
self.small_array_src=ArraySource(scene,spacing=self.spacing,origin=self.origin)
self.scene=scene#for debug
self.set_scene_patch()### (re)sets self.array_src data
scene.mayavi_scene.add_child(self.array_src)
self.volume=self.array_src.add_module(self.vol_module)
scene.draw_axes(self.array_src.scalar_data.shape)
...
class MyScene(MlabSceneModel):
volume=Instance(Volume,())
some_other_custom_parameters = Any()
...
##Some default picking behavior
def picker_callback(self...):
...
##Some default aesthetics
def draw_axes(self,...):