Skip to content
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
2 changes: 1 addition & 1 deletion .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
cache: 'pip'

- name: Install Python dependencies
run: pip install -r install/requirements/requirements.txt
run: pip install .[dev]
shell: bash

- name: Set up environment variables
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**/__pycache__/*
*.pyc
.loris_mri/
config/
python_virtualenvs/
environment
**/.DS_Store
8 changes: 4 additions & 4 deletions DTIPrep/DTIPrepRegister.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ =head1 SYNOPSIS

Available options are:

-profile : name of the config file in C<../dicom-archive/.loris-mri>
-profile : name of the config file in C<../config>

-DTIPrep_subdir : C<DTIPrep> subdirectory storing the processed files to
be registered
Expand Down Expand Up @@ -114,7 +114,7 @@ =head2 Methods

# Define the table describing the command-line options
my @args_table = (
["-profile", "string", 1, \$profile, "name of the config file in ../dicom-archive/.loris_mri."],
["-profile", "string", 1, \$profile, "name of the config file in ../config."],
["-DTIPrep_subdir", "string", 1, \$DTIPrep_subdir, "DTIPrep subdirectory storing the processed files to be registered"],
["-DTIPrepProtocol", "string", 1, \$DTIPrepProtocol, "DTIPrep protocol used to obtain the output files"],
["-DTI_file", "string", 1, \$dti_file, "Native DWI dataset used to obtain the output files"],
Expand All @@ -132,10 +132,10 @@ =head2 Methods
print STDERR "$Usage\n\tERROR: missing -profile argument\n\n";
exit $NeuroDB::ExitCodes::PROFILE_FAILURE;
}
{ package Settings; do "$ENV{LORIS_CONFIG}/.loris_mri/$profile" }
{ package Settings; do "$ENV{LORIS_CONFIG}/$profile" }
if ( !@Settings::db ) {
print STDERR "\n\tERROR: You don't have a \@db setting in the file "
. "$ENV{LORIS_CONFIG}/.loris_mri/$profile \n\n";
. "$ENV{LORIS_CONFIG}/$profile \n\n";
exit $NeuroDB::ExitCodes::DB_SETTINGS_FAILURE;
}
if (!$DTIPrep_subdir) {
Expand Down
104 changes: 52 additions & 52 deletions DTIPrep/DTIPrep_pipeline.pl

Large diffs are not rendered by default.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions batch_uploads_imageuploader.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ =head1 SYNOPSIS

Available options are:

-profile: name of the config file in C<../dicom-archive/.loris_mri>
-profile: name of the config file in C<../config>

-verbose: if set, be verbose

Expand Down Expand Up @@ -63,7 +63,7 @@ =head2 Methods


my $profile = '';
my $upload_id = undef;
my $upload_id = undef;
my ($debug, $verbose) = (0,1);
my $stdout = '';
my $stderr = '';
Expand All @@ -72,7 +72,7 @@ =head2 Methods
[ "Basic options", "section" ],
[
"-profile", "string", 1, \$profile,
"name of config file in ../dicom-archive/.loris_mri"
"name of config file in ../config"
],
["-verbose", "boolean", 1, \$verbose, "Be verbose."]
);
Expand Down Expand Up @@ -119,10 +119,10 @@ =head2 Methods
print STDERR "$Usage\n\tERROR: missing -profile argument\n\n";
exit $NeuroDB::ExitCodes::PROFILE_FAILURE;
}
{ package Settings; do "$ENV{LORIS_CONFIG}/.loris_mri/$profile" }
{ package Settings; do "$ENV{LORIS_CONFIG}/$profile" }
if ( !@Settings::db ) {
print STDERR "\n\tERROR: You don't have a \@db setting in the file "
. "$ENV{LORIS_CONFIG}/.loris_mri/$profile \n\n";
. "$ENV{LORIS_CONFIG}/$profile \n\n";
exit $NeuroDB::ExitCodes::DB_SETTINGS_FAILURE;
}

Expand Down Expand Up @@ -158,7 +158,7 @@ =head2 Methods



my ($stdoutbase, $stderrbase) = ("$data_dir/batch_output/imuploadstdout.log",
my ($stdoutbase, $stderrbase) = ("$data_dir/batch_output/imuploadstdout.log",
"$data_dir/batch_output/imuploadstderr.log");

while($_ = $ARGV[0] // '', /^-/) {
Expand Down Expand Up @@ -201,7 +201,7 @@ =head2 Methods
my $phantom = $phantomarray[$counter-1];
my $patientname = $patientnamearray[$counter-1];

## Ensure that
## Ensure that
## 1) the uploaded file is of type .tgz or .tar.gz or .zip
## 2) check that input file provides phantom details (Y for phantom, N for real candidates)
## 3) for non-phantoms, the patient name and path entries are identical; this mimics the imaging uploader in the front-end
Expand Down Expand Up @@ -235,7 +235,7 @@ =head2 Methods
}
}

## Populate the mri_upload table with necessary entries and get an upload_id
## Populate the mri_upload table with necessary entries and get an upload_id

$upload_id = insertIntoMRIUpload(\$dbh,
$patientname,
Expand Down
8 changes: 4 additions & 4 deletions batch_uploads_tarchive.pl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ =head1 DESCRIPTION
from C<STDIN>, one file name per line. Each file name is assumed to be a path
relative to C<tarchiveLibraryDir> (see below).

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

Expand Down Expand Up @@ -100,7 +100,7 @@ =head1 AUTHORS

my $profile = undef;
my $verbose = 0;
my $profile_desc = "name of the config file in ../dicom-archive/.loris_mri";
my $profile_desc = "name of the config file in ../config";

my @opt_table = (
[ "Basic options", "section" ],
Expand Down Expand Up @@ -148,10 +148,10 @@ =head1 AUTHORS
exit 3;
}

{ package Settings; do "$ENV{LORIS_CONFIG}/.loris_mri/$profile" }
{ package Settings; do "$ENV{LORIS_CONFIG}/$profile" }
if ($profile && !@Settings::db) {
print "\n\tERROR: You don't have a configuration file named ".
"'$profile' in: $ENV{LORIS_CONFIG}/.loris_mri/ \n\n";
"'$profile' in: $ENV{LORIS_CONFIG}/ \n\n";
exit 2;
}

Expand Down
62 changes: 25 additions & 37 deletions dicom-archive/dicomSummary.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl
# J-Sebastian Muehlboeck 2006
# [email protected]
# Perl tool based on DCMSUM.pm and DICOM.pm to create a summary report for a given dir containing dicoms
Expand All @@ -25,8 +25,7 @@ =head1 SYNOPSIS
-dbreplace : use this option only if the DICOM data changed and need to be updated
in the database

-profile : specify the name of the config file residing in C<.loris_mri> of the
current directory
-profile : specify the name of the config file residing in the config directory

-tmp : to specify a temporary directory. It will contain the summaries if
used with -noscreen option
Expand Down Expand Up @@ -94,9 +93,9 @@ =head2 METHODS
- a tool for producing an informative summary for dicoms in a given directory
- a quick way to get an idea on what there is for a given subject
- a quick way to obtain information about the suject, scanner and acquisition parameters
- a quick way of listing all acquisitions aquired for a given subject
- a convenient way to compare two directories in terms of the dicom data they contain...
or the contents of a directory with a database repository
- a quick way of listing all acquisitions aquired for a given subject
- a convenient way to compare two directories in terms of the dicom data they contain...
or the contents of a directory with a database repository

Usage:\n\t $0 </PATH/TO/DICOM/DIR> [ -comparedir </PATH/TO/DICOM/COMPARE/DIR> ] [ -tmp </PATH/TO/TMP/DIR> ] [options]
\n\n See $0 -help for more info\n\n";
Expand All @@ -108,17 +107,17 @@ =head2 METHODS
["-dbcompare","boolean",1, \$databasecomp, "Compare with database. Will only work if you actually archived your data using a database."],
["-database","boolean", 1, \$dbase, "Use a database if you have one set up for you. Just trying will fail miserably"],
["-dbreplace","boolean",1, \$dbreplace, "Use this option only if your dicom data changed and you want to re-insert the new summary"],
["-profile","string",1, \$profile, "Specify the name of the config file which resides in .loris_mri in the current directory."],
["-profile","string",1, \$profile, "Specify the name of the config file which resides in the config directory."],



["Output options", "section"],
["-screen","boolean",1, \$screen, "Print output to the screen."],
# fixme add more options based on the capabilities of the DCMSUM class
# ["-produce","string",1, \$produce, "Default is summary, other options are header, files, and acquisitions"],
["-tmp","string",1, \$temp, "You may specify a tmp dir. It will contain the summaries, if you use -noscreen"],
["-xdiff","boolean",1, \$xdiff, "You are comparing two folders or with the database and you want to see the result with sdiff."],
["-batch","boolean",1, \$batch, "Run in batchmode. Will log differences to a /tmp/diff.log"],

["General options", "section"],
["-verbose","boolean",1, \$verbose, "Be verbose."],
["-version","boolean",1, \$version, "Print version and revision number and exit"],
Expand All @@ -130,8 +129,8 @@ =head2 METHODS
if ($version) { print "$versionInfo\n"; exit; }

# checking for profile settings
if($profile && -f "$ENV{LORIS_CONFIG}/.loris_mri/$profile") { { package Settings; do "$ENV{LORIS_CONFIG}/.loris_mri/$profile" } }
if ($profile && !@Settings::db) { print "\n\tERROR: You don't have a configuration file named '$profile' in: $ENV{LORIS_CONFIG}/.loris_mri/ \n\n"; exit 33; }
if($profile && -f "$ENV{LORIS_CONFIG}/$profile") { { package Settings; do "$ENV{LORIS_CONFIG}/$profile" } }
if ($profile && !@Settings::db) { print "\n\tERROR: You don't have a configuration file named '$profile' in: $ENV{LORIS_CONFIG}/ \n\n"; exit 33; }


# basic error checking on dcm dir
Expand All @@ -148,7 +147,7 @@ =head2 METHODS
if ($xdiff || $compare || $batch || $databasecomp || $dbase){ $screen = undef; } elsif (!$compare || !$databasecomp) { $xdiff = undef; }

# you can't compare with db and a dir at the same time
if (($compare || $databasecomp) && $dbase) { print $Usage;
if (($compare || $databasecomp) && $dbase) { print $Usage;
print "\t Please consider that some option combinations do not make sense. \n\n"; exit 1;
}

Expand All @@ -162,19 +161,19 @@ =head2 METHODS
push @dcmDirs, $dcm_folder; if ($compare) { push @dcmDirs, $compare; } # if compare is set

# This will make sure that a user specified tmp dir does exist and is writeable
my $TmpDir = $temp || "/tmp"; if (! -e $TmpDir) { print "This is not a valid tmp dir choice: \n".$!; exit 2; }
my $TmpDir = $temp || "/tmp"; if (! -e $TmpDir) { print "This is not a valid tmp dir choice: \n".$!; exit 2; }
elsif(! -w $TmpDir) { print "Sorry you have no permission to use $TmpDir as tmp dir\n"; exit 2; }

# establish database connection if database option is set
my $dbh;
if ($dbase) { $dbh = &NeuroDB::DBI::connect_to_db(@Settings::db); print "Testing for database connectivity. \n" if $verbose; $dbh->disconnect(); print "Database is available.\n\n" if $verbose; }

####################### main ########################################### main ###########################################
####################### main ########################################### main ###########################################

my $count = 0;
my ($studyUnique, $metaname, @metaFiles, $dcmdir, $sumTypeVersion);

# this silly header will only show, if you choose to send your output to the screen.
# this silly header will only show, if you choose to send your output to the screen.
if ($screen){ &silly_head(); }

foreach $dcmdir (@dcmDirs) {
Expand All @@ -197,8 +196,8 @@ =head2 METHODS

# print the summary
$summary->dcmsummary();
# If output went to a meta file, rename it and give it a count if -compare was specified.

# If output went to a meta file, rename it and give it a count if -compare was specified.
if (!$screen) {
close META;
my $newName;
Expand All @@ -208,7 +207,7 @@ =head2 METHODS
push @metaFiles, $newName;
`$move`;
}
# Print to stout again
# Print to stout again
select (STDOUT);
print "Done with $metaname\n" if $verbose;

Expand All @@ -226,16 +225,16 @@ =head2 METHODS
# END OF LOOP #######################################################################################

my $returnVal = 0;

# if -databasecompare has been given look for an entry based on unique studyID
if ($databasecomp) {
my $conflict = &version_conflict($studyUnique);
if ($conflict) { print "\n\n\tWARNING: You are using Version: $versionInfo but archived with Version : $conflict\n\n"; }
$metaFiles[1] = &read_db_metadata($studyUnique);
if (!$metaFiles[1]) { print "\nYou never archived this study or you are looking in the wrong database.\n\n"; exit; }
if ($xdiff) { $diff = "sdiff $metaFiles[0] $metaFiles[1]"; system($diff); }
else {
$diff = "diff -q $metaFiles[0] $metaFiles[1]";
else {
$diff = "diff -q $metaFiles[0] $metaFiles[1]";
my $Comp = `$diff`;
if ($Comp ne "") { print "There are differences\n" if $verbose; $returnVal = 99; }
else { print "Comparing $dcm_folder with the database returned no differences. Smile :)\n" if $verbose; }
Expand Down Expand Up @@ -282,7 +281,7 @@ sub read_db_metadata {
$dbh = &NeuroDB::DBI::connect_to_db(@Settings::db);
print "Getting data from database.\n" if $verbose;
(my $query = <<QUERY) =~ s/\n/ /gm;
SELECT
SELECT
AcquisitionMetadata
FROM
tarchive
Expand All @@ -296,7 +295,7 @@ sub read_db_metadata {
$dbmeta = $row[0];
$dbcomparefile = "$TmpDir/dbcompare.meta";
open(DBDATA,">$dbcomparefile") || die ("Cannot Open File");
print DBDATA "$dbmeta";
print DBDATA "$dbmeta";
close(DBDATA);
return $dbcomparefile;
}
Expand Down Expand Up @@ -350,10 +349,10 @@ =head3 silly_head()
sub silly_head {
print <<HEAD;
* * * * * * * * * * * * * *
_
_|* _ _ _ _ * _ |_ _
_
_|* _ _ _ _ * _ |_ _
(_]|(_ (_)[ | ) |[ )| (_)

HEAD
}

Expand All @@ -371,14 +370,3 @@ =head1 AUTHORS
Neuroscience

=cut











10 changes: 5 additions & 5 deletions dicom-archive/dicomTar.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ =head1 SYNOPSIS
resulting tarball!

-profile : Specify the name of the config file which resides in
C<.loris_mri> in the current directory
the config directory

-centerName : Specify the symbolic center name to be stored
alongside the DICOM institution
Expand Down Expand Up @@ -124,7 +124,7 @@ =head2 Methods
["-clobber", "boolean", 1, \$clobber, "Use this option only if you want
to replace the resulting tarball!"],
["-profile","string",1, \$profile, "Specify the name of the config file
which resides in .loris_mri in the current directory."],
which resides in the config directory."],
["-centerName","string",1, \$neurodbCenterName, "Specify the symbolic
center name to be stored alongside the DICOM institution."],
["General options", "section"],
Expand All @@ -146,12 +146,12 @@ =head2 Methods
print STDERR "$Usage\n\tERROR: missing -profile argument\n\n";
exit $NeuroDB::ExitCodes::PROFILE_FAILURE;
}
if(-f "$ENV{LORIS_CONFIG}/.loris_mri/$profile") {
{ package Settings; do "$ENV{LORIS_CONFIG}/.loris_mri/$profile" }
if(-f "$ENV{LORIS_CONFIG}/$profile") {
{ package Settings; do "$ENV{LORIS_CONFIG}/$profile" }
}
if ( !@Settings::db ) {
print STDERR "\n\tERROR: You don't have a \@db setting in the file "
. "$ENV{LORIS_CONFIG}/.loris_mri/$profile \n\n";
. "$ENV{LORIS_CONFIG}/$profile \n\n";
exit $NeuroDB::ExitCodes::DB_SETTINGS_FAILURE;
}
# The source and the target dir have to be present and must be directories.
Expand Down
Loading