UNPKG

@itk-wasm/image-io

Version:

Input and output for scientific and medical image file formats.

13 lines 724 B
import axios from 'axios'; import { bufferToTypedArray, FloatTypes } from 'itk-wasm'; async function readImageHTTP(url) { const imageResponse = await axios.get(`${url}/index.json`, { responseType: 'json' }); const image = imageResponse.data; const dataResponse = await axios.get(`${url}/data/data.raw`, { responseType: 'arraybuffer' }); image.data = bufferToTypedArray(image.imageType.componentType, dataResponse.data); const directionResponse = await axios.get(`${url}/data/direction.raw`, { responseType: 'arraybuffer' }); image.direction = bufferToTypedArray(FloatTypes.Float64, directionResponse.data); return image; } export default readImageHTTP; //# sourceMappingURL=read-image-http.js.map