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

Properly set field TarchiveSeriesID for acquisitions that do not have an echo time #1055

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all 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
18 changes: 14 additions & 4 deletions dicom-archive/DICOM/DCMSUM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,12 @@ QUERY
?, ?
)
QUERY
my $query_select_TarchiveSeriesID = "SELECT TarchiveSeriesID FROM tarchive_series WHERE SeriesUID = ? AND EchoTime = ?";
my $select_TarchiveSeriesID = $dbh->prepare($query_select_TarchiveSeriesID);
my $query_select_TarchiveSeriesID =
"SELECT TarchiveSeriesID FROM tarchive_series WHERE SeriesUID = ? AND EchoTime = ?";
my $query_select_TarchiveSeriesID_null_echo =
"SELECT TarchiveSeriesID FROM tarchive_series WHERE SeriesUID = ?";
my $select_TarchiveSeriesID = $dbh->prepare($query_select_TarchiveSeriesID);
my $select_TarchiveSeriesID_null_echo = $dbh->prepare($query_select_TarchiveSeriesID_null_echo);
my $insert_file = $dbh->prepare($insert_query);
my $dcmdirRoot = dirname($self->{dcmdir});
foreach my $file (@{$self->{'dcminfo'}}) {
Expand All @@ -383,8 +387,14 @@ QUERY
$filename =~ s/^${dcmdirRoot}\///;
$file->[2] = undef if($file->[2] eq '');
$file->[3] = undef if($file->[3] eq '');
$select_TarchiveSeriesID->execute($file->[24], $file->[6]); # based on SeriesUID and EchoTime
my ($TarchiveSeriesID) = $select_TarchiveSeriesID->fetchrow_array();
my $TarchiveSeriesID;
if (!defined($file->[6]) || $file->[6] eq '') {
$select_TarchiveSeriesID_null_echo->execute($file->[24]); # based solely on SeriesUID
$TarchiveSeriesID = $select_TarchiveSeriesID_null_echo->fetchrow_array();
} else {
$select_TarchiveSeriesID->execute($file->[24], $file->[6]); # based on SeriesUID and EchoTime
$TarchiveSeriesID = $select_TarchiveSeriesID->fetchrow_array();
}
my @values;
if($file->[21] && $file->[25] eq 'MR') { # file is dicom and an MRI scan
@values =
Expand Down
Loading