Coder Social home page Coder Social logo

create-itk-app's People

Contributors

thewtex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

create-itk-app's Issues

Couldn't get tests to work.

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.

SyntaxError: expected expression, got '<'

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:

createitkapp-s01

Can you help me? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.