diff --git a/src/api/pfdcm/client.ts b/src/api/pfdcm/client.ts index 6e0f6a029..54c8e8e46 100644 --- a/src/api/pfdcm/client.ts +++ b/src/api/pfdcm/client.ts @@ -198,6 +198,9 @@ function getValue( data: { [key: string]: PypxTag | ReadonlyArray<{ [key: string]: PypxTag }> }, name: string, ): string { + if (!(name in data)) { + return ""; + } if ("value" in data[name]) { return "" + data[name].value; } @@ -205,35 +208,36 @@ function getValue( } function simplifyPypxSeriesData(data: { [key: string]: PypxTag }): Series { - const parsedNumInstances = - data.NumberOfSeriesRelatedInstances.value === 0 - ? NaN - : parseInt(data.NumberOfSeriesRelatedInstances.value); - const NumberOfSeriesRelatedInstances = Number.isNaN(parsedNumInstances) + const numInstances = parseInt( + getValue(data, "NumberOfSeriesRelatedInstances"), + ); + const NumberOfSeriesRelatedInstances = Number.isNaN(numInstances) ? null - : parsedNumInstances; + : numInstances; return { - SpecificCharacterSet: "" + data.SpecificCharacterSet.value, + SpecificCharacterSet: getValue(data, "SpecificCharacterSet"), StudyDate: parsePypxDicomDate(data.StudyDate), SeriesDate: parsePypxDicomDate(data.SeriesDate), - AccessionNumber: "" + data.AccessionNumber.value, - RetrieveAETitle: "" + data.RetrieveAETitle.value, - Modality: "" + data.Modality.value, - StudyDescription: "" + data.StudyDescription.value, - SeriesDescription: "" + data.SeriesDescription.value, - PatientName: "" + data.PatientName.value, - PatientID: "" + data.PatientID.value, + AccessionNumber: getValue(data, "AccessionNumber"), + RetrieveAETitle: getValue(data, "RetrieveAETitle"), + Modality: getValue(data, "Modality"), + StudyDescription: getValue(data, "StudyDescription"), + SeriesDescription: getValue(data, "SeriesDescription"), + PatientName: getValue(data, "PatientName"), + PatientID: getValue(data, "PatientID"), PatientBirthDate: parsePypxDicomDate(data.PatientBirthDate), - PatientSex: "" + data.PatientSex.value, - PatientAge: "" + data.PatientAge.value, - ProtocolName: "" + data.ProtocolName.value, - AcquisitionProtocolName: "" + data.AcquisitionProtocolName.value, - AcquisitionProtocolDescription: - "" + data.AcquisitionProtocolDescription.value, - StudyInstanceUID: "" + data.StudyInstanceUID.value, - SeriesInstanceUID: "" + data.SeriesInstanceUID.value, + PatientSex: getValue(data, "PatientSex"), + PatientAge: getValue(data, "PatientAge"), + ProtocolName: getValue(data, "ProtocolName"), + AcquisitionProtocolName: getValue(data, "AcquisitionProtocolName"), + AcquisitionProtocolDescription: getValue( + data, + "AcquisitionProtocolDescription", + ), + StudyInstanceUID: getValue(data, "StudyInstanceUID"), + SeriesInstanceUID: getValue(data, "SeriesInstanceUID"), NumberOfSeriesRelatedInstances, - PerformedStationAETitle: "" + data.PerformedStationAETitle.value, + PerformedStationAETitle: getValue(data, "PerformedStationAETitle"), }; } diff --git a/src/app.css b/src/app.css index 6b79447e8..a33b2182f 100644 --- a/src/app.css +++ b/src/app.css @@ -65,13 +65,13 @@ .small-button { width: 16px; height: 16px; - font-size: 0.8rem + font-size: 0.8rem; } .large-button { width: 24px; height: 24px; - font-size:1rem; + font-size: 1rem; } .button-style { @@ -81,5 +81,5 @@ display: flex !important; justify-content: center !important; align-items: center !important; - line-height:0 !important + line-height: 0 !important; } diff --git a/src/components/Pacs/PacsController.tsx b/src/components/Pacs/PacsController.tsx index 5d93388ba..eb17c7ef7 100644 --- a/src/components/Pacs/PacsController.tsx +++ b/src/components/Pacs/PacsController.tsx @@ -371,8 +371,9 @@ const PacsController: React.FC = ({ }, [preferences, studies]); const error = React.useMemo( - () => wsError || pfdcmServices.error?.message, - [wsError, pfdcmServices.error], + () => + wsError || pfdcmServices.error?.message || pfdcmStudies.error?.message, + [wsError, pfdcmServices.error, pfdcmStudies.error], ); // ========================================