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

[MRI Violated scans] Have the minc file linked to brainbrowser (Redmine 10928) #2219

Merged
merged 6 commits into from
Oct 4, 2016
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 7 additions & 3 deletions modules/brainbrowser/ajax/minc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@

$headers = array();

$query = "select File from files where FileID = :MincID";
$minc_file = $DB->pselectOne($query, array('MincID' => $_REQUEST['minc_id']));
$minc_file = getMincLocation() . $minc_file;
$query = "select File from files where FileID = :MincID";

if (isset($_REQUEST['minc_location'])) {
$minc_file = ($_REQUEST['minc_location']);
} else {
$minc_file = $DB->pselectOne($query, array('MincID' => $_REQUEST['minc_id']));
$minc_file = getMincLocation() . $minc_file;
}

$header = $_REQUEST['minc_headers'];
$header_data = $_REQUEST['raw_data'];
Expand Down
36 changes: 27 additions & 9 deletions modules/brainbrowser/js/brainbrowser.loris.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,24 +781,42 @@ $(function() {
}); // Should cursors in all panels be synchronized?

link = window.location.search;
var minc_tag;

minc_ids = getQueryVariable("minc_id");
if (minc_ids[0] === '[') {
// An array was passed. Get rid of the brackets and then split on ","
minc_ids = minc_ids.substring(1, minc_ids.length - 1);
minc_ids_arr = minc_ids.split(",");
if (getQueryVariable("minc_location")) {

} else {
// Only one passed
minc_ids = getQueryVariable("minc_location");
minc_ids_arr = [minc_ids];
minc_tag = "minc_location";
}


else {

minc_ids = getQueryVariable("minc_id");
minc_tag = "minc_id";

if (minc_ids[0] === '[') {

// An array was passed. Get rid of the brackets and then split on ","
minc_ids = minc_ids.substring(1, minc_ids.length - 1);
minc_ids_arr = minc_ids.split(",");

} else {

// Only one passed
minc_ids_arr = [minc_ids];
}
}



for (i = 0; i < minc_ids_arr.length; i += 1) {

minc_volumes.push({
type: 'minc',
header_url: loris.BaseURL + "/brainbrowser/ajax/minc.php?minc_id=" + minc_ids_arr[i] + "&minc_headers=true",
raw_data_url: loris.BaseURL + "/brainbrowser/ajax/minc.php?minc_id=" + minc_ids_arr[i] + "&raw_data=true",
header_url: loris.BaseURL + "/brainbrowser/ajax/minc.php?" + minc_tag + "=" + minc_ids_arr[i] + "&minc_headers=true",
raw_data_url: loris.BaseURL + "/brainbrowser/ajax/minc.php?" + minc_tag + "=" + minc_ids_arr[i] + "&raw_data=true",
template: {
element_id: "volume-ui-template4d",
viewer_insert_class: "volume-viewer-display"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
$useProjects = true;
}

$dir_path = $config->getSetting("imagePath");

$this->columns = array(
'v.PatientName',
'v.Site',
'v.TimeRun',
'v.MincFile',
'v.MincFileViolated',
'v.Series_Description as Series_Description_Or_Scan_Type',
'v.Problem',
'v.SeriesUID',
Expand All @@ -171,6 +174,7 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
c.ProjectID as Project,
s.SubprojectID as Subproject,
minc_location as MincFile,
CONCAT_WS('','" . $dir_path . "','trashbin/',SUBSTRING_INDEX(minc_location, '/', -2)) as MincFileViolated,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should use the $DB->quote function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

series_description as Series_Description,
'Could not identify scan type' as Problem,
SeriesUID,
Expand All @@ -195,6 +199,7 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
c.ProjectID as Project,
s.SubprojectID as Subproject,
MincFile,
IF(INSTR(`MincFile`, 'assembly'), IF(LEFT(`MincFile`, 8) = 'assembly',CONCAT_WS('','" . $dir_path . "',`MincFile`),`MincFile`), CONCAT_WS('','" . $dir_path . "','trashbin/',SUBSTRING_INDEX(MincFile, '/', -2))) as MincFileViolated,
Copy link
Collaborator

@driusan driusan Oct 3, 2016

Choose a reason for hiding this comment

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

This line seems really complex and hard to understand. Does whatever it's doing need to be in SQL or can it be done in code?

Either way, it should at least have a comment explaining it. (dir_path should also be quoted using the db quote function)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comments added.

mri_scan_type.Scan_type,
'Protocol Violation',
SeriesUID,
Expand All @@ -221,6 +226,7 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
c.ProjectID as Project,
s.SubprojectID as Subproject,
MincFile,
CONCAT_WS('','" . $dir_path . "','trashbin/',SUBSTRING_INDEX(MincFile, '/', -2)) as MincFileViolated,
null,
Reason,
SeriesUID,
Expand Down
4 changes: 4 additions & 0 deletions modules/mri_violations/templates/menu_mri_violations.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
{$items[item][piece].value}
</a>
</td>
{elseif $items[item][piece].name eq 'MincFileViolated'}
<td nowrap="nowrap" bgcolor="{$items[item][piece].bgcolor}">
<a href="#noID" onclick="window.open('{$baseurl}/brainbrowser/?minc_location={$items[item][piece].value}', 'BrainBrowser Volume Viewer', 'location = 0,width = auto, height = auto, scrollbars=yes')">{$items[item][piece].value}</a>
</td>
{elseif $items[item][piece].value eq 'Protocol Violation'}
<td nowrap="nowrap" bgcolor="{$items[item][piece].bgcolor}">
<a href="#" class="mri_violations" id="mri_protocol_check_violations" data-PatientName="{$items[item].PatientName}" "{if $items[item].series}" data-SeriesUID="{$items[item].series}{/if}">{{$items[item][piece].value}}</a>
Expand Down