Commit d0e90fe8 authored by Stephen Thompson's avatar Stephen Thompson

Merge branch '5-rename-project'

parents 65872c32 c02b4616
Pipeline #3057 passed with stages
in 9 minutes and 7 seconds
[run]
omit =
./sksurgerytorsosimulator/_version.py
./sksurgerytorsosimulator/__init__.py
./sksurgerytorsosimulator/__main__.py
./sksurgerytorsosimulator/ui/sksurgerytorsosimulator_command_line.py
./sksurgerytorsosimulator/ui/sksurgerytorsosimulator_demo.py
./snappysonic/_version.py
./snappysonic/__init__.py
./snappysonic/__main__.py
./snappysonic/ui/snappysonic_command_line.py
./snappysonic/ui/snappysonic_demo.py
include versioneer.py
include snappytorsosimulator/_version.py
include snappysonic/_version.py
scikit-torso-simulator
SnappySonic
===============================
.. image:: https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgerytorsosimulator/raw/master/project-icon.png
......@@ -23,15 +23,16 @@ scikit-torso-simulator
Author: Stephen Thompson
scikit-torso-simulator is part of the `SNAPPY`_ software project, developed at the `Wellcome EPSRC Centre for Interventional and Surgical Sciences`_, part of `University College London (UCL)`_.
SnappySonic can be used as an ultrasound acquisition simulator. The output from a tracking system (NDI or AruCo tags) is to select a frame of pre-recorded video to show. A suitable video of ultrasound data is included in the data directory, however the user can select a video of their choosing.
scikit-torso-simulator supports Python 3.6.
SnappySonic is part of the `SNAPPY`_ software project, developed at the `Wellcome EPSRC Centre for Interventional and Surgical Sciences`_, part of `University College London (UCL)`_.
snappy-torso-simulator uses out put from a tracking system (NDI or AruCo tags) to select a frame of video to show. It can be used to construct a simple to use ultrasound simulator.
SnappySonic supports Python 3.6.
::
python sksurgerytorsosimulator.py --config config.json
pip install snappysonic
python snappysonic.py --config config.json
The config file defines the tracking parameters and image buffer, e.g.
......@@ -39,7 +40,6 @@ The config file defines the tracking parameters and image buffer, e.g.
{
"ultrasound buffer": "data/usbuffer.mp4",
"default image": "data/logo.png",
"buffer descriptions": [
{
"name": "glove",
......@@ -79,29 +79,21 @@ You can clone the repository using the following command:
Running tests
^^^^^^^^^^^^^
Pytest is used for running unit tests:
::
pip install pytest
python -m pytest
Linting
^^^^^^^
This code conforms to the PEP8 standard. Pylint can be used to analyse the code:
Unit tests are performed in stand alone environments using tox, which also checks coding style.
::
pip install pylint
pylint --rcfile=tests/pylintrc snappytorsosimulator
tox
Installing
----------
You can pip install directly from the repository as follows:
You can pip install from pypi with
::
pip install snappysonic
or You can pip install directly from the repository as follows:
::
pip install git+https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgerytorsosimulator
......@@ -125,7 +117,7 @@ Licensing and copyright
-----------------------
Copyright 2019 University College London.
snappy-torso-simulator is released under the BSD-3 license. Please see the `license file`_ for details.
snappysonic is released under the BSD-3 license. Please see the `license file`_ for details.
Acknowledgements
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# snappytorsosimulator documentation build configuration file, created by
# snappysonic documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 19 17:02:44 2017.
#
# This file is execfile()d with the current directory set to its
......@@ -100,13 +100,13 @@ source_suffix = '.rst'
master_doc = 'index'
# This allows modules to be indexed under the submodule name rather than all appearing under snappytorsosimulator
# This allows modules to be indexed under the submodule name rather than all appearing under snappysonic
modindex_common_prefix = [
'snappytorsosimulator.'
'snappysonic.'
]
# General information about the project.
project = u'snappy-torso-simulator'
project = u'snappysonic'
copyright = u"2019, University College London"
author = u'Stephen Thompson'
......@@ -120,9 +120,9 @@ version = u''
release = u''
# The short X.Y version.
# version = snappytorsosimulator.__version__
# version = snappysonic.__version__
# The full version, including alpha/beta/rc tags.
# release = snappytorsosimulator.__version__
# release = snappysonic.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......@@ -200,7 +200,7 @@ html_sidebars = {
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'snappytorsosimulatordoc'
htmlhelp_basename = 'snappysonicdoc'
# -- Options for LaTeX output ---------------------------------------------
......@@ -226,8 +226,8 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'snappytorsosimulator.tex',
u'snappy-torso-simulator Documentation',
('index', 'snappysonic.tex',
u'snappysonic Documentation',
u'Stephen Thompson', 'manual'),
]
......@@ -236,8 +236,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'snappytorsosimulator',
u'snappy-torso-simulator Documentation',
('index', 'snappysonic',
u'snappysonic Documentation',
[u'Stephen Thompson'], 1)
]
......@@ -248,10 +248,10 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'snappytorsosimulator',
u'snappy-torso-simulator Documentation',
('index', 'snappysonic',
u'snappysonic Documentation',
u'Stephen Thompson',
'snappytorsosimulator',
'snappysonic',
'One line description of project.',
'Miscellaneous'),
]
......@@ -3,7 +3,7 @@
.. _requirements:
===============================================
Requirements for snappy-torso-simulator
Requirements for snappysonic
===============================================
This is the software requirements file for snappy-torso-simulator, part of the
......
project-icon.png

6.87 KB | W: | H:

project-icon.png

17.9 KB | W: | H:

project-icon.png
project-icon.png
project-icon.png
project-icon.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,9 +2,9 @@
# 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
numpy
opencv-contrib-python
PySide2
scikit-surgeryutils
scikit-surgerynditracker
scikit-surgeryarucotracker
PySide2
numpy
opencv-contrib-python
......@@ -4,5 +4,5 @@ universal=1
[versioneer]
VCS = git
style = pep440
versionfile_source = sksurgerytorsosimulator/_version.py
versionfile_source = snappysonic/_version.py
tag_prefix = v
# coding=utf-8
"""
Setup for scikit-torso-simulator
Setup for snappysonic
"""
from setuptools import setup, find_packages
......@@ -11,10 +11,10 @@ with open('README.rst') as f:
long_description = f.read()
setup(
name='scikit-surgerytorsosimulator',
name='snappysonic',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='scikit-surgerytorsosimulator provides an application to simulate an ultrasound probe moving over a body torso, it is intended for public engagement events"',
description='snappysonic provides an application to simulate an ultrasound probe moving over a body torso, it is intended for public engagement events"',
long_description=long_description,
long_description_content_type='text/x-rst',
url='https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/SNAPPY/scikit-surgerytorsosimulator',
......@@ -34,14 +34,13 @@ setup(
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Medical Science Apps.',
],
keywords='medical imaging',
keywords='medical imaging education',
packages=find_packages(
exclude=[
......@@ -53,16 +52,16 @@ setup(
install_requires=[
'opencv-contrib-python',
'PySide2',
'scikit-surgeryutils',
'scikit-surgerynditracker',
'scikit-surgeryarucotracker',
'numpy>=1.11',
'numpy',
'PySide2',
],
entry_points={
'console_scripts': [
'sksurgerytorsosimulator=sksurgerytorsosimulator.__main__:main',
'snappysonic=snappysonic.__main__:main',
],
},
)
"""Parameters
----------
image : ndarray
Input image data. Will be converted to float.
mode : str
One of the following strings, selecting the type of noise to add:
'gauss' Gaussian-distributed additive noise.
'poisson' Poisson-distributed noise generated from the data.
's&p' Replaces random pixels with 0 or 1.
'speckle' Multiplicative noise using out = image + n*image,where
n is uniform noise with specified mean & variance.
from
https://stackoverflow.com/questions/22937589/how-to-add-noise-gaussian-salt-and-pepper-etc-to-image-in-python-with-opencv
"""
import numpy as np
import os
import cv2
def noisy(noise_typ,image):
if noise_typ == "gauss":
row,col,ch= image.shape
mean = 0
var = 0.1
sigma = var**0.5
gauss = np.random.normal(mean,sigma,(row,col,ch))
gauss = gauss.reshape(row,col,ch)
noisy = image + gauss
return noisy
elif noise_typ == "s&p":
row,col,ch = image.shape
s_vs_p = 0.5
amount = 0.004
out = np.copy(image)
# Salt mode
num_salt = np.ceil(amount * image.size * s_vs_p)
coords = [np.random.randint(0, i - 1, int(num_salt))
for i in image.shape]
out[coords] = 1
# Pepper mode
num_pepper = np.ceil(amount* image.size * (1. - s_vs_p))
coords = [np.random.randint(0, i - 1, int(num_pepper))
for i in image.shape]
out[coords] = 0
return out
elif noise_typ == "poisson":
vals = len(np.unique(image))
vals = 2 ** np.ceil(np.log2(vals))
noisy = np.random.poisson(image * vals) / float(vals)
return noisy
elif noise_typ =="speckle":
row,col,ch = image.shape
gauss = np.random.randn(row,col,ch)
gauss = gauss.reshape(row,col,ch)
noisy = image + image * gauss
return noisy
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
import sys
from snappytorsosimulator.ui.snappytorsosimulator_command_line import main
from snappysonic.ui.snappysonic_command_line import main
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
# coding=utf-8
"""sksurgerytorsosimulator"""
"""snappysonic"""
from ._version import get_versions
__version__ = get_versions()['version']
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""sksurgerytorsosimulator"""
"""snappysonic"""
import sys
if __name__ == "__main__" and not __package__:
# To allow the package's main function to be executed without the -m switch,
# i.e. "python sksurgerytorsosimulator", we have to explicitly set the
# i.e. "python snappysonic", we have to explicitly set the
# module name and append the parent directory to the sys.path (see PEP 366)
from os import path
__package__ = "sksurgerytorsosimulator" # pylint: disable=redefined-builtin
__package__ = "snappysonic" # pylint: disable=redefined-builtin
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
sys.path.append(path.dirname(path.dirname(__file__)))
# pylint: disable=wrong-import-position
from sksurgerytorsosimulator.ui.sksurgerytorsosimulator_command_line import main
from snappysonic.ui.snappysonic_command_line import main
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
"""Functions for sksurgerytorsosimaulator"""
"""Functions for snappysonic"""
from numpy import iinfo, int16
from PySide2.QtGui import QPixmap, QImage
from sksurgerynditracker.nditracker import NDITracker
......
"""Functions for sksurgerytorsosimaulator"""
"""Functions for snappysonic"""
from math import cos, pi
from numpy import full, int32, uint8
from cv2 import randn, fillConvexPoly, circle
......
......@@ -5,12 +5,12 @@ from PySide2.QtWidgets import QLabel, QWidget
from cv2 import (rectangle, putText, circle, imread)
from numpy import zeros, uint8
from sksurgeryutils.common_overlay_apps import OverlayBaseApp
from sksurgerytorsosimulator.algorithms.algorithms import (configure_tracker,
lookupimage,
check_us_buffer,
get_bg_image_size,
numpy_to_qpixmap)
from sksurgerytorsosimulator.algorithms.logo import WeissLogo
from snappysonic.algorithms.algorithms import (configure_tracker,
lookupimage,
check_us_buffer,
get_bg_image_size,
numpy_to_qpixmap)
from snappysonic.algorithms.logo import WeissLogo
class OverlayApp(OverlayBaseApp):
"""Inherits from OverlayBaseApp,
......
# coding=utf-8
"""scikit-surgerytorsosimulator"""
"""snappysonic"""
......@@ -4,15 +4,15 @@
import argparse
from sksurgerytorsosimulator import __version__
from sksurgerytorsosimulator.ui.sksurgerytorsosimulator_demo import run_demo
from snappysonic import __version__
from snappysonic.ui.snappysonic_demo import run_demo
def main(args=None):
"""Entry point for scikit-surgery-torso-simulator application"""
"""Entry point for snappysonic application"""
parser = argparse.ArgumentParser(
description='scikit-surgery-torso-simulator')
description='snappysonic')
## ADD POSITIONAL ARGUMENTS
parser.add_argument(
......@@ -29,7 +29,7 @@ def main(args=None):
parser.add_argument(
"--version",
action='version',
version='scikit-surgery-torso-simulator version ' +
version='snappysonic version ' +
friendly_version_string
)
......
......@@ -6,7 +6,7 @@ from PySide2.QtWidgets import QApplication
from sksurgerycore.configuration.configuration_manager import (
ConfigurationManager
)
from sksurgerytorsosimulator.overlay_widget.overlay import OverlayApp
from snappysonic.overlay_widget.overlay import OverlayApp
def run_demo(configfile):
......
# coding=utf-8
"""snappy-torso-simulator tests"""
"""snappysonic tests"""
import pytest
from sksurgerytorsosimulator.ui.sksurgerytorsosimulator_demo import run_demo
from snappysonic.ui.snappysonic_demo import run_demo
def test_demo_with_bad_config():
""" test with an invalid config """
......
# coding=utf-8
"""snappy-torso-simulator tests"""
"""snappysonic tests"""
from math import floor
from numpy import zeros, uint8
import pytest
import sksurgerytorsosimulator.algorithms.algorithms as skalg
import snappysonic.algorithms.algorithms as skalg
def test_configure_tracker():
"""
......
# coding=utf-8
"""snappy-torso-simulator tests"""
"""snappysonic tests"""
from numpy import uint8, zeros
from sksurgerytorsosimulator.algorithms.logo import WeissLogo, noisy
from snappysonic.algorithms.logo import WeissLogo, noisy
def test_logo():
"""
......
# coding=utf-8
"""snappy-torso-simulator tests"""
"""snappysonic tests"""
import pytest
from sksurgerytorsosimulator.overlay_widget.overlay import OverlayApp
from snappysonic.overlay_widget.overlay import OverlayApp
def test_error_on_ultrasound_buffer(setup_qt):
"""
......
......@@ -13,14 +13,14 @@ deps=-rrequirements-dev.txt
whitelist_externals=coverage,pip
# See .coveragerc for list of omitted files
commands = coverage erase
coverage run -a --source ./sksurgerytorsosimulator -m pytest -v -s
coverage run -a --source ./snappysonic -m pytest -v -s
coverage report -m
[testenv:lint]
basepython=python3.6
deps=pylint
{[testenv]deps}
commands=pylint --rcfile=tests/pylintrc sksurgerytorsosimulator tests
commands=pylint --rcfile=tests/pylintrc snappysonic tests
[testenv:docs]
basepython=python3.6
......@@ -29,11 +29,11 @@ commands = sphinx-build -M html . build
[testenv:installer]
basepython=python3.6
commands=pyinstaller --onefile sksurgerytorsosimulator.py --noconfirm --windowed
commands=pyinstaller --onefile snappysonic.py --noconfirm --windowed
[testenv:pip3]
basepython=python3.6
changedir=pip_test
skip_install=True
commands = pip install {posargs}
sksurgerytorsosimulator --help
snappysonic --help
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment