Skip to content

Commit 6355e95

Browse files
authored
Merge pull request #13 from mobie/open_s3_command
Open flat 2d
2 parents 12438e5 + 3d7903b commit 6355e95

File tree

5 files changed

+870
-893
lines changed

5 files changed

+870
-893
lines changed

src/main/java/de/embl/cba/bdv/ome/zarr/loaders/N5OMEZarrImageLoader.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,6 @@ private <T extends NativeType<T>> RandomAccessibleInterval<T> prepareCachedImage
549549
}
550550
long[] dimensions = getDimensions(attributes);
551551
final int[] cellDimensions = getBlockSize(attributes);
552-
System.out.println("dim" + Arrays.toString(dimensions));
553-
System.out.println("cell" + Arrays.toString(cellDimensions));
554552
final CellGrid grid = new CellGrid(dimensions, cellDimensions);
555553

556554
final int priority = numMipmapLevels() - 1 - level;
@@ -618,8 +616,8 @@ public A createArray(DataBlock<?> dataBlock, long[] gridPosition) {
618616
long[] cellDims = getCellDims(gridPosition);
619617
int n = (int) (cellDims[0] * cellDims[1] * cellDims[2]);
620618

621-
if ( is2D )
622-
cellDims = Arrays.stream( cellDims ).limit( 2 ).toArray();
619+
if (is2D)
620+
cellDims = Arrays.stream(cellDims).limit(2).toArray();
623621

624622
switch (dataType) {
625623
case UINT8:
@@ -732,7 +730,7 @@ private static class N5OMEZarrCacheArrayLoader<A> implements SimpleCacheArrayLoa
732730
public A loadArray(final long[] gridPosition) throws IOException {
733731
DataBlock<?> block = null;
734732

735-
long[] dataBlockIndices = toDataBlockIndices( gridPosition );
733+
long[] dataBlockIndices = toDataBlockIndices(gridPosition);
736734

737735
long start = 0;
738736
if (logChunkLoading) {
@@ -755,48 +753,47 @@ public A loadArray(final long[] gridPosition) throws IOException {
755753
}
756754

757755
if (block == null) {
758-
return arrayCreator.createEmptyArray( gridPosition );
756+
return arrayCreator.createEmptyArray(gridPosition);
759757
} else {
760758
return arrayCreator.createArray(block, gridPosition);
761759
}
762760
}
763761

764-
private long[] toDataBlockIndices( long[] gridPosition )
765-
{
762+
private long[] toDataBlockIndices(long[] gridPosition) {
766763
long[] dataBlockIndices = gridPosition;
767764

768765
if (is2D) {
769766
dataBlockIndices = new long[2];
770-
System.arraycopy( gridPosition, 0, dataBlockIndices, 0, 2);
767+
System.arraycopy(gridPosition, 0, dataBlockIndices, 0, 2);
771768
}
772769

773770
if (is4DC && is4DT) {
774771
dataBlockIndices = new long[4];
775-
System.arraycopy( gridPosition, 0, dataBlockIndices, 0, 2);
772+
System.arraycopy(gridPosition, 0, dataBlockIndices, 0, 2);
776773
dataBlockIndices[2] = channel;
777774
dataBlockIndices[3] = timepoint;
778775
}
779776

780777
if (is5D) {
781778
dataBlockIndices = new long[5];
782-
System.arraycopy( gridPosition, 0, dataBlockIndices, 0, 3);
779+
System.arraycopy(gridPosition, 0, dataBlockIndices, 0, 3);
783780
dataBlockIndices[3] = channel;
784781
dataBlockIndices[4] = timepoint;
785782
}
786783

787784
if (is4DC && !is4DT) {
788785
dataBlockIndices = new long[4];
789-
System.arraycopy( gridPosition, 0, dataBlockIndices, 0, 3);
786+
System.arraycopy(gridPosition, 0, dataBlockIndices, 0, 3);
790787
dataBlockIndices[3] = channel;
791788
}
792789

793790
if (is4DT && !is4DC) {
794791
dataBlockIndices = new long[4];
795-
System.arraycopy( gridPosition, 0, dataBlockIndices, 0, 3);
792+
System.arraycopy(gridPosition, 0, dataBlockIndices, 0, 3);
796793
dataBlockIndices[3] = timepoint;
797794
}
798795

799-
if ( dataBlockIndices == null )
796+
if (dataBlockIndices == null)
800797
throw new RuntimeException("Could not determine the data block to be loaded.");
801798

802799
return dataBlockIndices;

0 commit comments

Comments
 (0)