-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
My example is using marching cubes, I have a volume-time series shown in sciview and I want to perform the marching cubes algorithm on it.
Right now it is using the Volume#getMetaData()
to get the original RandomAccessibleInterval
it would be good if there was a way that doesn't involve using a magic key.
The next problem is the marching cubes algorithm will use the first time point. So my idea was to use Volume#getCurrentTimepoint()
then create a shifted view.
I think there are two issues here.
-
How to access the original data source as an RandomAccessibleInterval/Img
public RandomAccessibleInterval<?> getOriginalRandomAccessibleInterval()
-
How to access the data used for the currently rendered volume.
public InternalInterval<?> getCurrentView();
@Override
public void run() {
Node active = sciView.getActiveNode();
Volume v;
if(active instanceof Volume) {
v = (Volume)active;
Img<UnsignedByteType> img = (Img<UnsignedByteType>)v.getMetadata().get("RandomAccessibleInterval");
int tp = v.getCurrentTimepoint();
IntervalView<UnsignedByteType> view = Views.hyperSlice(img, 3, tp);
Mesh meshes = MarchingCubesRealType.calculate(view, 1);
meshes = RemoveDuplicateVertices.calculate(meshes, 0);
Group g = new Group( );
g.setName("meshes-at:" + tp);
for(Map.Entry<String, Object> entry : v.getMetadata().entrySet()){
System.out.println(entry.getKey() + ", " + entry.getValue());
}
for(Mesh m : MeshConnectedComponents.iterable(meshes)){
graphics.scenery.Mesh ready = MarchingCubesCheck.convert(m);
ready.material().setWireframe(true);
ready.material().setDiffuse(new Vector3f(1f, 0.7f, 0.5f));
g.addChild(ready);
}
sciView.addNode(g, v);
} else{
ui.showDialog("The active node needs to be a volume.", DialogPrompt.MessageType.ERROR_MESSAGE);
return;
}
}
Metadata
Metadata
Assignees
Labels
No labels