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

Update index.tsx with contentF #4811

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mbellehumeur
Copy link

@mbellehumeur mbellehumeur commented Feb 26, 2025

Ticket: 8562338482 - Support for both 'value:' or 'contentF' when defining microscopy overlays.

Context

This PR aims to harmonize the definition of text overlays in OHIF.
The dicom-microscopy extension / microscopy mode uses the parameter name 'value' to store the function that returns the content of the overlay.
The basic viewer mode uses the parameter name 'contentF' to store the function that returns the content of the overlay.

This PR adds contentF parameter to microscopy overlays.
The original 'value" naming is also supported so existing configuration will work and new and updated configurations can use consistent naming.

Changed & Results

The ViewportOverlay component of the dicom-microscopy extension has updated parsing to load the function returning the overlay content for both value and contentF parameters.

Testing

In the customizationService element of the configuration, test with both contentF:

  'microscopyViewport.overlay': {
    id: 'MicroscopyViewportOverlay',
    topLeft: [
      {
        id: 'PatientName',
        inheritsFrom: 'ohif.overlayItem',
        label: '',
        color: 'white',
        background: 'green',
        condition: ({ instance }) =>
          instance && instance.PatientName && instance.PatientName.Alphabetic,
       **contentF:** ({ instance, formatPN }) =>
          formatPN(instance.PatientName && instance.PatientName.Alphabetic),
      },

Or value:

  'microscopyViewport.overlay': {
    id: 'MicroscopyViewportOverlay',
    topLeft: [
      {
        id: 'PatientName',
        inheritsFrom: 'ohif.overlayItem',
        label: '',
        color: 'white',
        background: 'green',
        condition: ({ instance }) =>
          instance && instance.PatientName && instance.PatientName.Alphabetic,
     ** value:** ({ instance, formatPN }) =>
          formatPN(instance.PatientName && instance.PatientName.Alphabetic),
      },

Both should work the same.

Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit f5404ac
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/67bf4b998f6a47000899d544
😎 Deploy Preview https://deploy-preview-4811--ohif-platform-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.

Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for ohif-dev ready!

Name Link
🔨 Latest commit f5404ac
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/67bf4b9996ea400008d85420
😎 Deploy Preview https://deploy-preview-4811--ohif-dev.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.

@wayfarer3130 wayfarer3130 self-requested a review February 26, 2025 14:09
@@ -88,7 +88,7 @@ export const generateFromConfig = ({ config, overlayData, ...props }) => {

const itemGenerator = (props: any) => {
const { item } = props;
const { title, value: valueFunc, condition, contents } = item;
const { title, value: valueFunc, contentF: contentFunc, condition, contents } = item;
Copy link
Contributor

Choose a reason for hiding this comment

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

const { title, value: valueFunc, contentF: contentFunc = valueFunc, condition, contents } = item;
will assign to contentFunc directly

@sedghi
Copy link
Member

sedghi commented Feb 26, 2025

@mbellehumeur
What's the problem, how can we reproduce it, and what steps will confirm the fix?

Copy link
Author

@mbellehumeur mbellehumeur left a comment

Choose a reason for hiding this comment

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

I tested that it works with value as well

@wayfarer3130
Copy link
Contributor

@mbellehumeur What's the problem, how can we reproduce it, and what steps will confirm the fix?

The problem is that the configuration looks different for overlays for microscopy versus cornerstone viewports, whereas they really should be the same.

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.

3 participants