Skip to content

Commit

Permalink
Added a ScannerID column to files table: Redmine 10939 (#156)
Browse files Browse the repository at this point in the history
* Added a ScannerCandID column to files table: Redmine 10939

* Populate ScannerID not ScannerCandID

* better way to populate the scannerID in files table

* updated DTIPrep files
  • Loading branch information
MounaSafiHarab authored and driusan committed Sep 28, 2016
1 parent b16d909 commit eb0910e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion uploadNeuroDB/NeuroDB/MRI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ sub register_db {
# build the insert query
my $query = "INSERT INTO files SET ";

foreach my $key ('File', 'SessionID','EchoTime', 'CoordinateSpace', 'OutputType', 'AcquisitionProtocolID', 'FileType', 'InsertedByUserID', 'Caveat', 'SeriesUID', 'TarchiveSource','SourcePipeline','PipelineDate','SourceFileID') {
foreach my $key ('File', 'SessionID','EchoTime', 'CoordinateSpace', 'OutputType', 'AcquisitionProtocolID', 'FileType', 'InsertedByUserID', 'Caveat', 'SeriesUID', 'TarchiveSource','SourcePipeline','PipelineDate','SourceFileID', 'ScannerID') {
# add the key=value pair to the query
$query .= "$key=".$dbh->quote($${fileData{$key}}).", ";
}
Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/minc_insertion.pl
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
## at this point things will appear in the database ############
## Set some file information ###################################
################################################################
$file->setParameter('ScannerID', $scannerID);
$file->setFileData('ScannerID', $scannerID);
$file->setFileData('SessionID', $sessionID);
$file->setFileData('SeriesUID', $file->getParameter('series_instance_uid'));
$file->setFileData('EchoTime', $file->getParameter('echo_time'));
Expand Down
2 changes: 1 addition & 1 deletion uploadNeuroDB/registerFile.pl
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
$file->getParameter('software_versions'),
$centerID,
\$dbh, 0);
$file->setParameter('ScannerID', $scannerID);
$file->setFileData('ScannerID', $scannerID);
print "Set scannerid = $scannerID\n" if $verbose;

# get ids from the headers
Expand Down
11 changes: 5 additions & 6 deletions uploadNeuroDB/register_processed_data.pl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
print LOG "\nERROR: could not determine scannerID based on sourceFileID $sourceFileID.\n\n";
exit 2;
}
$file->setParameter('ScannerID',$scannerID);
$file->setFileData('ScannerID',$scannerID);
print LOG "\t -> Set ScannerID to $scannerID.\n";


Expand Down Expand Up @@ -302,16 +302,15 @@ sub getSessionID {


=pod
This function gets ScannerID from parameter_file using sourceFileID
This function gets ScannerID from files using sourceFileID
=cut
sub getScannerID {
my ($sourceFileID,$dbh) = @_;

my $scannerID;
my $query = "SELECT pf.Value AS ScannerID " .
"FROM parameter_file AS pf " .
"JOIN parameter_type AS pt ON (pt.ParameterTypeID=pf.ParameterTypeID) " .
"WHERE pt.Name='ScannerID' AND pf.FileID=?";
my $query = "SELECT f.ScannerID AS ScannerID " .
"FROM files AS f " .
"WHERE f.FileID=?";
my $sth = $dbh->prepare($query);
$sth->execute($sourceFileID);
if($sth->rows > 0) {
Expand Down

0 comments on commit eb0910e

Please sign in to comment.