widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.95k stars 236 forks source link

transform volshow input to scatter plot input #380

Open nathalie29856 opened 3 years ago

nathalie29856 commented 3 years ago

Hi @maartenbreddels ,

I'm using ipyvolume to visualise 4D datasets with the shape (x,y,z,time). With volshow I can open the dataset as (x,y,z,0) and include the time component with a slider. Now I would like to visualise the dataset as a scatter plot. How can I transform my 4D dataset so that it can be used as input for the scatter plot? For this, x must be a 2D array (time, x) and y and z must be 1D arrays, right?

Thanks! Nathalie

maartenbreddels commented 3 years ago

Hi,

I'm not sure how you want to visualize the 4d as scatter plot. But scatter takes 1d arrays as input if it contains no time component, otherwise 2d.

Regards,

Maarten

nathalie29856 commented 3 years ago

Hi @maartenbreddels ,

thanks for the quick answer! My dataset shows algae that have autofluorescence of their chloroplasts swimming around in 3D. I thought I could also make them visible as a scatter plot by putting a dot where the algae is (i.e. boolean) and then using animation control to see how the algae moves. Is there a way to do this?

Regards, Nathalie

chrisgee commented 3 years ago

I guess what you would have to do is to determine the location of all algae in your volume data and list those locations. In subsequent frames you would have to identify the algae determined there with the algae detemined in the previous frame (e.g. by proximity, if the density is low and the frame rate is high). The number of spots would not be allowed to change...

But this is not part of this library, I guess.