Open xgui3783 opened 1 year ago
similarly,
import siibra
p = siibra.parcellations["julich brain 2.9"]
p.get_map("big brain", "labelled").fetch()
fails entirely.
similarly,
import siibra p = siibra.parcellations["julich brain 2.9"] p.get_map("big brain", "labelled").fetch()
fails entirely.
It throws InsufficientArgumentException
, which is the designed and expected output. Do you have an example of default output you'd expect?
as of 0.4a57
sample code:
import siibra p = siibra.parcellations["julich brain 2.9"] type(p.get_map("fsaverage", "labelled").fetch()) # returns <class 'dict'> type(p.get_map("mni152", "labelled").fetch()) # returns <class 'nibabel.nifti1.Nifti1Image'>
It would be nice to be the returned object to be of the same class, so if the user would like to export all maps to bytes, they could simply call
p.get_map("mni152", "labelled").fetch().to_bytes() # or something similar
edit:
proposal, map should have a
to_bytes
method, which yields a list of bytes, so users do not need to care the implementation details:# proposed solution... does not actually work yet import siibra p = siibra.parcellations["julich brain 2.9"] list_bytes = p.get_map("fsaverage", "labelled").to_bytes() for bytes in list_byptes: type(bytes) # bytes
I think your proposal makes sense. Later, if we introduce a mesh class instead of a dictionary for surfaces, we can then carry this implementation as well. I'd suggest (if this was not implicit already) is allowing to_bytes
to take the same kwargs as fetch
.
similarly,
import siibra p = siibra.parcellations["julich brain 2.9"] p.get_map("big brain", "labelled").fetch()
fails entirely.
It throws
InsufficientArgumentException
, which is the designed and expected output. Do you have an example of default output you'd expect?
What if the user just want to export a nifti, to be visualized in their viewer of interest?
The usecase in siibra-api is such that, provided with a parcellation and a template, please return me a nifti/volume file.
By internal meeting in December 2023, this was postponed to be discussed along with the mesh support of siibra-python.
Dev meeting 17.01.2024 notes:
n.b. there is a difference of different fileformat (e.g. gifti, obj, stl etc) and language specific format/library.
For former, there is already a discussion at https://github.com/FZJ-INM1-BDA/siibra-python/issues/13 . For latter, at least for nilearn, they seem to use their own implementation
Map.fetch()
goes out of siibra land, so we should not expect it to.Map.export(): Iterable[Tuple[str, bytes]]
?
Map.fetch
should first call Map.get_volume
, then Volume.fetch
(for siibra-api, call Map.get_volume
, Volume.export
)to_zip
as of 0.4a57
sample code:
It would be nice to be the returned object to be of the same class, so if the user would like to export all maps to bytes, they could simply call
edit:
proposal, map should have a
to_bytes
method, which yields a list of bytes, so users do not need to care the implementation details: