Skip to content

Commit

Permalink
Major Overhaul (#8)
Browse files Browse the repository at this point in the history
# Changes
* Add 3D support to the polar transform library such that one can give a stack of images, RGB or grayscale, and it will apply the polar transform to each image separately.
    * Include useMultithreading argument to the polar/cartesian conversion functions to allow for speedup of 3D images
* Reorganize code into multiple files rather than one large file
    * polarTransform.py now is split into convertToCartesianImage, convertToPolarImage, imageTransform and pointsConversion Python files
    * This change increases readability of the code and aides in development
    * This change includes moving the code files and the test folder into one polarTransform folder that will be copied to site-packages when installed via pip. Previously, the tests folder was thrown into the sites-packages which was confusing because multiple packages could have tests and it is not obvious that the tests were for polarTransform. This is now fixed by this change.
* Update documentation to include information about 3D conversion capabilities.
* Create tests for 3D support by using OpenCV to create/load videos where each frame is considered one part of a 3D Numpy array that is used for conversion between polar/cartesian domain
* Update TravisCI to include codecov support (still need to adequately test)
* Add __version__ string to polarTransform package that contains the current version
* Update package to include test data when installing via PyPi
  • Loading branch information
addisonElliott committed Oct 28, 2018
1 parent 474c9e7 commit 5215e6e
Show file tree
Hide file tree
Showing 51 changed files with 2,203 additions and 1,787 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@ ENV/
*.iml

# Ignore dist folder which contains the Python compiled code for creating a standalone executable
dist
dist

# Ignore vscode settings
.vscode
26 changes: 24 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
language: python

python:
- 3.6
install: pip install -r requirements.txt
script: python tests/test_polarTransform.py

# Command to install dependencies
install:
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install -r requirements-dev.txt

# Command to run tests
script: coverage run -m unittest discover -v polarTransform/tests

# Command to deploy releases to PyPi
deploy:
provider: pypi
distributions: sdist bdist_wheel
Expand All @@ -11,3 +21,15 @@ deploy:
tags: true
password:
secure: F0Xx96xWhRdtfD3kSywX4VqF2VbZst85Wy0AsI8774OeN3e2712lgQyRp1sBp4AZzsYWowKg4/kFNljvJtko56Ag+ulwLieP9K+idWj4kc62BKCBMfsTEhHWicAla3mnlfIQGMIvD9En7CUPAiu5Bs+wj8kto2LRwv2lztSKBN8fk56r9zTd7f6Ft8MOoZqXZ8cpQNv610BvsY61s/u2RnaDkcI75LyztPCGIQ3O1wYnZWNebslif9QMsygHvsSFxoomOhM/MjRvsvEwpzDapKdaQ7xYf9uBfw40/XG/9xL0JqAjXpbKNltxFaPkshVgDBt+xMStyYV2nd5LClPrYYpSBHeFtL+HsO/lnUksBs09GwLQFw0TYfed0E28seMeb6zTSlnFQF2VnxVWu1Vqe1uriMmSH/0iKaes6ucQZ6Oag22ub3mtABz855kQ5FtkVW2eK8MG8FoFoxi6x+9e+YN0BG9A2NsNlNvur+nzx5XTduGVs+REAHURZ/56WG8IsKqOpRrNHPL5cK3+FBwCnAZVwkR5cT9K4pKtJBiL4h0aJzPTi3F4MCSns2vMbLSMQMBHVBey+lmReOZ9GH7uzS3KOZa+5LJLEFkvQjb3N3X7znn0oJO7s/aSsW2bzjrRhsYPYoLvSkcPqmyswowesB/SrKzX3vzvgBT9DFsCAHI=

after_success:
- codecov

# Only build for master branch and tagged released (must follow semantic versioning syntax)
branches:
only:
- master
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/



3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include README.rst
include LICENSE
include LICENSE
include polarTransform/tests/data/*
31 changes: 27 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
.. image:: https://travis-ci.org/addisonElliott/polarTransform.svg?branch=master
:target: https://travis-ci.org/addisonElliott/polarTransform
:alt: Build Status

.. image:: https://img.shields.io/pypi/pyversions/polarTransform.svg
:target: https://img.shields.io/pypi/pyversions/polarTransform.svg
:alt: Python version

.. image:: https://badge.fury.io/py/polarTransform.svg
:target: https://badge.fury.io/py/polarTransform
:alt: PyPi version

.. image:: https://readthedocs.org/projects/polartransform/badge/?version=latest
:target: https://polartransform.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. image:: https://codecov.io/gh/addisonElliott/polarTransform/branch/master/graph/badge.svg
:target: https://codecov.io/gh/addisonElliott/polarTransform

|
Introduction
=================
polarTransform is a Python package for converting images between the polar and Cartesian domain. It contains many
Expand Down Expand Up @@ -43,9 +64,11 @@ the updated polarTransform code.

Test and coverage
=================
To test the code on any platform, make sure to clone the GitHub repository to get the tests and::
Run the following command in the base directory to run the tests:

.. code-block:: bash
python tests/test_polarTransform.py
python -m unittest discover -v polarTransform/tests
Example
=================
Expand Down Expand Up @@ -74,12 +97,12 @@ Input image:
plt.figure()
plt.imshow(cartesianImage, origin='lower')
Resulting polar domain image:
The result is a polar domain image with a specified initial and final radius and angle:

.. image:: http://polartransform.readthedocs.io/en/latest/_images/verticalLinesPolarImage_scaled3.png
:alt: Polar image

Converting back to the cartesian image results in:
Converting back to the cartesian image results in only a slice of the original image to be shown because the initial and final radius and angle were specified:

.. image:: http://polartransform.readthedocs.io/en/latest/_images/verticalLinesCartesianImage_scaled.png
:alt: Cartesian image
Expand Down
10 changes: 7 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
import polarTransform

def setup(app):
app.add_stylesheet('css/custom.css')
Expand Down Expand Up @@ -56,6 +57,9 @@ def setup(app):
# The master toctree document.
master_doc = 'index'

# Fixes issue with toctree reference to nonexisting document...
numpydoc_show_class_members = False

# General information about the project.
project = 'polarTransform'
copyright = '2018, Addison Elliott'
Expand All @@ -66,9 +70,9 @@ def setup(app):
# built documents.
#
# The short X.Y version.
version = '1.0'
version = polarTransform.__version__
# The full version, including alpha/beta/rc tags.
release = '1.0.0'
release = polarTransform.__version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -80,7 +84,7 @@ def setup(app):
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
exclude_patterns = ['polarTransform.tests.rst']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
Expand Down
8 changes: 4 additions & 4 deletions docs/source/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Getting Started
================

.. rubric:: Brief overview of polarTransform and how to install.

Introduction
============
polarTransform is a Python package for converting images between the polar and Cartesian domain. It contains many
Expand Down Expand Up @@ -53,9 +51,11 @@ the updated polarTransform code.

Test and coverage
=================
To test the code on any platform, make sure to clone the GitHub repository to get the tests and::
Run the following command in the base directory to run the tests:

.. code-block:: bash
python tests/test_polarTransform.py
python -m unittest discover -v polarTransform/tests
Using polarTransform
====================
Expand Down
15 changes: 14 additions & 1 deletion docs/source/polarTransform.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
===============
Reference Guide
===============

Table of Contents
-----------------

.. autosummary::

polarTransform.convertToCartesianImage
polarTransform.convertToPolarImage
polarTransform.getCartesianPointsImage
polarTransform.getPolarPointsImage
polarTransform.ImageTransform

polarTransform Module
---------------------

.. automodule:: polarTransform
:members:
:undoc-members:
Expand Down
6 changes: 5 additions & 1 deletion docs/source/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ User Guide

.. currentmodule:: polarTransform

:class:`convertToPolarImage` and :class:`convertToCartesianImage` are the two primary classes on which this entire project is based on. The two functions are opposites of one another, reversing the action that the other function does.
:class:`convertToPolarImage` and :class:`convertToCartesianImage` are the two primary functions that make up this package. The two functions are opposites of one another, reversing the action that the other function does.

As the names suggest, the two functions convert an image from the cartesian or polar domain to the other domain with a given set of parameters. The power of these functions is that the user can specify the resulting image resolution, interpolation order, initial and final radii or angles and much much more. See the :doc:`polarTransform` for more information on the specific parameters that are supported.

Since there are quite a few parameters that can be specified for the conversion functions, the class :class:`ImageTransform` is created and returned from the :class:`convertToPolarImage` or :class:`convertToCartesianImage` functions (along with the converted image) that contains the arguments specified. The benefit of this class is that if one wants to convert the image back to another domain or convert points on either image to/from the other domain, they can simply call the functions within the :class:`ImageTransform` class without specifying all of the arguments again.

Example 1
--------------
Expand Down

0 comments on commit 5215e6e

Please sign in to comment.