rii-mango / Papaya

A pure JavaScript medical research image viewer.
Other
554 stars 205 forks source link

Adding/removing images via javascript #159

Closed dgutman closed 2 years ago

dgutman commented 5 years ago

I awant to be able to add and/or remove images through the javacsript API....

I think there is an 8 image max limit (which I saw can be changed..), but I am curious if / how something like this could be done:

Say I have a stack of nifti images, 1st image is the base image, and the other 20 are masks/functional overlays. By default it only loads the first image, but then use javascript to load 7 more images ( I think I figured out how to do this..)

I then have now hit the "cap".. so I want to delete the first five masks, keep masks 6-8, and then load another 5 "new" files onto the viewer... I am not sure if this is possible and also how the indexing would work..

So imagine file structure like this (I'll pretend the cap is 3 images instead of 8, but same idea)

nL = Not loaded initially

imageName idxInArray InitialIdxinPapaya T1_baseImg 0 0 maskA 1 1 maskB 2 2 maskC 3 nL maskD 4 nL

So can I "unload" maskA, and then load maskC dynamically.. if so, how does the indexing work in papaya... would maskB maintain the index of 2, or since I would first remove maskA (papayaIndex1) would maskB's index within Papaya remain the same, or would this change as well?

I'm working on a parallel UI to help me control/toggle images, and trying to work through how to manage this.

martinezmj-ims commented 5 years ago

https://github.com/rii-mango/Papaya/issues/26#issuecomment-468509522

Let me know if the above doesn't solve your issue. Images are always added to the top and removed from the bottom.