From 6a892971186e6460ce4754e5b2b96131e046b6ae Mon Sep 17 00:00:00 2001 From: Craig Berry Date: Mon, 3 Feb 2025 08:39:51 -0500 Subject: [PATCH] fix formatting errors --- src/DicomMessage.js | 2 +- src/ValueRepresentation.js | 2 +- test/lossless-read-write.test.js | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/DicomMessage.js b/src/DicomMessage.js index 71c1c184..6a9ff329 100644 --- a/src/DicomMessage.js +++ b/src/DicomMessage.js @@ -283,7 +283,7 @@ class DicomMessage { originalValue = tagObject._rawValue.map(val => vr.applyFormatting(val) ); - } else { + } else { originalValue = vr.applyFormatting(tagObject._rawValue); } diff --git a/src/ValueRepresentation.js b/src/ValueRepresentation.js index 0c0e6901..eaa78a56 100644 --- a/src/ValueRepresentation.js +++ b/src/ValueRepresentation.js @@ -967,7 +967,7 @@ class PersonName extends EncodedStringRepresentation { } readBytes(stream, length) { - return this.readPaddedEncodedString(stream, length) + return this.readPaddedEncodedString(stream, length); } applyFormatting(value) { diff --git a/test/lossless-read-write.test.js b/test/lossless-read-write.test.js index 24f18900..09757659 100644 --- a/test/lossless-read-write.test.js +++ b/test/lossless-read-write.test.js @@ -5,7 +5,7 @@ import dcmjs from "../src/index.js"; import { deepEqual } from "../src/utilities/deepEqual"; import { getTestDataset } from "./testUtils"; -import {DicomMetaDictionary} from "../src/DicomMetaDictionary"; +import { DicomMetaDictionary } from "../src/DicomMetaDictionary"; const { DicomDict, DicomMessage } = dcmjs.data; @@ -978,28 +978,34 @@ describe("lossless-read-write", () => { deepEqual(dicomDict.dict, outputDicomDict.dict); }); - test('0 length PN tag should be retained following naturalize and de-naturalize', () => { + test("0 length PN tag should be retained following naturalize and de-naturalize", () => { const file = fs.readFileSync("test/empty-person-name.dcm"); const origDicomDict = DicomMessage.readFile(file.buffer); - const origNaturalizedDataset = DicomMetaDictionary.naturalizeDataset(origDicomDict.dict); + const origNaturalizedDataset = DicomMetaDictionary.naturalizeDataset( + origDicomDict.dict + ); // confirm starting dataset contains empty tag value for referring physician person name - expect(origDicomDict.dict["00080090"]._rawValue).toEqual("") + expect(origDicomDict.dict["00080090"]._rawValue).toEqual(""); expect(origNaturalizedDataset.ReferringPhysicianName).toEqual([]); // re-encode the unnaturalized object - origDicomDict.dict = DicomMetaDictionary.denaturalizeDataset(origNaturalizedDataset); + origDicomDict.dict = DicomMetaDictionary.denaturalizeDataset( + origNaturalizedDataset + ); const outputBuffer = origDicomDict.write(); const newDicomDict = DicomMessage.readFile(outputBuffer); - const newNaturalizedDataset = DicomMetaDictionary.naturalizeDataset(origDicomDict.dict); + const newNaturalizedDataset = DicomMetaDictionary.naturalizeDataset( + origDicomDict.dict + ); // confirm output referring physican name remains the same - expect(newDicomDict.dict["00080090"]._rawValue).toEqual("") + expect(newDicomDict.dict["00080090"]._rawValue).toEqual(""); expect(newNaturalizedDataset.ReferringPhysicianName).toEqual([]); // confirm no other changes to the rest of the file deepEqual(origDicomDict, newDicomDict); - }) + }); }); const getDcmjsDataFile = async (release, fileName) => {