How to work with volume renderings.

prev toc next
You can download example source code for this HowTo here. Before reading this HowTo, it may be helpful to read The relation between Content and Universe. It is possible to edit a volume rendering. VoltexGroup provides a method fillRoi(), which takes as input parameters a ROI and a fill value. The ROI (in canvas coordinates) is projected onto the volume, and the covered part of the volume is filled with the specified fill value. Because fillRoi() is a method which only applies to volume renderings (orthoslices being an exception), this method is not located in, but in VoltexGroup is a subclass of ContentNode, and can be retrieved from a Content (one which is displayed as a volume rendering) with getContent():
	// Add the image as a volume
	Content c = univ.addVoltex(imp);

	// Retrieve the VoltexGroup
	VoltexGroup voltex = (VoltexGroup)c.getContent();

	// Define a ROI
	Roi roi = new OvalRoi(240, 220, 70, 50);

	// Define a fill color
	byte fillValue = (byte)100;

	// Fill the part of the volume which results from the
	// projection of the polygon onto the volume:
	voltex.fillRoi(univ.getCanvas(), roi, fillValue);
One thing worth to keep in mind is that also the original image is changed, and can in this form be saved, if desired. Apart from fillRoi() volume renderings (i.e. VoltexGroup) offer apart from the implementations of the abstract methods of the superclass, ContentNode, no further methods.