Skip to content

Commit

Permalink
Merge pull request #218 from SciKit-Surgery/216-final-release-200
Browse files Browse the repository at this point in the history
216 - final release 2.0.0
  • Loading branch information
mxochicale committed May 24, 2023
2 parents 3fa59d5 + 782c003 commit 27c593d
Show file tree
Hide file tree
Showing 24 changed files with 134 additions and 116 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
sudo apt-get update
sudo apt-get install xvfb
sudo apt-get install libegl-dev
sudo apt-get install libxcb-cursor-dev
## Qt for X11 Requirements> https://doc.qt.io/qt-6/linux-requirements.html
sudo apt-get install libfontconfig1-dev libfreetype6-dev
sudo apt-get install libx11-dev libx11-xcb-dev
Expand All @@ -91,6 +92,7 @@ jobs:
export DISPLAY=:1
sudo Xvfb $DISPLAY -screen 0 1024x768x24 </dev/null &
export QT_DEBUG_PLUGINS=0
export QT_QPA_PLATFORM=xcb
export LD_LIBRARY_PATH=$pythonLocation"/lib/python${{ matrix.python-version }}/site-packages/PySide6/Qt/plugins/platforms"
coverage erase
coverage run -a --source ./sksurgeryvtk -m pytest -v -s
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ dist/

# For unit tests to write to.
tests/output

# docs/
docs/sksurgeryvtk.rst
docs/sksurgeryvtk.*.rst
docs/modules.rst
docs/build
23 changes: 23 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.8"

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: false

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: requirements-docs.txt
10 changes: 6 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
scikit-surgeryvtk
===============================

.. image:: sksvtk_logo.png
.. image:: https://raw.githubusercontent.com/SciKit-Surgery/scikit-surgeryvtk/master/sksvtk_logo.png
:height: 128px
:width: 128px
:target: https://github.com/SciKit-Surgery/scikit-surgeryvtk
Expand Down Expand Up @@ -29,8 +29,8 @@ scikit-surgeryvtk
:target: https://twitter.com/scikit_surgery?ref_src=twsrc%5Etfw
:alt: Follow scikit_surgery on twitter

Author(s): Stephen Thompson and Matt Clarkson;
Contributor(s): Miguel Xochicale, Thomas Dowrick, and Mian Ahmad.
Author(s): Stephen Thompson, Matt Clarkson, Thomas Dowrick and Miguel Xochicale;
Contributor(s): Mian Ahmad.

scikit-surgeryvtk implements VTK for Image Guided Surgery applications.

Expand Down Expand Up @@ -74,12 +74,14 @@ You can clone the repository using the following command:
Running the tests
^^^^^^^^^^^^^^^^^

You can run the unit tests by installing and running tox:
You can run the unit tests, build documentation, and other options by installing and running tox:

::

pip install tox
tox
tox -e docs
tox -e lint


Encountering Problems?
Expand Down
4 changes: 0 additions & 4 deletions docs/.gitignore

This file was deleted.

48 changes: 9 additions & 39 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import subprocess
import os
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
import os
import sys
# sys.path.insert(0, os.path.abspath('.'))

working_dir = os.path.abspath(os.path.dirname(__file__))
root_dir_rel = os.path.join('..')
root_dir_abs = os.path.abspath(root_dir_rel)
module_path = root_dir_abs
sys.path.insert(0, module_path)
logo_file = 'weiss_logo.png'
logo_file = 'sksvtk_logo.png'
logo_path = os.path.join('..', logo_file)

# List of patterns, relative to source directory, that match files and
Expand All @@ -45,7 +40,6 @@
'.DS_Store',
'_verion.py',
'versioneer.py'

]

# Add any paths that contain custom static files (such as style sheets) here,
Expand All @@ -55,27 +49,6 @@
html_static_path = [static_folder]


def generate_apidocs(*args):
"""Generate API docs automatically by trawling the available modules"""

global working_dir, module_path
output_path = working_dir
apidoc_command_path = 'sphinx-apidoc'
if hasattr(sys, 'real_prefix'): # called from a virtualenv
apidoc_command_path = os.path.join(sys.prefix, 'bin', 'sphinx-apidoc')
apidoc_command_path = os.path.abspath(apidoc_command_path)
subprocess.check_call(
[apidoc_command_path, '--force', '--separate'] +
['-o', output_path, module_path] +
[os.path.join(root_dir_abs, pattern) for pattern in exclude_patterns])


def setup(app):
# Hook to allow for automatic generation of API docs
# before doc deployment begins.
app.connect('builder-inited', generate_apidocs)


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -85,7 +58,7 @@ def setup(app):
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.imgmath', 'nbsphinx']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.imgmath']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -99,25 +72,25 @@ def setup(app):
# The master toctree document.
master_doc = 'index'


# This allows modules to be indexed under the submodule name rather than all appearing under sksurgeryvtk
modindex_common_prefix = [
'sksurgeryvtk.'
]

# General information about the project.
project = u'scikit-surgeryvtk'
copyright = u"2018, University College London"
copyright = u"2023, University College London"
# Authors: Stephen Thompson, Matt Clarkson, Thomas Dowrick and Miguel Xochicale
author = u'Thomas Dowrick'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u''
version = u'2.0.0'
# The full version, including alpha/beta/rc tags.
release = u''
release = u'2.0.0'

# The short X.Y version.
# version = sksurgeryvtk.__version__
Expand All @@ -129,15 +102,14 @@ def setup(app):
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# language = en

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down Expand Up @@ -196,7 +168,6 @@ def setup(app):
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
Expand Down Expand Up @@ -241,7 +212,6 @@ def setup(app):
[u'Thomas Dowrick'], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ scikit-surgeryvtk documentation
:start-after: .. features-start
:end-before: .. features-end

`Source code <https://github.com/SciKit-Surgery/scikit-surgeryvtk/>`_ is avaialble on GitHub.
`Source code <https://github.com/SciKit-Surgery/scikit-surgeryvtk/>`_ is available on GitHub.

.. toctree::
:maxdepth: 2
Expand Down
7 changes: 3 additions & 4 deletions docs/module_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Custom QtVTK Widgets
--------------------

Overlay Widget
^^^^^^^^^^^^^
^^^^^^^^^^^^^^
.. automodule:: sksurgeryvtk.widgets.vtk_overlay_window
:members:
:undoc-members:
Expand All @@ -16,7 +16,6 @@ Stereo interlaced Widget
:undoc-members:
:show-inheritance:


Rendering Generator
^^^^^^^^^^^^^^^^^^^
.. automodule:: sksurgeryvtk.widgets.vtk_rendering_generator
Expand Down Expand Up @@ -53,7 +52,7 @@ Surface Models
:undoc-members:
:show-inheritance:

.. automodule:: sksurgeryvtk.models.surface_model_directory_loader
.. automodule:: sksurgeryvtk.models.vtk_surface_model_directory_loader
:members:
:undoc-members:
:show-inheritance:
Expand All @@ -64,6 +63,7 @@ Unstructured Grid Model
:members:
:undoc-members:
:show-inheritance:

Image Model
^^^^^^^^^^^
.. automodule:: sksurgeryvtk.models.vtk_image_model
Expand All @@ -90,7 +90,6 @@ Geometric Primitives
:undoc-members:
:show-inheritance:


Camera Utilities
----------------

Expand Down
24 changes: 19 additions & 5 deletions docs/tutorials/text_overlay.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,29 @@ First, we need to import relevant modules, setup a Qt Application, and create a

.. code-block:: python
import sys
import cv2
from PySide2 import QtWidgets
from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout
from sksurgeryvtk.widgets import vtk_overlay_window
from sksurgeryvtk.text import text_overlay
app = QtWidgets.QApplication([])
# Check if already an instance of QApplication is present or not
if not QApplication.instance():
app = QApplication([])
else:
app = QApplication.instance()
window_qwidget = QWidget()
window_qwidget.show()
layout = QVBoxLayout()
window_qwidget.setLayout(layout)
background = cv2.imread('tests/data/rendering/background-960-x-540.png')
overlay_window = vtk_overlay_window.VTKOverlayWindow()
overlay_window = vtk_overlay_window.VTKOverlayWindow(offscreen=False, init_widget=False)
overlay_window.set_video_image(background)
layout.addWidget(overlay_window)
overlay_window.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
We can now create a corner annotations:

Expand Down Expand Up @@ -57,5 +68,8 @@ Finally, we execute the Qt app to show the window:
.. code-block:: python
overlay_window.show()
sys.exit(app.exec_())
overlay_window.Initialize()
overlay_window.Start()
app.exec()
overlay_window.close()
11 changes: 1 addition & 10 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
# This file lists the python packages that your software depends on
# for development.
# It is used by pip to manage software dependencies. It is not to be
# confused with the software requirements, which are listed in
# doc/requirements.rst
-r requirements.txt
coverage<=6.5.0
mock<=5.0.1
pyfakefs<=5.1.0
parameterized<=0.8.1
pylint<=2.16.1
sphinx<=5.3.0
sphinx_rtd_theme<=1.2.0
nbsphinx<=0.8.12
pyinstaller<=5.7.0
pytest<=7.2.1
pytest-qt-app<=1.0.1
pytest-qt<=4.2.0
tox<=4.4.5
coveralls<=3.3.1
pyyaml<=6.0
six<=1.16.0
pyyaml
5 changes: 5 additions & 0 deletions requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-r requirements.txt
six
docutils
sphinx
sphinx_rtd_theme
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file lists the python packages that your software depends on.
# It is used by pip to manage software dependencies. It is not to be
# confused with the software requirements, which are listed in
# doc/requirements.rst
# It is used by pip to manage software dependencies.
# It is not to be confused with the software requirements,
# which are listed in requirements-dev.rst and requirements-docs.rst
numpy>=1.11
vtk>=9.2.5
PySide6>=6.4.2
opencv-contrib-python-headless>=4.2.0.32
vtk>=9.2.6
PySide6>=6.5.0
opencv-contrib-python-headless>=4.7.0.72
scikit-surgerycore>=0.1.7
scikit-surgeryimage>=0.10.1
scikit-surgeryimage>=0.10.1
Loading

0 comments on commit 27c593d

Please sign in to comment.