Skip to content

Commit

Permalink
add install
Browse files Browse the repository at this point in the history
  • Loading branch information
mzouink committed Feb 3, 2022
1 parent f4b97d9 commit 1d10dbf
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
60 changes: 60 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

# This script is shamelessly adapted from https://github.com/saalfeldlab/n5-utils, thanks @axtimwalde & co!

VERSION="10.3.2-SNAPSHOT"
INSTALL_DIR=${1:-$(pwd)}

echo ""
echo "Installing into $INSTALL_DIR"

# check for operating system
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "Assuming on Linux operating system"
MEM=$(cat /proc/meminfo | grep MemTotal | sed s/^MemTotal:\\\s*\\\|\\\s\\+[^\\\s]*$//g)
MEMGB=$(($MEM/1024/1024))
MEM=$((($MEMGB/5)*4))
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "Assuming on MacOS X operating system"
# sysctl returns total hardware memory size in bytes
MEM=$(sysctl hw.memsize | grep hw.memsize | sed s/hw.memsize://g)
MEMGB=$(($MEM/1024/1024/1024))
MEM=$((($MEMGB/5)*4))
else
echo "ERROR - Operating system (arg2) must be either linux or osx - EXITING (on windows please run as a normal Java class from e.g. Eclipse)"
exit
fi

echo "Available memory:" $MEMGB "GB, setting Java memory limit to" $MEM "GB"

mvn clean install
mvn -Dmdep.outputFile=cp.txt -Dmdep.includeScope=runtime dependency:build-classpath

echo ""
echo "Installing 'bdv' command into" $INSTALL_DIR

echo '#!/bin/bash' > bdv
echo '' >> bdv
echo "JAR=\$HOME/.m2/repository/sc/fiji/bigdataviewer-core/${VERSION}/bigdataviewer-core-${VERSION}.jar" >> bdv
echo 'java \' >> bdv
echo " -Xmx${MEM}g \\" >> bdv
echo ' -XX:+UseConcMarkSweepGC \' >> bdv
echo -n ' -cp $JAR:' >> bdv
echo -n $(cat cp.txt) >> bdv
echo ' \' >> bdv
echo ' bdv.BigDataViewer "$@"' >> bdv


chmod a+x bdv

if [ $(pwd) == "$INSTALL_DIR" ]; then
echo "Installation directory equals current directory, we are done."
else
echo "Creating directory $INSTALL_DIR and moving files..."
mkdir -p $INSTALL_DIR
mv bdv $INSTALL_DIR/
fi

rm cp.txt

echo "Installation finished."
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>sc.fiji</groupId>
<artifactId>bigdataviewer-core</artifactId>
<version>10.3.1-SNAPSHOT</version>
<version>10.3.2-SNAPSHOT</version>

<name>BigDataViewer Core</name>
<description>BigDataViewer core classes with minimal dependencies.</description>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/bdv/BigDataViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,11 @@ public static void main( final String[] args )
// final String fn = "/Users/pietzsch/workspace/data/111010_weber_full.xml";
// final String fn = "/Volumes/projects/tomancak_lightsheet/Mette/ZeissZ1SPIM/Maritigrella/021013_McH2BsGFP_CAAX-mCherry/11-use/hdf5/021013_McH2BsGFP_CAAX-mCherry-11-use.xml";

final String fn = "/Users/Marwan/Downloads/drosophila_his-yfp/dataset.xml";
// final String fn = "/Users/Marwan/Downloads/drosophila_his-yfp/dataset.xml";

try
{
final String fn = args[0];
System.setProperty( "apple.laf.useScreenMenuBar", "true" );

final BigDataViewer bdv = open( fn, new File( fn ).getName(), new ProgressWriterConsole(), ViewerOptions.options() );
Expand All @@ -761,6 +763,8 @@ public static void main( final String[] args )
}
catch ( final Exception e )
{
if (args.length==0)
System.out.println("Please specify the input");
e.printStackTrace();
}
}
Expand Down

0 comments on commit 1d10dbf

Please sign in to comment.