Open obermillerk opened 3 years ago
@obermillerk I can understand your frustration.
Yes, it sounds like there is some sort of environment issue. One approach that make it easier to reveal what is happening is to build itk.js yourself in debug
mode. This will build the Emscripten modules with additional debugging information and not minified.
git clone https://github.com/InsightSoftwareConsortium/itk-js
cd itk-js
npm ci
npm run build:debug
I will also make a follow-up suggestion: either a repo containing a minimal reproduction scenario or any console errors (or both) would be very helpful for us in debugging this issue. :)
Thank you for the suggestions, I've had some other things on my plate since then so apologies for the delay. I will be back to working on this next week, so I'll try building itk-js myself and maybe see if I can get you a min repro on Monday.
Hey, sorry again for the delay, just managed to get back to this. Managed to get a minimal repro working here: https://github.com/obermillerk/itk-min-repro
yarn start
or npm equivalent to launch the electron app once dependencies are installed. Press the button to select the folder containing DICOM images and it will trigger an attempt to load them via ITK and convert to VTK image. This repro is presently attempting to use the web version, not the local version.
The electron renderer window has nodeIntegrationInWorker
set to true, as I use this in my actual project. Setting this to false (or removing) in index.ts
(line 16) makes it work, but since I use node integration in my own workers in my other project, ideally I'd be able to leave this as true.
I have yet to build ITK myself to try more debugging, but I'm about to try that now.
I've attempted to build the module in debug mode as you suggested, unfortunately your build process is not working for me.
To start, the pipelines fail to build the first time it tries each one. Then on subsequent runs that pipeline doesn't fail, so it gets to the next pipeline which does fail, until all of them are not failing. This is the error I got for each pipeline:
docker: error during connect: Post "http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.24/containers/create": open //./pipe/dockerDesktopLinuxEngine: The system cannot find the file specified.
See 'docker run --help'.
Then, after all the pipeline steps fail once and then no longer fail, I get the following error every time I try to run the build:
Error: Can't walk dependency graph: Cannot find module '../MeshIOIndex' from 'C:\Workspace\itk-js\src\WebWorkers\MeshIO.worker.js'
required by C:\Workspace\itk-js\src\WebWorkers\MeshIO.worker.js
at C:\Workspace\itk-js\node_modules\browser-resolve\node_modules\resolve\lib\async.js:137:35
at load (C:\Workspace\itk-js\node_modules\browser-resolve\node_modules\resolve\lib\async.js:156:43)
at onex (C:\Workspace\itk-js\node_modules\browser-resolve\node_modules\resolve\lib\async.js:181:17)
at C:\Workspace\itk-js\node_modules\browser-resolve\node_modules\resolve\lib\async.js:15:69
at FSReqCallback.oncomplete (fs.js:192:21)
Emitted 'error' event on Readable instance at:
at Labeled.<anonymous> (C:\Workspace\itk-js\node_modules\read-only-stream\index.js:28:44)
at Labeled.emit (events.js:376:20)
at Labeled.<anonymous> (C:\Workspace\itk-js\node_modules\stream-splicer\index.js:130:18)
at Labeled.emit (events.js:376:20)
at Deps.<anonymous> (C:\Workspace\itk-js\node_modules\stream-splicer\index.js:130:18)
at Deps.emit (events.js:376:20)
at C:\Workspace\itk-js\node_modules\module-deps\index.js:387:25
at onresolve (C:\Workspace\itk-js\node_modules\module-deps\index.js:185:25)
at C:\Workspace\itk-js\node_modules\browserify\index.js:528:22
at C:\Workspace\itk-js\node_modules\browser-resolve\index.js:265:24
Followed by a very long JSON object that I think might be the error with some config or something
Would greatly appreciate further assistance.
EDIT:
I notice that the file the last error is looking for (../MeshIOIndex
) doesn't exist as a normal .js
file, but there is a .js.in
file by that name in the expected location. I'm not familiar with that format, is there something I needed to do to compile that or anything before running the build?
I'd be interest to learn how to build this project as well, I get the following errors when I npm run build
:
src/io/readImageLocalFile.ts:7:26 - error TS2307: Cannot find module './internal/ImageIOIndex.js' or its corresponding type declarations.
7 import ImageIOIndex from './internal/ImageIOIndex.js'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/io/readMeshLocalFile.ts:7:25 - error TS2307: Cannot find module './internal/MeshIOIndex.js' or its corresponding type declarations.
7 import MeshIOIndex from './internal/MeshIOIndex.js'
~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/io/writeImageLocalFile.ts:7:26 - error TS2307: Cannot find module './internal/ImageIOIndex.js' or its corresponding type declarations.
7 import ImageIOIndex from './internal/ImageIOIndex.js'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/io/writeMeshLocalFile.ts:7:25 - error TS2307: Cannot find module './internal/MeshIOIndex.js' or its corresponding type declarations.
7 import MeshIOIndex from './internal/MeshIOIndex.js'
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 4 errors.
I'm on an ARM Mac, I'm not sure if it matters.
I wonder if anyone managed to find a solution to this issue. Currently trying to create a debug build and getting the same error with the missing ./internal/*IOIndex.js files.
@ZooLeeCoding do you get these errors when following the development documentation?
I've tried using both
readImageDICOMFileSeries
andreadLocalImageDICOMFileSeries
and both fail for different reasons. I've been at this for hours on end trying to fix one of them, but with no luck.I have a bit of a complex situation since I'm using electron with node support in the renderer, so I have a complicated environment that allows for both node and browser features, I'm not sure if that might be confusing itk or not.
readLocalImageDICOMFileSeries
This one just fails to read the dicom files. It fails at the
canReadTestFile
call that is made on the first file of the series, which I can't debug what exactly is failing because it goes to the compiled web assembly. I've looked at the ITK source code to find that method, and as far as I can tell my DICOMs do have the demarcation at 128 in the file, and every other DICOM parsing tool I've used has no issue reading them. I can even use theitk-vtk-viewer
in my browser to load the same file that is failing with this call, and it reads it and renders, so why is the different function it's using able to read it but not this one?readImageDICOMFileSeries
For this, I have the
ImageIOs
andWebWorkers
directories being copied over as per the Webpack instructions, and the web worker seems to start, but then the web worker has an error while trying to load the wasm. The...BindingWasm.js
file is loaded via a webpack dev server on localhost and then when that file runs, it tries to retrieve the binary.wasm
file via node fs for some reason? This wouldn't be a problem since as I said I have node support in my electron renderer environment, but the file it tries to read is the path that should be appended to my dev server host, not any actual file path. I could understand how this might be a result of there being both node and browser elements in my environment and reusing the DICOM Series Reader stuff.Any assistance you could offer would be great, feels like I've been hitting my head against a wall for the past couple days.