navigate Logo

Getting Started

  • Quick Start Guide
  • Software Installation
  • I Want To…

User Guide

  • Supported Hardware
  • Supported File Formats
  • User Interface Walkthrough
  • Setting Up A Microscope
  • Acquiring Data
  • Case Studies

Development

  • Contributing Guidelines
  • Developer Install
  • Software Architecture
  • Feature Container
  • REST-API
  • Plugin Architecture

Troubleshooting & Known Issues

  • Troubleshooting
  • Known Issues

Plugins

  • navigate Plugin Template
  • navigate Confocal Projection
  • navigate at Scale
  • navigate Constant Velocity Acquisition
  • navigate MMCore
  • navigate ilastik Server
  • navigate Photoactivation

Reference

  • Implemented Microscopes
  • Software API
navigate
  • navigate.controller.sub_controllers.camera_view.MIPViewController
  • View page source

navigate.controller.sub_controllers.camera_view.MIPViewController

class navigate.controller.sub_controllers.camera_view.MIPViewController(view, parent_controller=None)

Bases: BaseViewController

MIP View Controller Class.

__init__(view, parent_controller=None) → None

Initialize the MIP View Controller Class.

Parameters:
  • view (MIPTab) – The MIP tkinter frame that contains the widgets.

  • parent_controller (Controller) – The parent controller of the camera view controller.

Methods

__init__(view[, parent_controller])

Initialize the MIP View Controller Class.

add_crosshair(image)

Adds a cross-hair to the image.

apply_lut(image)

Applies a LUT to an image.

array_to_image(image)

Convert a numpy array to a PIL Image

calculate_offset()

Calculates the offset of the image.

detect_saturation(image)

Look for any pixels at the maximum intensity allowable for the camera.

digital_zoom()

Apply digital zoom.

display_image(image)

Display an image using the LUT specified in the View.

display_mip_image(*_)

Display MIP image in non-live view.

down_sample_image(image[, reset_original])

Down-sample the data for image display according to widget size.

execute(command, *args)

This function is called when a command is passed from a child process.

flip_image(image)

Flip the image according to the flip flags.

get_absolute_position()

Gets the absolute position of the computer mouse.

get_mip_image()

Get MIP image according to perspective and channel id

get_selected_channels([microscope_state])

Get the selected microscope channels from the MicroscopeState.

identify_channel_index_and_slice()

As images arrive, identify channel index and slice.

initialize(name, data)

Initialize the MIP view.

initialize_non_live_display(...)

Initialize the non-live display.

left_click(*_)

Toggles cross-hair on image upon left click event.

mark_position()

Marks the current position of the microscope in the multi-position acquisition table.

mouse_wheel(event)

Digitally zooms in or out on the image upon scroll wheel event.

move_crosshair()

Move the crosshair to a non-default position.

move_stage()

Move the stage according to the position the user clicked.

populate_image(image)

Converts image to an ImageTk.PhotoImage and populates the Tk Canvas

popup_menu(event)

Right-Click Popup Menu

preallocate_matrices()

Preallocate the matrices for the MIP.

prepare_mip_view()

Prepare the MIP view.

process_image()

Process the image to be displayed.

refresh(width, height)

Refresh the window.

register_event_listener(event_name, ...)

Register event listener in the parent_controller

reset_display([display_flag, reset_crosshair])

Set the display back to the original digital zoom.

resize(event)

Resize the window.

scale_image_intensity(image)

Scale the data to the min/max counts, and adjust bit-depth.

set_experiment_values()

Sets values of widgets based on experiment setting

set_mode([mode])

Sets mode of camera_view_controller.

show_verbose_info(*info)

Prints verbose information to the console

toggle_min_max_buttons([display])

Checks the value of the autoscale widget.

transpose_image(image)

Transpose the image according to the flip flags.

try_to_display_image(image)

Display the image.

update_canvas_size()

Update the canvas size.

update_experiment()

Update the experiment.yaml file

update_experiment_values()

Collects all the values of widgets

update_lut(target)

Update the LUT in the Camera View.

update_min_max_counts([display])

Get min and max count values from the View.

update_perspective()

Update the perspective of the image.

update_snr()

Updates the signal-to-noise ratio.

update_transpose_state([display])

Get Flip XY widget value from the View.

Attributes

custom_events

Custom events for the controller

view

The tkinter canvas that displays the image.

XY_image_height

The image height.

XY_image_width

The image width.

Z_image_value

Scaling factor for ratio of lateral and axial dimensions.

image

The image data.

zx_mip

The maximum intensity projection in the ZY plane.

zy_mip

The maximum intensity projection in the ZY plane.

xy_mip

The maximum intensity projection in the XY plane.

autoscale

The autoscale flag.

perspective

The perspective of the image.

render_widgets

The render widgets.

display_enabled

The display enabled flag.

add_crosshair(image: ndarray) → ndarray

Adds a cross-hair to the image.

Parameters:

image (np.ndarray) – Image data.

Returns:

image – Image data with cross-hair.

Return type:

np.ndarray

apply_lut(image: ndarray) → ndarray

Applies a LUT to an image.

Red is reserved for saturated pixels. self.color_values = [‘gray’, ‘gradient’, ‘rainbow’]

Parameters:

image (np.ndarray) – Image data.

Returns:

image – Image data with LUT applied.

Return type:

np.ndarray

array_to_image(image: ndarray) → <module 'PIL.Image' from '/opt/hostedtoolcache/Python/3.9.22/x64/lib/python3.9/site-packages/PIL/Image.py'>

Convert a numpy array to a PIL Image

Parameters:

image (numpy.ndarray) – Image data.

Returns:

image – A PIL Image

Return type:

Image

calculate_offset() → tuple

Calculates the offset of the image.

Returns:

  • offset_x (int) – The offset of the image in x.

  • offset_y (int) – The offset of the image in y.

detect_saturation(image: ndarray) → None

Look for any pixels at the maximum intensity allowable for the camera.

Note

The camera is set to 16-bit depth, so the maximum intensity is 2^16 - 1. If another camera is used, this function should be updated to reflect the maximum intensity value.

Parameters:

image (np.ndarray) – Image data.

digital_zoom() → ndarray

Apply digital zoom.

The x and y positions are between 0 and the canvas width and height respectively.

Returns:

image – Image after digital zoom applied

Return type:

np.ndarray

display_image(image: ndarray) → None

Display an image using the LUT specified in the View.

If Autoscale is selected, automatically calculates the min and max values for the data.

If Autoscale is not selected, takes the user values as specified in the min and max counts.

Parameters:

image (np.ndarray) – Image data.

display_mip_image(*_) → None

Display MIP image in non-live view.

down_sample_image(image: ndarray, reset_original: bool = False) → ndarray

Down-sample the data for image display according to widget size.

Parameters:
  • image (np.ndarray) – Image data.

  • reset_original (bool) – Flag to reset the original image size.

Returns:

down_sampled_image – Down-sampled image data.

Return type:

np.ndarray

execute(command, *args)

This function is called when a command is passed from a child process.

Parameters:
  • command (str) – command name

  • args (tuple) – command arguments

flip_image(image: ndarray) → ndarray

Flip the image according to the flip flags.

Parameters:

image (np.ndarray) – Image data.

Returns:

image – Flipped and/or transposed image data.

Return type:

numpy.ndarray

get_absolute_position() → tuple

Gets the absolute position of the computer mouse.

Returns:

  • x (int) – The x position of the mouse.

  • y (int) – The y position of the mouse.

get_mip_image() → ndarray

Get MIP image according to perspective and channel id

Returns:

image – Image data

Return type:

np.ndarray or None

get_selected_channels(microscope_state: Optional[dict] = None) → None

Get the selected microscope channels from the MicroscopeState.

Parameters:

microscope_state (Optional[dict]) – The microscope state dictionary object.

identify_channel_index_and_slice() → tuple

As images arrive, identify channel index and slice.

Returns:

  • channel_idx (int) – The channel index.

  • slice_idx (int) – The slice index.

initialize(name: str, data: list) → None

Initialize the MIP view.

Sets the min and max intensity values for the image.Disables the min and max widgets. Invokes the gray and autoscale widgets.Hides the SNR widget. Sets the perspective widget values. Sets the perspective widget to XY. Sets the channel widget to CH0.

Parameters:
  • name (str) – ‘minmax’, ‘image’.

  • data (list) – Min and max intensity values.

initialize_non_live_display(microscope_state: dict, camera_parameters: dict) → None

Initialize the non-live display.

Parameters:
  • microscope_state (dict) – Microscope state.

  • camera_parameters (dict) – Camera parameters.

left_click(*_) → None

Toggles cross-hair on image upon left click event.

mark_position() → None

Marks the current position of the microscope in the multi-position acquisition table.

mouse_wheel(event: Event) → None

Digitally zooms in or out on the image upon scroll wheel event.

Sets the self.zoom_value between 0.05 and 1 in .05 unit steps.

Parameters:

event (tk.Event) – num = 4 is zoom out. num = 5 is zoom in. x, y location. 0,0 is top left corner.

move_crosshair() → None

Move the crosshair to a non-default position.

move_stage() → None

Move the stage according to the position the user clicked.

populate_image(image: ndarray) → None

Converts image to an ImageTk.PhotoImage and populates the Tk Canvas

Note

When calling ImageTk.PhotoImage() to generate a new image, it will destroy what the canvas is showing, causing it to blink. This problem is solved by creating two images and alternating between them.

Parameters:

image (np.ndarray) – Image data.

popup_menu(event: Event) → None

Right-Click Popup Menu

Parameters:

event (tk.Event) – x, y location. 0,0 is top left corner.

preallocate_matrices() → None

Preallocate the matrices for the MIP.

Pre-allocated matrix is shape (number_of_channels, number_of_slices, width)

prepare_mip_view() → None

Prepare the MIP view.

Set the number of channels, number of slices, and the selected channels. Pre-allocate the matrices for the MIP.

process_image() → None

Process the image to be displayed.

Applies digital zoom, detects saturation, down-samples the image, scales the image intensity, adds a crosshair, applies the lookup table, and populates the image.

refresh(width: int, height: int) → None

Refresh the window.

Parameters:
  • width (int) – Width of the window.

  • height (int) – Height of the window.

register_event_listener(event_name, event_handler)

Register event listener in the parent_controller

Parameters:
  • event_name (str) – event name

  • event_handler (function) – event handler

reset_display(display_flag: bool = True, reset_crosshair: bool = True) → None

Set the display back to the original digital zoom.

Parameters:
  • display_flag (bool) – Flag for refreshing the image display. Default True.

  • reset_crosshair (bool) – Flag for resetting the crosshair. Default True.

resize(event: Event) → None

Resize the window.

Parameters:

event (tk.Event) – Tkinter event.

scale_image_intensity(image: ndarray) → ndarray

Scale the data to the min/max counts, and adjust bit-depth.

Parameters:

image (np.ndarray) – Image data.

Returns:

image – Scaled image data.

Return type:

np.ndarray

set_experiment_values()

Sets values of widgets based on experiment setting

setting_dict is a dictionary

set_mode(mode: str = '') → None

Sets mode of camera_view_controller.

Parameters:

mode (str) – camera_view_controller mode.

show_verbose_info(*info)

Prints verbose information to the console

Parameters:

info (tuple) – information to be printed

toggle_min_max_buttons(display: bool = False) → None

Checks the value of the autoscale widget.

If enabled, the min and max widgets are disabled and the image intensity is autoscaled. If disabled, miu and max widgets are enabled, and image intensity scaled.

transpose_image(image: ndarray) → ndarray

Transpose the image according to the flip flags.

Parameters:

image (np.ndarray) – Image data.

Returns:

image – Flipped and/or transposed image data.

Return type:

np.ndarray

try_to_display_image(image: ndarray) → None

Display the image.

Parameters:

image (np.ndarray) – Image data.

update_canvas_size() → None

Update the canvas size.

update_experiment() → None

Update the experiment.yaml file

update_experiment_values()

Collects all the values of widgets

setting_dict is a reference of experiment dictionary update the dictionary directly

update_lut(target) → None

Update the LUT in the Camera View.

When the LUT is changed in the GUI, this function is called. Updates the LUT.

update_min_max_counts(display: bool = False)

Get min and max count values from the View.

When the min and max counts are toggled in the GUI, this function is called. Updates the min and max values.

Parameters:

display (bool) – Flag to display the image.

update_perspective() → None

Update the perspective of the image.

update_snr() → None

Updates the signal-to-noise ratio.

update_transpose_state(display: bool = False) → None

Get Flip XY widget value from the View.

If True, transpose the image.

XY_image_height

The image height.

Type:

int

XY_image_width

The image width.

Type:

int

Z_image_value

Scaling factor for ratio of lateral and axial dimensions.

Type:

int

apply_cross_hair

The flag for the display of the cross-hair.

Type:

bool

autoscale

The autoscale flag.

Type:

bool

bit_depth

The bit depth of the image.

Type:

int

canvas

The tkinter canvas that displays the image.

Type:

tkinter.Canvas

canvas_height

The height of the canvas.

Type:

int

canvas_height_scale

The scaling factor for the height of the canvas.

Type:

int

canvas_width

The width of the canvas.

Type:

int

canvas_width_scale

The scaling factor for the width of the canvas.

Type:

int

colormap

The colormap for the image.

Type:

str

crosshair_x

Percentage of crosshair in x

Type:

float

crosshair_y

Percentage of crosshair in y

Type:

float

property custom_events

Custom events for the controller

display_enabled

The display enabled flag.

Type:

bool

flip_flags

The flip flags for the camera.

Type:

dict

height

The height of the image.

Type:

int

image

The image data.

Type:

np.ndarray

image_cache_flag

The flag for the image cache.

Type:

bool

image_count

The count of images.

Type:

int

image_mode

The imaging mode.

Type:

str

image_palette

The dictionary of image palette widgets.

Type:

dict

is_displaying_image

The lock for displaying the image.

Type:

VariableWithLock

logger

The logger for the camera view controller.

Type:

logging.Logger

max_counts

The maximum counts of the image.

Type:

int

microscope_name

The microscope name

Type:

str

min_counts

The minimum counts of the image.

Type:

int

mode

The mode of the camera view controller.

Type:

str

move_to_x

The x position of the mouse.

Type:

int

move_to_y

The y position of the mouse.

Type:

int

number_of_channels

The number of channels in the image.

Type:

int

number_of_slices

The number of slices in the image volume.

Type:

int

offset_crosshair

the flag for offsetting the crosshair

Type:

bool

original_image_height

The original height of the image.

Type:

int

original_image_width

The original width of the image.

Type:

int

parent_controller

parent controller

Type:

Controller

perspective

The perspective of the image.

Type:

str

render_widgets

The render widgets.

Type:

dict

resize_event_id

The resize event ID.

Type:

event

saturated_pixels

The saturated pixels in the image.

Type:

np.ndarray

selected_channels

The selected channels being acquired.

Type:

list

slice_index

The index of the slice in the image volume.

Type:

int

stack_cycling_mode

The stack cycling mode.

Type:

str

tk_image

The tkinter image.

Type:

ImageTk.PhotoImage

tk_image2

The tkinter image 2.

Type:

ImageTk.PhotoImage

total_images_per_volume

The total number of images per volume.

Type:

int

transpose

The flag for transposing the image.

Type:

bool

view

The tkinter canvas that displays the image.

Type:

tkinter.Canvas

width

The width of the canvas.

Type:

int

xy_mip

The maximum intensity projection in the XY plane.

Type:

np.ndarray

zoom_height

The zoom scale of the image.

Type:

float

zoom_offset

The zoom offset of the image.

Type:

numpy.ndarray

zoom_rect

The zoom rectangle of the image.

Type:

numpy.ndarray

zoom_scale

The zoom scale of the image.

Type:

float

zoom_value

The zoom value of the image.

Type:

float

zoom_width

The zoom width of the image.

Type:

int

zx_mip

The maximum intensity projection in the ZY plane.

Type:

np.ndarray

zy_mip

The maximum intensity projection in the ZY plane.

Type:

np.ndarray


© Copyright 2025, Dean Lab, UT Southwestern Medical Center.