React Polar Heatmap | B-Mode Image Ultrasound | Medical Heatmap

Creates a React Polar Ultrasound Heatmap in SciChart.js, by taking a 2D array of data points as hex values between 00 and FF, and displaying them in a polar heatmap.

Also Known As: B-Mode Image Ultrasound, Medical Heatmap

Fullscreen

Edit

 Edit

Docs

drawExample.ts

index.tsx

theme.ts

Copy to clipboard
Minimise
Fullscreen
1import {
2    PolarMouseWheelZoomModifier,
3    PolarZoomExtentsModifier,
4    PolarPanModifier,
5    PolarNumericAxis,
6    SciChartPolarSurface,
7    EPolarAxisMode, 
8    EAxisAlignment, 
9    HeatmapColorMap,
10    UniformHeatmapDataSeries,
11    PolarUniformHeatmapRenderableSeries,
12    LineArrowAnnotation,
13    EArrowHeadPosition,
14} from "scichart";
15import { appTheme } from "../../../theme";
16
17const FETAL_DATA_PATH = "heatmap_data.csv";
18
19async function parseCSV(): Promise<number[][]> {
20    const fileData = await fetch(FETAL_DATA_PATH);
21    const rows = (await fileData.text()).split("\n");
22
23    const zValues = rows.map(row => {
24        return row.split(",")
25            // from base 16 to decimal value
26            .map(value => parseInt(value, 16))
27    });
28
29    return zValues;
30}
31
32export const drawExample = async (rootElement: string | HTMLDivElement) => {
33    const { sciChartSurface, wasmContext } = await SciChartPolarSurface.create(rootElement, {
34        theme: appTheme.SciChartJsTheme,
35        title: "Fetal ultrasound at 31 weeks",
36        titleStyle: {
37            fontSize: 32
38        }
39    });
40
41    const angularAxisX = new PolarNumericAxis(wasmContext, {
42        polarAxisMode: EPolarAxisMode.Angular,
43        axisAlignment: EAxisAlignment.Top,
44        useNativeText: false,
45        labelPrecision: 0,
46        drawMajorBands: false,
47        drawMajorGridLines: false,
48        drawMinorGridLines: false,
49        totalAngle: Math.PI / 3,
50        startAngle: (Math.PI * 3 / 2) - (Math.PI / 6), 
51        // (start at 270deg) - (half of totalAngle) = 240deg
52        // could be simplified to `Math.PI * 4 / 3`
53    });
54    sciChartSurface.xAxes.add(angularAxisX);
55
56    const radialAxisY = new PolarNumericAxis(wasmContext, {
57        polarAxisMode: EPolarAxisMode.Radial,
58        axisAlignment: EAxisAlignment.Left,
59        useNativeText: false,
60        labelPrecision: 0,
61        drawMajorBands: false,
62        drawMajorGridLines: false,
63        drawMinorGridLines: false,
64        innerRadius: 0.4,
65        startAngle: Math.PI * 3 / 2 - Math.PI / 6, 
66    });
67    sciChartSurface.yAxes.add(radialAxisY);
68
69    // Heatmap
70    const heatmapSeries = new PolarUniformHeatmapRenderableSeries(wasmContext, {
71        opacity: 0.8,
72        dataSeries: new UniformHeatmapDataSeries(wasmContext, {
73            xStart: 0,
74            xStep: 1,
75            yStart: 0,
76            yStep: 1,
77            zValues: await parseCSV()
78        }),
79        colorMap: new HeatmapColorMap({
80            minimum: 0,
81            maximum: 255,
82            gradientStops: [
83                { offset: 0, color: "transparent" },
84                { offset: 1, color: "white" }
85            ]
86        })
87    });
88    sciChartSurface.renderableSeries.add(heatmapSeries);
89
90    // Optional Annotations
91    const headLine = new LineArrowAnnotation({
92        x1: 165.9,
93        y1: 74.5,
94        x2: 219.2,
95        y2: 136.5,
96        stroke: "white",
97        strokeThickness: 2,
98        arrowHeadPosition: EArrowHeadPosition.StartEnd,
99        arrowStyle: {
100            headWidth: 18,
101            headLength: 14
102        },
103        isEditable: true,
104        // strokeDashArray: [6, 30],
105        // labelValue: "Head diameter",
106        // axisLabelFill: appTheme.VividTeal,
107        // labelPlacement: ELabelPlacement.Auto,
108    });
109    const femurLine = new LineArrowAnnotation({
110        x1: 61, 
111        y1: 166,
112        x2: 82,
113        y2: 127,
114        stroke: "white",
115        strokeThickness: 2,
116        arrowHeadPosition: EArrowHeadPosition.StartEnd,
117        arrowStyle: {
118            headWidth: 10
119        },
120        // strokeDashArray: [6, 30],
121        // labelValue: "Head diameter",
122        // axisLabelFill: appTheme.VividTeal,
123        // labelPlacement: ELabelPlacement.Auto,
124    });
125    sciChartSurface.annotations.add(
126        headLine, 
127        femurLine
128    );
129
130    sciChartSurface.chartModifiers.add(
131        new PolarMouseWheelZoomModifier(),
132        new PolarZoomExtentsModifier(),
133        new PolarPanModifier()
134    );
135
136    return { sciChartSurface, wasmContext };
137};

Polar Uniform Heatmap Ultrasound Chart - React

Overview

This React implementation showcases a polar heatmap for ultrasound visualization using SciChart.js. The example demonstrates seamless integration of medical imaging data within a React component through the SciChart React wrapper.

Technical Implementation

The chart is initialized via the drawExample function passed to SciChartReact's initChart prop. The polar surface is configured with specialized axes and a UniformHeatmapDataSeries containing ultrasound intensity values. The React component handles the chart lifecycle automatically, including cleanup when unmounted.

Features and Capabilities

The example highlights medical-specific features including anatomical measurement annotations and a sector-limited polar view. The implementation leverages SciChart's WebGL rendering for high-performance visualization of large ultrasound datasets, with interactive navigation tools for detailed examination.

react Chart Examples & Demos

See Also: Polar Charts (21 Demos)

React Polar Line Chart | React Charts | SciChart.js Demo

React Polar Line Chart

Explore the React Polar Line Chart example to create data labels, line interpolation, gradient palette stroke and startup animations. Try the SciChart Demo.

React Polar Spline Line Chart | React Charts | SciChart.js

React Polar Spline Line Chart

Try the React Polar Spline Line Chart example to see SciChart's GPU-accelerated rendering in action. Choose a cubic spline or polar interpolation. View demo.

React Multi-Cycle Polar Line | React Charts | SciChart.js

React Multi Cycle-Polar Line Example

Create a React Multi-Cycle Polar Chart to plot data over multiple cycles and visualize patterns over time. This example shows surface temperature by month.

React Polar Column Chart | React Polar Bar Chart | SciChart

React Polar Column | React Polar Bar

Try the React Polar Bar Chart example to render bars in a polar layout with gradient fills and animations. Use SciChart for seamless integration with React.

React Polar Column Category Chart | SciChart.js Demo

React Polar Column Category Chart

Create a React Polar Colum Category chart visualizing UK consumer price changes. Try the demo with a custom positive/negative threshold fill and stroke.

React Polar Range Column Chart | React Charts | SciChart.js

React Polar Range Column Chart

Create a React Polar Range Column Chart with SciChart. This example displays monthly minimum and maximum temperatures within a Polar layout. Try the demo.

React Windrose Plot | React Polar Stacked Radial Column Chart

React Windrose Plot | React Polar Stacked Radial Column Chart

View the React Windrose Chart example to display directional data with stacked columns in a polar layout. Try the polar chart demo with customizable labels.

React Polar Sunburst Chart | React Charts | SciChart.js

React Polar Sunburst Chart

See the React Sunburst Chart example with multiple levels, smooth animation transitions and dynamically updating segment colors. Try the SciChart demo.

React Polar Radial Column Chart | React Charts | SciChart.js

React Polar Radial Column Chart

View the React Radial Column Chart example to see the difference that SciChart has to offer. Switch radial and angular axes and add interactive modifiers.

React Stacked Radial Column Chart | Stacked Radial Bar Chart

React Stacked Radial Column Chart | Stacked Radial Bar Chart

This React Stacked Radial Bar Chart example shows Olympic medal data by country. Try the demo for yourself with async initialization and theme application.

React Polar Area Chart | Polar Mountain Chart | SciChart

React Polar Area Chart | Polar Mountain Chart

The React Polar Area Chart example, also known as Nightingale Rose Chart, renders an area series with polar coordinates with interactive legend controls.

React Polar Stacked Radial Mountain Chart | SciChart.js

React Polar Stacked Radial Mountain Chart

Try the React Stacked Radial Mountain Chart example to show multiple datasets on a polar layout with a stacked mountain series and animated transitions.

React Polar Band | Polar Error Bands Chart | SciChart.js

React Polar Band | Polar Error Bands Chart

Create a React Polar Chart with regular and interpolated error bands. Enhance a standard chart with shaded areas to show upper and lower data boundaries.

React Polar Scatter Chart | React Charts | SciChart.js Demo

React Polar Scatter Chart

Build a React Polar Scatter Chart with this example to render multiple scatter series on radial and angular axes. Try the flexible SciChart demo today.

React Polar Radar Chart | Spider Radar Chart | SciChart

React Polar Radar Chart

View the React Polar Radar Chart example. Also known as the Spider Radar Chart, view the scalability and stability that SciChart has to offer. Try demo.

React Polar Gauge Chart | React Circular Gauge | SciChart

React Gauge Charts

Create React Gauge Charts, including a React Circular Gauge Dashboard, with React-friendly initialization and responsive design. Give the SciChart demo a go.

React Arc Gauge & FIFO Scrolling Charts Dashboard | SciChart

React Arc Gauge & FIFO Scrolling Charts Dashboard Example

View React Arc Gauge Charts alongside FIFO Scrolling Charts, all on the same dashboard with real-time, high-performance data rendering. Try the demo.

React Polar Uniform Heatmap Chart | SciChart.js Demo

React Polar Uniform Heatmap Chart

Try SciChart's React Polar Heatmap example to combine a polar heatmap with a legend component. Supports responsive design and chart and legend separation.

React Polar Partial Arc | React Charts | SciChart.js Demo

React Polar Partial Arc

Create a React Polar Partial Arc that bends from a full Polar Circle to a Cartesian-like arc. Try the demo to display an arc segment with Polar coordinates.

React Polar Axis Label Modes | React Charts | SciChart.js

React Polar Axis Label Modes

Create a React Polar Axis Label with SciChart. This demo shows the various label modes for Polar Axes – all optimised for pan, zoom, and mouse wheel.

React Polar Map Example | React Charts | SciChart.js Demo

React Polar Map Example

View the React Polar Map Example using the SciChartReact component. Display geographic data as color-coded triangles on a polar coordinate system. Try demo.

SciChart Ltd, 16 Beaufort Court, Admirals Way, Docklands, London, E14 9XL.