Giter VIP home page Giter VIP logo

Comments (10)

AnthonyAndroulakis avatar AnthonyAndroulakis commented on July 18, 2024

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.

christian-oreilly avatar christian-oreilly commented on July 18, 2024

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.

AnthonyAndroulakis avatar AnthonyAndroulakis commented on July 18, 2024

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.

christian-oreilly avatar christian-oreilly commented on July 18, 2024

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.

hanayik avatar hanayik commented on July 18, 2024

@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.

AnthonyAndroulakis avatar AnthonyAndroulakis commented on July 18, 2024

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.

christian-oreilly avatar christian-oreilly commented on July 18, 2024

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.

AnthonyAndroulakis avatar AnthonyAndroulakis commented on July 18, 2024

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.

AnthonyAndroulakis avatar AnthonyAndroulakis commented on July 18, 2024

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.

AnthonyAndroulakis avatar AnthonyAndroulakis commented on July 18, 2024

closing as solved

from ipyniivue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.