insightsoftwareconsortium / create-itk-app Goto Github PK
View Code? Open in Web Editor NEWGenerate a new application based on itk.js, vtk.js and react.js.
License: Apache License 2.0
Generate a new application based on itk.js, vtk.js and react.js.
License: Apache License 2.0
Expected behaviour:
Running yarn test
runs all tests.
Actual behaviour
FAIL src/App.test.js
● Test suite failed to run
/mnt/C49EA2229EA20D4C/linux/source/js/itk-react-app/node_modules/vtk.js/Sources/Rendering/Core/Actor/index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { vec3, mat4 } from 'gl-matrix';
^^^^^^
SyntaxError: Cannot use import statement outside a module
3 | import './App.css';
4 |
> 5 | import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor';
| ^
6 | import vtkSphereSource from 'vtk.js/Sources/Filters/Sources/SphereSource';
7 | import vtkMapper from 'vtk.js/Sources/Rendering/Core/Mapper';
8 | import vtkFullScreenRenderWindow from 'vtk.js/Sources/Rendering/Misc/FullScreenRenderWindow';
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at Object.<anonymous> (src/App.js:5:1)
at Object.<anonymous> (src/App.test.js:3:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 30.337s
Ran all test suites.
Watch Usage
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press q to quit watch mode.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press Enter to trigger a test run.
Done in 58.01s.
Any help with fixing this issue would be highly appreciated. Even simple hints to point me in the right direction (so that I can fix it myself) would be really helpful.
I'm trying to use itk-js on my CRA application to read DICOM files, so I did start from create-itk-app to understand how I can procede.
This is the simple application that I use to test:
import React, { Component } from 'react';
import './App.css';
//import readFile from 'itk/readFile'
import readImageFile from 'itk/readImageFile'
//import readImageDICOMFileSeries from 'itk/readImageDICOMFileSeries'
class App extends Component {
constructor(props) {
super(props);
this.fileOpen = React.createRef()
this.showFileOpen = this.showFileOpen.bind(this)
}
componentDidMount() {
}
componentDidUpdate(prevProps) {
}
showFileOpen() {
this.fileOpen.current.click()
}
handleOpenLocal = (files) => {
console.log('handleOpenLocal: ', files[0])
readImageFile(null, files[0])
.then(function ({ image }) {
console.log('image: ', image)
})
}
render() {
return (
<div className="App">
<button onClick={this.showFileOpen}>Open</button>
<div>
<input
type="file"
id="file_open"
style={{ display: "none" }}
ref={this.fileOpen}
onChange={e => this.handleOpenLocal(e.target.files)}
/>
</div>
</div>
);
}
}
export default App;
but I obtain the following error:
Can you help me? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.