Javascript: visualization toolkit 16 can render multi-component images

JavaScript: Visualization Toolkit 16 can render multi-component images

The JavaScript implementation of the Visualization Toolkit (VSK.JS) is in the 16. Main version before. The last blog message of the developers of the square library for scientific visualization is already a bit back: last they had been explored in 2019 version 9 by blog post, the total of seven intervening versions were allowed to receive smaller updates despite semantic versioning.

JavaScript: Visualization Toolkit 16 can render multi-component images

Multi-component renders of pictures with VTK.JS 16

VSK.JS 16 supports WebPack 5 and is moved for testing for Continuous Integration / Continuous Delivery (CI / CD) platform Github Actions. From the current version, the dependencies of the library should learn more quickly updates. The dependence of the KW web suite remotes according to blog message, and a new release channel has been added: with VTK.JS @ Beta want to test the developers breaking changes art before the release.

Create time series

In the field of visualization, the new version offers the multi-component render of images according to sections and scope. Also new is a two-dimensional convolution filter for the graphics processor. An external developer controlled the volume clipping as an innovation. A highlight are the time series that can be created from VTP files – the Kitware repository offers a live demo including source code:

Import ‘VTK.JS / Sources / Favicon ‘; Import VTKACTOR from ‘VTK.JS / Sources / Rendering / Core / Actor ‘; Import VTKpolyData from ‘VTK.JS / Sources / Common / DataModel / PolyData ‘; Import VTKFullScreenRenderWindow from ‘VTK.JS / Sources / Rendering / Misc / FullscreenRenderWindow ‘; Import VTKXMLpolyDareader from ‘VTK.JS / Sources / IO / XML / XMLpolyDareader ‘; Import VTKMapper from ‘VTK.JS / Sources / Rendering / Core / Mapper ‘; Import vtkhttpdataaccessHelper from ‘VTK.JS / Sources / IO / CORE / DATAACCESSHELPER / HTTPDATAACCESSHELPER ‘; Import ControlPanel from ‘./ Controller.HTML ‘; const {fetchbinary} = vtkhttpdataaccessHelper; // ——————————————————————- —————————- // standard rendering code setup // ————— ——————————————————————– ————- Const fullscreenRenderer = VTKFullScreenRenderWindow.NewINSTANCE ({Background: [0, 0, 0],}); Const renderer = fullscreenRenderer.Gentler (); Const RenderWindow = FullScreenRenderer.BetrenderWindow (); CONST MAPPER = VTKMAPPER.NewINSTANCE (); Mapper.SetInputData (VTKpolyData.NewINSTANCE ()); CONST ACTOR = VTCACTOR.NewINSTANCE (); actor.SetMapper (Mapper); renderer.Addactor (Actor); renderer.Resetcamera (); renderwindow.Render (); // ——————————————————————- —————————- // Example code // ——————————- ——————————————————————– ——— // Download A Series of VTP Files in A Time Series, Sort Them by Time, and // Then Display Them in A Playback Series. // ——————————————————————- —————————– CONST BASE_URL = ‘https: // kitware.github.IO / VTK-JS-DataSets / Data / VTP / CAN / ‘; Function DownloadTimeseries () {CONST FILES = [‘CAN_0.VTP ‘,’ CAN_5.VTP ‘,’ CAN_10.VTP ‘,’ CAN_15.VTP ‘,’ CAN_20.VTP ‘,’ CAN_25.VTP ‘,’ CAN_30.VTP ‘,’ CAN_35.VTP ‘,’ CAN_40.VTP ‘,]; Return Promise.All (files.Map (FileName) = Fetchbinary (`$ {base_url} / $ {filename}`).Then (binary) = {const reader = vtkxmlpolyDareader.NewINSTANCE (); reader.ParseAsArraybuffer (Binary); Return Reader.GetoutputData (0); })))); } function getDataTimstep (VTKOBJ) {const arr = VTKOBJ.GetfieldData ().TemperraybyName (‘Timevalue’); IF (ARR) {RETURN ARR.GetData () [0]; } Return zero; } function setVisibledataset (DS) {Mapper.SetinputData (DS); renderer.Resetcamera (); renderwindow.Render (); } // —————————————————————– ———– // UI Control Handling // ——————————- —————————- function uiupdateslider (max) {const timeslider = Document.Queryselector (‘# Timeslider’); Timeslider.min = 0; Timeslider.max = max – 1; Timeslider.STEP = 1; } fullscreenrenderer.Add Controller (ControlPanel); // ——————————————————————- ———– // Example Code Logic // ———————————- ————————— Let TimeseriesData = []; CONST TIMESLIDER = Document.Queryselector (‘# Timeslider’); CONST TIMEVALUE = Document.Queryselector (‘# Timevalue’); Timeslider.Adeventlistener (‘Input’, (e) = {const activeedataset = TimeseriesData [Number (E.target.Value)]; IF (ActiveDataSet) {setVisiBledataset (ActiveDataSet); timevalue.Inner text = getDataTimstep (ActiveDataSet); }}); DownloadTimerseries ().Then (DownloadedData) = {timeseriesData = downloadedData.Filter (DS) = GetDataTimstep (DS) !== zero); TimeseriesData.sort ((a, b) = getDataAtimestep (a) – getDataAtimSP (b)); UiupDatesLider (TimeseriesData.LENGTH); Timeslider.Value = 0; // Set Up Camera Renderer.GetactiveCamera ().Set position (0, 55, -22); renderer.GetactiveCamera ().SetViewUp (0, 0, -1); SetVisibledataset (TimeseriesData [0]); timevalue.Inner text = getDataTimstep (TimeseriesData [0]); }); // ——————————————————————- ———– // Make Some Variables Global So That You Can Inspect and // Modify Objects in Your Browser’s Developer Console: // ————— ——————————————— Global.Mapper = Mapper; global.actor = actor; global.renderer = renderer; global.RenderWindow = RenderWindow;

JavaScript: Visualization Toolkit 16 can render multi-component images

From time series can be obtained from VTK.Create JS 16 visualizations.

Cameramanipulation and scenes with ParaView

Some other innovations relate to camera amipulation, so the toolkit now has a camera view from the ego perspective and a rotational possibility of the camera axis using mouse movements (MousecameraAxrotateananipulator). In the INPUT / OUTPUT area (I / O), a stlwriter has been added, with which the rough geometric shapes over the mouse wheel let out – on GitHub can see a live demo.

Exporting scenes with ParaView should be better supported than so far, comes from a separate blog entry. VTK.JS 16 includes new readers such as Draco and PLY, improved ITK intergration and it supports field data from the XML poly data reader. In addition to the random stopology, the widgets now support SVG layers and scaling the pixels of the widget control elements (the kitware repository support for example for illustration).

Polyline Widget: Pixel Scaling of the Control Handle of a Widget

Outlook on upcoming features

Some functionalities are still in the planning and development phase, their entry into the visualization library is scheduled by VTK team: Arts are designed to have module builds of the JavaScript ES6 class library available. Instead of requiring users to integrate libraries for processing assets into the bundler of their choice like Webpack, the ESM build of VTK should.JS users remove the preprocessing of assets. In the beta-channel VTK.JS @ Beta is already available to this functionalitat according to publishers and she should soon land in the standard release channel.

The VTK.JS developers also have a React Library in the Pipeline (React VTK-JS), with which users can declaratively create visualization scenes. The library should be relevant via the Dash-VTK of Plotly. Thus, according to the blog entry this should be on the VTK.JS-based visualization from a Python server to rationalize the infrastructure developed by Plotly.

More information about the new release can be found in Kitware blog business. In the Github repository of the VTK developers, interested parties find the accelerated source code and sample videos. As an example of a VTK.JS built app can be visited Paraview Glance.

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: