* minor bug fix - reading modalities * react error log fix - button props * react warn fix - Typography color prop * calibration tool without persistence * added toolbar button for calibration tool * icon change for calibration tool * important bug fix for calibration - length and calibration rate calculation * fix weird autocorrection * [fix] bugs after merging upstream * [refactor] conform to the new service names
30 lines
765 B
JavaScript
30 lines
765 B
JavaScript
export default function getModalities(Modality, ModalitiesInStudy) {
|
|
if (!Modality && !ModalitiesInStudy) {
|
|
return {};
|
|
}
|
|
|
|
const modalities = Modality || {
|
|
vr: 'CS',
|
|
Value: [],
|
|
};
|
|
|
|
// Rare case, depending on the DICOM server we are using, but sometimes,
|
|
// modalities.Value is undefined or null.
|
|
modalities.Value = modalities.Value || [];
|
|
|
|
if (ModalitiesInStudy) {
|
|
if (modalities.vr && modalities.vr === ModalitiesInStudy.vr) {
|
|
for (let i = 0; i < ModalitiesInStudy.Value.length; i++) {
|
|
const value = ModalitiesInStudy.Value[i];
|
|
if (modalities.Value.indexOf(value) === -1) {
|
|
modalities.Value.push(value);
|
|
}
|
|
}
|
|
} else {
|
|
return ModalitiesInStudy;
|
|
}
|
|
}
|
|
|
|
return modalities;
|
|
}
|