Skip to content

Commit

Permalink
Merge pull request #50 from saalfeldlab/build/jdk21
Browse files Browse the repository at this point in the history
Build/jdk21
  • Loading branch information
cmhulbert authored May 21, 2024
2 parents d1ae3aa + ea668ef commit f3c5e77
Show file tree
Hide file tree
Showing 40 changed files with 2,872 additions and 2,587 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build-installers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Build Installers

on:
workflow_call:
pull_request:
branches: [master]

env:
DEV_IDENTITY: BXPZTQZ35S # Your Apple Dev identity, something like BXPZTQZ35S
PRIMARY_BUNDLE_ID: org.janelia.saalfeldlab.PainteraConvert # Unique to your app, often the launcher class

jobs:
build:
strategy:
matrix:
os: [macos-14, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Version
shell: bash
run: |
short_version=`git rev-parse --short HEAD`
echo "VERSION=$short_version" >> $GITHUB_ENV
- name: Download Wix
uses: i3h/download-release-asset@v1
if: matrix.os == 'windows-latest'
with:
owner: wixtoolset
repo: wix3
tag: wix3112rtm
file: wix311-binaries.zip
- name: Decompress Wix
uses: DuckSoft/[email protected]
if: matrix.os == 'windows-latest'
with:
pathSource: wix311-binaries.zip
pathTarget: ./target/wix
- name: Add Wix to Path
run: echo "$HOME/target/wix" >> $GITHUB_PATH
if: matrix.os == 'windows-latest'
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 21
distribution: 'temurin'
cache: 'maven'
- name: "Build with Maven"
if: matrix.os != 'macos-latest' && matrix.os != 'macos-14'
run: mvn -B clean install -Pbuild-installer "-Dmatrix.os=${{ matrix.os }}" --file pom.xml
- name: "Build with Maven (macOS No Signing)"
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
if: ${{ env.MACOS_CERTIFICATE == null && (matrix.os == 'macos-latest' || matrix.os == 'macos-14') }}
run: mvn -B clean install -Pbuild-installer "-Dmatrix.os=${{ matrix.os }}" --file pom.xml

- name: Upload Installers
uses: actions/upload-artifact@v4
with:
name: PainteraConvert-${{ matrix.os }}-${{ env.VERSION }}
path: |
${{ env.DMG_PATH }}
./target/installer-${{ matrix.os }}/*
4 changes: 2 additions & 2 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Set up CI environment
run: .github/setup.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Set up CI environment
run: .github/setup.sh
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/publish-installers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Publish Installers

on:
push:
tags: "paintera-conversion-helper-*.*.*"
workflow_dispatch:



env:
DEV_IDENTITY: BXPZTQZ35S # Your Apple Dev identity, something like BXPZTQZ35S
PRIMARY_BUNDLE_ID: org.janelia.saalfeldlab.PainteraConvert # Unique to your app, often the launcher class

jobs:
build_installers:
name: Build Installers
uses: ./.github/workflows/build-installers.yml

create_release:
needs: build_installers
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Set Version
run: |
tag_name=$(echo ${{ github.ref }} | grep -oE "[^/]+$")
echo "VERSION=$tag_name" >> $GITHUB_ENV
- name: Rename Artifacts
run: |
mv PainteraConvert-ubuntu-latest-*/*.deb PainteraConvert-${{ env.VERSION }}_x86_64.deb
mv PainteraConvert-macos-latest-*/*.pkg PainteraConvert-${{ env.VERSION }}-MacOS.pkg
mv PainteraConvert-macos-14-*/*.pkg PainteraConvert-${{ env.VERSION }}-MacOS-AppleSilicon.pkg
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Paintera Convert ${{ env.VERSION }}
tag_name: ${{ github.ref }}
prerelease: false
files: |
PainteraConvert-${{ env.VERSION }}_x86_64.deb
PainteraConvert-${{ env.VERSION }}-MacOS.pkg
PainteraConvert-${{ env.VERSION }}-MacOS-AppleSilicon.pkg
101 changes: 54 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
[![Build Status](https://github.com/saalfeldlab/paintera-conversion-helper/actions/workflows/build-main.yml/badge.svg)](https://github.com/saalfeldlab/paintera-conversion-helper/actions/workflows/build-main.yml)
![GitHub Release](https://img.shields.io/github/v/release/saalfeldlab/paintera-conversion-helper)

# Paintera Conversion Helper
Script to assist conversion of n5 datasets to paintera-friendly formats, as specified [here](https://github.com/saalfeldlab/paintera/issues/61).

## Installation
Releases can be download for Ubuntu and MacOS from the [Github Releases](https://github.com/saalfeldlab/paintera-conversion-helper/releases)

## Usage
This conversion tool currently supports any number of datasets (raw or label) with a
single (global) block size, and will output to a single N5 group in a paintera-compatible
format.

By default, spark will run locally:
```
paintera-convert to-paintera [...]
```

`paintera-convert` can also convert paintera label sources to scalar label datasets:
```
paintera-convert extract-to-scalar [...]
```
`extract-to-scalar` will the highest resolution scale level of a Paintera dataset as a scalar `uint64` Dataset. This is useful for using Paintera painted labels (and assignments) in downstream processing, e.g. classifier training. Optionally, the `fragment-segment-assignment` can be considered and additional assignments can be added. See `extract-to-scalar --help` for more details.


<details>
<summary><b>Deprecated</b></summary>

## Installation
paintera-conversion-helper is available on conda on the `hanslovsky` channel:
```
Expand Down Expand Up @@ -35,50 +59,15 @@ To run on the Janelia cluster build a fat jar without Spark:
mvn -Denforcer.skip=true -Pfat clean package
```

## Running
This conversion tool currently supports any number of datasets (raw or label) with a
single (global) block size, and will output to a single N5 group in a paintera-compatible
format. For local spark usage, [install through conda or pip](#installation), and run:
```
paintera-convert to-paintera [...]
```

Introduced in version `0.7.0`, the
```
paintera-convert extract-to-scalar [...]
```
extracts the highest resolution scale level of a Paintera dataset as a scalar `uint64`. Dataset. This is useful for using Paintera painted labels (and assignments) in downstream processing, e.g. classifier training. Optionally, the `fragment-segment-assignment` can be considered and additional assignments can be added (versions `0.8.0` and later). See `extract-to-scalar --help` for more details.


### Janelia cluster

Clone the repository with submodules:
```
git clone --recursive https://github.com/saalfeldlab/paintera-conversion-helper.git
```
If you have already cloned the repository, run this after cloning to fetch the submodules:
```
git submodule update --init --recursive
```

Then, run the following script to build the package:
```
./build-for-cluster.py
```

For submitting a job to the Janelia cluster you can use the following script:
```
startup-scripts/spark-janelia/convert.py <number of cluster nodes> <other parameters>
```
The first parameter is the number of cluster nodes to use (for example, 5), and the rest is the same parameters as in the `paintera-convert` command.

</details>

### Usage Example
To convert the `raw` and `neuron_ids` datasets of [sample A of the cremi challenge](https://cremi.org/data/) into Paintera format with mipmaps on Linux, assuming that you downloaded the data into `$HOME/Downloads`, run:
```sh
paintera-convert to-paintera \
--scale 2,2,1 2,2,1 2,2,1 2 2 \
--revert-array-attributes \
--reverse-array-attributes \
--output-container=paintera-converted.n5 \
--container=sample_A_20160501.hdf \
-d volumes/raw \
Expand All @@ -88,18 +77,12 @@ paintera-convert to-paintera \
-d volumes/labels/neuron_ids
```

or for a locally compiled fat jar:
```
java -Dspark.master=local[*] -jar target/paintera-conversion-helper-0.4.1-SNAPSHOT-shaded.jar [...]
```
with any desired command line arguments.

### Usage Help
```
$ paintera-convert to-paintera --help
Usage: paintera-convert to-paintera [[--block-size=X,Y,Z|U] [--scale=X,Y,Z|U...] [--scale=X,Y,Z|U...]...
[--downsample-block-sizes=X,Y,Z|U...] [--downsample-block-sizes=X,Y,Z|U...]...
[--revert-array-attributes] [--resolution=X,Y,Z|U] [--offset=X,Y,Z|U] [-m=N...]
[--reverse-array-attributes] [--resolution=X,Y,Z|U] [--offset=X,Y,Z|U] [-m=N...]
[-m=N...]... [--label-block-lookup-n5-block-size=N]
[--winner-takes-all-downsampling]] ([--container=CONTAINER] [] (-d=DATASET
[--target-dataset=TARGET_DATASET] [[--type=TYPE] ])...)... [--overwrite-existing]
Expand All @@ -117,9 +100,9 @@ Options:
--downsample-block-sizes=X,Y,Z|U...
Use --container-downsample-block-sizes and --dataset-downsample-block-sizes for container
and dataset specific block sizes, respectively.
--revert-array-attributes
Revert array attributes like resolution and offset, i.e. [x, y, z] -> [z, y, x].
Use --container-revert-array-attributes and --dataset-revert-array-attributes for
--reverse-array-attributes
Reverse array attributes like resolution and offset, i.e. [x, y, z] -> [z, y, x].
Use --container-reverse-array-attributes and --dataset-reverse-array-attributes for
container and dataset specific setting, respectively.
--resolution=X,Y,Z|U Specify resolution (overrides attributes of input datasets, if any).
Use --container-resolution and --dataset-resolution for container and dataset specific
Expand Down Expand Up @@ -155,3 +138,27 @@ Options:
--help
```

### Janelia cluster

Clone the repository with submodules:
```
git clone --recursive https://github.com/saalfeldlab/paintera-conversion-helper.git
```
If you have already cloned the repository, run this after cloning to fetch the submodules:
```
git submodule update --init --recursive
```

Then, run the following script to build the package:
```
./build-for-cluster.py
```

For submitting a job to the Janelia cluster you can use the following script:
```
startup-scripts/spark-janelia/convert.py <number of cluster nodes> <other parameters>
```
The first parameter is the number of cluster nodes to use (for example, 5), and the rest is the same parameters as in the `paintera-convert` command.



Loading

0 comments on commit f3c5e77

Please sign in to comment.