fix: passing metadata to getTextLines callback in annotation tools #1710
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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