Url launch parameters for PacsOne?

Most commonly desired features to be implemented in PacsOne
Post Reply
wtang
Posts:14
Joined:Thu Mar 09, 2006 4:37 pm
Url launch parameters for PacsOne?

Post by wtang » Wed Feb 27, 2008 7:30 pm

I am looking at a web based RIS system that lets users click on a patient study to automatically launch a web PACS to view the images. It does this by calling the URL of a web PACS with parameters. Is there any way to have my RIS launch PacsOne by passing URL parameters? In other words, is there a way to launch PacsOne in a web browser so that the user doesn't have to manually log into PacsOne, and to go directly to the selected study page in PacsOne automatically?

If not, do you know if there is a way to launch Radscaper from my RIS so that Radscaper can automatically load and display the selected study. In other words, can Radscaper be launched and query the PacsOne database for the study images without having to manually log into PacsOne first?

Thanks for any help.

Regards,
Warren Tang
Richmond Hill Radiology

pacsone
Site Admin
Posts:3149
Joined:Tue Sep 30, 2003 2:47 am

Post by pacsone » Thu Feb 28, 2008 12:51 am

Yes, it's very easy to URL link to the PacsOne web pages from your RIS, you just need to pass the user authentication information via the http POST request. For example, you can use the following template and save it into a new PHP script php/risAccess.php under the directory where PacsOne is installed:

Code: Select all

<?php
function isIpAddress($ip_addr)
{
    $num="(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
    return preg_match("/^$num\\.$num\\.$num\\.$num$/", $ip_addr);
}

session_start();

include_once 'database.php';
include_once 'sharedData.php';

$url = parse_url($_SERVER['HTTP_REFERER']);
$refer = $url['host'];

$hostname = "your.ris.host";
$ipaddr = "192.168.0.100";

// verify hostname or IP address
if ( !isIpAddress($refer) && strcasecmp($hostname, $refer)  )
    die('<h2><font color=red>Unauthorized Hostname!</font></h2>');

if (isIpAddress($refer) && strcasecmp($ipaddr, $refer))
    die('<h2><font color=red>Unauthorized IP Address!</font></h2>');
if (!isset($_POST['key']))
    die('<h2><font color=red>A Study Search Key Must Be Specified!</font></h2>');
if (!isset($_POST['value']))
    die('<h2><font color=red>A Study Search Value Must Be Specified!</font></h2>');
if (!isset($_POST['username']))
    die('<h2><font color=red>A Valid Username Must Be Specified!</font></h2>');
if (!isset($_POST['password']))
    die('<h2><font color=red>A Valid Password Must Be Specified!</font></h2>');
if (!isset($_REQUEST['database']))
    die('<h2><font color=red>A Valid Database Must Be Specified!</font></h2>');
// user authentication
$database = $_POST['database'];
$username = $_POST['username'];
$password = $_POST['password'];
$dbcon = new MyDatabase("localhost", $database, $username, $password);
$key = urldecode($_POST['key']);
$value = urldecode($_POST['value']);
$query = "select uuid from study where $key LIKE '$value%';";
$result = $dbcon->query($query);
global $PRODUCT;
print "<html>\n";
print "<head><title>$PRODUCT - Show Images</title></head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head>\n";
print "<body leftmargin=\"0\" topmargin=\"0\" bgcolor=\"#cccccc\">\n";
if (!$result)
    die("<h2><font color=red>Error querying $PRODUCT database!</font></h2>");
if (!$dbcon->num_rows($result))
    die('<h2>No Matching Study Found.</h2>');
$row = $dbcon->fetch_row($result);
$uid = $row[0];
// save login information
$_SESSION['authenticatedDatabase'] = $database;
$_SESSION['authenticatedUser'] = $username;
$_SESSION['authenticatedPassword'] = $password;

$uids = array();
$resultSeries = $dbcon->query("SELECT uuid FROM series where studyuid='$uid' ORDER BY seriesnumber ASC;");
while ($rowSeries = $dbcon->fetch_array($resultSeries))
{
    $seriesUid = $rowSeries[0];
    $result = $dbcon->query("SELECT uuid FROM image where seriesuid='$seriesUid' ORDER BY instance ASC;");
    while ($row = $dbcon->fetch_array($result)) {
        $uids[] = $row[0];
    }
}

include_once 'applet.php';
if (count($uids))
    appletViewer($uids);
else
    print "<p>No image to display.<br>";
require 'footer.php';
print "</body>\n";
print "</html>\n";
?>
Then create the following URL link in your RIS page:

Code: Select all

<form method="POST" action="http://pacsone.domainname/pacsone/risAccess.php">"
<input type="hidden" name="database" value="$database">
<input type="hidden" name="username" value="$username">
<input type="hidden" name="password" value="$password">
<input type="hidden" name="key" value="$key">
<input type="hidden" name="value" value="$value">
<input type="submit" value="View Study">
So your RIS page needs to pass the above 5 http POST variables to PacsOne to access a subject study:

$database - The name of the PacsOne Server database
$username - A valid Mysql username to access the database
$password - The password for the MySQL username above
$key/$value - A key/value pair that identifies the study

For example, you can use:

$key = "uid"
$value = "1.2.840.xxxxx" which is the Study Instance UID of the subject study

Or you can use:

$key = "accessionnum"
$value = Accession Number of the subject Study.

Post Reply