Comments (10)
Interesting. I'll test this out today and get back to you. Also, set_volume is a temporary function (currently used for testing on_change callbacks).
from ipyniivue.
Thanks for the feedback. If it is intended as a temporary function, what is the function that is expected in long run to be used to load the data that we want to work with?
from ipyniivue.
add_volume_from_url would be the similar function:
import ipyniivue
nv = ipyniivue.Niivue()
nv.add_volume_from_url("https://niivue.github.io/niivue/images/mni152.nii.gz")
from ipyniivue.
That is fine, but most neuroimaging work is not done on the web but on local computer (or on the local file system of a cluster). I'd personally consider loading a volume from a local system an "essential feature" and loading a file from a URL only a "nice to have" feature.
from ipyniivue.
@AnthonyAndroulakis and @christian-oreilly , add_volume_from_url
should also be able to load a volume from the users's file system.
For example, you can see how I do it here using a local nodejs server in the niivue desktop app. I thought that we could do something similar in python. You can see how AFNI do this using Flask in python here
from ipyniivue.
Sounds good. I'll look into it. It might be possible to just read the data and pass that data into Niivue?
It's a planned feature to be able to load in an image from data or nibabel.Nifti1Image object (see nilearn).
from ipyniivue.
I don't mind if, behind the scene, everything is loaded as url, with local files being served through a server (I trust your opinion on potential performance issues) but from a usability point of view, I think we would need to abstract this from the user (i.e., I don't think the user should have to worry about setting a local file server for typical workflows; this should probably be done under the hood and the local path provided by the user be translated automatically). Then, the set_volume
function can just be a thin layer of abstraction using add_volume_from_url
for the heavy lifting. WOuld that make sens to you @AnthonyAndroulakis and @hanayik ?
from ipyniivue.
I agree that the set_volume
function can just be a thin layer of abstraction that uses add_volume_from_url.
Instead of hosting files on a server perhaps we can use NVImage.loadFromBase64?
from ipyniivue.
I replaced the set_volume function with an add_volume function. This function takes in 1 input: the location of the file. This can either be a url or a local file.
Examples:
import ipyniivue
w = ipyniivue.Niivue(crosshair_color=[0,1,0,1])
w.add_volume('https://niivue.github.io/niivue/images/mni152.nii.gz')
display(w)
import ipyniivue
w = ipyniivue.Niivue(crosshair_color=[0,1,0,1])
w.add_volume('/Users/anthony/Downloads/CT_pitch.nii.gz')
display(w)
This add_volume function also accepts file urls, like file:///Users/anthony/Downloads/CT_pitch.nii.gz
from ipyniivue.
closing as solved
from ipyniivue.
Related Issues (20)
- ipyniivue installting correctly but viewer window not showing up
- a
- Graph features
- Add custom colormaps
- devDependency requirement on @jupyterlab/builder@^4.0.0
- load_meshes HOT 1
- Building documentation HOT 8
- Review code of NiiVue Jupyter notebook integration in IPyNiiVue HOT 4
- load_meshes does not add the mesh to self.meshes in MacOS and Linux HOT 5
- Restarting the kernel fails to destroy the NiiVue object
- jupyterlab 4 support HOT 4
- ENH: Integration with MNE-Python
- Possible to add overlays and/or possibly saving the whole scene as .html file to harddrive?
- Prototype of ipyniivue using anywidget HOT 7
- Project admin, milestones, and roadmap
- Priorities HOT 6
- ☂️ Volume HOT 9
- Better camel/snake scale conversion HOT 10
- Exposing `nv.saveScene` on the python side HOT 1
- Deleting big files HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ipyniivue.