repaint() {

		if ( this.geometryNeedsUpdate ) {

			this.updateGeometry();

		}

		const iLength = this.iLength,
			jLength = this.jLength,
			sliceAccess = this.sliceAccess,
			volume = this.volume,
			canvas = this.canvasBuffer,
			ctx = this.ctxBuffer;


		// get the imageData and pixel array from the canvas
		const imgData = ctx.getImageData( 0, 0, iLength, jLength );
		const data = imgData.data;
		const volumeData = volume.data;
		const upperThreshold = volume.upperThreshold;
		const lowerThreshold = volume.lowerThreshold;
		const windowLow = volume.windowLow;
		const windowHigh = volume.windowHigh;

		// manipulate some pixel elements
		let pixelCount = 0;

		if ( volume.dataType === 'label' ) {

			console.error( 'THREE.VolumeSlice.repaint: label are not supported yet' );

			// This part is currently useless but will be used when colortables will be handled

			// for ( let j = 0; j < jLength; j ++ ) {

			// 	for ( let i = 0; i < iLength; i ++ ) {

			// 		let label = volumeData[ sliceAccess( i, j ) ];
			// 		label = label >= this.colorMap.length ? ( label % this.colorMap.length ) + 1 : label;
			// 		const color = this.colorMap[ label ];
			// 		data[ 4 * pixelCount ] = ( color >> 24 ) & 0xff;
			// 		data[ 4 * pixelCount + 1 ] = ( color >> 16 ) & 0xff;
			// 		data[ 4 * pixelCount + 2 ] = ( color >> 8 ) & 0xff;
			// 		data[ 4 * pixelCount + 3 ] = color & 0xff;
			// 		pixelCount ++;

			// 	}

			// }

		} else {

			for ( let j = 0; j < jLength; j ++ ) {

				for ( let i = 0; i < iLength; i ++ ) {

					let value = volumeData[ sliceAccess( i, j ) ];
					let alpha = 0xff;
					//apply threshold
					alpha = upperThreshold >= value ? ( lowerThreshold <= value ? alpha : 0 ) : 0;
					//apply window level
					value = Math.floor( 255 * ( value - windowLow ) / ( windowHigh - windowLow ) );
					value = value > 255 ? 255 : ( value < 0 ? 0 : value | 0 );

					data[ 4 * pixelCount ] = value;
					data[ 4 * pixelCount + 1 ] = value;
					data[ 4 * pixelCount + 2 ] = value;
					data[ 4 * pixelCount + 3 ] = alpha;
					pixelCount ++;

				}

			}

		}

		ctx.putImageData( imgData, 0, 0 );
		this.ctx.drawImage( canvas, 0, 0, iLength, jLength, 0, 0, this.canvas.width, this.canvas.height );


		this.mesh.material.map.needsUpdate = true;

	}
Refresh the texture and the geometry if geometryNeedsUpdate is set to `true`.