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(adapter): add RTSS Adapter and Labelmaps to Contours convertor #734

Merged
merged 12 commits into from Oct 6, 2023

Conversation

dxlin
Copy link
Contributor

@dxlin dxlin commented Aug 9, 2023

-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:

  1. Start viewer
  2. Select Water Phantom study (or any with CT and PT) in TMTV mode
  3. Create "New Label" on right right
  4. Select "Rectangle ROI Threshold Tool"
  5. Create arbitrary rectangle in axial PT viewport
  6. Click "Run"
  7. Click "Export RTSS"

Save prompt should show up to save RTSS dicom file. Can also view console to review contours and RTSS object generated.

Checklist

PR

  • [] My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

Public Documentation Updates

  • [] The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • [] "OS: Windows 10
  • [] "Node version: 18.16.0
  • [] "Browser: Edge v115.0.1901.188

-extracted RTSS logic extension from OHIF viewer PR 3092
@netlify
Copy link

netlify bot commented Aug 9, 2023

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 8dad9b3
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/651f7b73bc310800080f15c3
😎 Deploy Preview https://deploy-preview-734--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dxlin dxlin marked this pull request as ready for review September 5, 2023 18:23
@dxlin dxlin changed the title WIP: feat(adapter): add RTSS Adapter and Code to Convert Segmentations to Contours feat(adapter): add RTSS Adapter and Code to Convert Segmentations to Contours Sep 5, 2023
Comment on lines 149 to 172
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
});
});
Copy link
Member

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

Copy link
Member

@sedghi sedghi left a 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
@dxlin
Copy link
Contributor Author

dxlin commented Oct 3, 2023

thanks for suggestions, refactored and cleaned up the code a bit as suggested

@dxlin
Copy link
Contributor Author

dxlin commented Oct 3, 2023

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.

Copy link
Member

@sedghi sedghi left a 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

Copy link
Member

@sedghi sedghi left a 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

@sedghi sedghi changed the title feat(adapter): add RTSS Adapter and Code to Convert Segmentations to Contours feat(adapter): add RTSS Adapter and Labelmaps to Contours convertor Oct 6, 2023
@sedghi sedghi merged commit e3e05bd into cornerstonejs:main Oct 6, 2023
9 checks passed
@sedghi sedghi mentioned this pull request Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants