cornerstonejs / react-cornerstone-viewport

Cornerstone medical image viewport component for React
https://react.cornerstonejs.org/
MIT License
96 stars 74 forks source link

Error when formatting PatientsName #45

Open mkramers opened 4 years ago

mkramers commented 4 years ago

Version(s):

using NPM packages:
├── cornerstone-core@2.3.0
├── cornerstone-tools@4.6.2
├── cornerstone-wado-image-loader@3.0.6
├── dicomweb-client@0.5.2
├── hammerjs@2.0.8
├── react@16.11.0
├── react-cornerstone-viewport@2.1

I am hitting the following error when loading some arbitrary data:

TypeError: name.replace is not a function

in

formatPN from node_modules/react-cornerstone-viewport/dist/index.umd.js:2569

at

var commaBetweenFirstAndLast = name.replace('^', ', '); // Replace any remaining '^' characters with spaces

It appears that for some of my data, the name is an object (i.e. Object { Alphabetic: "C3L-00766" }. I can modify the src directly to resolve this issue, however being relatively new to cornerstone, I am not certain the best way to go about resolving this. I am using cornerstone-wado-image-loader as my image loader.

Thanks!

dannyrb commented 4 years ago

That's odd. I can't remember if that's valid output from dicom-parser, but I would think that any metadata coming from cornerstone-wado-image-loader would be a string for patient name 🤔

Do you have an easy way to reproduce this issue that would allow for me to test on my end?

chafey commented 4 years ago

dicom-parser will not return a name like this - I suspect your source is a DICOMWeb server since it returns PN attributes coded this way. Perhaps the DICOMWeb server is not standards compliant or there is a bug in the cornerstone code that consumes it

mkramers commented 4 years ago

@dannyrb, @chafey - it seems that this may be specific to using WADORS via a PACS/DICOMWeb server (dcm4chee) which I have running locally. I am having a bit of trouble finding an easy way for you to reproduce this, as I can't seem to find a public PACS with WADORS. Any suggestions?

mkramers commented 4 years ago

If it helps - while using the same images which are causing issues, non of the tools work either (through settings them via props as per the example). If I add them manually (via cornerstoneTools.addTool(...)) they work fine.

chafey commented 4 years ago

The bug is that the patientModule metadataprovider assumes a dicom-parser/P10 based metadata here:

https://github.com/cornerstonejs/react-cornerstone-viewport/blob/master/src/metadataProvider.js#L96

Support fro DICOMWeb formatted PN attributes needs to be added there for your use case, or use WADOURI instead