[python-dtcwt] 65/497: add stub 3d transform functions

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 8532904ce7be148eae2c1d595ca0023cb1123b56
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Thu Aug 8 10:58:56 2013 +0100

    add stub 3d transform functions
---
 dtcwt/__init__.py    |  4 +++
 dtcwt/transform3d.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/testxfm3.py    |  1 +
 3 files changed, 78 insertions(+)

diff --git a/dtcwt/__init__.py b/dtcwt/__init__.py
index 41c3864..96aca00 100644
--- a/dtcwt/__init__.py
+++ b/dtcwt/__init__.py
@@ -1,6 +1,7 @@
 from .coeffs import biort, qshift
 from .transform1d import dtwavexfm, dtwaveifm
 from .transform2d import dtwavexfm2, dtwaveifm2
+from .transform3d import dtwavexfm3, dtwaveifm3
 
 __all__ = [
     'dtwavexfm',
@@ -9,6 +10,9 @@ __all__ = [
     'dtwavexfm2',
     'dtwaveifm2',
 
+    'dtwavexfm3',
+    'dtwaveifm3',
+
     'biort',
     'qshift',
 ]
diff --git a/dtcwt/transform3d.py b/dtcwt/transform3d.py
new file mode 100644
index 0000000..7d446f6
--- /dev/null
+++ b/dtcwt/transform3d.py
@@ -0,0 +1,73 @@
+import numpy as np
+import logging
+
+from six.moves import xrange
+
+from dtcwt import biort as _biort, qshift as _qshift
+from dtcwt.defaults import DEFAULT_BIORT, DEFAULT_QSHIFT
+from dtcwt.lowlevel import colfilter, coldfilt, colifilt
+
+def dtwavexfm3(X, nlevels=3, biort=DEFAULT_BIORT, qshift=DEFAULT_QSHIFT, include_scale=False):
+    """Perform a *n*-level DTCWT-3D decompostion on a 3D matrix *X*.
+
+    :param X: 3D real matrix/Image of shape (N, M)
+    :param nlevels: Number of levels of wavelet decomposition
+    :param biort: Level 1 wavelets to use. See :py:func:`biort`.
+    :param qshift: Level >= 2 wavelets to use. See :py:func:`qshift`.
+
+    :returns Yl: The real lowpass image from the final level
+    :returns Yh: A tuple containing the (N, M, 6) shape complex highpass subimages for each level.
+    :returns Yscale: If *include_scale* is True, a tuple containing real lowpass coefficients for every scale.
+
+    If *biort* or *qshift* are strings, they are used as an argument to the
+    :py:func:`biort` or :py:func:`qshift` functions. Otherwise, they are
+    interpreted as tuples of vectors giving filter coefficients. In the *biort*
+    case, this should be (h0o, g0o, h1o, g1o). In the *qshift* case, this should
+    be (h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b).
+
+    Example::
+
+        # Performs a 3-level transform on the real image X using the 13,19-tap
+        # filters for level 1 and the Q-shift 14-tap filters for levels >= 2.
+        Yl, Yh = dtwavexfm3(X, 3, 'near_sym_b', 'qshift_b')
+
+    .. codeauthor:: Rich Wareham <rjw57 at cantab.net>, Aug 2013
+
+    """
+    return None
+
+def dtwaveifm3(Yl,Yh,biort=DEFAULT_BIORT,qshift=DEFAULT_QSHIFT,gain_mask=None):
+    """Perform an *n*-level dual-tree complex wavelet (DTCWT) 3D
+    reconstruction.
+
+    :param Yl: The real lowpass subband from the final level
+    :param Yh: A sequence containing the complex highpass subband for each level.
+    :param biort: Level 1 wavelets to use. See :py:func:`biort`.
+    :param qshift: Level >= 2 wavelets to use. See :py:func:`qshift`.
+    :param gain_mask: Gain to be applied to each subband.
+
+    :returns Z: Reconstructed real image matrix.
+
+    The (*d*, *l*)-th element of *gain_mask* is gain for subband with direction
+    *d* at level *l*. If gain_mask[d,l] == 0, no computation is performed for
+    band (d,l). Default *gain_mask* is all ones. Note that both *d* and *l* are
+    zero-indexed.
+
+    If *biort* or *qshift* are strings, they are used as an argument to the
+    :py:func:`biort` or :py:func:`qshift` functions. Otherwise, they are
+    interpreted as tuples of vectors giving filter coefficients. In the *biort*
+    case, this should be (h0o, g0o, h1o, g1o). In the *qshift* case, this should
+    be (h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b).
+
+    Example::
+
+        # Performs a 3-level reconstruction from Yl,Yh using the 13,19-tap
+        # filters for level 1 and the Q-shift 14-tap filters for levels >= 2.
+        Z = dtwaveifm3(Yl, Yh, 'near_sym_b', 'qshift_b')
+
+    .. codeauthor:: Rich Wareham <rjw57 at cantab.net>, Aug 2013
+
+    """
+    return None
+
+# vim:sw=4:sts=4:et
diff --git a/tests/testxfm3.py b/tests/testxfm3.py
index b0c22b6..ac1c78d 100644
--- a/tests/testxfm3.py
+++ b/tests/testxfm3.py
@@ -3,6 +3,7 @@ from nose.tools import raises
 from nose.plugins.attrib import attr
 
 import numpy as np
+from dtcwt import dtwavexfm3, dtwaveifm3
 
 def setup():
     global sphere

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list