Comments (6)
Let me know if I'm not understanding your question. You're asking if you can do this:
params.images = ["myImage.nii"];
... instead of this...
params["images"] = ["myImage.nii"];
Yes, you can do either. The only reason for the associative array is when you need to specify image parameters, since in that case the parameter would most likely contain a dot. For example, this wouldn't work:
params.myImage.nii = {alpha:0.5};
... instead you'd need...
params["myImage.nii"] = {alpha:0.5};
Most of the documentation uses the associative array approach, but either way will work.
from papaya.
Ah, not exactly, but I think I'm getting closer to understanding the question myself.
The papaya tutorial lays out constructing the papayaContainers via html and some variables defined within javascript. It's a little weird (to me) that the html can read the string that references the variable name ("params" in this case), but in the end the (simple) way to construct papaya objects is to do in html:
<div class="papaya" data-params=<some string referencing a javascript variable>></div>
(1)
So to my understanding there is a lot going on under the hood with the above. The problem is if you want to construct many papayaContainer objects from an array of parameters:
[params1, params2, params3...]
such that each set of parameters is a function:
params1 = {images=[data_paths[i]], ...}
(for example), it's not straightforward in my limited experience how to reference these parameters with a string as in (1).
How would you go about this?
Another thing I've tried is just constructing all of the papaya objects with (1) with a global set of parameters, then using the loadNextImage method of papayaContainer. Alas, this failed (returned errors). Is there a correct way to do the following:
<script>my_file_paths.forEach(function (file_path, i) { <do awesome stuff here to papayaContrainers[i]>; })</script>
Thanks in advance.
from papaya.
To be a little more clear, <do awesome stuff here to papayaContrainers[i]>
should load image (or images) from file_path
.
from papaya.
Bonus if <do awesome stuff here to papayaContrainers[i]>
also allows you to control the color, transparency, etc of loaded image.
from papaya.
Got it. I think this is what you need:
papaya.Container.resetViewer(index, params)
index = the index of the papaya container
params = the parameters object itself (not the string literal name of the object, as is used in the HTML declaration)
So in this case, just create your papaya containers without any parameters, then call papaya.Container.resetViewer()
with the parameters you want. See here for documentation on how to control image parameters.
[One minor thing with this approach is if your parameters change the default UI (e.g., kioskMode), then you may see it flip from the default UI to the UI you specify. In that case, it may be a good idea to specify a global set of parameters just to set the UI state and which does not load images. Then when resetViewer() runs, it will load the images.]
More documentation on API methods here.
from papaya.
Beautiful, that appeared to get me close to what I want. I'll look more closely at those API options. Thanks!
from papaya.
Related Issues (20)
- Trouble creating new visualizer when page is already loaded HOT 1
- Client loading received image HOT 2
- Negative image HOT 1
- Using Papaya with React.js HOT 1
- [Bug?] Problem displaying images with PSR orientation
- How to integrate Papaya in a React.js component? HOT 3
- Need to add ref to mainView
- Get coordinates where mouse is/click HOT 2
- Hide and show certain surfaces
- Hide and show certain surfaces HOT 1
- Load vector3 for surface or do transformation only for one surface file?
- Add surface to params using addViewer() without reloading the whole viewer
- Large DICOM datasets overwhelm Chrome's request quota
- Making debug HTMLs like in the tests directory & Dev Guide
- Callback when error loading the images/surfaces
- URL Query Parameters - Opening an nii file
- Retrieve current image from specific View HOT 1
- Float32Array to papaya.Container.addImage HOT 1
- Not able to push changes that I have create to contribute to the project
- Urgent help needed - Error in ReactJS HOT 3
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 papaya.