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

Move minc pics creation to MRI.pm #149

Merged
merged 3 commits into from
Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions uploadNeuroDB/NeuroDB/MRI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,36 @@ sub make_nii {
$file->setParameter('check_nii_filename', $nifti);
}

=pod
Creates pics associated with MINC files
=cut
sub make_minc_pics {
my ($dbhr, $TarchiveSource, $profile, $minFileID) = @_;
my $where = "WHERE TarchiveSource = ? ";
my $query = "SELECT Min(FileID) AS min, Max(FileID) as max FROM files ";
$query = $query . $where;
my $sth = $${dbhr}->prepare($query);
$sth->execute($TarchiveSource);
print "TarchiveSource is " . $TarchiveSource . "\n";

Copy link
Contributor

Choose a reason for hiding this comment

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

@gluneau

I think the print statement was added for debugging purposes (original file did not have it)

my $script = undef;
my $output = undef;
my @row = $sth->fetchrow_array();
if (@row) {
$script = "mass_pic.pl -minFileID $row[$minFileID] -maxFileID $row[1] ".
"-profile $profile";
print "Running mass_pic as follows : " .$script . "\n";

Copy link
Contributor

Choose a reason for hiding this comment

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

@gluneau

  1. same comment re. "print" statement
  2. original script had -verbose option appended to the $script command if $verbose is set (you will probably need to pass this variable along with the function call), so it is good to keep this so that it is consistent with what we had before

############################################################
## Note: system call returns the process ID ################
## To get the actual exit value, shift right by eight as ###
## done below ##############################################
############################################################
$output = system($script);
$output = $output >> 8;
}
}

=pod
B<DICOMDateToUnixTimestamp( C<$dicomDate> )>
Converts a DICOM date field (YYYYMMDD) into a unix timestamp
Expand Down
31 changes: 6 additions & 25 deletions uploadNeuroDB/tarchiveLoader
Original file line number Diff line number Diff line change
Expand Up @@ -486,32 +486,13 @@ if ($valid_study) {
############################################################
############# Create minc-pics #############################
############################################################
print "\nCreating Minc Pics\n" if $verbose;
NeuroDB::MRI::make_minc_pics(\$dbh,
$tarchiveInfo{TarchiveID},
$profile,
0); # minFileID $row[0]
# maxFileID $row[1]

$where = "WHERE TarchiveSource =? ";
$query = "SELECT Min(FileID) AS min, Max(FileID) as max FROM files ";
$query = $query . $where;
if ($debug) {
print $query . "\n";
}
my $sth = $dbh->prepare($query);
$sth->execute($tarchiveInfo{TarchiveID});
my @row = $sth->fetchrow_array();
if (@row) {
my $script = "mass_pic.pl -minFileID $row[0] -maxFileID $row[1] ".
"-profile $profile ";
if ($verbose) {
$script .= " -verbose";
}
############################################################
## Note: system call returns the process ID ################
## To get the actual exit value, shift right by eight as ###
## done below ##############################################
############################################################
$output = system($script);
$output = $output >> 8;

}

############################################################
# spool a new study message ################################
############################################################
Expand Down