Repository navigation
Conversation
479b43e to
ea3eead
Compare
| /** | ||
| * By default channel data can arrive out of order and at different times. | ||
| * This can cause the rendering to update in a way that is not visually appealing. | ||
| * In particular, during time series playback or Z slice playback, we would like | ||
| * to see all channels update at the same time. | ||
| * @param sync Set true to force all requested channels to load at the same time | ||
| */ |
There was a problem hiding this comment.
| /** | |
| * By default channel data can arrive out of order and at different times. | |
| * This can cause the rendering to update in a way that is not visually appealing. | |
| * In particular, during time series playback or Z slice playback, we would like | |
| * to see all channels update at the same time. | |
| * @param sync Set true to force all requested channels to load at the same time | |
| */ | |
| /** | |
| * Set whether to force all requested channels to load at the same time. | |
| * | |
| * By default channel data can arrive out of order and at different times. | |
| * This can cause the rendering to update in a way that is not visually appealing. | |
| * For example, during time series playback or Z slice playback, we would like | |
| * to see all channels update at the same time. | |
| */ |
Really minor nit, but I feel like the wording of the current method string explains the problem first and not what the method actually does? But maybe not important because the method name is descriptive.
There was a problem hiding this comment.
the suggested change here removes the @param line
| export type { ControlPoint } from "./Lut.js"; | ||
| export type { CreateLoaderOptions } from "./loaders/index.js"; | ||
| export type { IVolumeLoader, PerChannelCallback, ThreadableVolumeLoader } from "./loaders/IVolumeLoader.js"; | ||
| // TODO export `IVolumeLoader`, `ThreadableVolumeLoader` as `VolumeLoader` aliases? |
There was a problem hiding this comment.
Consider exporting with a deprecated flag to explain the necessary migration?
| export type VolumeEvent = { | ||
| export type VolumeEvents = { | ||
| loadStart: void; | ||
| }; |
There was a problem hiding this comment.
Is this exposed as an external API at all?
There was a problem hiding this comment.
🟢 Approval recommended
The consolidation is consistently applied across implementations and consumers, with no blocking issues identified in static review.
0 open findings
What changed in this PR
Simplifies volume loading by replacing IVolumeLoader and ThreadableVolumeLoader with one abstract VolumeLoader class.
Changes:
- Consolidates the loader contract and documentation.
- Updates implementations, workers, exports, and demo consumers.
- Adapts test doubles to the consolidated contract.
| File | Description |
|---|---|
| src/workers/VolumeLoadWorker.ts | Updates worker loader types. |
| src/workers/VolumeLoaderContext.ts | Updates worker loader inheritance. |
| src/workers/types.ts | Redirects loader type imports. |
| src/Volume.ts | Uses VolumeLoader; renames event type. |
| src/View3d.ts | Redirects callback import. |
| src/test/volume.test.ts | Updates loader test doubles. |
| src/test/RequestQueue.test.ts | Redirects loader utility imports. |
| src/loaders/VolumeLoaderUtils.ts | Redirects shared loader imports. |
| src/loaders/VolumeLoader.ts | Consolidates contracts and documentation. |
| src/loaders/TiffLoader.ts | Uses the consolidated base class. |
| src/loaders/RawArrayLoader.ts | Uses the consolidated base class. |
| src/loaders/OpenCellLoader.ts | Uses the consolidated base class. |
| src/loaders/OmeZarrLoader.ts | Updates inheritance and formatting. |
| src/loaders/JsonImageInfoLoader.ts | Uses the consolidated base class. |
| src/loaders/index.ts | Updates factory return type. |
| src/index.ts | Exports consolidated loader type. |
| public/types.ts | Updates demo state loader type. |
| public/index.ts | Updates demo loader signatures. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ea3eead to
e662fe7
Compare
| /** | ||
| * By default channel data can arrive out of order and at different times. | ||
| * This can cause the rendering to update in a way that is not visually appealing. | ||
| * In particular, during time series playback or Z slice playback, we would like | ||
| * to see all channels update at the same time. | ||
| * @param sync Set true to force all requested channels to load at the same time | ||
| */ |
There was a problem hiding this comment.
the suggested change here removes the @param line
| // TODO make this return a promise that resolves when loading is done? | ||
| // TODO this is not cancellable in the sense that any async requests initiated here are not stored | ||
| // in a way that they can be interrupted. | ||
| // TODO explicitly passing a `LoadSpec` is now rarely useful. Remove? |
There was a problem hiding this comment.
are these TODOs being addressed? shoudl they be elevated to issue tickets?
Review time: smallish (15-20min)
Problem
For a while, we've made a distinction between
IVolumeLoader, the base interface for volume loaders, andThreadableVolumeLoader, an abstract class which implementsIVolumeLoaderin terms of lower-level methods that return types that are easier to transfer between threads. This distinction was never super important to maintain — allIVolumeLoadersended up implemented in terms ofThreadableVolumeLoaderfrom the jump. Now that we're looking at hiding most of the loader API behindVolumerather than making them an explicitly publicly-facing interface, it's a good time to simplify.Solution
Remove
IVolumeLoader; renameThreadableVolumeLoadertoVolumeLoader; useVolumeLoaderclass where either were previously used.