How to use the itk/readFile function in itk

To help you get started, we’ve selected a few itk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github InsightSoftwareConsortium / itk-js / examples / UnpkgIO / src / index.js View on Github external
const outputFileInformation = curry(function outputFileInformation (outputTextArea, event) {
  const dataTransfer = event.dataTransfer
  const files = event.target.files || dataTransfer.files
  return readFile(null, files[0])
    .then(function ({ image, mesh, webWorker }) {
      webWorker.terminate()
      const imageOrMesh = image || mesh

      function replacer (key, value) {
        if (!!value && value.byteLength !== undefined) {
          return String(value.slice(0, 6)) + '...'
        }
        return value
      }
      outputTextArea.textContent = JSON.stringify(imageOrMesh, replacer, 4)
    })
})
github InsightSoftwareConsortium / itk-js / examples / Webpack / src / index.js View on Github external
const outputFileInformation = curry(function outputFileInformation (outputTextArea, event) {
  outputTextArea.textContent = 'Loading...'
  const dataTransfer = event.dataTransfer
  const files = event.target.files || dataTransfer.files
  return readFile(null, files[0])
    .then(function ({ image, mesh, webWorker }) {
      webWorker.terminate()
      const imageOrMesh = image || mesh

      function replacer (key, value) {
        if (!!value && value.byteLength !== undefined) {
          return String(value.slice(0, 6)) + '...'
        }
        return value
      }
      outputTextArea.textContent = JSON.stringify(imageOrMesh, replacer, 4)
    })
})