Visualization

This section describes the currently supported visualization options of mermaid. Visualizations during the iterations are implemented in module Visualize registration results. There is also some rudimentary support for 3D slice viewing via matplotlib (see Viewers).

Visualize registration results

mermaid.visualize_registration_results.checkerboard_2d(I0, I1, nrOfTiles=8, multi_channel=False)[source]

Creates a checkerboard between two images

Parameters:
  • I0 – image 0, size XxYxZ
  • I1 – image 1, size XxYxZ
  • nrOfTiles – number of desired tiles in each direction
Returns:

returns tiled image

mermaid.visualize_registration_results.show_current_images(iter, iS, iT, iW, iSL=None, iTL=None, iWL=None, vizImages=None, vizName=None, phiWarped=None, visual_param=None)[source]

Visualizes the current images during registration.

Parameters:
  • iter – iteration number
  • iS – source image BxCxXxYxZ (only displays B=0,C=0)
  • iT – target image BxCxXxYxZ (only displays B=0,C=0)
  • iW – warped image BxCxXxYxZ (only displays B=0,C=0)
  • iSL – source image label map BxCxXxYxZ (only displays B=0,C=0)
  • iTL – target image label map BxCxXxYxZ (only displays B=0,C=0)
  • iWL – warped image label map BxCxXxYxZ (only displays B=0,C=0)
  • vizImages – custom visualization image XxYxZ
  • vizName – name for this image
  • phiWarped – warped map BxdimxXxYxZ (only displays B=0)
  • visual_param – visualization parameters

Viewers

Inheritance diagram of mermaid.viewers

Implements various viewers to display 3D data

class mermaid.viewers.FigureEventHandler(fig)[source]

Class to implement general event handling for matplotlib figures. In particular this class allows for easy event handling within different subplots.

fig = None

figure handle

ax_events = None

dictionary that keeps track of all the events

supported_events = None

events that are currently supported by the figure event handler

sync_d = None

dictionary to hold information about synchronization of subplots (for synchronized slicing)

reset_synchronize()[source]

Removes all the subplot synchronizations

synchronize(axes)[source]

Sets synchornization information (i.e., which axes need to be synchronized)

Parameters:axes – list of axes
connect()[source]

Connect to all the events

disconnect()[source]

Disconnect from all events

add_axes_event(eventname, ax, eventfcn, getsyncfcn=None, setsyncfcn=None)[source]

Associates events with a particular axis

Parameters:
  • eventname – event name: ‘button_press_event’, not yet supported: ‘button_release_event’, ‘key_press_event’, ‘key_release_event’
  • ax – axis handle
  • eventfcn – function that should be called
  • getsyncfcn – function that returns synchronization information
  • setsyncfcn – function that takes synchronization information
remove_axes_event(eventname, ax)[source]

Removes an event from an axis

Parameters:
  • eventname – event name: ‘button_press_event’, not yet supported: ‘button_release_event’, ‘key_press_event’, ‘key_release_event’
  • ax – axis handle
class mermaid.viewers.ImageViewer(ax, data)[source]

Abstract class for an image viewer.

show()[source]

Displays the image

display_title()[source]

Displays the title for a figure

class mermaid.viewers.ImageViewer3D(ax, data)[source]

Abstract class for a 3D image viewer.

previous_slice()[source]

display the previous slice

next_slice()[source]

display the next slice

set_synchronize(index)[source]

Synchronize to a particular slice

Parameters:index – slice index
get_synchronize()[source]

Get index to which should be synchronized

Returns:slice index
on_mouse_press(event)[source]

Implements going forward and backward in slices depending based on clicking in the left or the right of an image

Parameters:event – event data
class mermaid.viewers.ImageViewer3D_Sliced(ax, data, sliceDim, textStr='Slice', showColorbar=False)[source]

3D image viewer specialization to 3D sliced viewing

sliceDim = None

dimension to slice

textStr = None

title string

index = None

slice index to display

showColorbar = None

dispaly colorbar True/False

previous_slice()[source]

Display previous slice

next_slice()[source]

Display next slice

set_synchronize(index)[source]

Synchronize slice view to a particular slice

Parameters:index – slice index to synchronize to
get_synchronize()[source]

Get current slice index

Returns:current slice index
display_title()[source]

Display figure title

show()[source]

Show the current slice

class mermaid.viewers.ImageViewer3D_Sliced_Contour(ax, data, phi, sliceDim, textStr='Slice', showColorbar=False)[source]

Specialization of 3D sliced viewer to also display contours

phi = None

map

get_phi_slice_at_dimension(index)[source]

Get map (based on which we can draw contours) at a particular slice index

Parameters:index – slice index
Returns:returns the map at this slice index
show_contours()[source]

display the contours for a particular slice

previous_slice()[source]

display previous slice

next_slice()[source]

display next slice

set_synchronize(index)[source]

set slice to a particular index (to synchronize views)

Parameters:index – slice index
show()[source]

Show the image with contours overlaid

mermaid.viewers.test_viewer()[source]

simple test viewer