fix: Patient name handling as either Alphabetic object or simply string object

- formatPN should accept a string person name as well as an object with a Alphabetic field.
- For DICOM JSON data sources, spread in the patient data from the study object into the instance.
This commit is contained in:
Joe Boccanfuso 2023-02-16 13:50:59 -05:00 committed by GitHub
parent b67c7b23e8
commit ae4183852f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -206,8 +206,10 @@ function createDicomJSONApi(dicomJsonConfig) {
url: instance.url,
imageId: instance.url,
...series,
...study,
};
delete obj.instances;
delete obj.series;
return obj;
});
storeInstances(instances);

View File

@ -211,7 +211,7 @@ function TrackedCornerstoneViewport(props) {
seriesDescription: SeriesDescription,
patientInformation: {
patientName: PatientName
? OHIF.utils.formatPN(PatientName.Alphabetic)
? OHIF.utils.formatPN(PatientName)
: '',
patientSex: PatientSex || '',
patientAge: PatientAge || '',

View File

@ -6,9 +6,11 @@ export default function formatPN(name) {
return;
}
const nameToUse = name.Alphabetic ?? name;
// Convert the first ^ to a ', '. String.replace() only affects
// the first appearance of the character.
const commaBetweenFirstAndLast = name.replace('^', ', ');
const commaBetweenFirstAndLast = nameToUse.replace('^', ', ');
// Replace any remaining '^' characters with spaces
const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' ');