<s> """<STR_LIT>""" <EOL> from traits . api import Instance , Bool , on_trait_change , Property <EOL> from traitsui . api import View , Group , Item <EOL> from tvtk . api import tvtk <EOL> from mayavi . core . module import Module <EOL> from mayavi . core . pipeline_info import PipelineInfo <EOL> class ImageActor ( Module ) : <EOL> actor = Instance ( tvtk . ImageActor , allow_none = False , record = True ) <EOL> input_info = PipelineInfo ( datasets = [ '<STR_LIT>' ] , <EOL> attribute_types = [ '<STR_LIT>' ] , <EOL> attributes = [ '<STR_LIT>' ] ) <EOL> image_map_to_color = Instance ( tvtk . ImageMapToColors , ( ) , <EOL> allow_none = False , record = True ) <EOL> map_scalars_to_color = Bool <EOL> _force_map_scalars_to_color = Property ( depends_on = '<STR_LIT>' ) <EOL> view = View ( Group ( Item ( name = '<STR_LIT>' , style = '<STR_LIT>' , <EOL> resizable = True ) , <EOL> show_labels = False , label = '<STR_LIT>' ) , <EOL> Group ( <EOL> Group ( Item ( '<STR_LIT>' , <EOL> enabled_when = '<STR_LIT>' ) ) , <EOL> Item ( '<STR_LIT>' , style = '<STR_LIT>' , <EOL> enabled_when = '<STR_LIT>' , <EOL> show_label = False ) , <EOL> label = '<STR_LIT>' , <EOL> ) , <EOL> width = <NUM_LIT> , <EOL> height = <NUM_LIT> , <EOL> resizable = True ) <EOL> def setup_pipeline ( self ) : <EOL> self . actor = tvtk . ImageActor ( ) <EOL> @ on_trait_change ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def update_pipeline ( self ) : <EOL> """<STR_LIT>""" <EOL> mm = self . module_manager <EOL> if mm is None : <EOL> return <EOL> src = mm . source <EOL> if self . _force_map_scalars_to_color : <EOL> self . set ( map_scalars_to_color = True , trait_change_notify = False ) <EOL> if self . map_scalars_to_color : <EOL> self . configure_connection ( self . image_map_to_color , src ) <EOL> self . image_map_to_color . lookup_table = mm . scalar_lut_manager . lut <EOL> self . image_map_to_color . update ( ) <EOL> self . configure_input_data ( self . actor , <EOL> self . image_map_to_color . output ) <EOL> else : <EOL> self . configure_input_data ( self . actor , src . outputs [ <NUM_LIT:0> ] ) <EOL> self . pipeline_changed = True <EOL> def update_data ( self ) : <EOL> """<STR_LIT>""" <EOL> self . data_changed = True <EOL> def _actor_changed ( self , old , new ) : <EOL> if old is not None : <EOL> self . actors . remove ( old ) <EOL> old . on_trait_change ( self . render , remove = True ) <EOL> self . actors . append ( new ) <EOL> new . on_trait_change ( self . render ) <EOL> def _get__force_map_scalars_to_color ( self ) : <EOL> mm = self . module_manager <EOL> if mm is None : <EOL> return False <EOL> src = mm . source <EOL> return not isinstance ( src . outputs [ <NUM_LIT:0> ] . point_data . scalars , <EOL> tvtk . UnsignedCharArray ) </s>
