Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ImgBrowser] Add DICOM Download #2791

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions htdocs/mri/jiv/get_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@
exit(4);
}

// If $File contains "DCM_", prefix automatically inserted by the
// LORIS-MRI pipeline, identify it as $FileExt: "DICOMTAR"
if (strpos($File, "DCM_") ) {
$FileExt = "DICOMTAR";
}

switch($FileExt) {
case 'mnc':
$FullPath = $mincPath . '/' . $File;
Expand Down Expand Up @@ -131,6 +137,12 @@
$MimeType = 'image/vnd.nrrd';
$DownloadFilename = basename($File);
break;
case 'DICOMTAR':
// ADD case for DICOMTAR
$FullPath = $imagePath . '/' . $File;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christinerogers

$imagePath can eventually be changed to get the tarchiveLibraryDir from Config table (once #2649 is merged).

$MimeType = 'application/x-tar';
$DownloadFilename = basename($File);
break;
default:
$FullPath = $DownloadPath . '/' . $File;
$MimeType = 'application/octet-stream';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,17 @@ class Imaging_Session_ControlPanel
$params['PCandID'] = $timePoint->getCandID();
$params['PVL'] = $timePoint->getVisitLabel();
}
$tarchiveIDs = $DB->pselect(
"SELECT TarchiveID
FROM tarchive

// To enable DICOM download: Add pair: tarchiveID, ArchiveLocation
$qresult = $DB->pselectRow(
"SELECT TarchiveID, ArchiveLocation
FROM tarchive
WHERE PatientName LIKE $ID",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christinerogers

not sure how to use a prepared query with $ID being defined a few lines earlier with 2 cases and the second case being a concat of 3 different variables)...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed with @AnyhowStep, and he did not see the query the way it is as a security risk.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just not obvious in the diff that $ID is safe since GitHub is hiding that part of the code unless you manually expand it..

Copy link
Contributor

@MounaSafiHarab MounaSafiHarab Jul 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christinerogers

discussed at the Imaging meeting of July 18th, 2017:

  1. pselectRow should be pselect (we might have more than one tarchiveID per session)

  2. Have the download DICOM button next to the Dicom Archive Link; and /or have the download cloud list the Dicom Tarchive ID next to it

  3. add the download cloud in the dicom archive module as well (RM #9865); @davidblader

$params
);
$subjectData['tarchiveids'] = $tarchiveIDs;
$subjectData['tarchiveids'] = $qresult['TarchiveID'];
$subjectData['tarchiveidLoc'] = (empty($qresult['ArchiveLocation'])) ? ""
: $qresult['ArchiveLocation'];

$config =& NDB_Config::singleton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
<li><a href="{$baseurl}/{$subject.candid}/{$subject.sessionID}/radiology_review/?commentID={$subject.RadiologyReviewCommentID}">Radiology Review</a></li>
{/if}
{foreach from=$subject.tarchiveids item=tarchive}
<li><a href="{$baseurl}/dicom_archive/viewDetails/?tarchiveID={$tarchive.TarchiveID}&backURL={$backURL|escape:"url"}">DICOM Archive {$tarchive.TarchiveID}</a></li>{/foreach}
<li><a href="{$baseurl}/dicom_archive/viewDetails/?tarchiveID={$tarchive}&backURL={$backURL|escape:"url"}">DICOM Archive(s) {$tarchive}</a></li>
{/foreach}
{foreach from=$subject.tarchiveidLoc item=tarchiveLoc}
<li><a href="/mri/jiv/get_file.php?file=tarchive/{$tarchiveLoc}" class="btn btn-primary btn-small">
Copy link
Contributor

@MounaSafiHarab MounaSafiHarab May 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christinerogers

once this is merged (#2649); and get_file.php is made to use the Config variable tarchiveLibraryDir, the hardcoded tarchive in file=tarchive/{$tarchiveLoc} can be removed

<span class="glyphicon glyphicon-cloud-download"></span><span class="hidden-xs"> Download DICOM</span>
</a></li>
{/foreach}
{if $mantis}
<li><a target="mantis" href="{$mantis}">Report a Bug (Mantis)</a></li>
{/if}
Expand Down