From c06f96134bfe7d58f21e564d3093004cc4dfd170 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 19 Apr 2012 17:51:06 +0200 Subject: [PATCH 01/15] Added debian branch with configuration for debian package. Taken from nibabel. Thanks, Yarik --- debian/changelog | 25 ++++++++++++ debian/compat | 1 + debian/control | 43 ++++++++++++++++++++ debian/copyright | 65 +++++++++++++++++++++++++++++++ debian/gbp.conf | 8 ++++ debian/patches/no_doc_sources | 16 ++++++++ debian/patches/series | 1 + debian/pycompat | 1 + debian/python-pylocator-doc.docs | 1 + debian/python-pylocator-doc.links | 1 + debian/python-pylocator.install | 1 + debian/rules | 41 +++++++++++++++++++ debian/source/format | 1 + debian/source/options | 3 ++ debian/watch | 4 ++ 15 files changed, 212 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/gbp.conf create mode 100644 debian/patches/no_doc_sources create mode 100644 debian/patches/series create mode 100644 debian/pycompat create mode 100644 debian/python-pylocator-doc.docs create mode 100644 debian/python-pylocator-doc.links create mode 100644 debian/python-pylocator.install create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/options create mode 100644 debian/watch diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..38e1c70 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,25 @@ +pylocator (1.1.0-1) unstable; urgency=low + + * New upstream release: better gifti and trackvis support, bugfixes. + + -- Yaroslav Halchenko Wed, 04 May 2011 16:44:55 -0400 + +pylocator (1.0.2-1) unstable; urgency=low + + * Fresh bugfix upstream release + * debian/copyright: + - changes to confirm to DEP5 rev 174 + - added myself + - updated years + * debian/control: + - boosted policy compliance to 3.9.2 (no changes) + - purged DM-Upload-Allowed (no need any more) + - slight tune up of the long description + + -- Yaroslav Halchenko Thu, 28 Apr 2011 10:27:22 -0400 + +pylocator (1.0.0-1) unstable; urgency=low + + * Initial release (Closes: #600275). + + -- Michael Hanke Fri, 15 Oct 2010 08:20:14 -0400 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..96c4dfb --- /dev/null +++ b/debian/control @@ -0,0 +1,43 @@ +Source: pylocator +Section: python +Priority: extra +Maintainer: Thorsten Kranz +Uploaders: Thorsten Kranz +Build-Depends: debhelper (>= 7.2.18), python-all (>= 2.5), python-support (>= 0.6), python-numpy (>= 1.2), python-nibabel, python-vtk, python-gtk2, python-gtkglext1 +Standards-Version: 3.9.2 +Homepage: http://pylocator.thorstenkranz.de +Vcs-Browser: http://github.com/nipy/PyLocator +Vcs-Git: git://github.com/nipy/PyLocator.git +XS-Python-Version: >= 2.5 + +Package: python-pylocator +Architecture: all +Depends: ${misc:Depends}, ${python:Depends}, python-numpy, python-scipy, python-nibabel, python-vtk, python-gtk2, python-gtkglext1 +Recommends: python-dicom +Suggests: python-pylocator-doc +Provides: ${python:Provides} +XB-Python-Version: ${python:Versions} +Description: Localization of EEG-electrodes from MRI-volumes + + PyLocator is a little program for localizing EEG electrodes from MR-images. It uses VTK to show a neat GUI for marking electrode locations in 3d-space. It is based on previous work by John D. Hunter and Michael Castell as part of pbrain, now maintained by Eli Albert. PyLocator works as a stand-alone program without any dependencies from pbrain. + + This package provides the documentation in HTML format. + NiBabel provides read and write access to some common medical and + neuroimaging file formats, including: ANALYZE (plain, SPM99, SPM2), GIFTI, + NIfTI1, MINC, as well as PAR/REC. The various image format classes give full + or selective access to header (meta) information and access to the image data + is made available via NumPy arrays. NiBabel is the successor of PyNIfTI. + . + This package also provides a commandline tool for conversion of PAR/REC to + NIfTI images. + +Package: python-pylocator-doc +Section: doc +Architecture: all +Depends: ${misc:Depends}, libjs-jquery +Description: documentation for PyLocator + Localization of EEG-electrodes from MRI-volumes + + PyLocator is a little program for localizing EEG electrodes from MR-images. It uses VTK to show a neat GUI for marking electrode locations in 3d-space. It is based on previous work by John D. Hunter and Michael Castell as part of pbrain, now maintained by Eli Albert. PyLocator works as a stand-alone program without any dependencies from pbrain. + + This package provides the documentation in HTML format. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..ce49314 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,65 @@ +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=174 +Upstream-Name: pylocator +Upstream-Contact: thorstenkranz@gmail.com +Source: http://github.com/nipy/PyLocator + + +Files: * +Copyright 2011-2012, Thorsten Kranz. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THORSTEN KRANZ ''AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THORSTEN KRANZ OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are those of the +authors and should not be interpreted as representing official policies, either expressed +or implied, of Thorsten Kranz. + +Files: doc/sphinxext/autosummary/* +Copyright: 2007-2009, Stefan van der Walt and Sphinx team +License: BSD + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + a. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + b. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + c. Neither the name of the Enthought nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + + +Files: debian/* +Copyright: 2006-2010, Michael Hanke + 2011, Yaroslav Halchenko +License: Expat diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..92efb7d --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,8 @@ +[DEFAULT] +# the default branch for upstream sources: +upstream-branch = master +# the default branch for the debian patch: +debian-branch = debian +# the default tag formats used: +upstream-tag = %(version)s +debian-tag = debian/%(version)s diff --git a/debian/patches/no_doc_sources b/debian/patches/no_doc_sources new file mode 100644 index 0000000..5d2e473 --- /dev/null +++ b/debian/patches/no_doc_sources @@ -0,0 +1,16 @@ +Description: Do not put links to source documention source in HTML files + Documentation source files are not shipped in the binary package, because + the are not very useful and occupy space, hence these links would be broken. +Forwarded: not-needed +Author: Michael Hanke +--- a/doc/source/conf.py ++++ b/doc/source/conf.py +@@ -201,7 +201,7 @@ + #html_split_index = False + + # If true, links to the reST sources are added to the pages. +-html_show_sourcelink = True ++html_show_sourcelink = False + + # If true, an OpenSearch description file will be output, and all pages will + # contain a tag referring to it. The value of this option must be the diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..4c93208 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +no_doc_sources diff --git a/debian/pycompat b/debian/pycompat new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/debian/pycompat @@ -0,0 +1 @@ +2 diff --git a/debian/python-pylocator-doc.docs b/debian/python-pylocator-doc.docs new file mode 100644 index 0000000..6d28621 --- /dev/null +++ b/debian/python-pylocator-doc.docs @@ -0,0 +1 @@ +build/html diff --git a/debian/python-pylocator-doc.links b/debian/python-pylocator-doc.links new file mode 100644 index 0000000..5912988 --- /dev/null +++ b/debian/python-pylocator-doc.links @@ -0,0 +1 @@ +usr/share/javascript/jquery/jquery.js usr/share/doc/python-pylocator-doc/html/_static/jquery.js diff --git a/debian/python-pylocator.install b/debian/python-pylocator.install new file mode 100644 index 0000000..326a444 --- /dev/null +++ b/debian/python-pylocator.install @@ -0,0 +1 @@ +debian/tmp/usr/* usr/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e930b26 --- /dev/null +++ b/debian/rules @@ -0,0 +1,41 @@ +#!/usr/bin/make -f +# -*- mode: makefile; coding: utf-8 -*- + +# one ring to rule them all ... +%: +# need to enforce distutils, since we also have a makefile + dh $@ --buildsystem=python_distutils --builddirectory=build + +override_dh_auto_build: + dh_auto_build + # and docs + $(MAKE) htmldoc + # but remove jquery copy (later on link to Debian's version) + -rm build/html/_static/jquery.js + # objects inventory is of no use for the package + -rm build/html/objects.inv + # also doc source files only consume space + -rm -r build/html/_sources + +# enable when we believe that the tests should pass +override_dh_auto_test: +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) + for buildver in $(shell pyversions -vr); do \ + echo "I: Running NiBabel unittests using python$$buildver"; \ + $(MAKE) unittest PYTHON=python$$buildver || exit 1 ;\ + done +endif + +## immediately useable documentation +## and exemplar data (they are small excerpts anyway) +override_dh_compress: + dh_compress -X.py -X.html -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.par -X.bin + +override_dh_installman: + PYTHONPATH=build/lib:$(PYTHONPATH) help2man -N \ + -n 'convert PARREC image to NIfTI' bin/parrec2nii > build/parrec2nii.1 + dh_installman build/parrec2nii.1 + +override_dh_clean: + $(MAKE) clean + dh_clean diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..9874f1d --- /dev/null +++ b/debian/source/options @@ -0,0 +1,3 @@ +# ignore changes to the commit info file, since it will always have the +# shasum of the release tag and the repository version does not. +# extend-diff-ignore = nibabel/COMMIT_INFO.txt diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..69185e7 --- /dev/null +++ b/debian/watch @@ -0,0 +1,4 @@ +# Compulsory line, this is a version 3 file +version=3 +opts="filenamemangle=s/.*\/(.*)/pylocator-$1\.tar\.gz/" \ + http://github.com/nipy/pylocator/downloads .*tarball/([\d\.a-z]+) From 473ebcfdd35d05f31f9a78fc52f037ce829c51f8 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 19 Apr 2012 17:59:03 +0200 Subject: [PATCH 02/15] Minor changes --- debian/rules | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/debian/rules b/debian/rules index e930b26..2131fb6 100755 --- a/debian/rules +++ b/debian/rules @@ -11,21 +11,12 @@ override_dh_auto_build: # and docs $(MAKE) htmldoc # but remove jquery copy (later on link to Debian's version) - -rm build/html/_static/jquery.js + -rm doc/build/html/_static/jquery.js # objects inventory is of no use for the package - -rm build/html/objects.inv + -rm doc/build/html/objects.inv # also doc source files only consume space -rm -r build/html/_sources -# enable when we believe that the tests should pass -override_dh_auto_test: -ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) - for buildver in $(shell pyversions -vr); do \ - echo "I: Running NiBabel unittests using python$$buildver"; \ - $(MAKE) unittest PYTHON=python$$buildver || exit 1 ;\ - done -endif - ## immediately useable documentation ## and exemplar data (they are small excerpts anyway) override_dh_compress: From 31ccd30b08fec939ed7c1fb84844fba8eff59a80 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 19 Apr 2012 17:51:06 +0200 Subject: [PATCH 03/15] Added debian branch with configuration for debian package. Taken from nibabel. Thanks, Yarik --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 2131fb6..7895f0d 100755 --- a/debian/rules +++ b/debian/rules @@ -11,9 +11,9 @@ override_dh_auto_build: # and docs $(MAKE) htmldoc # but remove jquery copy (later on link to Debian's version) - -rm doc/build/html/_static/jquery.js + -rm build/html/_static/jquery.js # objects inventory is of no use for the package - -rm doc/build/html/objects.inv + -rm build/html/objects.inv # also doc source files only consume space -rm -r build/html/_sources From 319dd96e0b73cfc2c450b59849aeefd005fc1aa3 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 19 Apr 2012 17:59:03 +0200 Subject: [PATCH 04/15] Minor changes --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 7895f0d..2131fb6 100755 --- a/debian/rules +++ b/debian/rules @@ -11,9 +11,9 @@ override_dh_auto_build: # and docs $(MAKE) htmldoc # but remove jquery copy (later on link to Debian's version) - -rm build/html/_static/jquery.js + -rm doc/build/html/_static/jquery.js # objects inventory is of no use for the package - -rm build/html/objects.inv + -rm doc/build/html/objects.inv # also doc source files only consume space -rm -r build/html/_sources From 473fbc28f794f52790bf9406fc8d302b01bc0d3b Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 19 Apr 2012 23:16:47 +0200 Subject: [PATCH 05/15] making deb-build work; first shot --- debian/control | 27 +++++---------------------- debian/rules | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 36 deletions(-) diff --git a/debian/control b/debian/control index 96c4dfb..26d14e3 100644 --- a/debian/control +++ b/debian/control @@ -18,26 +18,9 @@ Suggests: python-pylocator-doc Provides: ${python:Provides} XB-Python-Version: ${python:Versions} Description: Localization of EEG-electrodes from MRI-volumes + PyLocator is a little program for localizing EEG electrodes from MR-images. + It uses VTK to show a neat GUI for marking electrode locations in 3d-space. + It is based on previous work by John D. Hunter and Michael Castell as part + of pbrain, now maintained by Eli Albert. + PyLocator works as a stand-alone program without any dependencies from pbrain. - PyLocator is a little program for localizing EEG electrodes from MR-images. It uses VTK to show a neat GUI for marking electrode locations in 3d-space. It is based on previous work by John D. Hunter and Michael Castell as part of pbrain, now maintained by Eli Albert. PyLocator works as a stand-alone program without any dependencies from pbrain. - - This package provides the documentation in HTML format. - NiBabel provides read and write access to some common medical and - neuroimaging file formats, including: ANALYZE (plain, SPM99, SPM2), GIFTI, - NIfTI1, MINC, as well as PAR/REC. The various image format classes give full - or selective access to header (meta) information and access to the image data - is made available via NumPy arrays. NiBabel is the successor of PyNIfTI. - . - This package also provides a commandline tool for conversion of PAR/REC to - NIfTI images. - -Package: python-pylocator-doc -Section: doc -Architecture: all -Depends: ${misc:Depends}, libjs-jquery -Description: documentation for PyLocator - Localization of EEG-electrodes from MRI-volumes - - PyLocator is a little program for localizing EEG electrodes from MR-images. It uses VTK to show a neat GUI for marking electrode locations in 3d-space. It is based on previous work by John D. Hunter and Michael Castell as part of pbrain, now maintained by Eli Albert. PyLocator works as a stand-alone program without any dependencies from pbrain. - - This package provides the documentation in HTML format. diff --git a/debian/rules b/debian/rules index 2131fb6..ec9c0f2 100755 --- a/debian/rules +++ b/debian/rules @@ -9,24 +9,24 @@ override_dh_auto_build: dh_auto_build # and docs - $(MAKE) htmldoc - # but remove jquery copy (later on link to Debian's version) - -rm doc/build/html/_static/jquery.js - # objects inventory is of no use for the package - -rm doc/build/html/objects.inv - # also doc source files only consume space - -rm -r build/html/_sources +# $(MAKE) htmldoc +# # but remove jquery copy (later on link to Debian's version) +# -rm doc/build/html/_static/jquery.js +# # objects inventory is of no use for the package +# -rm doc/build/html/objects.inv +# # also doc source files only consume space +# -rm -r build/html/_sources ## immediately useable documentation ## and exemplar data (they are small excerpts anyway) override_dh_compress: dh_compress -X.py -X.html -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.par -X.bin -override_dh_installman: - PYTHONPATH=build/lib:$(PYTHONPATH) help2man -N \ - -n 'convert PARREC image to NIfTI' bin/parrec2nii > build/parrec2nii.1 - dh_installman build/parrec2nii.1 +#override_dh_installman: +# PYTHONPATH=build/lib:$(PYTHONPATH) help2man -N \ +# -n 'convert PARREC image to NIfTI' bin/parrec2nii > build/parrec2nii.1 +# dh_installman build/parrec2nii.1 -override_dh_clean: - $(MAKE) clean - dh_clean +#override_dh_clean: +# $(MAKE) clean +# dh_clean From 50791e485381195525eba4b5ad566d749f1bff0c Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Fri, 20 Apr 2012 07:10:53 +0200 Subject: [PATCH 06/15] Changes to make building .deb work - finally --- debian/changelog | 25 +++---------------------- debian/patches/no_doc_sources | 16 ---------------- debian/patches/series | 1 - debian/python-pylocator.install | 1 - 4 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 debian/patches/no_doc_sources delete mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 38e1c70..b15ca25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,25 +1,6 @@ -pylocator (1.1.0-1) unstable; urgency=low +pylocator (1.0-1) unstable; urgency=low - * New upstream release: better gifti and trackvis support, bugfixes. + * First debian package for PyLocator - -- Yaroslav Halchenko Wed, 04 May 2011 16:44:55 -0400 + -- Thorsten Kranz Fri, 20 April 2012 15:00:00 +0100 -pylocator (1.0.2-1) unstable; urgency=low - - * Fresh bugfix upstream release - * debian/copyright: - - changes to confirm to DEP5 rev 174 - - added myself - - updated years - * debian/control: - - boosted policy compliance to 3.9.2 (no changes) - - purged DM-Upload-Allowed (no need any more) - - slight tune up of the long description - - -- Yaroslav Halchenko Thu, 28 Apr 2011 10:27:22 -0400 - -pylocator (1.0.0-1) unstable; urgency=low - - * Initial release (Closes: #600275). - - -- Michael Hanke Fri, 15 Oct 2010 08:20:14 -0400 diff --git a/debian/patches/no_doc_sources b/debian/patches/no_doc_sources deleted file mode 100644 index 5d2e473..0000000 --- a/debian/patches/no_doc_sources +++ /dev/null @@ -1,16 +0,0 @@ -Description: Do not put links to source documention source in HTML files - Documentation source files are not shipped in the binary package, because - the are not very useful and occupy space, hence these links would be broken. -Forwarded: not-needed -Author: Michael Hanke ---- a/doc/source/conf.py -+++ b/doc/source/conf.py -@@ -201,7 +201,7 @@ - #html_split_index = False - - # If true, links to the reST sources are added to the pages. --html_show_sourcelink = True -+html_show_sourcelink = False - - # If true, an OpenSearch description file will be output, and all pages will - # contain a tag referring to it. The value of this option must be the diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 4c93208..0000000 --- a/debian/patches/series +++ /dev/null @@ -1 +0,0 @@ -no_doc_sources diff --git a/debian/python-pylocator.install b/debian/python-pylocator.install index 326a444..e69de29 100644 --- a/debian/python-pylocator.install +++ b/debian/python-pylocator.install @@ -1 +0,0 @@ -debian/tmp/usr/* usr/ From 2360deea7f1aa149c5c1b242623517efe5c9e7d2 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Fri, 20 Apr 2012 07:18:50 +0200 Subject: [PATCH 07/15] Added .desktop file --- debian/python-pylocator.desktop | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 debian/python-pylocator.desktop diff --git a/debian/python-pylocator.desktop b/debian/python-pylocator.desktop new file mode 100644 index 0000000..50dae48 --- /dev/null +++ b/debian/python-pylocator.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0b1 +Type=Application +Name=PyLocator +Comment=Marking electrode locations in MRI recordings +TryExec=pylocator +Exec=pylocator %F +Icon=pylocator +MimeType=image/x-foo; From bfd407aa2f936b80515358b30013f32513ca38f3 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Fri, 20 Apr 2012 11:39:03 +0200 Subject: [PATCH 08/15] new build --- debian/changelog | 2 +- debian/source/format | 2 +- debian/watch | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 debian/watch diff --git a/debian/changelog b/debian/changelog index b15ca25..98233f2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -pylocator (1.0-1) unstable; urgency=low +pylocator (1.0b2) unstable; urgency=low * First debian package for PyLocator diff --git a/debian/source/format b/debian/source/format index 163aaf8..89ae9db 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff --git a/debian/watch b/debian/watch deleted file mode 100644 index 69185e7..0000000 --- a/debian/watch +++ /dev/null @@ -1,4 +0,0 @@ -# Compulsory line, this is a version 3 file -version=3 -opts="filenamemangle=s/.*\/(.*)/pylocator-$1\.tar\.gz/" \ - http://github.com/nipy/pylocator/downloads .*tarball/([\d\.a-z]+) From a622b832a89a8998f6664d1530209b7a2f81bd2c Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Fri, 20 Apr 2012 17:31:19 +0200 Subject: [PATCH 09/15] cleaned debian package build --- debian/changelog | 2 +- debian/control | 3 +-- debian/{python-pylocator.desktop => pylocator.desktop} | 0 debian/python-pylocator-doc.docs | 1 - debian/python-pylocator-doc.links | 1 - debian/python-pylocator.install | 0 6 files changed, 2 insertions(+), 5 deletions(-) rename debian/{python-pylocator.desktop => pylocator.desktop} (100%) delete mode 100644 debian/python-pylocator-doc.docs delete mode 100644 debian/python-pylocator-doc.links delete mode 100644 debian/python-pylocator.install diff --git a/debian/changelog b/debian/changelog index 98233f2..6c05d4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -pylocator (1.0b2) unstable; urgency=low +pylocator (1.0b3) unstable; urgency=low * First debian package for PyLocator diff --git a/debian/control b/debian/control index 26d14e3..f8a59d1 100644 --- a/debian/control +++ b/debian/control @@ -10,11 +10,10 @@ Vcs-Browser: http://github.com/nipy/PyLocator Vcs-Git: git://github.com/nipy/PyLocator.git XS-Python-Version: >= 2.5 -Package: python-pylocator +Package: pylocator Architecture: all Depends: ${misc:Depends}, ${python:Depends}, python-numpy, python-scipy, python-nibabel, python-vtk, python-gtk2, python-gtkglext1 Recommends: python-dicom -Suggests: python-pylocator-doc Provides: ${python:Provides} XB-Python-Version: ${python:Versions} Description: Localization of EEG-electrodes from MRI-volumes diff --git a/debian/python-pylocator.desktop b/debian/pylocator.desktop similarity index 100% rename from debian/python-pylocator.desktop rename to debian/pylocator.desktop diff --git a/debian/python-pylocator-doc.docs b/debian/python-pylocator-doc.docs deleted file mode 100644 index 6d28621..0000000 --- a/debian/python-pylocator-doc.docs +++ /dev/null @@ -1 +0,0 @@ -build/html diff --git a/debian/python-pylocator-doc.links b/debian/python-pylocator-doc.links deleted file mode 100644 index 5912988..0000000 --- a/debian/python-pylocator-doc.links +++ /dev/null @@ -1 +0,0 @@ -usr/share/javascript/jquery/jquery.js usr/share/doc/python-pylocator-doc/html/_static/jquery.js diff --git a/debian/python-pylocator.install b/debian/python-pylocator.install deleted file mode 100644 index e69de29..0000000 From 2cdce78956c702e28eda66e9077fe95794d7c320 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Sat, 21 Apr 2012 04:15:35 +0200 Subject: [PATCH 10/15] Added desktop file to pylocator.install --- debian/pylocator.install | 1 + 1 file changed, 1 insertion(+) create mode 100644 debian/pylocator.install diff --git a/debian/pylocator.install b/debian/pylocator.install new file mode 100644 index 0000000..ac9142e --- /dev/null +++ b/debian/pylocator.install @@ -0,0 +1 @@ +debian/pylocator.desktop usr/share/applications/ From bc36e6a7fcdf49456834c7f4c3b1251a53b9d23f Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Mon, 23 Apr 2012 00:54:09 +0200 Subject: [PATCH 11/15] Next try for desktop & icon installation --- debian/pylocator.desktop | 3 ++- debian/pylocator.install | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/pylocator.desktop b/debian/pylocator.desktop index 50dae48..f37ca13 100644 --- a/debian/pylocator.desktop +++ b/debian/pylocator.desktop @@ -1,9 +1,10 @@ [Desktop Entry] Version=1.0b1 Type=Application +Categories=Science; Name=PyLocator Comment=Marking electrode locations in MRI recordings TryExec=pylocator Exec=pylocator %F Icon=pylocator -MimeType=image/x-foo; +MimeType=application/x-gzip; data/octet-stream diff --git a/debian/pylocator.install b/debian/pylocator.install index ac9142e..ed661e8 100644 --- a/debian/pylocator.install +++ b/debian/pylocator.install @@ -1 +1,2 @@ debian/pylocator.desktop usr/share/applications/ +pylocator/resources/pylocator.ico usr/share/icons/ From e15443da29dfbb135d933497c568f51e8ff2be02 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Wed, 25 Apr 2012 23:07:45 +0200 Subject: [PATCH 12/15] Trying multithreading for rendering --- pylocator/events.py | 4 ++-- pylocator/marker_list.py | 2 ++ pylocator/render_window.py | 19 +++++++++++++++++++ pylocator/surf_renderer_props.py | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/pylocator/events.py b/pylocator/events.py index bfe7744..eb97c75 100644 --- a/pylocator/events.py +++ b/pylocator/events.py @@ -172,9 +172,9 @@ def detach(self, observer): def notify(self, event, *args): for observer in self.observers.keys(): if shared.debug: - print "EventHandler.notify(", event, "): calling update_viewer for ", observer + print "EventHandler.notify(", event, "): calling enqueue_update for ", observer try: - observer.update_viewer(event, *args) + observer.enqueue_update(event, *args) except Exception, e: print "Error while updating observer", observer, type(e), e diff --git a/pylocator/marker_list.py b/pylocator/marker_list.py index bc8432f..151c097 100644 --- a/pylocator/marker_list.py +++ b/pylocator/marker_list.py @@ -131,6 +131,8 @@ def update_viewer(self, event, *args): marker = args[0] self.__set_marker_selected(marker,False) + enqueue_update = update_viewer + def cb_add(self,*args): parent_window = self.get_parent_window() #print parent_window diff --git a/pylocator/render_window.py b/pylocator/render_window.py index b9ba9f7..001c118 100644 --- a/pylocator/render_window.py +++ b/pylocator/render_window.py @@ -1,3 +1,5 @@ +from Queue import Queue, Empty +from threading import Thread import gtk import vtk from GtkGLExtVTKRenderWindowInteractor import GtkGLExtVTKRenderWindowInteractor @@ -17,6 +19,10 @@ def __init__(self,*args): GtkGLExtVTKRenderWindowInteractor.__init__(self,*args) self.screenshot_button_label = "_render window_" self.roi_actors = {} + self.event_queue = Queue(10) + self.stop_rendering = False + self.updating_thread = Thread(target=self.start_event_loop) + self.updating_thread.start() EventHandler().attach(self) self.interactButtons = (1,2,3) @@ -131,6 +137,9 @@ def _get_roi_actor(self, uuid): return return self.roi_actors[uuid] + def enqueue_update(self, event, *args): + self.event_queue.put((event, args), timeout=10) + def update_viewer(self, event, *args): if event=='render off': self.renderOn = 0 @@ -185,6 +194,16 @@ def update_viewer(self, event, *args): self.change_roi_opacity(uuid, opacity) self.Render() + def start_event_loop(self): + while not self.stop_rendering: + try: + event, args = self.event_queue.get(timeout=1) + self.update_viewer(event,*args) + except Empty: + pass + except Exception, e: + print type(e), e + class ThreeDimRenderWindow(object): textActors = {} diff --git a/pylocator/surf_renderer_props.py b/pylocator/surf_renderer_props.py index 569973f..afaea59 100644 --- a/pylocator/surf_renderer_props.py +++ b/pylocator/surf_renderer_props.py @@ -476,3 +476,5 @@ def set_image_data(self, data): def update_viewer(self, event, *args): if event=='set image data': self.set_image_data(args[0]) + + enqueue_update = update_viewer From 8d49faeb4f1b0c9bc4c594041c6c7f73b5cdf3d6 Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Wed, 25 Apr 2012 23:43:47 +0200 Subject: [PATCH 13/15] Updating windows with idle_add Instead of using multiple threads (producing random crashed without sync) we now use the idle_add-possibility of gobject to integrate the updated into the event loop of gtk. --- pylocator/render_window.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/pylocator/render_window.py b/pylocator/render_window.py index 001c118..d8dce20 100644 --- a/pylocator/render_window.py +++ b/pylocator/render_window.py @@ -1,6 +1,6 @@ from Queue import Queue, Empty -from threading import Thread import gtk +import gobject import vtk from GtkGLExtVTKRenderWindowInteractor import GtkGLExtVTKRenderWindowInteractor from events import EventHandler @@ -20,9 +20,6 @@ def __init__(self,*args): self.screenshot_button_label = "_render window_" self.roi_actors = {} self.event_queue = Queue(10) - self.stop_rendering = False - self.updating_thread = Thread(target=self.start_event_loop) - self.updating_thread.start() EventHandler().attach(self) self.interactButtons = (1,2,3) @@ -139,6 +136,7 @@ def _get_roi_actor(self, uuid): def enqueue_update(self, event, *args): self.event_queue.put((event, args), timeout=10) + gobject.idle_add(self.do_update) def update_viewer(self, event, *args): if event=='render off': @@ -194,15 +192,12 @@ def update_viewer(self, event, *args): self.change_roi_opacity(uuid, opacity) self.Render() - def start_event_loop(self): - while not self.stop_rendering: - try: - event, args = self.event_queue.get(timeout=1) - self.update_viewer(event,*args) - except Empty: - pass - except Exception, e: - print type(e), e + def do_update(self): + try: + event, args = self.event_queue.get(timeout=1) + self.update_viewer(event,*args) + except Empty: + pass class ThreeDimRenderWindow(object): textActors = {} From 9ce77d9813990da54221d2a4f09529d587d1167e Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 26 Apr 2012 03:35:21 +0200 Subject: [PATCH 14/15] Version number --- pylocator/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylocator/__init__.py b/pylocator/__init__.py index b214e35..73aaa0e 100644 --- a/pylocator/__init__.py +++ b/pylocator/__init__.py @@ -12,5 +12,5 @@ pygtk, gtkglext """ -__version__ = "1.0 beta 1" +__version__ = "1.0.90" From 1bf595250f0909afe0f295595ca8f5c97a02f5de Mon Sep 17 00:00:00 2001 From: Thorsten Kranz Date: Thu, 3 May 2012 00:00:50 +0200 Subject: [PATCH 15/15] Multiple selection; first shot --- pylocator/marker_list.py | 49 +++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/pylocator/marker_list.py b/pylocator/marker_list.py index f773e78..d0b9466 100644 --- a/pylocator/marker_list.py +++ b/pylocator/marker_list.py @@ -1,4 +1,5 @@ from __future__ import division +from sets import Set import gobject import gtk @@ -22,6 +23,7 @@ def __init__(self): self._marker_ids = {} self.nmrk=0 self.__ignore_sel_changed = False + self.old_selection=Set([]) #Toolbar toolbar = self.__create_toolbar() @@ -39,7 +41,7 @@ def __init__(self): self.treev_mrk = gtk.TreeView(self.tree_mrk) self._treev_sel = self.treev_mrk.get_selection() self._treev_sel.connect("changed",self.treev_sel_changed) - self._treev_sel.set_mode(gtk.SELECTION_SINGLE) + self._treev_sel.set_mode(gtk.SELECTION_MULTIPLE) renderer = gtk.CellRendererText() renderer.set_property("xalign",1.0) #renderer.set_xalign(0.0) @@ -147,10 +149,11 @@ def cb_add(self,*args): EventHandler().add_marker(marker) def cb_remove(self,*args): - marker = self.__get_selected_marker() - if marker==None: + markers = self.__get_selected_markers() + if markers==None: return - EventHandler().remove_marker(marker) + for marker in markers: + EventHandler().remove_marker(marker) def cb_choose_color(self,*args): marker = self.__get_selected_marker() @@ -248,17 +251,30 @@ def remove_marker(self,marker): def treev_sel_changed(self,selection): if self.__ignore_sel_changed: return - EventHandler().clear_selection() - try: - treeiter = selection.get_selected()[1] - if treeiter: + model, rows = selection.get_selected_rows() + if rows!=None: + new_selection = Set(rows) + newly_selected = new_selection - self.old_selection + newly_deselected = self.old_selection - new_selection + #print self.old_selection + #print new_selection + #print newly_selected + #print newly_deselected + for row in newly_selected: + treeiter = model.get_iter(row) mrk_id = self.tree_mrk.get(treeiter,0)[0] if mrk_id==None: return marker = self._markers[mrk_id] - EventHandler().select_new(marker) - except: - pass + EventHandler().add_selection(marker) + for row in newly_deselected: + treeiter = model.get_iter(row) + mrk_id = self.tree_mrk.get(treeiter,0)[0] + if mrk_id==None: + return + marker = self._markers[mrk_id] + EventHandler().remove_selection(marker) + self.old_selection = Set(rows) def __update_treeview_visibility(self): if self.tree_mrk.get_iter_first()==None: @@ -269,12 +285,13 @@ def __update_treeview_visibility(self): self.emptyIndicator.hide() self.scrolledwindow.show() - def __get_selected_marker(self): - treeiter = self._treev_sel.get_selected()[1] - if not treeiter: + def __get_selected_markers(self): + model, rows = self._treev_sel.get_selected_rows() + if rows==None: return - mrk_id = self.tree_mrk.get(treeiter,0)[0] - return self._markers[mrk_id] + treeiters = [model.get_iter(row) for row in rows] + mrk_ids = [model.get(treeiter,0)[0] for treeiter in treeiters] + return [self._markers[mrk_id] for mrk_id in mrk_ids] def __format_coord_string(self,x,y,z): def fmt(f):