-
Notifications
You must be signed in to change notification settings - Fork 115
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
_image.data is undefined #144
Comments
Hi @KhyatiMehta3 - it's hard to know from your screenshots. Are you planning to make your implementation available? It would be great if you could do that, and start by making a pull request so that others can try your code and maybe help debug it. It can be tricky to work on features like this that require possible changes to both dcmjs and ohif, but it's possible to set up an environment for testing (I think there are instructions in the ohif docs for that). |
Hi @pieper thank you for your response! I'll send a PR. and refer this issue there as well. |
Hello @pieper and @KhyatiMehta3, I'm having exactly same issue here. Could this be related to the type of loader being used when loading the dicom files? Because, if i use the cornerstone.loadImage() function with an imageId set for dicomWeb the data property is there in my viewer but if I use wadouri it's not. |
Hi @pieper , @helghast79 , @KhyatiMehta3 , I'm facing the same problem, have you found a way to address it? |
I'm not sure myself, that sounds like a cornerstone issue with the ways the segmentation tool is implemented. Segmentation display is working in OHIF with cornerstone and vtk.js, so maybe looking at that implementation will help. Segmentation creation is not yet in OHIF, just in a few demos like the one in dcmjs. https://viewer.ohif.org/viewer/1.2.826.0.13854362241694438965858641723883466450351448 |
Hello @pieper and all, I don't think it as anything to do with the segmentation tool since the data property exists in the images object even without the segmentation extension. If I use the imageIds from this example which have a "dicomweb" loader prefix then the data property is there in any version of Ohif viewer I have tried. As to a possible workaround and with the aim of using DCMJS functions like the generateSegmentation which require a datatset object stored in the image data property, we can generate this dataset with dicom-parser library with the help of cornerstone, cornerstoneTools and OHIF.utils to generate the required data.
Warning: labelmaps3D array will probably need to be adapted also because DCMJS expects the individual labelMap3d elements to have a metadata property with data that follows some schema, so in order to use the generateSegmentation function mentioned above we need to make sure it's there. cheers |
Hi @helghast79, thank you so much for your detailed answer! I'll try your approach soon. |
Hi @helghast79, I have tried your solution and it allowed me to advance further however as you mentioned there was an issue with labelmaps3D. Should I use a similar logic to fill in labelmaps3D with the dataset? |
Hello Sinan, I don't know exactly what's the problem with your labelMaps3D but probably is the lack of metadata associated with each individual labelMap3d. These should be set according to the specifics of each segment before running dcmjs generateSegmentation function. You can however, mock this data with something like:
(took it from generateMockMetadata function from here. All props but the There is also a correction to the workaround I posted before. If you use that code you'll find all segmentations collapsed in the first image. That's because the dataset added to each image is the same for all images. While I couldn't find a way to generate an arrayBuffer that contains only data from each image I found that generating an instance of the image metadata with
(note: I prefer to make a copy of the modified dcmjs close to the script using it and then import it instead)
(I didn't test with multiframe images but followed similar logic found in dcmjs) Hope It's not too much confusing... cheers :) |
Thank you very much @helghast79 for taking the time to provide detailed explanations! |
Hi @helghast79, it seems there's an issue with the segmentations not being loaded on the right image. Here's what I did: Created a segmentation in a series on the first and fifth images. Saved the segmentation thanks to your updated logic then imported the segmentations in Orthanc. After that I visited the series again in OHIF Viewer and I noticed the segmentation were displayed on the last and fifth before last images of the series, instead of the first and fifth images. It seems something has been reversed. I've tried reversing the loop on imageIds in your previous answer but that does not help. Can you please point me towards the way to have the segmentation be loaded on the correct images? |
Hello @sinanmb, I could not replicate this issue on any of my images set. So I'm just guessing here. Maybe some particular issue between the Dicom loader ordering and the ordering mechanism dcmjs uses. Most certainly the problem should be on saving the segmentation file and not on loading it. Some more details could help to figure out the reason behind this behaviour. Also, the code you use could help to replicate and debug non obvious errors. note: I've submitted a pull request to include the function that generates the segmentation from an array of datasets as discussed above. While it's not included yet, you could take a look at the code changes and check if the you've followed the same path |
finally, I could replicate your issue @sinanmb. While making the pull request I made changes to source code and build dcmjs plugin. The release file then contained a lot of changes from the dcmjs plugin included in Ohif viewer, which was the one I've modified with the GenerateSegmentationFromDatasets function. So, I can't really tell whats going on with this newer version of dcmjs but seems that some change must be the cause to some series (those that for some reason have inverted ordering) to become out of sync from labelmaps ordering. Is this what's happening to you? |
Hi @helghast79, thank you for getting back to me! Yes that is the problem I was facing. The way I have fixed the issue was to add this line: I feel it's a bit hacky though. |
@sinanmb, you could do that but then the cheers |
Thank you @helghast79 for letting me know! I will try your solution soon. |
Hi @helghast79, I am currently able to generate and save segmentations that contain 1 single segment. I would like to be able to create multiple segments. I have tried adding a new object inside the |
I know that it's quite an old thread but this might help somebody. I did manage to find a 'hacky' solution for getting 'image.data' for every image in OHIF V2, without having to fork dcmjs. Similarly to the solution in the comment above, you can actually call
You can use it as:
Again, it's quite hacky and I'm not sure that it will work in all cases, but at least with images loaded over from Orthanc (or any DicomWeb endpoint probably) it seems to work alright. |
Hello!
I'm trying to write a segmentation drawing extension tool over OHIF Viewer.
I'm referring to this example, to get the Part10 dcmjs representation of the segmentation.
In the example this image promise returns the image without any issues and creates the segmentation, as shown below:
But in the viewer, the same image Promise returns an image without the property "data" in it, which is causing the mentioned error. Shown below:
I wasn't sure if the question is more suited under cornerstone tools repository, so I just put it up here because the error is coming under dcmjs script.
Can anyone help me resolve this issue?
The text was updated successfully, but these errors were encountered: