-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first version of frontend and backend * update changelog * Merge branch 'master' of github.com:scalableminds/webknossos into find-volume-data * extract find methods into new trait * apply pr feedback
- Loading branch information
Showing
8 changed files
with
126 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataFinder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.scalableminds.webknossos.datastore.services | ||
|
||
import com.scalableminds.util.geometry.Point3D | ||
import com.scalableminds.webknossos.datastore.models.datasource.DataLayer | ||
|
||
trait DataFinder { | ||
private def getExactDataOffset(data: Array[Byte], bytesPerElement: Int): Point3D = { | ||
val bucketLength = DataLayer.bucketLength | ||
for { | ||
z <- 0 until bucketLength | ||
y <- 0 until bucketLength | ||
x <- 0 until bucketLength | ||
scaledX = x * bytesPerElement | ||
scaledY = y * bytesPerElement * bucketLength | ||
scaledZ = z * bytesPerElement * bucketLength * bucketLength | ||
} { | ||
val voxelOffset = scaledX + scaledY + scaledZ | ||
if (data.slice(voxelOffset, voxelOffset + bytesPerElement).exists(_ != 0)) return Point3D(x, y, z) | ||
} | ||
Point3D(0, 0, 0) | ||
} | ||
|
||
def getPositionOfNonZeroData(data: Array[Byte], | ||
globalPositionOffset: Point3D, | ||
bytesPerElement: Int): Option[Point3D] = | ||
if (data.nonEmpty && data.exists(_ != 0)) Some(globalPositionOffset.move(getExactDataOffset(data, bytesPerElement))) | ||
else None | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters