Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

OHIF error when opening studies

Open marcopin opened this issue 6 years ago • 28 comments

I'm using lastest ohif viewer with docker (ohif/viewer:lastest), and I have configured to read my local images (dcm4chee). But when I try to open more of my studies I get this message:

Something went wrong in ViewerMain ViewerMain: windowWidth.toFixed is not a function

Captura de Pantalla 2020-10-29 a la(s) 8 49 11 p  m

And no images is shown.

marcopin avatar Oct 30 '20 00:10 marcopin

Additional: Stack Trace:

in ViewportOverlay in div in div in CornerstoneViewport in ConnectFunction in OHIFCornerstoneViewport in Suspense in OHIFCornerstoneViewport in ExtendedOHIFCornerstoneViewport in div in ViewportPane in div in ViewportGrid in ConnectFunction in div in ViewerMain in ConnectFunction in ErrorBoundary in OHIFErrorBoundary in ErrorBoundaryDialog in div in div in Viewer in WrappedComponent in ConnectFunction in ViewerRetrieveStudyData in ConnectFunction in ViewerRouting in AsyncComponent in ErrorBoundary in OHIFErrorBoundary in Transition in CSSTransition in Route in OHIFStandaloneViewer in ConnectFunction in withRouter(Connect(OHIFStandaloneViewer)) in Unknown in Unknown in ModalProvider in DialogProvider in SnackbarProvider in Router in BrowserRouter in I18nextProvider in AppProvider in Provider in ErrorBoundary in OHIFErrorBoundary in App

marcopin avatar Oct 30 '20 00:10 marcopin

Study failing (one from some others):

https://drive.google.com/file/d/1GGzKjVCB7t3ItrzeR96SB7p_f1hb_esL/view?usp=sharing

marcopin avatar Nov 02 '20 23:11 marcopin

Same here

brucedesa avatar Nov 12 '20 19:11 brucedesa

same here

nisalupendra avatar Nov 13 '20 15:11 nisalupendra

Same issue here

barthelemyleveque avatar Nov 17 '20 18:11 barthelemyleveque

Facing same issue. Any solution for this ? Error: Something went wrong in ViewerMain

ViewerMain: windowWidth.toFixed is not a function

in ViewportOverlay (created by CornerstoneViewport) in div (created by CornerstoneViewport) in div (created by CornerstoneViewport) in CornerstoneViewport (created by ConnectFunction) in ConnectFunction (created by OHIFCornerstoneViewport) in OHIFCornerstoneViewport (created by OHIFCornerstoneViewport) in Suspense (created by OHIFCornerstoneViewport) in OHIFCornerstoneViewport (created by ExtendedOHIFCornerstoneViewport) in ExtendedOHIFCornerstoneViewport (created by ViewportGrid) in div (created by ViewportPane) in ViewportPane (created by ViewportGrid) in div (created by ViewportGrid) in ViewportGrid (created by ConnectFunction) in ConnectFunction (created by ViewerMain) in div (created by ViewerMain) in ViewerMain (created by ConnectFunction) in ConnectFunction (created by Viewer) in ErrorBoundary (created by OHIFErrorBoundary) in OHIFErrorBoundary (created by ErrorBoundaryDialog) in ErrorBoundaryDialog (created by Viewer) in div (created by Viewer) in div (created by Viewer) in Viewer (created by WrappedComponent) in WrappedComponent (created by ConnectFunction) in ConnectFunction (created by ViewerRetrieveStudyData) in ViewerRetrieveStudyData (created by ConnectFunction) in ConnectFunction (created by ViewerRouting) in ViewerRouting (created by AsyncComponent) in AsyncComponent (created by Context.Consumer) in ErrorBoundary (created by OHIFErrorBoundary) in OHIFErrorBoundary (created by Context.Consumer) in Transition (created by CSSTransition) in CSSTransition (created by Context.Consumer) in Route (created by OHIFStandaloneViewer) in OHIFStandaloneViewer (created by ConnectFunction) in ConnectFunction (created by Context.Consumer) in withRouter(Connect(OHIFStandaloneViewer)) (created by Component) in Unknown (created by Component) in Component (created by App) in ModalProvider (created by App) in DialogProvider (created by App) in SnackbarProvider (created by App) in Router (created by BrowserRouter) in BrowserRouter (created by App) in I18nextProvider (created by App) in AppProvider (created by App) in Provider (created by App) in ErrorBoundary (created by OHIFErrorBoundary) in OHIFErrorBoundary (created by App) in App (created by HotExportedApp) in AppContainer (created by HotExportedApp) in HotExportedApp

SivanRAVSoft avatar Dec 01 '20 12:12 SivanRAVSoft

I have the same bug with dcm4chee-arc-psql:5.22.6-secure-ui. 5.22.5 works without issues. I suggest using that version as a workaround for now.

davidthemaster30 avatar Dec 14 '20 05:12 davidthemaster30

I have the same bug with dcm4chee-arc-psql:5.22.6-secure-ui. 5.22.5 works without issues. I suggest using that version as a workaround for now.

can you share your yml file?

proteeti13 avatar Jan 04 '21 15:01 proteeti13

sorry I can't share the full yml file, but just add the version tags to your dcm4chee service in your yml like this:

version: "3.7"
services:
    archive:
      image: dcm4che/dcm4chee-arc-psql:5.22.5-secure-ui
	/* ... */
    pgdb:
      image: dcm4che/postgres-dcm4chee:12.2-22
	/* ... */
    keycloak:
      image: dcm4che/keycloak:11.0.2
	/* ... */
    ldap:
      image: dcm4che/slapd-dcm4chee:2.4.50-22.5

davidthemaster30 avatar Jan 04 '21 21:01 davidthemaster30

@davidthemaster30 thanks! I tried but it didn't resolve my error!

ptt-bs23 avatar Jan 05 '21 08:01 ptt-bs23

The error is not from OHIF Viewer, but the dependent library "react-cornerstone-viewport". You can change var wwwc = "W: ".concat(windowWidth.toFixed(0), " L: ").concat(windowCenter.toFixed(0)); into var wwwc = "W: ".concat(Number(windowWidth).toFixed(0), " L: ").concat(Number(windowCenter).toFixed(0));

in the ./node_modules/react-cornerstone-viewport/dist/index.umd.js.

bianyueyan avatar Feb 02 '21 09:02 bianyueyan

The error is not from OHIF Viewer, but the dependent library "react-cornerstone-viewport". You can change var wwwc = "W: ".concat(windowWidth.toFixed(0), " L: ").concat(windowCenter.toFixed(0)); into var wwwc = "W: ".concat(Number(windowWidth).toFixed(0), " L: ").concat(Number(windowCenter).toFixed(0));

in the ./node_modules/react-cornerstone-viewport/dist/index.umd.js.

This solution seems to work. Thanx @bianyueyan

marcopin avatar Feb 03 '21 21:02 marcopin

Hi @bianyueyan I'm using latest ohif viewer from docker in debian 10, can you help me?, i have been searching index.umd.js, but I can not find it :(

Thanks

eanzuresb avatar Feb 13 '21 03:02 eanzuresb

you won't find index.umd.js in 'ohif/viewer:latest' on docker, because it's already compiled. You need change it before it's compiled, so you'll need to make you own Dockerfile. You can base your own on the one that's used for the official build https://github.com/OHIF/Viewers/blob/master/Dockerfile

FYI,

        var wwwc = "W: ".concat(windowWidth.toFixed(0), " L: ").concat(windowCenter.toFixed(0));

is on line 7066 in "node_modules/react-cornerstone-viewport/dist/index.umd.js". the node_modules folder is only created when "yarn install" is executed.

davidthemaster30 avatar Feb 14 '21 17:02 davidthemaster30

Just tested the fix, and it does get rid on the error. But images appear either solid white or solid black.

davidthemaster30 avatar Feb 14 '21 21:02 davidthemaster30

I checked this issue in the releases @ohif:[email protected] I was able to connect to my dcm4chee:5.22.6 instance by downgrading to @ohif:[email protected]. Haven't tested for releases 3.x.

The error is not from OHIF Viewer, but the dependent library "react-cornerstone-viewport". You can change var wwwc = "W: ".concat(windowWidth.toFixed(0), " L: ").concat(windowCenter.toFixed(0)); into var wwwc = "W: ".concat(Number(windowWidth).toFixed(0), " L: ").concat(Number(windowCenter).toFixed(0));

in the ./node_modules/react-cornerstone-viewport/dist/index.umd.js.

By performing these changes in the latest version series of other errors appeared for me:

  1. Window level adjustment gets extremely sensitive, eventually getting to NaN values;
  2. Couldn't use 2D MPR. It throws javascript errors;
  3. Many studies won't load, rendering errors;

I could open different issues for each case. But I could not use ohif viewer's latest versions connected to dcm4chee 5.

ken-proradis avatar Feb 23 '21 16:02 ken-proradis

thanks @ken-proradis ohif/viewer:v2.11.8.7749 (the latest v2 version) works!. I also tried the v3 (ohif/viewer:v3.11.11.11515, the latest v3) and it has the same error as v4.

davidthemaster30 avatar Feb 24 '21 02:02 davidthemaster30

This errors appear when the metadata is formed. On old dcm4chee arc WindowCenter and WindowWidth appear as number, float or integer in the metadata as is expected . I don't know why at this time why this happen, But I tested here and changed on metadataprovider

    const windowCenter = Array.isArray(WindowCenter)
      ? WindowCenter
      : [WindowCenter];
    const windowWidth = Array.isArray(WindowWidth)
      ? WindowWidth
      : [WindowWidth];

to const windowCenter = Array.isArray(WindowCenter) ? Number(WindowCenter) : Number([WindowCenter]); const windowWidth = Array.isArray(WindowWidth) ? Number(WindowWidth) : Number([WindowWidth]);

And all worked as the past with CR and DR images.

This workaround will not working with CT modalities.

gccgomes avatar Feb 24 '21 18:02 gccgomes

I changed

      rescaleIntercept: instance.RescaleIntercept,
      rescaleSlope: instance.RescaleSlope,

to rescaleIntercept: Number(instance.RescaleIntercept), rescaleSlope: Number(instance.RescaleSlope),

in the "MetadataProvider.js"

it is working for CT modalities.

bianyueyan avatar Mar 08 '21 16:03 bianyueyan

@bianyueyan thank you. I can go further based on your solution.

I modified Metadata.js and add this lines, and removed all modifications on MetadataProvider.

getData() { this.metadataSanitizer(this._data) return this._data; }

metadataSanitizer( data ){

if((typeof data.metadata )!= 'undefined' ){
  data.metadata.WindowCenter = parseInt(data.metadata.WindowCenter,10)
  data.metadata.WindowWidth = parseInt(data.metadata.WindowWidth,10)
  data.metadata.RescaleIntercept = parseFloat(data.metadata.RescaleIntercept,10)
  data.metadata.RescaleSlope = parseInt(data.metadata.RescaleSlope,10)
  data.metadata.DataCollectionDiameter =parseFloat(data.metadata.DataCollectionDiameter,10)
  data.metadata.Exposure =parseInt(data.metadata.Exposure,10)
  data.metadata.ExposureTime =parseInt(data.metadata.ExposureTime,10)
  data.metadata.GantryDetectorTilt =parseFloat(data.metadata.GantryDetectorTilt,10)
  data.metadata.GeneratorPower =parseInt(data.metadata.GeneratorPower,10)
  data.metadata.InstanceNumber =parseInt(data.metadata.InstanceNumber,10)
  data.metadata.KVP =parseInt(data.metadata.KVP,10)
  data.metadata.ReconstructionDiameter=parseFloat(data.metadata.ReconstructionDiameter,10)
  data.metadata.SeriesNumber =parseInt(data.metadata.SeriesNumber,10)
  data.metadata.SliceThickness =parseFloat(data.metadata.SliceThickness,10)
  data.metadata.TableHeight  =parseFloat(data.metadata.TableHeight,10)
  data.metadata.XRayTubeCurrent =parseInt(data.metadata.XRayTubeCurrent,10)
  data.metadata.SliceLocation=parseInt(data.metadata.SliceLocation,10)
  if(data.metadata.hasOwnProperty("PixelSpacing")){
    data.metadata.PixelSpacing[0]=parseFloat(data.metadata.PixelSpacing[0],10)
    data.metadata.PixelSpacing[1]=parseFloat(data.metadata.PixelSpacing[1],10)
  }
  if(data.metadata.hasOwnProperty("ImagePositionPatient")){
    data.metadata.ImagePositionPatient[0]=parseFloat(data.metadata.ImagePositionPatient[0],10)
    data.metadata.ImagePositionPatient[1]=parseFloat(data.metadata.ImagePositionPatient[1],10)
    data.metadata.ImagePositionPatient[2]=parseFloat(data.metadata.ImagePositionPatient[2],10)
  }
  if(data.metadata.hasOwnProperty("ImageOrientationPatient")){
    data.metadata.ImageOrientationPatient[0]=parseFloat(data.metadata.ImageOrientationPatient[0],10)
    data.metadata.ImageOrientationPatient[1]=parseFloat(data.metadata.ImageOrientationPatient[1],10)
    data.metadata.ImageOrientationPatient[2]=parseFloat(data.metadata.ImageOrientationPatient[2],10)
    data.metadata.ImageOrientationPatient[3]=parseFloat(data.metadata.ImageOrientationPatient[3],10)
    data.metadata.ImageOrientationPatient[4]=parseFloat(data.metadata.ImageOrientationPatient[4],10)
    data.metadata.ImageOrientationPatient[5]=parseFloat(data.metadata.ImageOrientationPatient[5],10)
  }
  if(data.metadata.hasOwnProperty("FocalSpots")){
    data.metadata.FocalSpots[0]=parseFloat(data.metadata.FocalSpots[0],10)
    data.metadata.FocalSpots[1]=parseFloat(data.metadata.FocalSpots[1],10)
  }
}

}

gccgomes avatar Mar 08 '21 20:03 gccgomes