-
Notifications
You must be signed in to change notification settings - Fork 175
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
[ImgBrowser] Add DICOM Download #2791
Conversation
// To enable DICOM download: Add pair: tarchiveID, ArchiveLocation | ||
$tarchiveIDLoc = $DB->pselect( | ||
"SELECT TarchiveID, ArchiveLocation | ||
FROM tarchive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a prepared statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the catch 👍
Clicking on the download link doesn't do anything. @mohadesz -- Are your Dicom tarchives (and above directories) Executable? (will only work if so, i'll amend the PR blurb at top) |
I meant to push to your branch not this pull request; I did not know it would make it directly here without you approving it first. Sorry! |
htdocs/mri/jiv/get_file.php
Outdated
@@ -136,10 +136,10 @@ | |||
$MimeType = 'image/vnd.nrrd'; | |||
$DownloadFilename = basename($File); | |||
break; | |||
case 'DICOMTAR': | |||
case 'tar': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MounaSafiHarab - good improvement to just handle all Tars.
- if using 'tar' over DICOMTAR, let's also remove the code at that sets $FileExt = 'DICOMTAR'
- I specified dicomtar, envisioning that Media Module etc might store other tars of stimulus files, or other non-imaging tars stored elsewhere (even genetics). i.e. Will all future tars in Loris be images accessible on the Imaging path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the last commit,
- I switched it back to have the option to allow other tar to be downloaded (so I went back to dicomtar), but I changed the "trachive" to "DCM_" which is automatically appended by the pipeline (tarchive no longer exists in the archivelocation as it is now a relative location).
- ran phpcs
@@ -131,6 +137,12 @@ | |||
$MimeType = 'image/vnd.nrrd'; | |||
$DownloadFilename = basename($File); | |||
break; | |||
case 'DICOMTAR': | |||
// ADD case for DICOMTAR | |||
$FullPath = $imagePath . '/' . $File; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$imagePath can eventually be changed to get the tarchiveLibraryDir from Config table (once #2649 is merged).
<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"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
// To enable DICOM download: Add pair: tarchiveID, ArchiveLocation | ||
$qresult = $DB->pselectRow( | ||
"SELECT TarchiveID, ArchiveLocation | ||
FROM tarchive | ||
WHERE PatientName LIKE $ID", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed at the Imaging meeting of July 18th, 2017:
-
pselectRow should be pselect (we might have more than one tarchiveID per session)
-
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
-
add the download cloud in the dicom archive module as well (RM #9865); @davidblader
I'm using a different approach now; these changes shouldn't cause any issues. Removing the |
for item 1. above, please see this: |
@christinerogers |
|
Closing. |
This pull request adds DICOM download to the Imaging Browser View Session page, via a button in the navigation panel.
All files for the given session (specifically, tarchiveID) will be downloaded.
get_file.php is also modified to identify DICOM tarchives as type of file for download.
Note that your Dicom tarchives (and above directories) must be Executable* (unix permission-wise) for the download (get_file.php) to work.