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

fix: passing metadata to getTextLines callback in annotation tools #1710

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

salimkanoun
Copy link
Contributor

Context

In nuclear medicine, some quantifications may have different normalization such as SUV lean body mass or glycaemia corrected SUV.

To implement specific quantification we previously add callback definition to override statistics computation or result rendering (stat calculator and getTextLines parameters)

Our current problem is that we want to change the rendered value SUV => SUL, to do this we need to get PatientWeight, PatientSize and PatientSex in the Metadata store.

The probleme we are facing is that the getTextLines callaback is not giving enough context about the measurement especially to retrieve the volumeId/displaySet/SeriesInstanceUID that are needed to link the measurement rendering from the Metadata Store.

So in this PR i add the metadata in the getTextLines of Circle and Rectangle start stop, it should solve our problem but now the issues is that getTextLines has different definition from a tool to another, for instance :

In 2D annotation we have : defaultGetTextLines(data, targetId)
in UltrasoundDirectional we have : defaultGetTextLines(data, targetId, configuration)
And now for 3D annotation we will have : defaultGetTextLines(data, _metadata)

I'm a bit afraid seeing different callback definition from a tool to another, that can be complicated to document and maintain in long term, i wonder if we shouldn't send the whole annotation object as one single param so the getTextLines call back can pickup watever needed, but this will become a breaking change

Changes & Results

Add more context to getTextLines params

Testing

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:
  • [] "Node version:
  • [] "Browser:

Copy link

stackblitz bot commented Dec 14, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Dec 14, 2024

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit 421100a
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/6760a84774daf20008f2b861
😎 Deploy Preview https://deploy-preview-1710--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.

*/
function defaultGetTextLines(data): string[] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have it as defaultGetTextLines(data, {} ), i'm pretty sure in future something else need to get injected too

@salimkanoun
Copy link
Contributor Author

here it is, yes this object is more extensible in the future,

What to do with 2D annotation which have :
defaultGetTextLines(data, targetId)
And ultrasounds direction tools has
defaultGetTextLines(data, targetId, configuration):

Do we change something for 2D roi ? (but can be a breaking change)

@sedghi sedghi changed the title passing metadata to getTextLines callback in annotation tools fix: passing metadata to getTextLines callback in annotation tools Dec 18, 2024
@sedghi sedghi merged commit 67618fa into cornerstonejs:main Dec 18, 2024
26 checks passed
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.

2 participants