Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ jobs:
- name: Submodule recursive
run: git submodule update --init --recursive

- name: Update vcpkg
run: |
cd ${{ env.VCPKG_ROOT }}
git checkout master

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
- uses: lukka/get-cmake@latest
# Restore both vcpkg and its artifacts from the GitHub cache service.
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
- name: Submodule recursive
run: git submodule update --init --recursive

- name: Update vcpkg
run: |
cd ${{ env.VCPKG_ROOT }}
git checkout master

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
- uses: lukka/get-cmake@latest
# Restore both vcpkg and its artifacts from the GitHub cache service.
Expand Down Expand Up @@ -117,11 +122,11 @@ jobs:
- name: Get version
id: get_version
run: |
echo ::set-output name=VERSION_TAG::${GITHUB_REF#refs/tags/}
echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Deploy documentation
if: ${{ (env.BRANCH_NAME == 'master') || (env.BRANCH_NAME == 'develop') }}
uses: JamesIves/github-pages-deploy-action@v4.3.3
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/build/html # The folder the action should deploy.
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/quick-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ jobs:
- name: Submodule recursive
run: git submodule update --init --recursive

- name: Update vcpkg
run: |
cd ${{ env.VCPKG_ROOT }}
git checkout master

# Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service.
- uses: lukka/get-cmake@latest
# Restore both vcpkg and its artifacts from the GitHub cache service.
Expand Down Expand Up @@ -115,7 +120,7 @@ jobs:
pytest -vv --cov-report xml --cov=pyapr

- name: Upload coverage report
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3

- name: Build documentation
run: |
Expand Down
48 changes: 24 additions & 24 deletions pyapr/utils/filegui.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pyqtgraph.Qt as Qt
from pyqtgraph.Qt import QtCore, QtWidgets
import pyqtgraph as pg
import matplotlib.pyplot as plt
import numpy as np


class DoubleSlider(Qt.QtWidgets.QSlider):
class DoubleSlider(QtWidgets.QSlider):
"""
Extends QSlider to allow floating-point values

Expand All @@ -13,7 +13,7 @@ class DoubleSlider(Qt.QtWidgets.QSlider):
"""

# create a signal that we can connect to if necessary
doubleValueChanged = Qt.QtCore.pyqtSignal(float)
doubleValueChanged = QtCore.pyqtSignal(float)

def __init__(self, decimals=2, *args, **kwargs):
super(DoubleSlider, self).__init__(*args, **kwargs)
Expand Down Expand Up @@ -51,10 +51,10 @@ def __init__(self, window, label_name, decimals=0):

self.decimals = decimals

self.slider = DoubleSlider(decimals, Qt.QtCore.Qt.Horizontal, window)
self.maxBox = Qt.QtWidgets.QDoubleSpinBox(window, decimals=self.decimals)
self.slider = DoubleSlider(decimals, QtCore.Qt.Horizontal, window)
self.maxBox = QtWidgets.QDoubleSpinBox(window, decimals=self.decimals)

self.label = Qt.QtWidgets.QLabel(window)
self.label = QtWidgets.QLabel(window)

self.maxBox.setMaximum(64000)
self.maxBox.setValue(300)
Expand Down Expand Up @@ -95,13 +95,13 @@ def updateText(self):
self.label.setText(text_str)


class MainWindowImage(Qt.QtWidgets.QWidget):
class MainWindowImage(QtWidgets.QWidget):
def __init__(self, slider_decimals=0):
super(MainWindowImage, self).__init__()

self.setMouseTracking(True)

self.layout = Qt.QtGui.QGridLayout()
self.layout = QtWidgets.QGridLayout()
self.setLayout(self.layout)
self.layout.setSpacing(0)

Expand All @@ -112,7 +112,7 @@ def __init__(self, slider_decimals=0):
self.layout.addWidget(self.pg_win, 0, 0, 3, 1)

# add a slider
self.slider = Qt.QtWidgets.QSlider(Qt.QtCore.Qt.Horizontal, self)
self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)

self.slider.valueChanged.connect(self.valuechange)

Expand All @@ -129,27 +129,27 @@ def __init__(self, slider_decimals=0):
self.hist.item.sigLevelsChanged.connect(self.histogram_updated)

# add a QLabel giving information on the current slice and the APR
self.slice_info = Qt.QtGui.QLabel(self)
self.slice_info = QtWidgets.QLabel(self)

self.slice_info.move(20, 20)
self.slice_info.setFixedWidth(250)

# add a label for the current cursor position

self.cursor = Qt.QtGui.QLabel(self)
self.cursor = QtWidgets.QLabel(self)

self.cursor.move(20, 40)
self.cursor.setFixedWidth(250)

# add parameter tuning

# create push button
self.exit_button = Qt.QtWidgets.QPushButton('Use Parameters', self)
self.exit_button = QtWidgets.QPushButton('Use Parameters', self)
self.exit_button.setFixedWidth(300)
self.exit_button.move(300, 10)
self.exit_button.clicked.connect(self.exitPressed)

self.max_label = Qt.QtWidgets.QLabel(self)
self.max_label = QtWidgets.QLabel(self)
self.max_label.setText("Slider Max")
self.max_label.move(610, 50)

Expand Down Expand Up @@ -278,11 +278,11 @@ def update_slice(self, new_view):
self.updateSliceText(new_view)

def keyPressEvent(self, event):
if event.key() == Qt.QtCore.Qt.Key_Left:
if event.key() == QtCore.Qt.Key_Left:
# back a frame
self.update_slice(self.current_view - 1)

if event.key() == Qt.QtCore.Qt.Key_Right:
if event.key() == QtCore.Qt.Key_Right:
# forward a frame
self.update_slice(self.current_view + 1)

Expand Down Expand Up @@ -345,13 +345,13 @@ def set_image(self, img, converter):

self.hist.setImageItem(self.img_I)

self.img_I_ds.setRect(Qt.QtCore.QRectF(self.min_x, self.min_y, self.x_num_ds*2, self.y_num_ds*2))
self.img_I.setRect(Qt.QtCore.QRectF(self.min_x, self.min_y, self.x_num, self.y_num))
self.img_I_ds.setRect(QtCore.QRectF(self.min_x, self.min_y, self.x_num_ds*2, self.y_num_ds*2))
self.img_I.setRect(QtCore.QRectF(self.min_x, self.min_y, self.x_num, self.y_num))

## Set up the z slider
self.slider.setMinimum(0)
self.slider.setMaximum(self.z_num - 1)
self.slider.setTickPosition(Qt.QtWidgets.QSlider.TicksBothSides)
self.slider.setTickPosition(QtWidgets.QSlider.TicksBothSides)
self.slider.setGeometry(0.05 * self.full_size, 0.97 * self.full_size, 0.95 * self.full_size, 40)

self.setLUT('viridis')
Expand All @@ -367,30 +367,30 @@ def closeEvent(self, event):
class InteractiveIO:
def __init__(self):
# class methods require a QApplication instance - this helps to avoid multiple instances...
self.app = Qt.QtGui.QApplication.instance()
self.app = QtWidgets.QApplication.instance()
if self.app is None:
self.app = Qt.QtGui.QApplication([])
self.app = QtWidgets.QApplication([])

@staticmethod
def get_tiff_file_name():
print("Please select an input image file (TIFF)")
file_name = Qt.QtGui.QFileDialog.getOpenFileName(None, "Open Tiff", "~", "(*.tif *.tiff)")
file_name = QtWidgets.QFileDialog.getOpenFileName(None, "Open Tiff", "~", "(*.tif *.tiff)")
return file_name[0]

@staticmethod
def get_apr_file_name():
print("Please select an input APR file (HDF5)")
file_name = Qt.QtGui.QFileDialog.getOpenFileName(None, "Open APR", "", "(*.apr *.h5)")
file_name = QtWidgets.QFileDialog.getOpenFileName(None, "Open APR", "", "(*.apr *.h5)")
return file_name[0]

@staticmethod
def save_apr_file_name(default_name='output.apr'):
file_name = Qt.QtGui.QFileDialog.getSaveFileName(None, "Save APR", default_name, "(*.apr *.h5)")
file_name = QtWidgets.QFileDialog.getSaveFileName(None, "Save APR", default_name, "(*.apr *.h5)")
return file_name[0]

@staticmethod
def save_tiff_file_name(default_name='output.tif'):
file_name = Qt.QtGui.QFileDialog.getSaveFileName(None, "Save TIFF", default_name, "(*.tif *.tiff)")
file_name = QtWidgets.QFileDialog.getSaveFileName(None, "Save TIFF", default_name, "(*.tif *.tiff)")
return file_name[0]

def interactive_apr(self, converter, apr, img, slider_decimals=2):
Expand Down
6 changes: 3 additions & 3 deletions pyapr/viewer/compressInteractive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
from pyqtgraph.Qt import QtCore, QtWidgets
import pyqtgraph as pg
from _pyaprwrapper.data_containers import APR, ShortParticles
from _pyaprwrapper.viewer import compress_and_fill_slice
Expand Down Expand Up @@ -156,9 +156,9 @@ def interactive_compression(apr: APR,
pg.setConfigOption('foreground', 'k')
pg.setConfigOption('imageAxisOrder', 'row-major')

app = QtGui.QApplication.instance()
app = QtWidgets.QApplication.instance()
if app is None:
app = QtGui.QApplication([])
app = QtWidgets.QApplication([])

## Create window with GraphicsView widget
win = CompressWindow()
Expand Down
6 changes: 3 additions & 3 deletions pyapr/viewer/partsViewer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
from pyqtgraph.Qt import QtCore, QtWidgets
from _pyaprwrapper.data_containers import APR, ByteParticles, ShortParticles, FloatParticles, LongParticles
from _pyaprwrapper.viewer import fill_slice, fill_slice_level, min_occupied_level
from ..utils import particles_to_type
Expand Down Expand Up @@ -364,9 +364,9 @@ def parts_viewer(apr: APR,
Input particle intensity values.
"""
_check_input(apr, parts)
app = QtGui.QApplication.instance()
app = QtWidgets.QApplication.instance()
if app is None:
app = QtGui.QApplication([])
app = QtWidgets.QApplication([])

pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
Expand Down
6 changes: 3 additions & 3 deletions pyapr/viewer/raycastViewer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
from pyqtgraph.Qt import QtCore, QtWidgets
import pyqtgraph as pg
from _pyaprwrapper.data_containers import APR, ByteParticles, ShortParticles, FloatParticles, LongParticles
from _pyaprwrapper.viewer import APRRaycaster
Expand Down Expand Up @@ -314,9 +314,9 @@ def raycast_viewer(apr: APR,
pg.setConfigOption('foreground', 'k')
pg.setConfigOption('imageAxisOrder', 'row-major')

app = QtGui.QApplication.instance()
app = QtWidgets.QApplication.instance()
if app is None:
app = QtGui.QApplication([])
app = QtWidgets.QApplication([])

# Create window with GraphicsView widget
win = MainWindowImage()
Expand Down