Skip to content

Commit

Permalink
Merge pull request #60 from melissalinkert/uint32
Browse files Browse the repository at this point in the history
Add uint32 support
  • Loading branch information
chris-allan authored Sep 29, 2020
2 parents 65c806a + 41b0743 commit 070ba9a
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 127 deletions.
23 changes: 15 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ dependencies {
implementation 'info.picocli:picocli:4.2.0'
implementation 'com.univocity:univocity-parsers:2.8.4'
implementation 'org.janelia.saalfeldlab:n5:2.2.0'
implementation 'org.janelia.saalfeldlab:n5-blosc:1.1.0'
implementation 'org.janelia.saalfeldlab:n5-zarr:0.0.4'

// exclude JUnit 4 to make sure our tests all use JUnit 5
implementation('org.janelia.saalfeldlab:n5-blosc:1.1.0') {
exclude group: 'junit', module: 'junit'
}
implementation('org.janelia.saalfeldlab:n5-zarr:0.0.4') {
exclude group: 'junit', module: 'junit'
}
implementation 'org.openpnp:opencv:3.4.2-1'

// https://github.com/junit-team/junit5-samples/blob/master/junit5-migration-gradle/build.gradle
def junit4Version = '4.12'
def junitVintageVersion = '5.2.0'
def junitJupiterVersion = '5.2.0'
def junitPlatformVersion = '1.2.0'
def junitVintageVersion = '5.7.0'
def junitJupiterVersion = '5.7.0'
def junitPlatformVersion = '1.7.0'
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testImplementation "junit:junit:${junit4Version}"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junitPlatformVersion}"

// https://stackoverflow.com/questions/45462987/junit5-with-intellij-and-gradle
Expand All @@ -58,6 +61,10 @@ jar {
}
}

test {
useJUnitPlatform()
}

distributions {
main {
contents {
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/glencoesoftware/bioformats2raw/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.janelia.saalfeldlab.n5.DoubleArrayDataBlock;
import org.janelia.saalfeldlab.n5.FloatArrayDataBlock;
import org.janelia.saalfeldlab.n5.GzipCompression;
import org.janelia.saalfeldlab.n5.IntArrayDataBlock;
import org.janelia.saalfeldlab.n5.Lz4Compression;
import org.janelia.saalfeldlab.n5.N5FSReader;
import org.janelia.saalfeldlab.n5.N5FSWriter;
Expand Down Expand Up @@ -877,6 +878,13 @@ private void processTile(
dataBlock = new ShortArrayDataBlock(size, gridPosition, asShort);
break;
}
case FormatTools.INT32:
case FormatTools.UINT32: {
int[] asInt = new int[tile.length / 4];
bb.asIntBuffer().get(asInt);
dataBlock = new IntArrayDataBlock(size, gridPosition, asInt);
break;
}
case FormatTools.FLOAT: {
float[] asFloat = new float[tile.length / 4];
bb.asFloatBuffer().get(asFloat);
Expand Down Expand Up @@ -979,6 +987,12 @@ public void saveResolutions(int series)
case FormatTools.UINT16:
dataType = DataType.UINT16;
break;
case FormatTools.INT32:
dataType = DataType.INT32;
break;
case FormatTools.UINT32:
dataType = DataType.UINT32;
break;
case FormatTools.FLOAT:
dataType = DataType.FLOAT32;
break;
Expand Down
Loading

0 comments on commit 070ba9a

Please sign in to comment.