Skip to content

Latest commit

 

History

History
251 lines (181 loc) · 7.87 KB

2024-08-08.md

File metadata and controls

251 lines (181 loc) · 7.87 KB

OHIF Office Hours Notes 2024-08-08

Q & A

Attendees: 14

Discussed:

🖼️ OHIF is able to render images with missing required metatdata like pixel spacing, aspect ratio. Same image, when trying to render using cornerstone3d's example code, crashes the application. Does OHIF use some sane defaults?

A: OHIF uses a separate metadata provider than Cornerstone. The main differences are:

  1. OHIF uses metadata providers with priorities, including a custom one from DCMJS metadata.
  2. Cornerstone by default uses metadata providers in WADO-RS and WADO-URI.
  3. OHIF can use instance metadata directly.

To troubleshoot:


🔄 How can we detect if the image is rendered from scrolling (ScrollMouseWheelTool or StackScrollTool) when we use image_rendered events?

A: To detect when scrolling reaches the end of a stack:

  1. Modify the scroll function in the StackViewport:
const imageIdIndex = viewport.getCurrentImageIdIndex();

if (imageIdIndex + delta > viewport.getImageIds().length - 1) {
  // fire out of bound for stack viewport
  viewport.eventTarget.dispatchEvent(new CustomEvent('stackScrollOutOfBounds', {
    detail: { viewport, imageIdIndex, delta }
  }));
}
  1. Add this check in the scroll function of the StackViewport.
  2. Listen for the 'stackScrollOutOfBounds' event in your application.

Consider submitting a PR to add this functionality to Cornerstone.


📋 Where is WorkList (WorkList.tsx) been used or called in OHIF? If I want to popup a window (in OHIF application) that shows a study list using the similar style of WorkList, what is the suggested way to do it?

A: The WorkList is called in the route configuration:

  1. Check platform/app/src/routes/index.tsx for the WorkList route.
  2. For pop-up windows, use the UI Modal Service:
import { uiModalService } from '@ohif/core';

uiModalService.show({
  content: YourCustomComponent,
  title: 'Your Pop-up Title',
  contentProps: {
    // Props for your custom component
  },
  containerDimensions: 'w-[70%] max-w-[900px]',
});

Refer to the OHIF documentation for more details on using the UI Modal Service: https://docs.ohif.org/platform/services/ui/ui-modal-service


🔐 How can we pass headers to orthanc? For example sending an Authorization token header to a secure Orthanc server. I have tried sending them through beforeSend hook on the initWadoImageLeader but still nothing is getting sent

A: To pass headers to Orthanc:

  1. In the DicomWebDataSource (index.js), modify the getAuthorizationHeader function:

function getAuthorizationHeader() { return { Authorization: 'Bearer your-token-here' }; }

  1. Ensure this function is called when setting up the QIDO headers.
  2. For CORS issues, you may need to configure your Orthanc server to accept the Authorization header in preflight requests.
  3. Check server logs to ensure the header is being received and processed correctly.

If issues persist, consider using the OHIF Orthanc deployment guide with Keycloak for a more robust authentication setup.


📊 How to specify hanging protocol constraints with functions. Example: if there are two studies: have a 2 x 2 layout: FLAIR (1) | FLAIR(2) DWI(1) | DWI(2). This works if I specify ClinicalTrialTimePointID - but can it work off of Study Date? If there were multiple priors - it would sort them so that the latest one was on the left and the older prior on the right.

A: You can use custom attributes in hanging protocols:

  1. In your mode's init function, register a custom attribute:
hangingProtocolService.addCustomAttribute(
  'studyDate',
  'Study Date',
  (study) => {
    // Extract and return the study date
    return study.studyDate;
  }
);

2. Use this custom attribute in your hanging protocol definition:

{
  id: 'twoStudyComparison',
  hasUpdatedPriorsInformation: true,
  displaySetSelectors: {
    flair: {
      seriesDescription: 'FLAIR',
    },
    dwi: {
      seriesDescription: 'DWI',
    },
  },
  stages: [
    {
      id: 'twoByTwo',
      viewportStructure: {
        type: 'grid',
        properties: {
          rows: 2,
          columns: 2,
        },
      },
      viewports: [
        // ... viewport configurations ...
      ],
    },
  ],
  studyMatchingRules: {
    studies: {
      currentStudy: {
        studyInstanceUid: {
          equals: {
            value: '@firstStudy',
          },
        },
      },
      priorStudy: {
        studyInstanceUid: {
          notEquals: {
            value: '@firstStudy',
          },
        },
        studyDate: {
          lessThan: {
            value: '@firstStudy.studyDate',
          },
        },
      },
    },
  },
}

This setup will use study dates to arrange the viewports, with the most recent study on the left and older studies on the right.


📅 When is 3.9 going to be out of beta?

A: The release of OHIF 3.9 is expected around the end of September or early October. Key points:

  • Many features are 90% complete
  • UI revamp for responsiveness (tablet and mobile) took longer than expected
  • Segmentation work in Cornerstone required significant reworking
  • Some lower priority items may be postponed

Users can cherry-pick specific commits for urgent fixes if needed before the official release.


📦 Getting error when installing dependencies. For example (npm install react-query). How can I install any package in the OHIF project. Right now I cant install any.

A: To install dependencies in the OHIF monorepo:

  1. Go to platform/app/package.json
  2. Add the dependency to the dependencies object:
"dependencies": {
  "react-query": "^3.39.2"
}
  1. Run yarn install from the root of the project

Alternatively, you can add the dependency to the root package.json if it's needed across multiple packages.


🖌️ I am trying to add a new component called PlanarFreehandContourSegmentation but when I try to run it I get the "A contour must be active" error

A: To use segmentation tools in OHIF:

  1. Create a segmentation first:
segmentationService.createSegmentation({
  representationType: 'CONTOUR',
});
  1. Ensure you have the correct segmentation representation for your tool
  2. Add the segmentation to the toolGroup:
segmentationService.addSegmentationRepresentationToToolGroup(toolGroupId, segmentationId);
  1. Activate the segmentation:
segmentationService.setActiveSegmentationForToolGroup(toolGroupId, segmentationId);

For more details, refer to the Cornerstone 3D documentation on segmentation: https://www.cornerstonejs.org/docs/concepts/cornerstone-tools/segmentation/


🖥️ I noticed when running commandsManager.runCommand('setWindowLevel', { window: instance.window_width[0], level: instance.window_center[0], }); that sometimes it will silently fail. Some window width and level values will just be ignored or not work. Are there limits to the WWLC that are valid for a series that is displayed in the viewport?

A: The silent failure of setWindowLevel command could be due to:

  1. Race conditions (command executed before viewport is fully initialized)
  2. Invalid window/level values for the specific image data

To troubleshoot:

  1. Wrap the command in a setTimeout to rule out race conditions:
setTimeout(() => {
  commandsManager.runCommand('setWindowLevel', {
    window: instance.window_width[0],
    level: instance.window_center[0],
  });
}, 2000);
  1. Add debugger statements in the setVOIGPU function in Cornerstone to see where it might be failing
  2. Ensure the window/level values are within the valid range for the image data
  3. Consider adding error handling or logging in the setWindowLevel command implementation

If the issue persists, it may be worth opening a GitHub issue with a reproducible example.