Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cornerstone3D not work #49

Closed
acegank opened this issue Oct 9, 2022 · 6 comments
Closed

Cornerstone3D not work #49

acegank opened this issue Oct 9, 2022 · 6 comments

Comments

@acegank
Copy link

acegank commented Oct 9, 2022

import * as cornerstone from "@cornerstonejs/core/dist/esm";
import * as cornerstoneNIFTIImageLoader from "@cornerstonejs/nifti-image-loader/dist/cornerstoneNIFTIImageLoader";
cornerstoneNIFTIImageLoader.external.cornerstone = cornerstone;

but will error:

Cannot read properties of undefined (reading 'dispatchEvent')
Cornerstone3D has not events properties

how to solve this?

@kousu
Copy link

kousu commented Oct 9, 2022

The maintainer explained yesterday that unfortunately they are not yet compatible. So you cannot use

npm install @cornerstonejs/core               # aka "Cornerstone3D"
npm install @cornerstonejs/nifti-image-loader

You have to instead use

npm install cornerstone-core                   # aka "legacy Cornerstone"
npm install @cornerstonejs/nifti-image-loader  # gets 1.0.7 of this project

or

npm install cornerstone-core
npm install cornerstonejs-nifti-image-loader  # which gets the older 1.0.0 of this project

Not even the OHIF viewer, which is the main consumer and funder of Cornerstone, uses Cornerstone3D yet -- it's still on cornerstone-core^2.6.1

@kousu
Copy link

kousu commented Oct 9, 2022

@acegank, if it helps, I've rewritten the example, that uses the latest nifti loader with the latest cornerstone-core:

screenshot

Unlike the older examples, my rewrite uses the Cornerstone directly off npm, instead using an old vendored copy, but it doesn't go as far as upgrading all the way to Cornerstone3D because that's impossible at the moment.

You'll have to adapt the packaging to your project, whether you're using webpack or node or rollup, and you'll probably want to add cornerstone-tools to make it more useful, but it successfully displays a .nii.gz file and should get you going.

Would you consider closing this issue now? I think it's fair to say this is a duplicate of my post at #48.

@acegank
Copy link
Author

acegank commented Oct 10, 2022

@kousu ,Thank you for the clarification!

I have another question for you, there are two nifti files, one is origin files, one is mask files(segmentation), how to overlay them?

Thanks you again!

@acegank acegank closed this as completed Oct 10, 2022
@kousu
Copy link

kousu commented Oct 10, 2022

I have another question for you, there are two nifti files, one is origin files, one is mask files(segmentation), how to overlay them?

That's a good question. I hadn't thought of trying to do that, but knowing how to do layers would be good. I have no idea. I don't even know.

The reason I posted #48 is because I am also a newbie to Cornerstone and I got lost in the documentation's sprawl, and it's apparently currently worse because they're going through a major version upgrade.

I took a look through the docs and found this, but I can't really tell if that will do the right thing, or if it's even the right code because, again, that's from the Cornerstone3D docs. But maybe if you combine reading that with reading the source of cornerstone-tools you can get it to work.

Anyway that's about all I have time for right now, but good luck with your project!

@acegank
Copy link
Author

acegank commented Oct 10, 2022

thanks! you are right. if use Cornerstone3D will be easy. but use cornerstone-core i can't solve it.

i try many times,but..😔

anyway, thank you.

@x6262
Copy link

x6262 commented May 21, 2023

Have you solved the problem of compatibility between cornerstone3D and nifti files yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants