3
�Ó4]’  ã               @   sh   d Z ddlmZmZmZmZ ddlmZmZm	Z	 ddl
mZ ddlmZ ddlmZ G dd„ deƒZd	S )
z Displays ImageData efficiently.
é    )ÚInstanceÚBoolÚon_trait_changeÚProperty)ÚViewÚGroupÚItem)Útvtk)ÚModule)ÚPipelineInfoc            
   @   sÈ   e Zd Zeejddd�Zedgdgdgd�Zeej	f ddd�Z
eZedd�Zeeed	d
dd�ddd�eeeddd�ƒedd
ddd�dd�dddd�Zdd„ Zedƒdd„ ƒZdd„ Zdd „ Zd!d"„ Zd#S )$Ú
ImageActorFT)Ú
allow_noneÚrecordÚ
image_dataÚany)ÚdatasetsÚattribute_typesÚ
attributeszmodule_manager.source)Ú
depends_onÚactorÚcustom)ÚnameÚstyleÚ	resizableZActor)Úshow_labelsÚlabelÚmap_scalars_to_colorznot _force_map_scalars_to_color)Úenabled_whenÚimage_map_to_color)r   r   Ú
show_labelzMap Scalars)r   iô  iX  )ÚwidthÚheightr   c             C   s   t jƒ | _d S )N)r	   r   r   )Úself© r#   ú]/home/yuhw/wc/wire-cell-python/venv/lib/python3.6/site-packages/mayavi/modules/image_actor.pyÚsetup_pipeline<   s    zImageActor.setup_pipelinez¢map_scalars_to_color,image_map_to_color.[output_format,pass_alpha_to_output],module_manager.scalar_lut_manager.lut_mode,module_manager.vector_lut_manager.lut_modec             C   sŠ   | j }|dkrdS |j}| jr,| jddd� | jrj| j| j|ƒ |jj| j_	| jj
ƒ  | j| jj| jƒ n| j| jj|jd ƒ d| _dS )zyOverride this method so that it *updates* the tvtk pipeline
        when data upstream is known to have changed.
        NTF)r   Útrait_change_notifyr   )Úmodule_managerÚsourceÚ_force_map_scalars_to_colorÚ	trait_setr   Úconfigure_connectionr   Zscalar_lut_managerZlutZlookup_tableÚupdateÚconfigure_inputr   ZmapperÚoutputsZpipeline_changed)r"   ÚmmÚsrcr#   r#   r$   Úupdate_pipeline?   s    


zImageActor.update_pipelinec             C   s
   d| _ dS )z_Override this method so that it flushes the vtk pipeline if
        that is necessary.
        TN)Zdata_changed)r"   r#   r#   r$   Úupdate_dataX   s    zImageActor.update_datac             C   s@   |d k	r$| j j|ƒ |j| jdd� | j j|ƒ |j| jƒ d S )NT)Úremove)Zactorsr3   r   ÚrenderÚappend)r"   ÚoldÚnewr#   r#   r$   Ú_actor_changedb   s
    zImageActor._actor_changedc             C   s.   | j }|d krdS |j}t|jƒ jjtjƒ S )NF)r'   r(   Ú
isinstanceZget_output_datasetZ
point_dataÚscalarsr	   ZUnsignedCharArray)r"   r/   r0   r#   r#   r$   Ú _get__force_map_scalars_to_colori   s    z+ImageActor._get__force_map_scalars_to_colorN)Ú__name__Ú
__module__Ú__qualname__r   r	   r   r   r   Ú
input_infoZImageMapToColorsr   r   r   r   r)   r   r   r   Úviewr%   r   r1   r2   r8   r;   r#   r#   r#   r$   r      s4   




r   N)Ú__doc__Ú
traits.apir   r   r   r   Útraitsui.apir   r   r   Útvtk.apir	   Zmayavi.core.moduler
   Úmayavi.core.pipeline_infor   r   r#   r#   r#   r$   Ú<module>   s   