Skip to content

Commit 80e2ed2

Browse files
authored
In agglomerate mesh loading, skip missing segments (#8771)
In the hdf5 variant there was already a flatMap there, dropping non-full boxes. Let’s do the same in zarr case. ### Steps to test: - Load a an agglomerate mesh where you know a segment is not present in the meshfile - Should still load ### Issues: - fixes #8763 ------ - [x] Added changelog entry (create a `$PR_NUMBER.md` file in `unreleased_changes` or use `./tools/create-changelog-entry.py`) - [x] Considered [common edge cases](../blob/master/.github/common_edge_cases.md) - [x] Needs datastore update after deployment
1 parent 86f966b commit 80e2ed2

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

unreleased_changes/8771.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
### Changed
2+
- Adapted zarr mesh loading to skip segments missing in the meshfile. This was already the case for the hdf5 variant.

webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/mesh/ZarrMeshFileService.scala

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import play.api.libs.json.{JsResult, JsValue, Reads}
1919
import ucar.ma2.{Array => MultiArray}
2020

2121
import javax.inject.Inject
22-
import scala.concurrent.ExecutionContext
22+
import scala.concurrent.{ExecutionContext, Future}
2323

2424
case class MeshFileAttributes(
2525
formatVersion: Long,
@@ -178,9 +178,8 @@ class ZarrMeshFileService @Inject()(chunkCacheService: ChunkCacheService,
178178
m: MessagesProvider): Fox[WebknossosSegmentInfo] =
179179
for {
180180
meshFileAttributes <- readMeshFileAttributes(meshFileKey)
181-
meshChunksForUnmappedSegments: List[List[MeshLodInfo]] <- listMeshChunksForSegmentsNested(meshFileKey,
182-
segmentIds,
183-
meshFileAttributes)
181+
meshChunksForUnmappedSegments: List[List[MeshLodInfo]] <- Fox.fromFuture(
182+
listMeshChunksForSegmentsNested(meshFileKey, segmentIds, meshFileAttributes))
184183
_ <- Fox.fromBool(meshChunksForUnmappedSegments.nonEmpty) ?~> "zero chunks" ?~> Messages(
185184
"mesh.file.listChunks.failed",
186185
segmentIds.mkString(","),
@@ -194,10 +193,12 @@ class ZarrMeshFileService @Inject()(chunkCacheService: ChunkCacheService,
194193
segmentIds: Seq[Long],
195194
meshFileAttributes: MeshFileAttributes)(
196195
implicit ec: ExecutionContext,
197-
tc: TokenContext): Fox[List[List[MeshLodInfo]]] =
198-
Fox.serialCombined(segmentIds) { segmentId =>
199-
listMeshChunksForSegment(meshFileKey, segmentId, meshFileAttributes)
200-
}
196+
tc: TokenContext): Future[List[List[MeshLodInfo]]] =
197+
for {
198+
resultBoxes <- Fox.serialSequence(segmentIds) { segmentId =>
199+
listMeshChunksForSegment(meshFileKey, segmentId, meshFileAttributes)
200+
}
201+
} yield resultBoxes.flatten
201202

202203
def readMeshChunk(meshFileKey: MeshFileKey, meshChunkDataRequests: Seq[MeshChunkDataRequest])(
203204
implicit ec: ExecutionContext,

0 commit comments

Comments
 (0)