[med-svn] r1867 - in trunk/packages: . imagej imagej/trunk imagej/trunk/debian

tille at alioth.debian.org tille at alioth.debian.org
Thu May 15 17:15:01 UTC 2008


Author: tille
Date: 2008-05-15 17:15:01 +0000 (Thu, 15 May 2008)
New Revision: 1867

Added:
   trunk/packages/imagej/
   trunk/packages/imagej/tags/
   trunk/packages/imagej/trunk/
   trunk/packages/imagej/trunk/debian/
   trunk/packages/imagej/trunk/debian/README.Debian
   trunk/packages/imagej/trunk/debian/changelog
   trunk/packages/imagej/trunk/debian/compat
   trunk/packages/imagej/trunk/debian/control
   trunk/packages/imagej/trunk/debian/copyright
   trunk/packages/imagej/trunk/debian/dirs
   trunk/packages/imagej/trunk/debian/docs
   trunk/packages/imagej/trunk/debian/imagej.1
   trunk/packages/imagej/trunk/debian/imagej.sh
   trunk/packages/imagej/trunk/debian/menu
   trunk/packages/imagej/trunk/debian/rules
   trunk/packages/imagej/trunk/debian/watch
Log:
Injected imagej with some changes (group maintenance, watch file, homepage in control)


Added: trunk/packages/imagej/trunk/debian/README.Debian
===================================================================
--- trunk/packages/imagej/trunk/debian/README.Debian	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/README.Debian	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,14 @@
+imagej for Debian
+-----------------
+
+Still have some problem with luts as files are binary so for the moment are
+base64 encoded but i've to write something in rules to base64 decode all luts file
+beforse copying them, matbe somthing like:
+perl -MMIME::Base64 -e 'print decode_base64(join("", <>))' < debian/extra/luts/*.enc > $(CURDIR)/debian/imagej/usr/share/imagej/luts/
+need help :)
+
+ -- Paolo Ariano <paolo.ariano at unito.it>, Thu, 03 Apr 2008 14:17:43 +0200
+
+The package was put into contrib because it is compiled with Sun Java 1.4.2_06.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>, Fri, 28 Apr 2006 11:41:53 +0200

Added: trunk/packages/imagej/trunk/debian/changelog
===================================================================
--- trunk/packages/imagej/trunk/debian/changelog	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/changelog	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,106 @@
+imagej (1.40a-2) unstable; urgency=low
+
+  * Group maintenance according to Debian-Med group policy
+  * Added myself as Uploader
+  * VCS fields
+  * Added Homepage to debian/control
+  * Added watch file
+
+ -- Andreas Tille <tille at debian.org>  Thu, 15 May 2008 17:20:37 +0200
+
+imagej (1.40a-1) unstable; urgency=high
+
+  * New Upstream Release.
+
+  * imagej.sh script doesn't symlink existent macros.
+
+  * imagej.sh script correctly symlink names with spaces.
+
+  * imagej.sh doesn't print redundant usage message.
+
+  * added again $HOME/.imagej/luts (closes: #470797).
+
+  * Thanks to Andre Lehovich (closes: #470810).
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Fri, 28 Mar 2008 13:41:34 +0100
+
+imagej (1.39q-2) unstable; urgency=high
+
+  * New imagej.sh wrapper (closes: #468173).  
+
+  * New man page.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Fri, 06 Mar 2008 15:29:56 +0100
+
+imagej (1.39q-1) unstable; urgency=low
+
+  * New Upstream Release.  
+
+  * Symlinks in $HOME/.imagej/macro are ready, (closes: #447594).
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Fri, 08 Feb 2008 11:29:56 +0100
+
+imagej (1.39b-5) unstable; urgency=high
+
+  * New sections graphics.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Wed, 26 Sep 2007 13:02:02 +0200
+
+imagej (1.39b-4) unstable; urgency=high
+
+  * New man page.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Wed, 26 Sep 2007 12:02:02 +0200
+
+imagej (1.39b-3) unstable; urgency=high
+
+  * You can pass extra arguments to java, such as amount of memory.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Tue, 25 Sep 2007 16:24:02 +0200
+
+imagej (1.39b-2) unstable; urgency=high
+
+  * New startup script (Closes: #439247).
+
+  * Deleted Disclaimer from Copyright (Closes: #439627).
+
+  * Filled a man page (Closes: #439252). 
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Tue, 25 Sep 2007 15:24:02 +0200
+
+imagej (1.39b-1) unstable; urgency=low
+
+  * New Upstream Release.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Thu, 02 Aug 2007 16:09:06 +0200
+
+imagej (1.37m-5) unstable; urgency=low
+
+  * Changhed path for /usr/sbin/update-java-alternatives in imagej.sh (thanks fog).
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Wed, 13 Jun 2007 23:50:06 +0200
+
+imagej (1.37m-4) unstable; urgency=low
+
+  * Added possibility to pass extra arguments to java (thanks to Mike Miller).
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Wed, 10 May 2006 23:48:28 +0200
+
+imagej (1.37m-3) unstable; urgency=low
+
+  * Added lut.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Mon, 07 Aug 2006 22:41:53 +0200
+
+imagej (1.37m-2) unstable; urgency=low
+
+  * Added the amount of memory as command line parameter.
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Mon, 07 Aug 2006 22:41:53 +0200
+
+imagej (1.37m-1) unstable; urgency=low
+
+  * Initial release (Closes: #4526773, #6353442).
+
+ -- Paolo Ariano <paolo.ariano at unito.it>  Fri, 28 Apr 2006 11:41:53 +0200
+

Added: trunk/packages/imagej/trunk/debian/compat
===================================================================
--- trunk/packages/imagej/trunk/debian/compat	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/compat	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1 @@
+4

Added: trunk/packages/imagej/trunk/debian/control
===================================================================
--- trunk/packages/imagej/trunk/debian/control	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/control	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,36 @@
+Source: imagej
+Section: contrib/science
+Priority: optional
+Maintainer: Debian-Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
+DM-Upload-Allowed: yes
+Uploaders: Paolo Ariano <paolo.ariano at unito.it>,
+ Andreas Tille <tille at debian.org>
+Build-Depends: ecj | java2-compiler, cdbs, debhelper, ant, gif2png
+Standards-Version: 3.7.3
+Vcs-Browser: http://svn.debian.org/wsvn/debian-med/trunk/packages/imagej/trunk/?rev=0&sc=0
+Vcs-Svn: svn://svn.debian.org/svn/debian-med/trunk/packages/imagej/trunk/
+Homepage: http://rsb.info.nih.gov/ij/
+
+Package: imagej
+Architecture: all
+Depends: gij | java2-runtime
+Suggests: java2-compiler
+Description: Image processing program inspired by NIH Image for the Macintosh
+ It can display, edit, analyze, process, save and print 8-bit, 16-bit and
+ 32-bit images. It can read many image formats including TIFF, GIF, JPEG,
+ BMP, DICOM, FITS and "raw". It supports "stacks", a series of images that
+ share a single window.
+ .
+ It can calculate area and pixel value statistics of user-defined
+ selections. It can measure distances and angles. It can create density
+ histograms and line profile plots. It supports standard image processing
+ functions such as contrast manipulation, sharpening, smoothing, edge
+ detection and median filtering.
+ .
+ Spatial calibration is available to provide real world dimensional
+ measurements in units such as millimeters. Density or gray scale
+ calibration is also available.
+ .
+ ImageJ is developed by Wayne Rasband (wayne at codon.nih.gov), is at the
+ Research Services Branch, National Institute of Mental Health, Bethesda,
+ Maryland, USA.

Added: trunk/packages/imagej/trunk/debian/copyright
===================================================================
--- trunk/packages/imagej/trunk/debian/copyright	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/copyright	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,16 @@
+This package was debianized by Paolo Ariano <paolo.ariano at unito.it> on
+Fri, 28 Apr 2006 11:41:53 +0200.
+
+It was downloaded from <http://rsb.info.nih.gov/ij/download/src/>
+
+Author : Wayne Rasband, rwsr at nih.gov, for the NIH
+
+License:
+
+   ImageJ is being developed at the National Institutes of Health by an employee
+ of the Federal Government in the course of his official duties. Pursuant to 
+Title 17, Section 105 of the United States Code, this software is not subject 
+to copyright protection and is in the public domain. ImageJ is an experimental 
+system. NIH assumes no responsibility whatsoever for its use by other parties, 
+and makes no guarantees, expressed or implied, about its quality, reliability, 
+or any other characteristic.

Added: trunk/packages/imagej/trunk/debian/dirs
===================================================================
--- trunk/packages/imagej/trunk/debian/dirs	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/dirs	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,7 @@
+usr/bin
+usr/share/java
+usr/share/pixmaps
+usr/share/imagej
+usr/share/imagej/plugins
+usr/share/imagej/macros
+usr/share/imagej/luts

Added: trunk/packages/imagej/trunk/debian/docs
===================================================================
--- trunk/packages/imagej/trunk/debian/docs	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/docs	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,3 @@
+aREADME.txt
+IJ_Props.txt
+release-notes.html

Added: trunk/packages/imagej/trunk/debian/imagej.1
===================================================================
--- trunk/packages/imagej/trunk/debian/imagej.1	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/imagej.1	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,102 @@
+.\" Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.\" Please adjust this date whenever revising the manpage.
+.\" 
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.TH "IMAGEJ" "1" "March 14, 2008" "Paolo Ariano" ""
+.SH "NAME"
+.LP 
+imagej \- A Java image processing program inspired by NIH Image.
+.SH "SYNTAX"
+.LP 
+imagej [\fIoption\fP] <\fIfilename\fP>
+.br 
+imagej [\-i image] [\-b|\-m] [arg1 ... argN]
+.SH "DESCRIPTION"
+.LP 
+\fBImagej\fP is a Java\-based image processing program developed at the National Institutes of Health. ImageJ was designed with an open architecture that provides extensibility via Java plugins and recordable macros.
+Custom acquisition, analysis and processing plugins can be developed using ImageJ's built\-in editor and a Java compiler.
+User\-written plugins make it possible to solve many image processing and 
+analysis problems, from 3\-dimensional live\-cell imaging,
+ to radiological image processing, multiple imaging system data comparisons 
+to automated hematology systems.
+ImageJ's plugin architecture and built in development environment has made 
+it a popular platform for teaching image processing.
+
+ImageJ can be run as an online applet, a downloadable application, or on 
+any computer with a Java 1.1 or later virtual machine. 
+.SH "OPTIONS"
+.LP 
+.TP 
+\fB\-h\fR
+Output help information and exit.
+.TP 
+\fB\-o\fR
+Open images in existing ImageJ panel if one exists.
+.TP 
+\fB\-p\fR <\fIN\fP>
+Open images in existing ImageJ panel number <N>.
+.TP 
+\fB\-x\fR <\fIMB\fP>   
+Set available memory.
+.TP 
+\fB\-c\fR
+Enable plugin compilation within imagej.
+.TP 
+\fB\-v\fR
+Be verbose (vv or vvv increases verbosity).
+.TP 
+\fB\-e\fR \fIMacro Code\fP
+Execute macro code.
+.TP 
+\fB\-r\fR \fIMenu Command\fP
+Run menu command.
+Quotation marks are required around commands including spaces
+Commands can be sent to open ImageJ panels with the \-p option.
+.TP 
+\fB\-b\fR \fImacro\fP
+Run macro without graphics window.
+.TP 
+\fB\-m\fR \fImacro\fP
+Run macro, image will be opened before macro is run all following arguments are passed to macro.
+.SH "FILES"
+.LP 
+Most IMAGEJ add\-on are taken from $HOME/.imagej.  The  system  wide
+ equivalent is in /usr/share/imagej/
+.TP 
+.B \ HOME/.imagej/plugins/,
+you can find and put new plugins here
+.TP 
+.B \ HOME/.imagej/macros/,
+you can find and put new macros here
+.TP 
+.B \ HOME/.imagej/luts/,
+you can find and put new look up tables here
+
+.SH "EXAMPLES"
+.LP 
+For compiling plugins:
+.LP 
+imagej \-c
+.SH "SEE ALSO"
+.\"/.BR bar (1),
+.\"/.BR baz (1).
+.br 
+The program is fully documented at 
+http://rsb.info.nih.gov/ij/docs/
+.SH "AUTHOR"
+.LP 
+ImageJ was written by Wayne Rasband <wsr at nih.gov>
+.PP 
+This manual page, the wrapper and packaging was done by Paolo Ariano <paolo.ariano at unito.it>, for the Debian project.

Added: trunk/packages/imagej/trunk/debian/imagej.sh
===================================================================
--- trunk/packages/imagej/trunk/debian/imagej.sh	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/imagej.sh	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,424 @@
+#!/bin/bash
+
+# imagej.sh - a not so simple wrapper script used to run ImageJ
+
+#	Copyright © 2008 Paolo Ariano
+#	Authors: Paolo Ariano (paolo dot ariano at unito dot it)
+#	Last modified date: 04 March 2008
+
+# This is a not so simple wrapper script used to run ImageJ in Unix but 
+# optimized for Debian GNU/Linux, this is a merge between my original script 
+# and a more exhaustive one from Jon Jackson (jjackson at familyjackson dot net)
+
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public Licenseas published by
+# the Free Software Foundation, either version 3 of the License, or (at 
+# your option) any later version. See the file Documentation/LGPL3 in the
+# original distribution for details. There is ABSOLUTELY NO warranty.
+# This program is free software, but comes with no warrenty or guarantee
+# send bug reports or feedback to me or to debian bug tracking system
+
+
+# setup environment
+set +u # don't give error for unset variables (matters for environment variables)
+shopt -s extglob # allow extended pattern matching
+
+##################### DEFINE JAVA_HOME  #####################
+
+if [ -z "$JAVA_HOME" ] ; then
+    JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | head -1 | cut -d' ' -f 3)
+fi
+
+##################### CREATE THE RIGHT ENVIRONMENT #####################
+
+# ImageJ path
+ij_path=/usr/share/java
+
+#ImageJ user path
+ij_user_path=$HOME/.imagej
+
+# report errors to this user
+ijadmin='paolo.ariano at unito.it'
+
+# Documentation URL
+doc_url='http://rsb.info.nih.gov/ij/'
+
+# temp folder
+ij_tmp=$HOME/.imagej/tmp
+
+# default behaviour when an ImageJ window is already open
+newwindow='true'
+#newwindow='false'
+
+# macro argument conjoining character
+separator=':'
+# a ' ' may work provided no arguments would contain spaces
+# use macro functions:  args=getArgument(); argArray=split(args, ':'); 
+# to recover macro arguments
+
+declare -i mem
+declare -i default_mem=500
+declare -i min_mem=16
+declare -i max_mem
+declare -i free_mem
+
+# other variables 
+dir=`pwd`
+user=`whoami`
+host=`hostname`
+if [[ -z "$DISPLAY" ]] ; then
+    echo 'Display variable not set'
+    echo 'If ImageJ fails to load, try '
+    echo '% setenv DISPLAY yourcomputer:0'
+    echo 'if you use the "csh" or for "bash" try'
+    echo '% export DISPLAY=yourcomputer:0'
+    display='default' 
+else
+    display="$DISPLAY"
+fi
+
+declare -i port=0
+declare -i verbosity=0
+images=''
+macrocmd=''
+macroargs=''
+
+# max memory allocation is 1800MB on 32bit java and 4000 on 64bit java
+if [[ `uname` == 'SunOS' ]] ; then
+    arch='-d64'
+	java_path="${ij_path}/jre64/bin/java"	
+	max_mem=`vmstat | awk 'NR == 3 {fmem=int($5 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`
+	free_mem="max_mem"
+	mem=${free_mem}/2*3
+	if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
+elif [[ `uname` == 'Linux' ]] ; then
+	if [[ `uname -m` == 'x86_64' ]] ; then
+    	arch='-d64'
+    	java_path="${ij_path}/jre64/bin/java"
+    	max_mem=`free | awk 'NR == 2 {fmem=int($2 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`
+		free_mem=`free | awk 'NR == 3 {fmem=int($4 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`
+		mem=${free_mem}/3*2
+		if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
+	else
+		arch='-d32'
+    	java_path="${ij_path}/jre/bin/java"
+    	free_mem=`free | awk 'NR == 2 {fmem=int($2 / 1024); if (fmem < 1800) {print fmem} else {print 1800}}'`
+		free_mem=`free | awk 'NR == 3 {fmem=int($4 / 1024); if (fmem < 1800) {print fmem} else {print 1800}}'`
+		mem=${free_mem}/3*2
+		if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi	
+	fi
+fi
+
+# create plugins,macro,tmp dirs 
+mkdir -p $ij_user_path/plugins 
+mkdir -p $ij_user_path/macros
+mkdir -p $ij_user_path/luts
+
+# create imagej socket-lock directory if non existant 
+if [[ ! -d "$ij_tmp" ]] ; then
+    mkdir -p "$ij_tmp"
+    #chmod 777 "$ij_user_path/tmp"
+fi
+
+# Warning on syntax change
+# for var in "$@" ; do
+ 	#if [[ "$var" == @(-batch|-eval|-macro|-mem|-new|-port|-run|-verbose) ]] ; then
+#	if [ $var == @(-batch|-eval|-macro|-mem|-new|-port|-run|-verbose) ] ; then
+#		echo "ImageJ command line options have changed!" 1>&2
+# 		echo "$var is no longer a valid option, type 'imagej -h'" 1>&2
+# 		echo "for full usage" 1>&2
+# 		exit 1
+# 	fi
+# done
+
+# makes symbolik links from shared plugins, macros and luts 
+
+ls /usr/share/imagej/plugins | while read p ; do
+  if [ ! -e "$ij_user_path/plugins/$p" ] ; then
+    ln -s /usr/share/imagej/plugins/$p $ij_user_path/plugins/$p
+  fi
+done
+
+ls /usr/share/imagej/macros | while read p; do
+  if [ ! -e "$ij_user_path/macros/$p" ] ; then
+      ln -s "/usr/share/imagej/macros/$p" "$ij_user_path/macros/$p"
+  fi
+done
+
+ls /usr/share/imagej/luts | while read p ; do
+    if [ ! -e "$ij_user_path/luts/$p" ] ; then
+	ln -s /usr/share/imagej/luts/$p $ij_user_path/luts/$p
+    fi
+done
+
+
+
+##################### USAGE DESCRIPTION #####################
+
+function usage {
+    echo 
+    echo 'Image display and analysis program. Opens formats including:'
+    echo 'UNC, Analyze, Dicom, NIFTI, Tiff, Jpeg, Gif, PNG ...'  
+    echo
+    echo 'imagej [options] image [ image2 ... image3 ]'
+    echo '    -h        print help and more options'
+    echo '    -o        open images in an open ImageJ panel'
+    echo '    -p <N>    open images in ImageJ panel number <N>' 
+    echo "    -x <MB>   set available memory (default=${mem} max=${max_mem})"     
+    echo 
+}
+
+function fullusage {
+    echo 
+    echo 'Image display and analysis program. Opens formats including:'
+    echo 'UNC, Analyze, Dicom, NIFTI, Tiff, Jpeg, Gif, PNG ...'  
+    echo 
+    echo 'imagej [options] image [ image2 ... image3 ] -> open images'
+    echo
+    echo 'basic options:'
+    echo '  -h        print help and more options'
+    echo '  -o        open images in existing ImageJ panel if one exists'
+    echo '  -p <N>    open images in existing ImageJ panel number <N>' 
+    echo "  -x <MB>   set available memory (default=${mem} max=${max_mem})"
+    echo
+    echo 'advanced options:'
+    echo '  -c        enable plugin compilation within imagej'
+    echo '  -d        use development version'
+    echo '  -v        be verbose (vv or vvv increases verbosity)'  
+    echo
+    echo 'options for batch processing:'
+    echo "  -e 'Macro Code'            execute macro code"
+    echo "  -r 'Menu Command'          run menu command"
+    echo "Quotation marks '' are required around commands including spaces"
+    echo 'Commands can be sent to open ImageJ panels with the -p option'
+    echo 
+    echo 'options for macros:'
+    echo 'imagej [-i image] [-b|-m] [arg1 ... argN] '
+    echo '  -b macro    run macro without graphics window' 
+    echo '  -m macro    run macro' 
+    echo '"image" will be opened before macro is run'
+    echo 'all following arguments are passed to macro'        
+    echo 
+    echo "Documentation - $doc_url "
+	echo "Report problems with this software to $ijadmin"
+    echo
+}
+
+function macroCmdError {
+	fullusage 
+	echo 'Only one command option (-b -e -m OR -r) may be specified' 1>&2
+	exit 1
+}
+
+# The best way to install .jar libraries required by plugins is to copy them 
+# to the imagej ij_path=/usr/share/java alternatively or add the .jar
+# filepath to the modules line below. Paths are separated by a colon
+# modules="-cp ${ij_path}/ij.jar:${ij_path}/plugins/jars/dcmie.jar"
+modules="-cp ${ij_path}/ij.jar"
+ 
+# enable plugins to be compiled in imagej
+tools="$JAVA_HOME/lib/tools.jar"
+
+
+#####################  ARGUMENTS PARSING #####################
+
+while getopts b:ce:hi:m:op:r:vx: options
+do
+	case $options in
+		b)	if [[ -n "$macrocmd" ]] ; then macroCmdError ; fi
+			macrocmd="-batch ${OPTARG}"
+			;;
+		c)	modules="${modules}:${tools}"
+			;;
+		e)  if [[ -n "$macrocmd" ]] ; then macroCmdError ; fi
+			macrocmd='-eval'
+			macroargs="'${OPTARG}'"
+			;;
+		h)  fullusage
+			exit 0
+			;;
+		i)  images="${images}'${OPTARG}' "
+			;;
+		m)	if [[ -n "$macrocmd" ]] ; then macroCmdError ; fi
+			macrocmd="-macro ${OPTARG}"
+			;;
+		o)  newwindow='false'
+			;;
+		p)	newwindow='false'
+			port="${OPTARG}"
+        	if (( "$port" < 1 || "$port" > 99 )) ; then
+            	echo "${OPTARG} is not a permissible value for port number (-p)" 1>&2
+            	exit 1
+        	fi
+			;;
+		r)	if [[ -n "$macrocmd" ]] ; then macroCmdError ; fi
+			macrocmd='-run'
+			macroargs="'${OPTARG}'"
+			;;
+		v)	verbosity=verbosity+1
+			if (( $verbosity == 2 )) ; then set -x ; fi
+			if (( $verbosity == 3 )) ; then set -v ; fi
+			;;
+		x)	mem="${OPTARG}"
+			if (( $mem < $min_mem || $mem > $max_mem )) ; then
+            	echo "${OPTARG} is not a permissible value for memory (-x)" 1>&2
+            	echo "min=${min_mem}, max=${max_mem}" 1>&2
+            	exit 1				
+			fi
+			;;
+		\?) usage
+			exit 1 
+			;;
+	esac
+done
+			
+declare -i i=1
+while (( i < $OPTIND )) ; do
+	shift
+	i=i+1
+done
+
+#if (( "$#" == 0 )) ; then
+#	usage
+#fi	
+
+# -b and -m options only:
+# remaining command line arguments are passed as macro arguments 
+# separated by $separator
+if [[ -n "$macrocmd" && -z "$macroargs" ]] ; then
+	while (( "$#" > 0 )) ; do
+        if [[ -z "$macroargs" ]] ; then 
+            macroargs="${1}"
+        else
+            macroargs="${macroargs}${separator}${1}"
+        fi
+        shift 		
+	done
+	macroargs="'$macroargs'"
+fi
+	
+# protect possible spaces in image filenames
+if (( "$#" > 0 )) ; then
+	while (( "$#" > 0 )) ; do
+		images="${images}'${1}' "
+		shift 
+	done
+fi
+
+##################### USING PORT #####################
+
+# Creates a temp file indicating a port is in use by imagej
+pushd "$ij_tmp" > /dev/null
+declare -i count=1
+portopen='false'
+lockFileCreated='false'
+declare -a locklist=(`ls | grep '[0-9][0-9]-.*'`)
+
+if (( $verbosity > 0 )) ; then echo -e "locklist: \n ${locklist[*]}" ; fi
+
+# port specified by user
+if (( $port > 0 )) ; then
+    # look for a lock on the port specified
+    for lockname in ${locklist[*]} ; do
+        prefix=`printf '%02u' $port`
+        if [[ "$lockname" == ${prefix}-${user}-${host}* ]] ; then
+        	# found lock on the requested port, owned by user on current display
+            portopen='true'
+            if (( $verbosity > 0 )) ; then echo "Using socket lock: $lockname" ; fi
+            count=$port
+            break
+        elif ("$lockname" =~ ${prefix}-* ) ; then
+            echo "Port $port is in use by some other user or a different host" 1>&2
+            if (( $verbosity > 0 )) ; then echo "Port lock: $lockname" ; fi
+            exit 1
+        fi
+    done 
+    # specified port not in use 
+    count=$port
+
+# If existing window is requested, look for listening port
+elif [[ "$newwindow" == 'false' && ${#locklist} != 0 ]] ; then
+    # look for a lock on the current display for this user
+    for lockname in ${locklist[*]} ; do
+        if [[ "$lockname" == [0-9][0-9]-${user}-${host}-${display} ]] ; then
+            portopen='true'
+            if (( $verbosity > 0 )) ; then echo "Found socket lock: $lockname" ; fi
+            # if a matching user/display is found, use this one
+            count="${lockname%-*-*-*}"
+            #count=`echo $lockname | sed  -e 's/^\([0-9][0-9]\).*/\1/' -e 's/^0//'` # csh?
+            break
+        fi
+    done
+fi
+
+# if a new port is to be used
+if [[ "$portopen" == 'false' ]] ; then
+    # new window requested or no matching port found
+    # if port is not specified, look for first free port
+    if (( "$port" == 0 )) ; then 
+        if (( ${#locklist} == 0 )) ; then
+            # no active locks - use first port
+            count=1
+        else
+            # active locks - check each port number so see if it is in use
+            # this is not synchronised!!
+            count=0
+            inuse='true'
+            while [[ "$inuse" == 'true' ]] ; do
+                count=count+1
+                prefix=`printf '%02u' $count`
+                inuse='false'
+                for lockname in ${locklist[*]} ; do
+                    if [[ "$lockname" == ${prefix}-* ]] ; then
+                        inuse='true'
+                    fi
+                done
+            done
+        fi
+    fi
+    # creating a new port lock
+    prefix=`printf '%02u' $count`
+    lockname=${prefix}-${user}-${host}-${display}
+	if (( $verbosity > 0 )) ; then echo -n "creating lock $lockname ... " ; fi
+	touch $lockname
+	trap '\rm -f ${ij_tmp}/$lockname >/dev/null ; exit 1' EXIT TERM 
+	# Quitting ImageJ sends EXIT, as does a kill/kill -9 
+	# CTRL+C in terminal sends INT + EXIT
+	# System shutdown sends TERM (+EXIT??)
+	
+	if (( $verbosity > 0 )) ; then  echo 'done' ; fi
+
+    lockFileCreated='true'
+	echo 'Open other images in this ImageJ panel as follows:'
+	echo "  imagej -p $count <image1> [<image2> ... <imageN>]"
+    if (( $verbosity > 0 )) ; then echo "Socket lock: $lockname" ; fi
+	echo
+fi
+
+# Report number of port locks - more than 50 may indicate error in this script
+if [[ $count -gt 50 && $port == 0 && "$ijadmin" != '' ]] ; then
+mail -s "ImageJ ports on $host" $ijadmin << EOF
+Port locks on $host reached $count
+EOF
+fi
+
+##################### FINALLY RUN IMAGEJ #####################
+
+popd > /dev/null
+
+if [ "$JAVA_HOME" ] ; then
+	if (( $verbosity > 0 )) ; then
+		echo ${modules}
+    		echo $JAVA_HOME/bin/java ${arch} -mx${mem}m ${modules} ij.ImageJ -ijpath ${ij_user_path} -port${count} ${images} ${macrocmd} ${macroargs}
+	else
+	eval $JAVA_HOME/bin/java ${arch} -mx${mem}m ${modules} ij.ImageJ -ijpath ${ij_user_path} -port${count} ${images} ${macrocmd} ${macroargs}
+	fi
+else
+  echo "No JVM found to run ImageJ"
+  echo "Please apt-get install a JVM to run ImageJ or "
+  echo "set JAVA_HOME if it's not a JVM from a Debian Package."
+  exit 1
+fi
+
+exit 0
+

Added: trunk/packages/imagej/trunk/debian/menu
===================================================================
--- trunk/packages/imagej/trunk/debian/menu	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/menu	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,6 @@
+?package(imagej):\
+  needs="X11"\
+  section="Applications/Graphics"\
+  title="imagej"\
+  icon="/usr/share/pixmaps/microscope.xpm"\
+  command="/usr/bin/imagej"

Added: trunk/packages/imagej/trunk/debian/rules
===================================================================
--- trunk/packages/imagej/trunk/debian/rules	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/rules	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,28 @@
+#!/usr/bin/make -f
+# debian/rules for imagej (uses CDBS)
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/ant.mk
+include /usr/share/cdbs/1/rules/simple-patchsys.mk
+
+JAVA_HOME		:= $(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d' ' -f 3)
+JAVACMD			:= $(JAVA_HOME)/bin/java
+DEB_BUILDDIR		:= $(CURDIR)
+DEB_ANT_BUILD_TARGET	:= build
+ANT_HOME		:= /usr/share/ant
+DEB_CLASSPATH		:= $(ANT_HOME)/lib/ant.jar:$(ANT_HOME)/lib/ant-launcher.jar:$(JAVA_HOME)/lib/tools.jar
+VERSION			:= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -f 1 -d '-')
+
+install/imagej::
+	install -m 644 $(DEB_BUILDDIR)/ij.jar $(CURDIR)/debian/imagej/usr/share/java/
+	install -m 755 $(CURDIR)/debian/imagej.sh $(CURDIR)/debian/imagej/usr/bin/imagej
+	cp -r $(CURDIR)/plugins/*.class $(CURDIR)/debian/imagej/usr/share/imagej/plugins/
+	cp -r $(CURDIR)/build/macros/* $(CURDIR)/debian/imagej/usr/share/imagej/macros/
+	#base64 -d < debian/extra/luts
+	cp -r $(CURDIR)/extra/luts/* $(CURDIR)/debian/imagej/usr/share/imagej/luts/
+	install -m 644 $(CURDIR)/extra/microscope.xpm $(CURDIR)/debian/imagej/usr/share/pixmaps/
+	dh_installman -i debian/imagej.1
+


Property changes on: trunk/packages/imagej/trunk/debian/rules
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/packages/imagej/trunk/debian/watch
===================================================================
--- trunk/packages/imagej/trunk/debian/watch	                        (rev 0)
+++ trunk/packages/imagej/trunk/debian/watch	2008-05-15 17:15:01 UTC (rev 1867)
@@ -0,0 +1,5 @@
+# watch control file for imagej
+version=3
+
+opts="uversionmangle=s/(\d)+(\d\d)/$1.$2/" \
+http://rsb.info.nih.gov/ij/download/src/ij(141b)-src.zip




More information about the debian-med-commit mailing list