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(adapter): add RTSS Adapter and Labelmaps to Contours convertor #734
Conversation
-extracted RTSS logic extension from OHIF viewer PR 3092
…into feat/RTSSadapter
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
packages/adapters/src/adapters/Cornerstone3D/RTStruct/generateROIContourFromSegmentation.js
Outdated
Show resolved
Hide resolved
contours.forEach((contour, index) => { | ||
const ContourGeometricType = contour.type; | ||
const NumberOfContourPoints = | ||
contour.contourPoints.length; | ||
const ContourData = []; | ||
|
||
contour.contourPoints.forEach(point => { | ||
const pointData = reducedSet.points[point]; | ||
//pointData[0] = +pointData[0].toFixed(2); | ||
//pointData[1] = +pointData[1].toFixed(2); | ||
//pointData[2] = +pointData[2].toFixed(2); | ||
ContourData.push(pointData[0]); | ||
ContourData.push(pointData[1]); | ||
ContourData.push(pointData[2]); | ||
}); | ||
|
||
contourSequence.push({ | ||
ContourImageSequence, | ||
ContourGeometricType, | ||
NumberOfContourPoints, | ||
ContourNumber: index + 1, | ||
ContourData | ||
}); | ||
}); |
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.
I don't think this function should deal with RTSS, it should just create contours (list of points) from given segmentation. And later you convert those in to the desired format by RTSS
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.
see my comments please, thanks!
-move RTSS formatting out of contour to segmentation function -refactor generateROIContoursFromSegmentations to generateContourSetFromSegmentation -add check if no volume is found when generating contousr from segmentation -rename contourUtils to utilities -move helper functions out of RTSS.js to utilities folder -clean unnecessary console logs
thanks for suggestions, refactored and cleaned up the code a bit as suggested |
I just noticed new segmentation mode in OHIF was available, I will do test via segmentation mode first to ensure compatibility. I will update once I have checked compatibility. |
…into feat/RTSSadapter
…/dxlin/feat/RTSSadapter
-adjust utility functions to work with both
…ne3D into pr/dxlin/feat/RTSSadapter
-change roiContour to match segments -fix for segments thresholding -use segment labels for contours -use Segmentation label for RTSS
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.
Thanks a lot, this is a valuable PR
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.
Thanks a lot, this is a valuable PR
-extracted RTSS logic extension from OHIF viewer PR 3092
Context
-extracted RTSS logic extension from OHIF viewer PR 3092
Changes & Results
generateROIContoursFromSegmentations:
-use vtkImageMarchingSquares to iterate through segmentation labelmap and create contours that can be stored as ROIContours
RTSS:
-populate data structure compliant in
Note: vtkjs v27.3.1 dependency added to adapters
Testing
Sample usage of adapter under:
https://github.com/dxlin/viewers/tree/feat/RTSSadapter
->extensions/dicom-rtss/src/commandsModule.js
Using viewer:
Save prompt should show up to save RTSS dicom file. Can also view console to review contours and RTSS object generated.
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