Extension to integrate Python-based ML app

Dear community,

we are trying to create an extension to integrate a ML app. For the first version, this should be just accomplished through a simple button in the right panel calling a Python script and displaying the results.

However, when we try to develop an extension, we cannot display it in the interface or the DOM.

(prostatecancer.ai is, unfortunately, not feasible for us due to our windows OS and react framework requirements)

What we have followed:

  1. Created an extension template using the CLI
  2. Implemented index.tsx and a Panel class
  3. Linking the extension to the OHIF viewer

Problem:
Luckily, the alert shows up, i.e., the extension is correctly linked. However, we cannot get the “XAIResultsPanel” running. And, as the documentation has no specific details about OHIF v3 extension, we are unsure how to position our module in the right panel (similar to “segmentation” or “measurements” in the default viewer).

The index.tsx (simplified):

...
import { XAIResultsPanel } from './Panels';

export default {
  onModeEnter({ servicesManager }) {
    alert("viewer opened")
  },

  getPanelModule: ({
   ...
  }) => {
    const wrappedXAIPanel = () => {
      return (
        <XAIResultsPanel
          commandsManager={commandsManager}
          servicesManager={servicesManager}
          extensionManager={extensionManager}
        />
      )
    };

    return [
      {
        name: 'xai-nodule-panel',
        iconName: 'th-list',
        iconLabel: 'XAI Results',
        label: 'XAI Nodule Detection Results',
        component: XAIResultsPanel,
        defaultContext: ['VIEWER'],
      }
    ]
  },
}

The panel’s XAIResultsPanel.tsx (simplified):

import React from 'react';
import { Button, MeasurementTable, Input } from '@ohif/ui';

export default function XAIResultsPanel({ servicesManager, commandsManager, extensionManager }) {

  return (
    <div>
      <Button>Run AI</Button>
    </div>
  );
}

Do you have any ideas how we get this working?

We highly appreciate any hints.
Thank you so much in advance…

Luis

Hello and welcome to the community forum.

I suspect that the problem is that whatever mode you are running OHIF with (e.g. longitudinal), the mode is not including the panel. Have a look at modes\longitudinal\src\index.js where it specifies leftPanels and rightPanels.

Hope this helps.

Hey @jbocce ,

thank you so much - it worked! :slight_smile:

BR