Skip to content

Adopt new DICOM study importer in the MRI pipeline #1264

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

Merged
Merged
Show file tree
Hide file tree
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
28 changes: 16 additions & 12 deletions dicom-archive/dicomTar.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# J-Sebastian Muehlboeck 2006
# sebas@bic.mni.mcgill.ca
# Archive your dicom data using DICOM::DCMSUM
# Archive your dicom data using DICOM::DCMSUM
# Tar and gzip dicom files and retar them with pertaining summary and creation log
# @VERSION : $Id: dicomTar.pl 9 2007-12-18 22:26:00Z jharlap $

Expand Down Expand Up @@ -133,6 +133,10 @@ =head2 Methods
exit."],
);

print STDERR "WARNING: `dicomTar.pl` is deprecated and may eventually be removed. Please use the"
. " new `import_dicom_study.py` script instead, which also comes with new features"
. " like support for enhanced DICOMs, multi-echo series, and more.\n\n";

GetOptions(\@arg_table, \@ARGV) || exit $NeuroDB::ExitCodes::GETOPT_FAILURE;

if ($version) { print "Version: $versionInfo\n"; exit; }
Expand Down Expand Up @@ -171,7 +175,7 @@ =head2 Methods
exit $NeuroDB::ExitCodes::MISSING_ARG;
}

# The tar target
# The tar target
my $totar = basename($dcm_source);
print "Source: ". $dcm_source . "\nTarget: ". $targetlocation . "\n\n"
if $verbose;
Expand All @@ -187,7 +191,7 @@ =head2 Methods
print "Database is available.\n\n" if $verbose;
}

# *************************************** main ***************************************
# *************************************** main ***************************************
#### get some info about who created the archive and where and when
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
my $date = sprintf("%4d-%02d-%02d %02d:%02d:%02d\n",
Expand Down Expand Up @@ -217,7 +221,7 @@ =head2 Methods
# get the unique study ID
my $studyUnique = $summary->{'studyuid'};
my $creator = $summary->{user};
my $sumTypeVersion = $summary->{sumTypeVersion};
my $sumTypeVersion = $summary->{sumTypeVersion};

# check if the study is already uploaded in the tarchive tables
if ($dbase) {
Expand Down Expand Up @@ -246,7 +250,7 @@ =head2 Methods
exit $NeuroDB::ExitCodes::TARGET_EXISTS_NO_CLOBBER;
}

# read acquisition metadata into variable
# read acquisition metadata into variable
my $metafile = "$targetlocation/$metaname.meta";
open META, ">$metafile";
META->autoflush(1);
Expand All @@ -260,7 +264,7 @@ =head2 Methods
# get rid of newline
chomp($hostname,$system);

#### create tar from rigt above the source
#### create tar from rigt above the source
chdir(dirname($dcm_source));
print "You will archive the dir\t\t: $totar\n" if $verbose;
# tar contents into tarball
Expand All @@ -283,7 +287,7 @@ =head2 Methods
&archive_head;
close TARINFO;
select(STDOUT);
my $tarinfo = &read_file("$totar.log");
my $tarinfo = &read_file("$totar.log");

my $retar = "tar cvf DCM\_$byDate\_$totar.tar $totar.meta $totar.log $totar.tar.gz";
`$retar`;
Expand All @@ -295,7 +299,7 @@ =head2 Methods
&archive_head;
close TARINFO;
select(STDOUT);
$tarinfo = &read_file("$totar.log");
$tarinfo = &read_file("$totar.log");
print $tarinfo if $verbose;


Expand Down Expand Up @@ -343,7 +347,7 @@ =head2 Methods

exit $NeuroDB::ExitCodes::SUCCESS;

=pod
=pod

=head3 archive_head()

Expand All @@ -363,11 +367,11 @@ sub archive_head {
* Archive target location : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$finalTarget,
* Name of creating host : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$hostname,
$hostname,
* Name of host OS : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$system,
* Created by user : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$creator,
$creator,
* Archived on : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$date,
* dicomSummary version : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Expand All @@ -382,7 +386,7 @@ sub archive_head {
$ARCHIVEmd5sum,
.

=pod
=pod

=head3 read_file($file)

Expand Down
9 changes: 8 additions & 1 deletion docs/scripts_md/ConfigOB.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ RETURN: new instance of this class.

### &$getConfigSettingRef($setting)

Private method. This method fetches setting `$setting` from the LORIS table
Private method. This method fetches setting `$setting` from the LORIS table
Config. It will throw a `NeuroDB::objectBroker::ObjectBrokerException` if either
the database transaction failed for some reason or it succeeded but returned no
results (i.e. setting `$setting` does not exist).
Expand Down Expand Up @@ -262,6 +262,13 @@ Get the bids\_validator\_options\_to\_ignore Config setting
RETURN: an array of the BIDS validator options to ignore
to use when creating a BIDS dataset

### getUseLegacyDicomStudyImporter()

Get the use\_legacy\_dicom\_study\_importer Config setting

RETURN: (boolean) 1 if use\_legacy\_dicom\_study\_importer is set to Yes in the Config module, 0
otherwise

# TO DO

Nothing planned.
Expand Down
2 changes: 0 additions & 2 deletions docs/scripts_md/GetRole.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ INPUTS:
Field3 => undef
}


RETURNS:
- a reference to an array of hash references. Every hash contains the values
for a given row returned by the method call: the key/value pairs contain
Expand All @@ -135,6 +134,5 @@ INPUTS:
Field3 => undef
}


RETURNS:
- the number of records found.
5 changes: 2 additions & 3 deletions docs/scripts_md/MRI.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ exists, the method will try to create it using the supplied parameters.
INPUTS:
- $subjectIDref: hash reference of subject IDs
- $studyDate : study date
- $dbh : database handle
- $dbh : database handle
- $db : database object

RETURNS: an array of 2 elements:
RETURNS: an array of 2 elements:
- A reference to a hash containing the session properties:
`ID` => session ID.
`ProjectID` => project ID for the session.
Expand Down Expand Up @@ -429,7 +429,6 @@ that could not be deleted.
INPUTS:

- @files: list of files to delete.


# TO DO

Expand Down
14 changes: 7 additions & 7 deletions docs/scripts_md/MRIProcessingUtility.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Creates a new instance of this class. The parameter `$dbhr` is a reference
to a `DBI` database handle, used to set the object's database handle, so that
all the DB-driven methods will work.

INPUT:
INPUT:
- $db : database object
- $dbhr : DBI database handle reference
- $debug : degug flag (1 for debug, 0 otherwise)
Expand Down Expand Up @@ -117,9 +117,9 @@ RETURNS:

This function does:
1) Determine subject's ID based on scanner ID and DICOM archive information.
2) Call the `CreateMRICandidate` function (will create the candidate if it does
2) Call the `CreateMRICandidate` function (will create the candidate if it does
not exists and `createCandidates` config option is set to yes)
3) Call the `validateCandidate` to validate the candidate information
3) Call the `validateCandidate` to validate the candidate information
(it will return a `CandMismatchError` if there is one)

INPUTS:
Expand Down Expand Up @@ -181,7 +181,7 @@ RETURNS: project ID

### determineScannerID($tarchiveInfo, $to\_log, $centerID, $projectID, $upload\_id)

Determines which scanner ID was used for DICOM acquisitions. Note, if
Determines which scanner ID was used for DICOM acquisitions. Note, if
a scanner ID is not already associated to the scanner information found
in the DICOM headers, then a new scanner will automatically be created.

Expand Down Expand Up @@ -391,7 +391,7 @@ Registers a new candidate in the `candidate` table.

Note: before doing so, the following checks will be performed:
1) check that the `createCandidates` config option was set to yes
2) check that the `PSCID` given in `$subjectIDsref` is not already associated
2) check that the `PSCID` given in `$subjectIDsref` is not already associated
to an existing candidate
3) check that the `CandID` given in `$subjectIDsref` is not already associated
to an existing candidate
Expand Down Expand Up @@ -438,8 +438,8 @@ RETURNS: the final directory in which the registered MINC files will go

Check that the candidate's information derived from the patient name field of
the DICOM files is valid (`CandID` and `PSCID` of the candidate should
correspond to the same subject in the database). It will also check that the
Visit Label of `$subjectIDsref` is a valid Visit Label present in the
correspond to the same subject in the database). It will also check that the
Visit Label of `$subjectIDsref` is a valid Visit Label present in the
`Visit_Windows` table.

INPUT: subject's ID information hash ref
Expand Down
4 changes: 2 additions & 2 deletions docs/scripts_md/batch_uploads_tarchive.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ batch\_uploads\_tarchive - upload a batch of DICOM archives using script
# DESCRIPTION

This script uploads a list of DICOM archives to the database by calling script
`tarchiveLoader.pl` on each file in succession. The list of files to process is read
`tarchiveLoader.pl` on each file in succession. The list of files to process is read
from `STDIN`, one file name per line. Each file name is assumed to be a path
relative to `tarchiveLibraryDir` (see below).

The following settings of file `$ENV{LORIS_CONFIG}/.loris-mri/prod` affect the
The following settings of file `$ENV{LORIS_CONFIG}/.loris-mri/prod` affect the
behvaviour of `batch_uploads_tarchive` (where `$ENV{LORIS_CONFIG}` is the
value of the Unix environment variable `LORIS_CONFIG`):

Expand Down
Loading
Loading