FZJ-INM1-BDA / siibra-python

Software interfaces for interacting with brain atlases - Python client
Apache License 2.0
46 stars 8 forks source link

Use `nilearn.resample_to_img` for merging fragments #572

Closed AhmetNSimsek closed 2 months ago

AhmetNSimsek commented 4 months ago

Based on the conversation at #561 Code to test:

import siibra
from nilearn import plotting
res = 0.68
fmt = 'neuroglancer/precomputed'
bg_img = siibra.get_template('mni152').fetch(format=fmt, resolution_mm=res)
mp = siibra.get_map('2.9', 'mni152')
cmap = mp.get_colormap()
img = mp.fetch(format=fmt, resolution_mm=res)
plotting.view_img(img, bg_img=bg_img, symmetric_cmap=False, cmap=cmap).open_in_browser()
AhmetNSimsek commented 4 months ago

How is the performance compared to the previous implementation? comparable?

Since Neuroglancer precomputed images are not cached on disk, the testing time included the download and it is difficult to distinguish. With a resolution of 0.68 mm with an ethernet connection, the data is fetched and merged in 6-7s for both cases but nilearn seems to be very slightly faster. So I tested with nifti (Julich Brain 2.9 on MNI152). With nilearn average is about 0.34s while with the previous method it is about 0.37s. (repeated at least 5 times for each)