-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nd support for tiff export job #7971
Changes from 10 commits
5135f74
96fdd8e
528aef0
d648e4a
62aa78d
d36ac2f
6eef0e5
1a81b88
06fd8b2
bf43aed
b93826c
85b33c6
de9f764
864b8aa
6586793
02eeb3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,7 +1,7 @@ | ||||||
package com.scalableminds.webknossos.datastore.datareaders | ||||||
|
||||||
import com.scalableminds.webknossos.datastore.models.datasource.AdditionalAxis | ||||||
import play.api.libs.json.{Json, OFormat} | ||||||
import play.api.libs.json.{JsValue, Json, OFormat} | ||||||
|
||||||
// Defines the axis order of a DatasetArray. Note that this ignores transpose codecs/ArrayOrder.F/C. | ||||||
// Those will have to be applied on individual chunk’s contents. | ||||||
|
@@ -97,6 +97,12 @@ case class FullAxisOrder(axes: Seq[Axis]) { | |||||
def permuteIndicesArrayToWk(indices: Array[Int]): Array[Int] = | ||||||
arrayToWkPermutation.map(indices(_)) | ||||||
|
||||||
def toWkLibsDictObject: JsValue = | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also went for |
||||||
Json.toJson(axes.zipWithIndex.collect { | ||||||
case (axis, index) if axis.name == "x" || axis.name == "y" || axis.name == "z" => | ||||||
axis.name -> index | ||||||
}.toMap) | ||||||
|
||||||
} | ||||||
|
||||||
object FullAxisOrder { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.scalableminds.webknossos.datastore.datareaders | ||
|
||
import com.scalableminds.util.geometry.BoundingBox | ||
import com.scalableminds.webknossos.datastore.models.datasource.AdditionalAxis | ||
import play.api.libs.json.{JsValue, Json} | ||
|
||
case class NDBoundingBox(boundingBox: BoundingBox, additionalAxes: Seq[AdditionalAxis], fullAxisOrder: FullAxisOrder) { | ||
|
||
def toWkLibsDict: JsValue = { | ||
val additionalAxesDict = Json.toJson(additionalAxes) | ||
val axisOrderDict = fullAxisOrder.toWkLibsDictObject | ||
boundingBox.toWkLibsDict ++ Json.obj("additionalAxes" -> additionalAxesDict, "axisOrder" -> axisOrderDict) | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,17 @@ case class AdditionalAxis(name: String, bounds: Array[Int], index: Int) { | |
lazy val lowerBound: Int = bounds(0) | ||
lazy val upperBound: Int = bounds(1) | ||
lazy val highestValue: Int = upperBound - 1 | ||
|
||
def enclosingAdditionalCoordinates(additionalCoordinates: Seq[AdditionalCoordinate]): AdditionalAxis = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment what this is for? I didn’t quite understand it on first read. Also, if it returns an Axis, why is it called enclosingAdditionalCoordinates? 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I renamed the method and added comments. Is it clearer now? |
||
val matchingCoordinate = additionalCoordinates.find(ac => ac.name == name) | ||
matchingCoordinate match { | ||
case Some(ac) => | ||
AdditionalAxis(name, Array(ac.value, ac.value + 1), index) | ||
case None => | ||
// Use the lower bound as fallback | ||
AdditionalAxis(name, Array(lowerBound, lowerBound + 1), index) | ||
} | ||
} | ||
} | ||
|
||
object AdditionalAxis { | ||
|
@@ -112,5 +123,4 @@ object AdditionalAxis { | |
} | ||
case None => Seq.empty | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.