4D Rendering of Meshes and Volumes with 3D Viewer/SciView?

3d-viewer

#1

Hello,

I have been trying to sort out if it is possible to add lines, spheres, and meshes in general to a 4D rendering of volumetric data in a frame specific manner. Below is a simplified example of what I was expecting would add a sphere to a different position for each time point in a time series (I used the mitosis sample dataset to for playing around). Instead of my expectations, I got all of the spheres rendered in the first frame only, rather than one per frame. Moving to other frames shows only the volume, not the meshes.

#@ ImagePlus imp

# Import 3D Viewer components...
import ij3d.Image3DUniverse as Image3DUniverse
import org.scijava.vecmath.Point3f as Point3f
import org.scijava.vecmath.Color3f as Color3f

# Create a universe, add the data, and show it...
univ = Image3DUniverse();
univ.show();
univ.addVoltex(imp);

# Add a sphere at different spots at each time point...
timeline = univ.getTimeline()
timeline.first()
pos = [0,0,0]
step = [imp.getCalibration().pixelWidth, imp.getCalibration().pixelHeight, imp.getCalibration().pixelDepth]

for f in range(timeline.size()):
	univ.addIcospheres([Point3f(pos[0], pos[1], pos[2])], Color3f(255,0,255), 5, 1, "End-points-%s" % pos[0])
	timeline.next()
	pos[0] += step[0]
	pos[1] += step[1]
	pos[2] += step[2]

Is it possible to do this? I searched around to see if content could be added to a specific time point, but I did not find anything. SciView seems to be currently favored over 3D Viewer as the modern/future rendering tool and appears to support my goal, but I have not read up on it beyond a couple of tutorial plugins. If necessary, I will try to move over to SciView. I appreciate any advice!

Cheers,
Andy

:microscope: :computer: :coffee:


#2

Something to get you started. This doesn’t do exactly what you want, because it isn’t dealing with the timeline bit. We are having some discussions about replicating the timeline mechanism, but regardless I think you can still get the same effect you are after:

#@ Dataset img
#@ SciView sciView

# From forum post: https://forum.image.sc/t/4d-rendering-of-meshes-and-volumes-with-3d-viewer-sciview/20489

import sc.iview.vector

# Add the volume to the scene
sciView.addVolume( img )

# Add a sphere at one spot
pos = sc.iview.vector.FloatVector3( 0, 0, 0 )
radius = 1
sciView.addSphere( pos, radius )

#3

Bump @skalarproduktraum @ctrueden with regards to the timeline implementation. We need to finish the time slider that should toggle visibility of Nodes. Perhaps Nodes should have a predicate method that returns the visibility of the Node as a function of the status of the scene (including timepoint). I’m soliciting some extra thoughts on the matter.


#4

Err, was that something I had promised to work on? I agree it would be great to have, but I don’t think I personally have time to work on it any time soon. But if there are obstacles I can help overcome, please let me know!


#5

No, I don’t think that you agreed to that. I just wanted to bring it up again to keep the discussion moving :smiley: