Implementing Datastore to access a database without file URIs #1124
Replies: 4 comments
-
it is normally local file/access path.. that can represent location of your image..
i guess you have data in remote database.. and when someone calls get_image_uri you would like to download it from remote and cache it.. something similar to xnat/dsa datastore.. https://github.com/Project-MONAI/MONAILabel/blob/main/monailabel/datastore/xnat.py#L92 |
Beta Was this translation helpful? Give feedback.
-
If you want don't want to support cache.. then there is a workaround.. you need to use your own LoadImage transform that can fetch the image directly from your remote database.. but ideally this user-experience is slow.. specially when you run some interactions on the same image again and again.. so simplest way is to download and cache the image.. when someone calls get_image_uri method.. |
Beta Was this translation helpful? Give feedback.
-
to answer your first question.. who uses get_image.. this is when you want to upload the image via server to the client.. example.. you are using 3d slicer.. and wants to load an image (via next sample).. and the image is with monailabel server (via some datastore).. 3d slicer will call this method/api to download the image and open it it's viewer.. but again.. since this is 2 hop operation.. for now.. we just fallback on cached file.. so that it's useful in either case.. |
Beta Was this translation helpful? Give feedback.
-
Got it, thanks for your explanation. I did notice a lot of temporary file I/O, and this explains the design thoughts behind it. Are there any plans to improve upon this I/O pattern? In particular, I’d argue that all of this should be part of the datastore implementation. Or perhaps there should be a LocalCachingDatastore that wraps datastore implementations written without any caching concerns. The data store then just returns (and accepts) data dicts after LoadImage, or equivalent. In my opinion, this would really simplify a lot of MONAILabel’s internal code. No more I/O or file formats anywhere but in the datastore. It would also help handle use cases where reading the entire image isn’t feasible and we instead want to sample image patches. I’d be happy to open a dedicated issue for this conversation, or perhaps even a feature/improvement request. Let me know what you think. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm attempting to add rudimentary support for the Flywheel database to a MONAILabel app by implementing
monailabel.interfaces.datastore.Datastore
, and I'm confused howDatastore.get_image
andDatastore.get_image_uri
are meant to be used.In this case, the image files are located in the Flywheel database and I don't always have a HTTP URI, but I can read them using the Flywheel SDK. So now I seem to have the following situation:
It isn't completely clear to me why we need both functions to begin with.
Datastore
should either provide a URI for us to read, or read the file for us but then we don't need its URI.What am I missing and how do I proceed?
Beta Was this translation helpful? Give feedback.
All reactions