Closed LeoReubelt closed 1 year ago
Instead of creating an instance of a factory, you now can just call createView(elements, image)
to create a View
(see createView in the doc).
Thanks @ivmartel.
@ivmartel - do i have to be on 0.32.1 for this to work? Because i still can't seem to get it to work. I can not seem to import it.
Yes, it's on 0.32.1 (#1410).
ok. thanks.
@ivmartel - sorry for the continuous questions. but when i upgrade to 0.32.1, i get dozens of the following error. Index already used in storage: 0
In what context? Are you trying to load a data?
yep. that is the error i get back in the loaderror event listener.
dwvAppRef.current?.addEventListener(`loaderror`, (event: any) => {
console.log(`ERROR &&&&& `, event);
message.error(event.error.message);
});
message: "Index already used in storage: 0"
Error: Index already used in storage: 0
at nn.addNew (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:379049)
at #Wr (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:455077)
at eval (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:378658)
at t.onloaditem (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:378208)
at #Hn (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:362132)
at #Wn (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:363037)
at #Qn.#Qn.ondecodeditem [as onworkitem] (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:364217)
at Worker.onmessage (webpack-internal:///./node_modules/dwv/dist/dwv.min.js:1:359079)
This error is when the app tries to use an already assigned index. Are you loading with loadURLs
?
no, i am using App.loadFiles. we get zip files that sometimes contain multiple series mixed together, subfolders, non-dicom files, and rtstruct or rtplan modalities. so first i open the zip, separate everything by file type, series, and modality. and then i use App.loadFiles and pass it files: File[].
but if if i make urls from the files and use loadURLs, i get the same errors.
const urls = props.files.map((file) => URL.createObjectURL(file));
app.loadURLs(urls);
Did you find a solution to your problem?
@ivmartel yes thanks. i don't actually know what fixed it. otherwise i would have put it here. but i had a remaining require('dwv'). and when i changed it to import some of the functions changed. so i am assuming that is what fixed it.
dwv 0.32 allows to do individual imports such as import {App} from 'dwv'
. I would recommend it if your environment supports it instead of a global import or require. That way you know exactly what you depend upon.
I have a function to that uses ViewFactory.
i used to do the following...
After upgrading to 0.32, I get the following... TypeError: Cannot read properties of undefined (reading 'ViewFactory')
And I can't seem to figure out how to get it now.