a
    «ˆc’  ã                   @   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	d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ÚrecordZ
image_dataÚany)ZdatasetsZattribute_typesÚ
attributes© zmodule_manager.source)Z
depends_onÚactorZcustom)ÚnameÚstyleÚ	resizableZActor)Zshow_labelsÚlabelÚmap_scalars_to_colorznot _force_map_scalars_to_color)Úenabled_whenÚimage_map_to_color)r   r   Z
show_labelzMap Scalars)r   iô  iX  )ÚwidthÚheightr   c                 C   s   t  ¡ | _d S )N)r	   r   r   ©Úselfr   r   ú]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/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u rdS |j}| jr,| jddd� | jrj|  | j|¡ |jj| j_	| j 
¡  |  | jj| j¡ n|  | 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   Ztrait_change_notifyr   )Úmodule_managerÚsourceÚ_force_map_scalars_to_colorZ	trait_setr   Zconfigure_connectionr   Zscalar_lut_managerZlutZlookup_tableÚupdateZ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_changedr   r   r   r   Úupdate_dataX   s    zImageActor.update_datac                 C   s@   |d ur$| j  |¡ |j| jdd� | j  |¡ | | j¡ d S )NT)Úremove)Zactorsr*   r   ÚrenderÚappend)r   ÚoldÚnewr   r   r   Ú_actor_changedb   s
    zImageActor._actor_changedc                 C   s.   | j }|d u rdS |j}t| ¡ jjtjƒ S )NF)r    r!   Ú
isinstanceZget_output_datasetZ
point_dataZscalarsr	   ZUnsignedCharArrayr%   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   Z
input_infoZImageMapToColorsr   r   r   r   r"   r   r   r   Úviewr   r   r(   r)   r/   r1   r   r   r   r   r      sF   þÿ

ÿþÿþúó

r   N)Ú__doc__Z
traits.apir   r   r   r   Ztraitsui.apir   r   r   Ztvtk.apir	   Zmayavi.core.moduler
   Zmayavi.core.pipeline_infor   r   r   r   r   r   Ú<module>   s   