Repository navigation
Conversation
| } | ||
|
|
||
| async loadRawChannelData( | ||
| async loadData( |
There was a problem hiding this comment.
Is this API surfaced to external clients? Do you have plans to make any kind of migration guide from v4 to v5?
There was a problem hiding this comment.
It is, though the idea of this batch of work is that external clients ought to not call it at all anymore. Which is an even larger change and an even bigger migration effort! I'm not certain where a migration guide would go though. As a .md built on our docs page?
| import { VolumeDims } from "../VolumeDims.js"; | ||
| import { CreateLoaderOptions, PrefetchDirection, VolumeFileFormat, pathToFileType } from "../loaders/index.js"; | ||
| import { VolumeLoader, LoadSpec, RawChannelDataCallback, LoadedVolumeInfo } from "../loaders/VolumeLoader.js"; | ||
| import type { VolumeLoader, LoadSpec, RawChannelDataCallback, LoadedVolumeInfo } from "../loaders/VolumeLoader.js"; |
There was a problem hiding this comment.
We should really install some plugins to do this for us...
There was a problem hiding this comment.
I've really been feeling this repo's lack of import sorting and type-import validation lately. Might track you down for help putting those things in place later.
| // TODO pass in load specs here? | ||
| const { loadSpec, imageInfo } = loader.getImageInfo(infoSpec); |
There was a problem hiding this comment.
What does the TODO here mean? Is it still relevant?
There was a problem hiding this comment.
I... have no idea. Looks like I added this whole function in one commit, so best guess it was a note I left for myself while I was working on that? I'll get rid of it.
| this.loader = loader; | ||
| // TODO pass in load specs here? | ||
| const { loadSpec, imageInfo } = loader.getImageInfo(infoSpec); | ||
| this.imageInfo.imageInfo = imageInfo; |
There was a problem hiding this comment.
Nit: slightly unfortunate variable + property naming here
There was a problem hiding this comment.
Yeah, I'm not a huge fan of this, but that's how CImageInfo works right now.
(I do think, someday soon, we gotta kill CImageInfo.)
d5f1891 to
971e8c5
Compare
83318e6 to
09e674e
Compare
| } | ||
|
|
||
| function playTimeSeries(onNewFrameCallback: () => void) { | ||
| if (myState.isPlaying) { |
There was a problem hiding this comment.
I remember my youth, when myState.isPlaying == true
Review time: medium (~30min)
This PR takes the final step in this stack's aim to make our new event model (#448) the preferred way to observe the volume lifecycle.
It contains several semi-related refactors:
loadVolumeDatafrom theVolumeLoaderabstract class. This method called the lower-levelloadRawChannelDatamethod, then put the data in the passedVolume. With this gone,VolumeLoaderis philosophically more like a file system handle: it retrieves metadata about the data it points to synchronously and retrieves data asynchronously, but does not take any action with that data on its own. It also contains no meaningful behavior to justify being anabstract classrather than aninterface, so now it's just aninterface.Volume:loadChannel,loadEnd,loadError,channelAdded,channelRemoved. These should be how client code responds to the volume's load cycle going forward, rather than initiating loads themselves via aVolumeLoaderand passing a callback.Volumea bit to be more of a container/controller of aVolumeLoader. Accordingly, it gets a new publicsetLoaderand reworkedloadmethod with a simpler interface.VolumeDataObserver, currently only used to informView3dof load events; andsetLoadErrorHandler, used to listen for and respond to errors. The latter is now marked deprecated; the former is removed entirely.Potential future work:
VolumeLoader.loadDatato return a promise rather than relying on its current callback interface. Alas, I wasn't able to fully purge its callbacky-ness on this iteration.Volumeto remove the public methodssetChannelDataFromAtlasandsetChannelDataFromVolume(in favor, again, ofVolumeLoaders being the single interface to volume data). This would have allowed these implementation-simple but interface-verbose methods to be brought inside other functions and simplified the code flow for loading data a bit further.VolumeMaker, a class full of utility functions for generating procedural volumes, which is currently the only way we ever generate data to feed to either of the above methods. I think building aVolumeLoaderthat accepts SDFs and uses them to generate volume channels would be great, and would allow the refactor above to proceed, but it's a slightly larger project than this PR.