This is a builder which creates an ImageBuilder that lets you process composite datasets. The implementation relies on a single off-screen canvas to generate the resulting image of a composite structure (rgb.jpg + composite.json).
var CompositeImageBuilder = require('paraviewweb/src/Rendering/Image/CompositeImageBuilder'), instance = new CompositeImageBuilder(qdm, pm);
constructor(queryDataModel, pipelineModel)
Create an instance of a CompositeImageBuilder using the associated queryDataModel that should be used to fetch the data.
And the pipelineModel that should be used for controlling the ImageBuilder.
Under the hood this will create an off-screen canvas for the image generation. Then, depending if the method setPushMethodAsImage() has been called, the ‘image-ready’ notification will not contain the same object. By default we use the setPushMethodAsBuffer() configuration.
// setPushMethodAsImage() var eventAsImage = { url: 'data:image/png:ASDGFsdfgsdgf...', builder: this };
update() - inherited
Trigger the fetching of the data (composite.json + rgb.jpg).
setPipelineQuery(pipelineQuery)
Should be called each time the pipeline setting is changed.
The pipelineQuery is a string that encodes the pipeline configuration such as which layer is visible or not and which field should be rendered for a given layer.
The pipelineQuery is structured as follows:
var pipelineQuery = "A_BBCAD_EA";
// In that example we have the following setting var layerSettings = [ "A_", // Layer A is invisible "BB", // Layer B is using field B "CA", // Layer C is using field A "D_", // Layer D is invisible "EA"// Layer E is using field A ];
render()
Process the current set of loaded data and render it into the background canvas. Once done, an event gets triggered to let the application know that the image is ready to be rendered/displayed somewhere.
onImageReady(callback) : subscription - inherited
Allows the registration of a callback(data, envelope) function when the actual generated image is ready.
destroy()
Free the internal resources of the current instance.
* updateCompositeMap(query, composite)
Internal function used to update the composite map for faster rendering.
_updateOffsetMap(pipelineQuery)
Internal function used to update the offset map based on the Pipeline configuration. The pipelineQuery is a String that encode the pipeline configuration such as which layer is visible or not and which field should be rendered for a given layer.
_pushToFront(width, height)
Trigger the event notification that the image is ready. This will call the proper method to either send the ImageData or an ImageURL.
_pushToFrontAsImage(width, height)
Called as pushToFront when setPushMethodAsImage() is used.
_pushToFrontAsBuffer(width, height)
Called as pushToFront when setPushMethodAsBuffer() is used.
getListeners - inherited
Returns a list of MouseHandler listeners.
getControlWidgets - inherited
Returns a list of Widgets needed to drive the ImageBuilder.
getControlModels - inherited
Returns a list of Model that can drive the ImageBuilder.
pushToFrontAsImage(width, height) { let ctx = null;
// Make sure we have a foreground buffer if (this.fgCanvas) { this.fgCanvas.size(width, height); } else { this.fgCanvas = new CanvasOffscreenBuffer(width, height); this.registerObjectToFree(this.fgCanvas); }