From 873bb0c900f9f2695abc4d1c16f8e2b304a53c47 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 25 Sep 2014 09:12:46 -0400 Subject: [PATCH 1/9] housecleaning for 0.7.0 release --- CHANGES.txt | 2 ++ docs/source/conf.py | 4 ++-- docs/source/how_do_i.rst | 18 ++++++++++-------- docs/source/index.rst | 2 +- docs/source/introduction.rst | 5 +++-- docs/source/roadmap.rst | 7 +++++++ docs/source/whatsnew/0.7.rst | 11 +++++++++++ docs/source/whatsnew/index.rst | 1 + glymur/test/fixtures.py | 3 ++- glymur/version.py | 2 +- 10 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 docs/source/whatsnew/0.7.rst diff --git a/CHANGES.txt b/CHANGES.txt index 44d6832..071453c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,5 @@ +Sep 25, 2014 - -v0.7.0 Added __getitem__, __setitem__ support. + Mar 06, 2014 - Added Cinema2K, Cinema4K write support. Changed constructor for ChannelDefinition box. Removed support for Python 2.6. Added write support for JP2 UUID, DataEntryURL, diff --git a/docs/source/conf.py b/docs/source/conf.py index 3e6b26e..5c44e90 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -76,9 +76,9 @@ copyright = u'2013, John Evans' # built documents. # # The short X.Y version. -version = '0.6' +version = '0.7' # The full version, including alpha/beta/rc tags. -release = '0.6.0' +release = '0.7.0rc1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/source/how_do_i.rst b/docs/source/how_do_i.rst index a9da7c1..3e0c3ee 100644 --- a/docs/source/how_do_i.rst +++ b/docs/source/how_do_i.rst @@ -3,11 +3,12 @@ How do I...? ------------ -... read the lower resolution images? -===================================== -Jp2k implements slicing via the :py:meth:`__getitem__` method so -any lower resolution images in a JPEG 2000 file can easily be -accessed, for example here's how to retrieve the first sub-image :: +... read images? +================ +Jp2k implements slicing via the :py:meth:`__getitem__` method, meaning that +multiple resolution imagery in a JPEG 2000 file can +easily be accessed. For example here's how to retrieve a full resolution and +first lower-resolution image :: >>> import glymur >>> jp2file = glymur.data.nemo() @@ -24,15 +25,16 @@ such as quality layers. ... display metadata? ===================== -There are two ways. From the command line, the script **jp2dump** is +There are two ways. From the command line, the console script **jp2dump** is available. :: $ jp2dump /path/to/glymur/installation/data/nemo.jp2 -From within Python, it is as simple as printing the Jp2k object, i.e. :: +From within Python, the same result is obtained simply by printing the Jp2k +object, i.e. :: >>> import glymur - >>> jp2file = glymur.data.nemo() + >>> jp2file = glymur.data.nemo() # just a path to a JP2 file >>> jp2 = glymur.Jp2k(jp2file) >>> print(jp2) File: nemo.jp2 diff --git a/docs/source/index.rst b/docs/source/index.rst index 0675eef..8c1fb03 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -15,9 +15,9 @@ Contents: introduction detailed_installation how_do_i - api whatsnew/index roadmap + api ------------------ Indices and tables diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index bfe7174..11059fd 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -27,5 +27,6 @@ but you should also be able to install Glymur via pip :: $ pip install glymur -In addition to the package, this also gives you a script **jp2dump** that can -be used from the command line line to print JPEG 2000 metadata. +In addition to the package, this also gives you a command line script +**jp2dump** that can be used from the command line line to print JPEG 2000 +metadata. diff --git a/docs/source/roadmap.rst b/docs/source/roadmap.rst index f0d7017..284c139 100644 --- a/docs/source/roadmap.rst +++ b/docs/source/roadmap.rst @@ -1,3 +1,10 @@ +------------------------------------- +Platforms Tested (0.7.0 release only) +------------------------------------- + * Linux Mint 17 / Python 3.4.0 + * Linux Mint 17 / Python 2.7.6 + * MacOS 10.6.8 / MacPorts / Python 3.4.1 + ------------ Known Issues ------------ diff --git a/docs/source/whatsnew/0.7.rst b/docs/source/whatsnew/0.7.rst new file mode 100644 index 0000000..0a21d9b --- /dev/null +++ b/docs/source/whatsnew/0.7.rst @@ -0,0 +1,11 @@ +===================== +Changes in glymur 0.7 +===================== + +Changes in 0.7.0 +================= + + * implemented :py:meth:`__getitem__`, :py:meth:`__setitem__` support + * added back windows support + * box_id and longname are class attributes now instead of instance + attributes (see issue 248) diff --git a/docs/source/whatsnew/index.rst b/docs/source/whatsnew/index.rst index da7e319..2d69949 100644 --- a/docs/source/whatsnew/index.rst +++ b/docs/source/whatsnew/index.rst @@ -10,3 +10,4 @@ These document the changes between minor (or major) versions of glymur. 0.5 0.6 + 0.7 diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 98554d6..838756a 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -23,7 +23,8 @@ if sys.hexversion < 0x03000000: WARNING_INFRASTRUCTURE_MSG = "3.x warning infrastructure only" elif re.match('1.[0-6]', six.__version__) is not None: WARNING_INFRASTRUCTURE_ISSUE = True - WARNING_INFRASTRUCTURE_MSG = "Cannot use with this version of six" + msg = "Cannot run test with version {0} of python-six" + WARNING_INFRASTRUCTURE_MSG = msg.format(six.__version__) class MetadataBase(unittest.TestCase): """ diff --git a/glymur/version.py b/glymur/version.py index 8ffd80f..43ae3f5 100644 --- a/glymur/version.py +++ b/glymur/version.py @@ -19,7 +19,7 @@ from .lib import openjp2 as opj2 # Do not change the format of this next line! Doing so risks breaking # setup.py -version = "0.6.0" +version = "0.7.0rc1" _sv = LooseVersion(version) version_tuple = _sv.version From 7feb71e55bcf85e1a084d438b66fa8fc68f4a4d9 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 25 Sep 2014 14:50:25 -0400 Subject: [PATCH 2/9] skip one test for openjpeg versions < 1.5 --- glymur/test/test_jp2k.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 87c307e..a9e22c7 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -27,6 +27,7 @@ import pkg_resources import glymur from glymur import Jp2k +from glymur.version import openjpeg_version from .fixtures import HAS_PYTHON_XMP_TOOLKIT from .fixtures import WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG @@ -441,8 +442,9 @@ class TestJp2k(unittest.TestCase): actdata = j2.read() self.assertTrue(fixtures.mse(actdata[0], expdata[0]) < 0.38) - @unittest.skipIf(re.match('1.5.(1|2)', - glymur.version.openjpeg_version) is not None, + @unittest.skipIf(re.match('1.[0-4]', openjpeg_version) is not None, + "Not supported with OpenJPEG {0}".format(openjpeg_version)) + @unittest.skipIf(re.match('1.5.(1|2)', openjpeg_version) is not None, "Mysteriously fails in 1.5.1 and 1.5.2") def test_no_cxform_pclr_jpx(self): """Indices for pclr jpxfile if no color transform""" From 55ef875275c73dabf4cafb05277a0ebb517f1fe6 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 25 Sep 2014 14:51:23 -0400 Subject: [PATCH 3/9] clarification of wording --- glymur/jp2k.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glymur/jp2k.py b/glymur/jp2k.py index 66b79c9..734ed60 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -873,7 +873,7 @@ class Jp2k(Jp2kBox): rlevel : int, optional Factor by which to rlevel output resolution. Use -1 to get the lowest resolution thumbnail. This is the only keyword option - available to use when only the OpenJPEG version 1.5.1 is present. + available to use when the OpenJPEG version is 1.5 or earlier. layer : int, optional Number of quality layer to decode. area : tuple, optional From 4284adb387b555e3517cab3440d18a0a66846dbf Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 25 Sep 2014 14:51:39 -0400 Subject: [PATCH 4/9] add testing mention of CentOS --- docs/source/roadmap.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/roadmap.rst b/docs/source/roadmap.rst index 284c139..d0f9015 100644 --- a/docs/source/roadmap.rst +++ b/docs/source/roadmap.rst @@ -1,9 +1,10 @@ ------------------------------------- Platforms Tested (0.7.0 release only) ------------------------------------- - * Linux Mint 17 / Python 3.4.0 - * Linux Mint 17 / Python 2.7.6 + * Linux Mint 17 / Python 3.4.0 and 2.7.6 / OpenJPEG 2.1.0 * MacOS 10.6.8 / MacPorts / Python 3.4.1 + * CentOS 6.5 / Anaconda Python 3.4.1 / OpenJPEG 1.3 + (please use OpenJPEG 2.1.0 instead, though) ------------ Known Issues From 653db644b5c8b01cc6a50c8116a24f9f67fcf3b5 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 25 Sep 2014 15:26:19 -0400 Subject: [PATCH 5/9] skipping some tests on versions 1.3 and 1.4 --- glymur/test/test_jp2k.py | 2 ++ glymur/test/test_opj_suite_write.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index a9e22c7..2868e84 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -774,6 +774,8 @@ class TestJp2k(unittest.TestCase): self.assertEqual(data.shape, (1024, 1024, 3)) +@unittest.skipIf(re.match('1.[0-4]', openjpeg_version) is not None, + "Not supported with OpenJPEG {0}".format(openjpeg_version)) @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") class TestJp2k_write(unittest.TestCase): """Write tests, can be run by versions 1.5+""" diff --git a/glymur/test/test_opj_suite_write.py b/glymur/test/test_opj_suite_write.py index ebdce2e..7e6357d 100644 --- a/glymur/test/test_opj_suite_write.py +++ b/glymur/test/test_opj_suite_write.py @@ -27,6 +27,7 @@ from . import fixtures import glymur from glymur import Jp2k from glymur.codestream import SIZsegment +from glymur.version import openjpeg_version class CinemaBase(fixtures.MetadataBase): @@ -218,6 +219,8 @@ class TestSuiteNegative2pointzero(unittest.TestCase): j.write(data, cinema2k=48) +@unittest.skipIf(re.match(r'''1.[0-4]''', openjpeg_version) is not None, + "Writing not supported until OpenJPEG 1.5") @unittest.skipIf(os.name == "nt", "no write support on windows, period") @unittest.skipIf(NO_READ_BACKEND, NO_READ_BACKEND_MSG) @unittest.skipIf(OPJ_DATA_ROOT is None, From a2a6b62316f6908a825c7291b18363e52f599847 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 25 Sep 2014 15:26:34 -0400 Subject: [PATCH 6/9] minor doc mods --- docs/source/introduction.rst | 6 +++++- docs/source/roadmap.rst | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index 11059fd..54681f7 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -5,7 +5,11 @@ Glymur: a Python interface for JPEG 2000 **Glymur** is an interface to the OpenJPEG library which allows one to read and write JPEG 2000 files from Python. Glymur supports both reading and writing of JPEG 2000 images, but writing -JPEG 2000 images is currently limited to images that can fit in memory +JPEG 2000 images is currently limited to images that can fit in memory. +**Glymur** can read images using OpenJPEG library versions as far back as 1.3, +but it is strongly recommended to use version 2.1.0, which is the most recently +released version of OpenJPEG at this time. + In regards to metadata, most JP2 boxes are properly interpreted. Certain optional JP2 boxes can also be written, including XML boxes and diff --git a/docs/source/roadmap.rst b/docs/source/roadmap.rst index d0f9015..47ccfd1 100644 --- a/docs/source/roadmap.rst +++ b/docs/source/roadmap.rst @@ -1,10 +1,9 @@ ------------------------------------- Platforms Tested (0.7.0 release only) ------------------------------------- - * Linux Mint 17 / Python 3.4.0 and 2.7.6 / OpenJPEG 2.1.0 + * Linux Mint 17 / Python 3.4.0 and 2.7.6 / OpenJPEG 2.1.0 and 1.3.0 * MacOS 10.6.8 / MacPorts / Python 3.4.1 - * CentOS 6.5 / Anaconda Python 3.4.1 / OpenJPEG 1.3 - (please use OpenJPEG 2.1.0 instead, though) + * CentOS 6.5 / Anaconda Python 3.4.1 / OpenJPEG 1.3.0 ------------ Known Issues From 83df9533899944c1b52285a5ebe5f2acd0b62e73 Mon Sep 17 00:00:00 2001 From: jevans Date: Thu, 25 Sep 2014 18:52:19 -0400 Subject: [PATCH 7/9] more doc updates --- docs/source/detailed_installation.rst | 8 +++--- docs/source/how_do_i.rst | 37 +++++++++++++++++++-------- docs/source/introduction.rst | 3 +-- docs/source/roadmap.rst | 2 +- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/docs/source/detailed_installation.rst b/docs/source/detailed_installation.rst index ecf0632..1a9281c 100644 --- a/docs/source/detailed_installation.rst +++ b/docs/source/detailed_installation.rst @@ -24,11 +24,11 @@ configuration format is the same as used by Python’s configparser module, i.e. :: [library] - openjp2: /opt/openjp2-svn/lib/libopenjp2.so + openjp2: /somewhere/lib/libopenjp2.so This assumes, of course, that you've installed OpenJPEG into -/opt/openjp2-svn on a linux system. The location of the configuration file -can vary as well (of course). If you use either linux or mac, the path +/opt/openjpeg on a linux system. The location of the configuration file +can vary as well. If you use either linux or mac, the path to the configuration file would normally be :: $HOME/.config/glymur/glymurrc @@ -48,7 +48,7 @@ You may also include a line for the version 1.x openjpeg library if you have it installed in a non-standard place, i.e. :: [library] - openjpeg: /not/the/usual/location/lib/libopenjpeg.so + openjpeg: /somewhere/lib/libopenjpeg.so ''''''' Testing diff --git a/docs/source/how_do_i.rst b/docs/source/how_do_i.rst index 3e0c3ee..5d11d67 100644 --- a/docs/source/how_do_i.rst +++ b/docs/source/how_do_i.rst @@ -7,11 +7,11 @@ How do I...? ================ Jp2k implements slicing via the :py:meth:`__getitem__` method, meaning that multiple resolution imagery in a JPEG 2000 file can -easily be accessed. For example here's how to retrieve a full resolution and -first lower-resolution image :: +easily be accessed via array-style slicing. For example here's how to +retrieve a full resolution and first lower-resolution image :: >>> import glymur - >>> jp2file = glymur.data.nemo() + >>> jp2file = glymur.data.nemo() # just a path to a JPEG2000 file >>> jp2 = glymur.Jp2k(jp2file) >>> fullres = jp2[:] >>> print(fullres.shape) @@ -20,8 +20,21 @@ first lower-resolution image :: >>> print(thumbnail.shape) (728, 1296, 3) -The :py:meth:`read` method gives many more options for other JPEG 2000 features -such as quality layers. +The :py:meth:`read` method exposes many more options for other JPEG 2000 +features such as quality layers. + +... write images? +================= +So long as the image data can fit entirely into memory, array-style slicing may +also be used to write JPEG 2000 files. + + >>> import glymur, numpy as np + >>> jp2 = glymur.Jp2k('zeros.jp2', mode='wb') + >>> jp2[:] = np.zeros((640, 480), dtype=np.uint8) + +The :py:meth:`write` method exposes many more options for other JPEG 2000 +features. You should have OpenJPEG version 1.5 or more recent before writing +JPEG 2000 images. ... display metadata? ===================== @@ -328,10 +341,10 @@ is currently limited to XML and UUID boxes. ... create an image with an alpha layer? ======================================== -OpenJPEG can create JP2 files with more than 3 components (requires -the development version of OpenJPEG), but by default, any extra components are -not described as such. In order to do so, we need to rewrap such -an image in a set of boxes that includes a channel definition box. +OpenJPEG can create JP2 files with more than 3 components (use version 2.1.0+ +for this), but by default, any extra components are not described +as such. In order to do so, we need to rewrap such an image in a +set of boxes that includes a channel definition box. This example is based on SciPy example code found at http://scipy-lectures.github.io/advanced/image_processing/#basic-manipulations . @@ -389,7 +402,11 @@ Here's how the Preview application on the mac shows the RGBA image. ... work with XMP UUIDs? ======================== -XMP is metadata on steroids. +`Wikipedia `_ states +that "The Extensible Metadata Platform (XMP) is an ISO standard, +originally created by Adobe Systems Inc., for the creation, processing +and interchange of standardized and custom metadata for all kinds +of resources." The example JP2 file shipped with glymur has an XMP UUID. :: diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index 54681f7..ae6d6ab 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -10,12 +10,11 @@ JPEG 2000 images is currently limited to images that can fit in memory. but it is strongly recommended to use version 2.1.0, which is the most recently released version of OpenJPEG at this time. - In regards to metadata, most JP2 boxes are properly interpreted. Certain optional JP2 boxes can also be written, including XML boxes and XMP UUIDs. There is incomplete support for reading JPX metadata. -Glymur 0.6 works on Python versions 2.7, 3.3 and 3.4. If you have Python 2.6, +Glymur works on Python versions 2.7, 3.3 and 3.4. If you have Python 2.6, you should use the 0.5 series of Glymur. For more information about OpenJPEG, please consult http://www.openjpeg.org. diff --git a/docs/source/roadmap.rst b/docs/source/roadmap.rst index 47ccfd1..df629ac 100644 --- a/docs/source/roadmap.rst +++ b/docs/source/roadmap.rst @@ -2,7 +2,7 @@ Platforms Tested (0.7.0 release only) ------------------------------------- * Linux Mint 17 / Python 3.4.0 and 2.7.6 / OpenJPEG 2.1.0 and 1.3.0 - * MacOS 10.6.8 / MacPorts / Python 3.4.1 + * MacOS 10.6.8 / MacPorts / Python 3.4.1, 3.3.5,and 2.7.8 * CentOS 6.5 / Anaconda Python 3.4.1 / OpenJPEG 1.3.0 ------------ From af699fedfe5caf6a70bf7ed520420a205a87c019 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 2 Oct 2014 08:17:48 -0400 Subject: [PATCH 8/9] updated README to mention Python 3.4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 22338f1..bdc84d4 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,6 @@ glymur: a Python interface for JPEG 2000 **glymur** contains a Python interface to the OpenJPEG library which allows one to read and write JPEG 2000 files. **glymur** works on -Python 2.7 and 3.3. Python 3.3 is strongly recommended. +Python 2.7, 3.3, and 3.4. Please read the docs, https://glymur.readthedocs.org/en/latest/ From 454afec67bc86b87a83c8db0d71749decaf17612 Mon Sep 17 00:00:00 2001 From: John Evans Date: Thu, 2 Oct 2014 08:21:04 -0400 Subject: [PATCH 9/9] bumping to 0.7.1 --- CHANGES.txt | 2 ++ docs/source/conf.py | 2 +- glymur/version.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2abf6d0..b61c616 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,5 @@ +Oct 02, 2014 - v0.7.1 Fixed README to mention Python 3.4 + Oct 01, 2014 - v0.7.0 Added array-style slicing. August 03, 2014 - v0.6.0 Added Cinema2K, Cinema4K write support. diff --git a/docs/source/conf.py b/docs/source/conf.py index ace116b..56a0b17 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -78,7 +78,7 @@ copyright = u'2013, John Evans' # The short X.Y version. version = '0.7' # The full version, including alpha/beta/rc tags. -release = '0.7.0' +release = '0.7.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/glymur/version.py b/glymur/version.py index 2092d4b..93171aa 100644 --- a/glymur/version.py +++ b/glymur/version.py @@ -19,7 +19,7 @@ from .lib import openjp2 as opj2 # Do not change the format of this next line! Doing so risks breaking # setup.py -version = "0.7.0" +version = "0.7.1" _sv = LooseVersion(version) version_tuple = _sv.version