-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(seg): compatibility issue for SEG sourcing MG images (#351)
* added unit test for SEG sourcing MG images * fix incompatibility issue for SEG sourcing MG images
- Loading branch information
1 parent
4252063
commit e84a36c
Showing
2 changed files
with
146 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,45 @@ | ||
it("No tests yet", () => {}); | ||
import "regenerator-runtime/runtime.js"; | ||
import fs from "fs"; | ||
import Segmentation_4X from "../src/adapters/Cornerstone/Segmentation_4X" | ||
import { getTestDataset } from "./testUtils.js"; | ||
|
||
const mockMetadataProvider = { | ||
get: (type, imageId) => { | ||
// Unlike CT, is missing coordinate system such as frameOfReferenceUID or rowCosines attributes | ||
if (imageId === "mg://1") { | ||
return { | ||
seriesInstanceUID: "1.2.840.113681.167838594.1562401072.4432.2070.71100000", | ||
rows: 3328, | ||
columns: 2560, | ||
pixelSpacing: [0.065238, 0.065238], | ||
rowPixelSpacing: 0.065238, | ||
columnPixelSpacing: 0.065238, | ||
columnCosines: null, | ||
frameOfReferenceUID: undefined, | ||
imageOrientationPatient: undefined, | ||
imagePositionPatient: undefined, | ||
rowCosines: null, | ||
sliceLocation: undefined, | ||
sliceThickness: undefined | ||
}; | ||
} | ||
} | ||
} | ||
|
||
it("Can generate tool state (4X) with SEG sourcing MG images without throwing any errors", async () => { | ||
const url = | ||
"https://github.com/dcmjs-org/data/releases/download/mg-seg/seg-test-SEG.dcm"; | ||
const dcmPath = await getTestDataset(url, "seg-test-SEG.dcm") | ||
const arrayBuffer = fs.readFileSync(dcmPath).buffer | ||
|
||
expect( | ||
() => { | ||
Segmentation_4X.generateToolState( | ||
["mg://1"], | ||
arrayBuffer, | ||
mockMetadataProvider | ||
) | ||
}, | ||
).not.toThrowError(); | ||
|
||
}); |