-
Notifications
You must be signed in to change notification settings - Fork 327
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(adapters): overlapping segs with labelmap images #1815
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I don't think we're on the right track here. The adapter should return |
I was really hoping you would point to specific parts of the code and ask for specific changes instead of abstract ones. I'm not following what you're asking me to do. |
@@ -104,7 +104,7 @@ const state = { | |||
toolGroup: null, | |||
toolGroupId: "MY_TOOL_GROUP_ID", | |||
viewportIds: ["CT_AXIAL"], | |||
segmentationId: "LOAD_SEG_ID:" + cornerstone.utilities.uuidv4(), | |||
segmentationIds: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we should have the segmentationId, there is one segmentation for this case and it happens to be overlapping, so don't change this to an array
state.viewportIds[0], | ||
[{ segmentationId: state.segmentationId }] | ||
); | ||
for (const segmentationId of state.segmentationIds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, there is only one segmentation here
So basically the idea is to have this work. const { labelMapImages } =
await Cornerstone3D.Segmentation.createFromDICOMSegBuffer(
referenceImageIds,
arrayBuffer,
{
metadataProvider: metaData,
skipOverlapping: false
}
); Then we do csToolsSegmentation.addSegmentations([
{
segmentationId,
representation: {
type: cornerstoneTools.Enums.SegmentationRepresentations
.Labelmap,
data: {
imageIds: labelMapImages.flat()
}
}
}
]); The key files that need to be changed are Here const derivedImageId = getCurrentLabelmapImageIdForViewport(
viewportId,
representation.segmentationId
); as you see it only get one labelmapimageId for viewport => but we have changed that so that it can have multiple for one segmentationId (overlapping) and then later on in that file viewport.addImages([
{
imageId: derivedImageId,
representationUID: `${segmentationId}-${SegmentationRepresentations.Labelmap}`,
callback: ({ imageActor }) => {
imageActor.getMapper().setInputData(imageData);
},
},
]); you see we only add one derivedImageId to the viewport (since we only had support for one slice -> one imageId -> per labelmap) but now we want to support multiple so we need to loop over derivedImageIds for that slice and then add them one by one which should work Hope this helps |
Context
In order to address OHIF/Viewers#3496 we're taking a two steps approach:
1 - chopping the volume data buffer array into planar data buffer arrays
2 - adopt some strategy to duplicate these planar data buffer arrays when we get overlapping segs
This PR aims to cover the second step.
Changes & Results
Before - loss of information:
After - overlapping segs maintained:
Testing
Checklist
PR
semantic-release format and guidelines.
Code
[] My code has been well-documented (function documentation, inline comments,
etc.)
[] I have run the
yarn build:update-api
to update the API documentation, and havecommitted the changes to this PR. (Read more here https://www.cornerstonejs.org/docs/contribute/update-api)
Public Documentation Updates
additions or removals.
Tested Environment