From b98e76c7dfbb0bf82411e53a0718de044a7a4914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0imko?= Date: Wed, 18 Sep 2024 14:06:13 +0200 Subject: [PATCH 1/2] Add OCT normalizer --- src/DicomMetaDictionary.js | 3 ++- src/normalizers.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/DicomMetaDictionary.js b/src/DicomMetaDictionary.js index 9769c4b9..b8444eb0 100644 --- a/src/DicomMetaDictionary.js +++ b/src/DicomMetaDictionary.js @@ -382,7 +382,8 @@ DicomMetaDictionary.sopClassNamesByUID = { "1.2.840.10008.5.1.4.1.1.88.33": "ComprehensiveSR", "1.2.840.10008.5.1.4.1.1.128": "PETImage", "1.2.840.10008.5.1.4.1.1.130": "EnhancedPETImage", - "1.2.840.10008.5.1.4.1.1.128.1": "LegacyConvertedEnhancedPETImage" + "1.2.840.10008.5.1.4.1.1.128.1": "LegacyConvertedEnhancedPETImage", + '1.2.840.10008.5.1.4.1.1.77.1.5.4': "OphthalmicTomographyImage", }; DicomMetaDictionary.dictionary = dictionary; diff --git a/src/normalizers.js b/src/normalizers.js index 912df5f5..f23b6b8e 100644 --- a/src/normalizers.js +++ b/src/normalizers.js @@ -51,6 +51,7 @@ class Normalizer { PETImageNormalizer; sopClassUIDMap[toUID.Segmentation] = SEGImageNormalizer; sopClassUIDMap[toUID.DeformableSpatialRegistration] = DSRNormalizer; + sopClassUIDMap[toUID.OphthalmicTomographyImage] = OCTImageNormalizer; return sopClassUIDMap[sopClassUID]; } @@ -66,7 +67,8 @@ class Normalizer { toUID.EnhancedPETImage, toUID.LegacyConvertedEnhancedPETImage, toUID.Segmentation, - toUID.ParametricMapStorage + toUID.ParametricMapStorage, + toUID.OphthalmicTomographyImage ]; return multiframeSOPClasses.indexOf(sopClassUID) !== -1; } @@ -531,6 +533,12 @@ class DSRNormalizer extends Normalizer { } } +class OCTImageNormalizer extends ImageNormalizer { + normalize() { + super.normalize(); + } +} + export { Normalizer }; export { ImageNormalizer }; export { MRImageNormalizer }; @@ -543,3 +551,4 @@ export { PETImageNormalizer }; export { SEGImageNormalizer }; export { PMImageNormalizer }; export { DSRNormalizer }; +export { OCTImageNormalizer }; From a3f2d22ed8ff4aabbb88eea93d3206c357642f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0imko?= Date: Tue, 1 Oct 2024 09:41:01 +0200 Subject: [PATCH 2/2] Add OCT normalizer test --- test/normalizers.test.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/normalizers.test.js b/test/normalizers.test.js index cc877c3f..2dbdda10 100644 --- a/test/normalizers.test.js +++ b/test/normalizers.test.js @@ -1 +1,24 @@ -it("No tests yet", () => {}); +import "regenerator-runtime/runtime.js"; + +import fs from "fs"; +import { jest } from "@jest/globals"; +import { getTestDataset } from "./testUtils"; +import { DicomMessage } from "../src/DicomMessage"; +import { DicomMetaDictionary } from "../src/DicomMetaDictionary"; +import dcmjs from "../src"; + +// The asset downloads in this file might take some time on a slower connection +jest.setTimeout(60000); + +it("test_normalizer_oct", async () => { + const url = "https://github.com/dcmjs-org/data/releases/download/oct/oct.dcm"; + const dcmPath = await getTestDataset(url, "oct.dcm"); + const file = fs.readFileSync(dcmPath); + const dicomDict = DicomMessage.readFile(file.buffer); + + const dataset = DicomMetaDictionary.naturalizeDataset(dicomDict.dict); + const multiframe = dcmjs.normalizers.Normalizer.normalizeToDataset([dataset]); + + expect(dataset.NumberOfFrames).toEqual(97); + expect(multiframe.NumberOfFrames).toEqual(97); +}); \ No newline at end of file