Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add OCT normalizer #402

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/DicomMetaDictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 10 additions & 1 deletion src/normalizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Normalizer {
PETImageNormalizer;
sopClassUIDMap[toUID.Segmentation] = SEGImageNormalizer;
sopClassUIDMap[toUID.DeformableSpatialRegistration] = DSRNormalizer;
sopClassUIDMap[toUID.OphthalmicTomographyImage] = OCTImageNormalizer;
return sopClassUIDMap[sopClassUID];
}

Expand All @@ -66,7 +67,8 @@ class Normalizer {
toUID.EnhancedPETImage,
toUID.LegacyConvertedEnhancedPETImage,
toUID.Segmentation,
toUID.ParametricMapStorage
toUID.ParametricMapStorage,
toUID.OphthalmicTomographyImage
];
return multiframeSOPClasses.indexOf(sopClassUID) !== -1;
}
Expand Down Expand Up @@ -531,6 +533,12 @@ class DSRNormalizer extends Normalizer {
}
}

class OCTImageNormalizer extends ImageNormalizer {
normalize() {
super.normalize();
}
}

export { Normalizer };
export { ImageNormalizer };
export { MRImageNormalizer };
Expand All @@ -543,3 +551,4 @@ export { PETImageNormalizer };
export { SEGImageNormalizer };
export { PMImageNormalizer };
export { DSRNormalizer };
export { OCTImageNormalizer };
25 changes: 24 additions & 1 deletion test/normalizers.test.js
Original file line number Diff line number Diff line change
@@ -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);
});