spam.visual package

Contents

spam.visual package#

Submodules#

spam.visual.QtImageViewer module#

QtImageViewer.py: PyQt image viewer widget for a QPixmap in a QGraphicsView scene with mouse zooming and panning.

class spam.visual.QtImageViewer.QtImageViewer[source]#

Bases: QGraphicsView

PyQt image viewer widget for a QPixmap in a QGraphicsView scene with mouse zooming and panning.

Displays a QImage or QPixmap (QImage is internally converted to a QPixmap). To display any other image format, you must first convert it to a QImage or QPixmap.

Some useful image format conversion utilities:

qimage2ndarray: NumPy ndarray <==> QImage (hmeine/qimage2ndarray) ImageQt: PIL Image <==> QImage (python-pillow/Pillow)

Mouse interaction:

Left mouse button drag: Pan image. Right mouse button drag: Zoom box. Right mouse button doubleclick: Zoom to show entire image.

leftMouseButtonPressed#

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

rightMouseButtonPressed#

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

leftMouseButtonReleased#

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

rightMouseButtonReleased#

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

leftMouseButtonDoubleClicked#

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

rightMouseButtonDoubleClicked#

str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Type:

pyqtSignal(*types, name

hasImage()[source]#

Returns whether or not the scene contains an image pixmap.

clearImage()[source]#

Removes the current image pixmap from the scene if it exists.

pixmap()[source]#

Returns the scene’s current image pixmap as a QPixmap, or else None if no image exists. :rtype: QPixmap | None

image()[source]#

Returns the scene’s current image pixmap as a QImage, or else None if no image exists. :rtype: QImage | None

setImage(image)[source]#

Set the scene’s current image pixmap to the input QImage or QPixmap. Raises a RuntimeError if the input image has type other than QImage or QPixmap. :type image: QImage | QPixmap

loadImageFromFile(fileName='')[source]#

Load an image from file. Without any arguments, loadImageFromFile() will popup a file dialog to choose the image file. With a fileName argument, loadImageFromFile(fileName) will attempt to load the specified image file directly.

updateViewer()[source]#

Show current zoom (if showing entire image, apply current aspect ratio mode).

resizeEvent(event)[source]#

Maintain current zoom on resize.

mousePressEvent(event)[source]#

Start mouse pan or zoom mode.

mouseReleaseEvent(event)[source]#

Stop mouse pan or zoom mode (apply zoom if valid).

mouseDoubleClickEvent(event)[source]#

Show entire image.

spam.visual.visualClass module#

Library of SPAM functions for graphical alignment Copyright (C) 2020 SPAM Contributors

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

class spam.visual.visualClass.ereg(images, enterPhi, names, binning=None, imUpdate=0)[source]#

Bases: QWidget

slideIm1(value)[source]#
slideIm2(value)[source]#
showImages()[source]#
changeAxis(i)[source]#
checkSlave()[source]#
changeComp(value)[source]#
changeCB(value)[source]#
changeColorF()[source]#
modifyPhi(mod, value)[source]#
saveTSV()[source]#
saveTIFF()[source]#
validate()[source]#
resetTSV()[source]#
resetIdentity()[source]#
output()[source]#
equalize()[source]#
class spam.visual.visualClass.QtCropWidget(images, phi, crop, names, binning=1, imUpdate=0)[source]#

Bases: QWidget

showImages()[source]#
slideZMin(value)[source]#
slideZMax(value)[source]#
slideYMin(value)[source]#
slideYMax(value)[source]#
slideXMin(value)[source]#
slideXMax(value)[source]#
slideZView(value)[source]#
slideYView(value)[source]#
slideXView(value)[source]#
saveTSVCrop()[source]#
output()[source]#
changeImage(val)[source]#
class spam.visual.visualClass.JHist(images, phi, crop, fontColor, names, imUpdate)[source]#

Bases: QWidget

slideIm1Max(value)[source]#
slideIm2Max(value)[source]#
slideIm1Min(value)[source]#
slideIm2Min(value)[source]#
changeBins(i)[source]#
changeDistance()[source]#
plusOrMinusDist(val)[source]#
changeNBP()[source]#
plusOrMinusNBP(val)[source]#
computeHistogram()[source]#
fitEllipsoid()[source]#
showHistogram()[source]#
slideIndexedValChange(index)[source]#
reFit(index)[source]#
class spam.visual.visualClass.PhaseDiagram(gaussianParameters, bins, jointHistogram, names)[source]#

Bases: QWidget

distanceMax(x, y, gp)[source]#
changeDistanceType(i)[source]#
changeSigma()[source]#
findFullCoverage()[source]#
computePhaseDiagram()[source]#
showPhaseDiagram()[source]#
class spam.visual.visualClass.FinalStep(images, crop, phaseDiagram, phi, GP, bins, greyLimitsCrop, binning, deformedImageName, names)[source]#

Bases: QWidget

starCorrelation()[source]#

Module contents#