Skip to content

Commit

Permalink
WIP: Fix precomputed reading
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth committed Jan 19, 2023
1 parent 4f48a8b commit 2b80411
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.apache.commons.compress.compressors.gzip.{
import org.blosc.{BufferSizes, IBloscDll, JBlosc}
import play.api.libs.json.{Format, JsResult, JsValue, Json}

import java.awt.image.BufferedImage
import java.awt.image.{BufferedImage, DataBufferByte}
import java.io._
import java.nio.ByteBuffer
import java.util
Expand Down Expand Up @@ -274,8 +274,11 @@ class JpegCompressor() extends Compressor {
@throws[IOException]
override def uncompress(is: InputStream, os: OutputStream): Unit = {
val iis: ImageInputStream = createImageInputStream(is)
val ios = createImageOutputStream(os)
val bi: BufferedImage = ImageIO.read(iis: ImageInputStream)
ImageIO.write(bi, "bmp", ios)
val raster = bi.getRaster
val dbb: DataBufferByte = raster.getDataBuffer.asInstanceOf[DataBufferByte]
val width = raster.getWidth
val data = dbb.getData.grouped(width).toList.transpose
os.write(data.flatten.toArray)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.scalableminds.webknossos.datastore.datareaders

import com.scalableminds.webknossos.datastore.storage.httpsfilesystem.HttpsPath
import net.liftweb.util.Helpers.tryo

import java.net.URI
import java.nio.file.{FileSystem, Files, Path, Paths}
import java.nio.file.{FileSystem, Files, Path}

class FileSystemStore(val internalRoot: Path) {
def readBytes(key: String): Option[Array[Byte]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ object MultiArrayUtils {
*/
val permutation = axisOrder.permutation(source.getRank)
val flippedIfNeeded = if (flip) permutation.reverse else permutation
source.permute(flippedIfNeeded)
val permutationHack = Array(0, 2, 1)
source.permute(permutationHack)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class PrecomputedArray(relativePath: DatasetPath,
.min(header.precomputedScale.size(i))
s"$beginOffset-$endOffset"
})
//logger.info(s"${header.precomputedScale.key}: Getting chunk ${chunkIndex(0)},${chunkIndex(1)},${chunkIndex(2)}, resulting in ${coordinates.mkString(header.dimension_separator.toString)}")
coordinates.mkString(header.dimension_separator.toString)
}

Expand Down

0 comments on commit 2b80411

Please sign in to comment.