Viewers: Open the viewer with study uid

Created on 3 Feb 2020  路  5Comments  路  Source: OHIF/Viewers

Hello, I am new to using OHIF and i have no experience working with react. I wanted to open the OHIF viewer with an existing study uid. From the study list when you click on a study it will normally go to the link "index.html/viewer/{studyuid}". I can't do this directly on the browser address bar because the server will try to actually find a static resource (I am using Orthanc BTW). In angular when you have routes like this it usually have a # before the route so that you can use such URL directly on the browser address bar. Is there a way to do this in OHIF?

Community

All 5 comments

Yes, the lookup of the studyinstanceuid from the url should be a plugable function. This function could default to extract the studyinstanceuid from the url.

Or a more direct interface where the "router" logic is external and optional and the "viewer" gets the information which studies to show or whether to show the patient list via standard method calls.

Also see #1400

I support this request, this should be implemented as a function. An alternative option is to use URL rewriting in your web server. This is my working Apache HTTPD config for the embedded viewer:

<Directory /Applications/MAMP/htdocs/ohif>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.html [QSA,L]
</Directory>

In angular when you have routes like this it usually have a # before the route so that you can use such URL directly on the browser address bar. Is there a way to do this in OHIF?

What you're describing is "Hash Routing". We use React's "Browser Router" (HTML5 history API).

React Router has a few different options:

The above responses should answer your remaining points.

Thank you all for your responses. I understand the use of browser history for routing in OHIF and will have to configure the server to handle the rewrite. Thank you.

@biruk-abebe if for some reason you need to reconsider please check the following:
https://github.com/OHIF/Viewers/issues/1400

In my opinion, if you are embedding the viewer into existing web app, it would be a better approach.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MathisGuilhin picture MathisGuilhin  路  3Comments

panzhengo1 picture panzhengo1  路  3Comments

TZubiri picture TZubiri  路  3Comments

trypag picture trypag  路  4Comments

JamesAPetts picture JamesAPetts  路  3Comments