diff --git a/uploadNeuroDB/NeuroDB/MRI.pm b/uploadNeuroDB/NeuroDB/MRI.pm index 5fcc19b4e..362f11c48 100755 --- a/uploadNeuroDB/NeuroDB/MRI.pm +++ b/uploadNeuroDB/NeuroDB/MRI.pm @@ -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}}).", "; } diff --git a/uploadNeuroDB/minc_insertion.pl b/uploadNeuroDB/minc_insertion.pl index e0d018814..57ee4b923 100755 --- a/uploadNeuroDB/minc_insertion.pl +++ b/uploadNeuroDB/minc_insertion.pl @@ -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')); diff --git a/uploadNeuroDB/registerFile.pl b/uploadNeuroDB/registerFile.pl index 08e1d0279..d447afa03 100755 --- a/uploadNeuroDB/registerFile.pl +++ b/uploadNeuroDB/registerFile.pl @@ -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 diff --git a/uploadNeuroDB/register_processed_data.pl b/uploadNeuroDB/register_processed_data.pl index bd69f8192..bbb9a4376 100755 --- a/uploadNeuroDB/register_processed_data.pl +++ b/uploadNeuroDB/register_processed_data.pl @@ -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"; @@ -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) {