This module provide a 2D QPixmap view on spatial images

class image.gui.pixmap_view.PixmapView(img=None, palette=None)[source]

Bases: object

Base class for 2D views on spatial images

Provide a QPixmap when asked to

data_coordinates(x_pix, y_pix)[source]

Convert coordinates expressed in the pixmap into coordinates expressed as indices in the data space.

Parameters:
  • x_pix (int)
  • y_pix (int)
Returns Type:

int,int

image()[source]

Get currently displayed image

Returns Type:array
palette()[source]

Palette used to associate a color with info contains in a voxel

Returns Type:array of qRgba
pixmap()[source]

Return a pixmap representation of the spatial image

pixmap_coordinates(inds)[source]

Convert coordinates expressed in data space into a point in the pixmap space

Parameters:
  • inds (tuple of int) - coordinate of a point in data space

    e.g. i,j or i,j,k

Returns Type:

int,int

pixmap_real_size()[source]

Return the spatial extension of the pixmap

Returns Type:float,float
resolution()[source]

Return resolution of the pixmap

Returns Type:float,float
rotate(orient)[source]

Rotate view 90 degrees

Parameters:
  • orient (int) - orientation of rotation
    • if orient == 1, rotation clockwise
    • if orient == -1, rotation counterclockwise
set_image(img)[source]

Set an image to display

Parameters:
  • im (array)
set_palette(palette)[source]

Set the palette

Parameters:
  • palette (list of int)
class image.gui.pixmap_view.PixmapStackView(img=None, palette=None)[source]

Bases: image.gui.pixmap_view.PixmapView

Pixmap view of a spatial image as a stack of images

current_slice()[source]

Index of the currently displayed slice

Returns Type:int
data_coordinates(x_pix, y_pix, axis=0)[source]

Convert coordinates expressed in the pixmap into coordinates expressed as indices in the data space.

Parameters:
  • x_pix (int)
  • y_pix (int)
Returns Type:

int,int,int

nb_slices()[source]

Number of slices in the stack

Returns Type:int
pixmap()[source]

Return a pixmap representation of the spatial image

pixmap_coordinates(i, j)[source]

Convert coordinates expressed in data space into a point in the pixmap space

Parameters:
  • inds (tuple of int) - coordinate of a point in data space

    e.g. i,j or i,j,k

Returns Type:

int,int

rotate(orient)[source]

Rotate view 90 degrees

Parameters:
  • orient (int) - orientation of rotation
    • if orient == 1, rotation clockwise
    • if orient == -1, rotation counterclockwise
set_current_slice(ind)[source]

Change current displayed slice

Parameters:
  • ind (int) - index of the slice in the data array
set_image(img)[source]

Set an image to display

Parameters:
  • im (array)
set_palette(palette, axis=2)[source]

Set the palette

Warning

will cast color value to uint32

Parameters:
  • palette (list of int)
class image.gui.pixmap_view.ScalableLabel(parent=None)[source]

Bases: PySide.QtGui.QLabel

Scalable label that respect the ratio of the pixmap it display

mouseMoveEvent(event)[source]
mousePressEvent(event)[source]
pixmap_coordinates(x_screen, y_screen)[source]

Compute pixmaps coordinates that map the given point on the screen

Parameters:
  • x_screen (int)
  • y_screen (int)
resizeEvent(event)[source]
setPixmap(pix)[source]
set_resolution(x_scale, y_scale)[source]

Set the resolution of the image

Parameters:
  • x_scale (float) - size of a pixel in x direction
  • y_scale (float) - size of a pixel in y direction
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x2adee80e6758>
class image.gui.pixmap_view.ScalableGraphicsView(*args, **kwargs)[source]

Bases: PySide.QtGui.QGraphicsView

Graphics View that always zoom to fit it's content

mouseMoveEvent(event)[source]
mousePressEvent(event)[source]
resizeEvent(event)[source]
staticMetaObject = <PySide.QtCore.QMetaObject object at 0x2adee80e6710>

This Page