diff --git a/Sources/controls/FileLoader/index.js b/Sources/controls/FileLoader/index.js index 3d9c5f0a..93cf434e 100644 --- a/Sources/controls/FileLoader/index.js +++ b/Sources/controls/FileLoader/index.js @@ -27,14 +27,19 @@ export default class FileLoader extends React.Component { ReaderFactory.loadFiles(files).then( (readers) => { for (let i = 0; i < readers.length; i++) { - const { reader, sourceType, name } = readers[i]; + const { reader, sourceType, name, dataset } = readers[i]; if (reader) { const source = this.props.proxyManager.createProxy( 'Sources', 'TrivialProducer', { name } ); - source.setInputAlgorithm(reader, sourceType); + if (dataset) { + source.setInputData(dataset, sourceType); + } else { + source.setInputAlgorithm(reader, sourceType); + } + this.props.proxyManager.createRepresentationInAllViews(source); this.props.proxyManager.renderAllViews(); } diff --git a/Sources/index.js b/Sources/index.js index 3ec2ed12..074dbff6 100644 --- a/Sources/index.js +++ b/Sources/index.js @@ -15,6 +15,8 @@ import defaultConfig from './config/glanceProxyConfig'; import MainView from './MainView'; import ReaderFactory from './io/ReaderFactory'; +export const { registerReader } = ReaderFactory; + export function createViewer(container, proxyConfiguration = defaultConfig) { const proxyManager = vtkProxyManager.newInstance({ proxyConfiguration }); const mainView = ReactDOM.render( diff --git a/Sources/io/ReaderFactory.js b/Sources/io/ReaderFactory.js index 2c54ae5a..ded77f88 100644 --- a/Sources/io/ReaderFactory.js +++ b/Sources/io/ReaderFactory.js @@ -85,8 +85,10 @@ function readFile(file) { const reader = vtkReader.newInstance(); const io = new FileReader(); io.onload = function onLoad(e) { - reader[parseMethod](io.result); - resolve({ reader, sourceType, name: file.name }); + const ds = reader[parseMethod](io.result); + Promise.resolve(ds).then((dataset) => { + resolve({ dataset, reader, sourceType, name: file.name }); + }); }; io[readMethod](file); } else {