aboutsummaryrefslogtreecommitdiff
path: root/academic/ImageJ
diff options
context:
space:
mode:
Diffstat (limited to 'academic/ImageJ')
-rw-r--r--academic/ImageJ/ImageJ.SlackBuild85
-rw-r--r--academic/ImageJ/ImageJ.info14
-rw-r--r--academic/ImageJ/README34
-rw-r--r--academic/ImageJ/doinst.sh3
-rw-r--r--academic/ImageJ/imagej483
-rw-r--r--academic/ImageJ/imagej.desktop8
-rw-r--r--academic/ImageJ/imagej.pngbin0 -> 234 bytes
-rw-r--r--academic/ImageJ/slack-desc19
8 files changed, 646 insertions, 0 deletions
diff --git a/academic/ImageJ/ImageJ.SlackBuild b/academic/ImageJ/ImageJ.SlackBuild
new file mode 100644
index 0000000000000..a10cf37730bfc
--- /dev/null
+++ b/academic/ImageJ/ImageJ.SlackBuild
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# Slackware build script for ImageJ
+
+# Copyright 2012 Petar Petrov, ppetrov@paju.oulu.fi
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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.
+
+PRGNAM=ImageJ
+VERSION=${VERSION:-1.45}
+ARCH=noarch
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+SRCNAM=ij
+SRCVER=145
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM
+unzip $CWD/${SRCNAM}${SRCVER}.zip
+cd $PRGNAM
+unzip $CWD/ucsd-plugins.zip
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+mkdir -p $PKG/usr/share/$PRGNAM
+cp -a luts macros plugins ij.jar $PKG/usr/share/$PRGNAM
+
+# Install bio-formats plugins
+mkdir -p $PKG/usr/share/$PRGNAM/plugins/LOCI
+cp -a $CWD/loci_tools.jar $PKG/usr/share/$PRGNAM/plugins/LOCI
+
+# Install UCSD confocal microscopy plugins
+cp -a UCSD\ Plugins $PKG/usr/share/$PRGNAM/plugins/
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a README.html $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# Fix permissions
+find $PKG -type d -exec chmod 755 {} \; -o \
+ -type f -exec chmod 644 {} \;
+
+# Install wrapper of ij.jar
+install -D -m755 $CWD/imagej $PKG/usr/bin/imagej
+
+mkdir -p $PKG/usr/share/{applications,pixmaps}
+cp $CWD/imagej.desktop $PKG/usr/share/applications
+cp $CWD/imagej.png $PKG/usr/share/pixmaps
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/academic/ImageJ/ImageJ.info b/academic/ImageJ/ImageJ.info
new file mode 100644
index 0000000000000..2d6110ba67d1b
--- /dev/null
+++ b/academic/ImageJ/ImageJ.info
@@ -0,0 +1,14 @@
+PRGNAM="ImageJ"
+VERSION="1.45"
+HOMEPAGE="http://rsb.info.nih.gov/ij/"
+DOWNLOAD="http://rsb.info.nih.gov/ij/download/zips/ij145.zip \
+ http://www.loci.wisc.edu/files/software/loci_tools.jar \
+ http://rsbweb.nih.gov/ij/plugins/download/ucsd-plugins.zip"
+MD5SUM="c0e0202c4a358e886ce1582dd2c9b830 \
+ 2914600d36ce0c077526a0380b59f099 \
+ 277dec926cc27ade8ef01b8ae4bb69cb"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Petar Petrov"
+EMAIL="ppetrov@paju.oulu.fi"
+APPROVED="dsomero"
diff --git a/academic/ImageJ/README b/academic/ImageJ/README
new file mode 100644
index 0000000000000..3c15f5325e82e
--- /dev/null
+++ b/academic/ImageJ/README
@@ -0,0 +1,34 @@
+ImageJ is a Java 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 is multi-
+threaded, so time-consuming operations such as image file reading can
+be performed in parallel with other operations.
+
+ImageJ 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.
+
+ImageJ does geometric transformations such as scaling, rotation and
+flips. Image can be zoomed up to 32:1 and down to 1:32. All analysis
+and processing functions are available at any magnification factor.
+The program supports any number of windows (images) simultaneously,
+limited only by available memory.
+
+Spatial calibration is available to provide real world dimensional
+measurements in units such as millimeters. Density or gray scale
+calibration is also available.
+
+ImageJ was designed with an open architecture that provides
+extensibility via Java plugins. User-written plugins make it possible
+to solve almost any image processing or analysis problem.
+
+This includes the following additional plugins:
+1) Bio-Formats.
+2) UCSD confocal microscopy plugins.
+
+For a complete list of available plugins, check the corresponding
+section at the program website.
diff --git a/academic/ImageJ/doinst.sh b/academic/ImageJ/doinst.sh
new file mode 100644
index 0000000000000..5fb28930db0b9
--- /dev/null
+++ b/academic/ImageJ/doinst.sh
@@ -0,0 +1,3 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
diff --git a/academic/ImageJ/imagej b/academic/ImageJ/imagej
new file mode 100644
index 0000000000000..44922f4fd73be
--- /dev/null
+++ b/academic/ImageJ/imagej
@@ -0,0 +1,483 @@
+#!/bin/bash
+# A wrapper script to launch imagej from the UNIX command line
+# Images given as arguments will be opened, macros may also be given as arguments
+# Looks for macros in the imagej macro directory
+#
+# This program is free software, but comes with no warrenty or guarantee
+# send bug reports or feedback to jjackson at familyjackson dot net
+# Author: Jon Jackson
+# Last modified date: $Date: 2008-09-17 10:31:27 +0100 (Wed, 17 Sep 2008) $
+# $Revision: 51 $
+#
+# INSTALLATION INSTRUCTIONS
+#
+### WARNING ###########################################################
+# This file must be edited with a program that supports unix new line characters
+# - it won't run if edited in 'Notepad' !
+#######################################################################
+
+# Source location: http://rsb.info.nih.gov/ij/download/linux/unix-script.txt
+# 1) Save this script in the ImageJ directory as 'imagej'
+# 2) Modify path variables according to your system
+# 3) Give the new file execute permission
+# 4) Be sure the 'imagej' wrapper is in the 'PATH'
+
+### MODIFICATION ###
+# With minor modifications to use with Slackware, by Petar Petrov 2012
+# ppetrov at paju dot oulu dot fi
+####################
+
+# setup environment
+set +u # don't give error for unset variables (matters for environment variables)
+shopt -s extglob # allow extended pattern matching
+
+############ SITE SPECIFIC VARIABLES #########################
+# Trailing / is not required for path variables
+# IMAGEJ PATH - production installation
+ij_path='/usr/share/ImageJ'
+# Path to ImageJ development installation
+#ij_path_dev='/home/jjackson/ImageJ'
+# JAVA PATH
+# assumes executable is ${java_home}/bin/java
+# set java_home variables ='' to use JAVA_HOME environment variable
+#if [[ -d /usr/java/jdk1.5 ]] ; then
+# java_home='/usr/java/jdk1.5'
+#else
+# # Optionally specify java path for all available OS / architecture combinations
+# java_home_Linux="${ij_path}/jre"
+# java_home_Linux_x86_64="${ij_path}/jre64"
+# java_home_SunOS="${ij_path}/jre64"
+# #
+#fi
+ijadmin=''
+# DOCUMENTATION URL
+doc_url='http://rsb.info.nih.gov/ij/'
+
+# TEMP FOLDER
+ij_tmp='/tmp/imagej'
+# LOG FILE
+#ij_log="${ij_tmp}/log.txt"
+# default behaviour when an ImageJ window is already open
+newwindow='true'
+#newwindow='false'
+# macro argument delimiter character
+separator=':'
+# a ' ' may work provided no arguments would contain spaces
+# use macro functions: args=getArgument(); argArray=split(args, ':');
+# to recover macro arguments
+
+############ DEFAULT MEMORY SETTINGS #########################
+
+declare -i default_mem=768
+declare -i min_mem=32
+declare -i max_32bit=1800 # empirical
+declare -i max_64bit=17000000000 # conservative
+
+############ SITE SPECIFIC MODULES #########################
+
+# JAR libraries for additional modules may be placed in ${ij_path}/lib
+# jmf.jar jai_codec.jar jai_core.jar mlibwrapper_jai.jar
+
+# Native libraries may be placed in ${ij_path}/lib/$OS
+# where OS matches the output of the 'uname' command
+
+############ END SITE SPECIFIC VARIABLES #########################
+
+OS=$(uname)
+processor=$(uname -m) # -p doesn't work on ubuntu
+declare -i mem
+declare -i max_mem
+declare -i free_mem
+
+java_home="${java_home:-$JAVA_HOME}"
+
+if [[ "$OS" == 'SunOS' ]] ; then
+ java_arch='-d64'
+ JAVA_HOME="${java_home_SunOS:-$java_home}"
+ max_mem=`vmstat | awk 'BEGIN{maxMem='$max_64bit'} NR == 3 {fmem=int($5 / 1024); if (fmem < maxMem) {print fmem} else {print maxMem}}'`
+ free_mem="max_mem"
+ mem=${free_mem}/2
+ if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
+elif [[ "$OS" == 'Linux' ]] ; then
+ if [[ "$processor" == 'x86_64' ]] ; then
+ java_arch='-d64'
+ JAVA_HOME="${java_home_Linux_x86_64:-$java_home}"
+ max_mem=`free | awk -v maxMem=$max_64bit 'NR == 2 {fmem=int($2 / 1024); if (fmem < maxMem) {print fmem} else {print maxMem}}'`
+ free_mem=`free | awk -v maxMem=$max_64bit 'NR == 3 {fmem=int($4 / 1024); if (fmem < maxMem) {print fmem} else {print maxMem}}'`
+ mem=${free_mem}/3*2
+ if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
+ else
+ java_arch='-d32'
+ JAVA_HOME="${java_home_Linux:-$java_home}"
+ max_mem=`free | awk -v maxMem=$max_32bit 'NR == 2 {fmem=int($2 / 1024); if (fmem < maxMem) {print fmem} else {print maxMem}}'`
+ free_mem=`free | awk -v maxMem=$max_32bit 'NR == 3 {fmem=int($4 / 1024); if (fmem < maxMem) {print fmem} else {print maxMem}}'`
+ mem=${free_mem}/3*2
+ if (( $mem > $default_mem || $mem < $min_mem )) ; then mem=$default_mem ; fi
+ fi
+fi
+
+
+# if tools.jar is not in ${ij_path}/jre/lib/ext/ edit the 'tools=' line
+# to point to tools.jar. The -compile switch will load tools.jar into the
+# classpath and enable plugins to be compiled in imagej
+
+if [[ -f "${ij_path}/tools.jar" ]] ; then
+ tools="${ij_path}/tools.jar"
+else
+ tools=''
+fi
+
+# End Site specific variables ---------------------------------------------------------
+
+# 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=''
+
+
+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
+}
+
+function getFullPath {
+ # Return full path to file
+ # treats multiple arguments as a single file with spaces
+ if (( $# == 0 )) ; then
+ echo "error getting full path for '${*}'" 1>&2
+ fi
+ pwd_getFullPath="$PWD"
+ \cd $(dirname "${*}") > /dev/null
+ dir_getFullPath="$PWD"
+ \cd "$pwd_getFullPath" > /dev/null
+ echo "$dir_getFullPath"/$(basename "${*}")
+}
+function derefln {
+ # Returns the full path of file to which link points
+ # following multiple levels of symbolic links.
+ # NOTE: if you use this function in a script, don't use any
+ # of the variable names used here
+ if (( $# == 0 )) ; then
+ return
+ fi
+ local the_link="$1"
+ local link_dir
+ local current_dir="$PWD"
+ while file "$the_link" | grep symbolic > /dev/null ; do # resolve links until target is regular file
+ if [[ "$the_link" == */* ]] ; then # path contains /
+ \cd $(dirname "${the_link}") > /dev/null
+ the_link=$(basename "$the_link")
+ fi
+ link_dir="$PWD"
+ # some versions of 'file' surround the path in `' quotes, hence the tr to remove them
+ the_link=$(file "${the_link}" | awk '/symbolic link/ {print $NF}' | tr -d "\140\047" )
+ if [[ "$the_link" != /* ]] ; then # path is not absolute path - make it one
+ the_link="$link_dir/$the_link"
+ fi
+ \cd "$current_dir" > /dev/null
+ done
+ echo $the_link
+}
+
+
+# parse input arguments
+while getopts b:cde:hi:m:nop:r:vx: options
+do
+ case $options in
+ b) if [[ -n "$macrocmd" ]] ; then macroCmdError ; fi
+ macrocmd="-batch ${OPTARG}"
+ ;;
+ c) modules="${modules:-}${modules+:}${tools}"
+ ;;
+ d) ij_path="$ij_path_dev"
+ ;;
+ 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}"
+ ;;
+ n) newwindow='true'
+ ;;
+ 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}"
+ newwindow='true'
+ 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
+
+#for ((i=1; i < $OPTIND; i++))
+#do
+# shift
+#done
+## above syntax not supported in bash < 2.05
+declare -i i=1
+while (( i < $OPTIND )) ; do
+ shift
+ i=i+1
+done
+
+if [[ "$#" == 0 && -z "$macrocmd" ]] ; then
+ usage
+fi
+
+# The best way to install .jar libraries required by plugins is to copy them
+# to the imagej plugins/jars directory
+# Alternatively, either copy them to ${ij_path}/jre/lib/ext/ or add the .jar
+# filepath to the modules line below. Paths are separated by a colon
+# Classpath must follow command line arguments, as ij_path is dependent on the -d option
+
+# Resolving ij.jar path. If ij.jar is a symbolic link to ij_<version>.jar
+# this allows updating ij.jar without crashing running sessions
+ij_jar_path=$(derefln ${ij_path}/ij.jar)
+
+for mod_jar in ${ij_path}/lib/*jar ; do
+ modules="${modules:-}${modules+:}$mod_jar"
+done
+modules="-cp ${ij_jar_path}:${modules+:}${modules:-}"
+#${ij_path}/plugins/jars/dcmie.jar
+
+export LD_LIBRARY_PATH="${ij_path}/lib/${OS}_$processor"
+if (( $verbosity > 0 )) ; then
+ echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
+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
+ filearg="${1}"
+ # full file path required when sending images to running ImageJ panel
+ if [[ "${newwindow}" == 'false' && -f "${filearg}" ]] && ! expr "${filearg}" : '/.*' > /dev/null; then
+ filearg="$(getFullPath ${filearg})"
+ fi
+ images="${images}'$filearg' "
+ shift
+ done
+fi
+
+# CREATE IMAGEJ SOCKET-LOCK DIRECTORY IF NON EXISTANT
+if [[ ! -d "$ij_tmp" ]] ; then
+ mkdir "$ij_tmp"
+ chmod 777 "$ij_tmp"
+fi
+
+# CREATE IMAGEJ LOG FILE IF NON EXISTANT
+if [[ -n "$ij_log" && ! -f "$ij_log" ]] ; then
+ touch "$ij_log"
+ chmod 666 "$ij_log"
+fi
+
+# CREATES A TEMP FILE INDICATING A PORT IS IN USE BY IMAGEJ
+cd "$ij_tmp"
+declare -i count=1
+portopen='false'
+lockFileCreated='false'
+declare -a locklist=(`ls | grep '[0-9][0-9]-.*'`)
+
+[[ -n "$ij_log" ]] && echo -e "$$\t$(date)\tNew Window = $newwindow" >> "$ij_log" 2> /dev/null
+[[ -n "$ij_log" ]] && echo -e "$$\t$(date)\tPort = $port" >> "$ij_log" 2> /dev/null
+[[ -n "$ij_log" ]] && echo -e "$$\t$(date)\tlocklist: \n ${locklist[*]}" >> "$ij_log" 2> /dev/null
+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}
+
+ [[ -n "$ij_log" ]] && echo -e "$$\t$(date)\tCreating lock\t$lockname" >> "$ij_log" 2> /dev/null
+ if (( $verbosity > 0 )) ; then echo -n "creating lock $lockname ... " ; fi
+ touch $lockname
+ trap '\rm -f ${ij_tmp}/$lockname >/dev/null ; [[ -n "$ij_log" ]] && echo -e "$$\t$(date)\tReleasing lock\t$lockname" >> "$ij_log" 2> /dev/null' EXIT TERM KILL
+ # 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'
+ if [[ -z "$macrocmd" ]] ; then
+ echo 'Open other images in this ImageJ panel as follows:'
+ echo " imagej -p $count <image1> [<image2> ... <imageN>]"
+ fi
+ [[ -n "$ij_log" ]] && echo -e "$$\t$(date)\tSocket lock:\t$lockname" >> "$ij_log" 2> /dev/null
+ if (( $verbosity > 0 )) ; then echo "Socket lock: $lockname" ; fi
+ echo
+fi
+
+if (( $verbosity > 0 )) ; then
+ echo ${JAVA_HOME}/bin/java ${java_arch} -mx${mem}m ${modules} ij.ImageJ -ijpath ${ij_path} -port${count} ${images} ${macrocmd} ${macroargs}
+fi
+
+cd "$dir"
+eval "${JAVA_HOME}/bin/java ${java_arch} -mx${mem}m ${modules} ij.ImageJ -ijpath ${ij_path} -port${count} ${images} ${macrocmd} ${macroargs} "
+exit 0
diff --git a/academic/ImageJ/imagej.desktop b/academic/ImageJ/imagej.desktop
new file mode 100644
index 0000000000000..bd6bde5fa7781
--- /dev/null
+++ b/academic/ImageJ/imagej.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Categories=Education;
+Comment=Scientific image manipulation software
+Exec=imagej
+Icon=imagej
+Name=ImageJ
+StartupNotify=false
+Type=Application
diff --git a/academic/ImageJ/imagej.png b/academic/ImageJ/imagej.png
new file mode 100644
index 0000000000000..8041fc114ade9
--- /dev/null
+++ b/academic/ImageJ/imagej.png
Binary files differ
diff --git a/academic/ImageJ/slack-desc b/academic/ImageJ/slack-desc
new file mode 100644
index 0000000000000..637ac00056897
--- /dev/null
+++ b/academic/ImageJ/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+ImageJ: ImageJ (Image processing and analysis in Java)
+ImageJ:
+ImageJ: ImageJ is a Java image processing program inspired by NIH Image
+ImageJ: for the Macintosh. It was designed with an open architecture that
+ImageJ: provides extensibility via Java plugins. User-written plugins make
+ImageJ: it possible to solve almost any image processing or analysis problem.
+ImageJ:
+ImageJ: Home: http://rsb.info.nih.gov/ij/
+ImageJ:
+ImageJ:
+ImageJ: