run_defacing.pl -- a script that creates defaced images for anatomical acquisitions specified in the Config module of LORIS.
perl tools/run_defacing_script.pl [options]
Available options are:
-profile
: name of the config file in ../dicom-archive/.loris_mri
-tarchive_ids
: comma-separated list of MySQL TarchiveID
s
-verbose
: be verbose
This script will create defaced images for anatomical acquisitions that are specified in the Config module of LORIS.
Queries the database for the list of acquisitions' FileID to be used to run the defacing algorithm based on the provided list of SessionID and Scan_type to restrict the search.
INPUTS:
- $session_id_ref : array of SessionIDs to use when grepping FileIDs
- @modalities_to_deface: array of Scan_type to use when grepping FileIDs
RETURNS: hash of matching FileIDs to be used to run the defacing algorithm organized in a hash as follows:
{0123} # sessionID key
{flair} # flair scan type key
{$FileID} = $File_path # key = FileID; value = MINC file path
{t1} # t1 scan type key
{$FileID} = $File_path # key = FileID 1; value = MINC file 1 path
{$FileID} = $File_path # key = FileID 2; value = MINC file 2 path
Greps the candidate's CandID
and the visit label corresponding to the
SessionID
given as input.
INPUT: the session ID to use to look for CandID
and visit label
RETURNS: the candidate's CandID
and the session visit label
Checks whether there are already defaced images present in the database for the session.
INPUTS:
- $session_files: list of files to deface
- $session_id : the session ID to use to look for defaced images in
files
RETURNS: 1 if there are defaced images found, 0 otherwise
Grep the first t1w image from $session_files
to use it as a reference image for
deface_minipipe.pl
.
INPUTS:
- $session_files : list of files to deface
- $ref_t1_scan_type: LORIS scan type of the t1w file to use as a reference
for
deface_minipipe.pl
RETURNS: hash with information for the reference t1w image
Determine the output directory path and basename to be used by deface_minipipe.pl
.
INPUTS:
- $root_dir: root directory (usually a temporary directory where defaced outputs will be created)
- $candID : candidate's
CandID
- $visit : candidate's visit label
- $ref_file: hash with information about the reference t1 file to use to deface
RETURNS:
- $output_basedir : output base
CandID/VisitLabel
directory where defaced images will be created - $output_basename: basename to be used to create the
_deface_grid_0.mnc
file
Function that will run deface_minipipe.pl
on all anatomical images of the session
and will return all defaced outputs in a hash.
INPUTS:
- $ref_file : hash with info about the reference t1w file used to deface
- $session_files : list of other files than the reference t1w file to deface
- $output_basename: output basename to be used by
deface_minipipe.pl
RETURNS: hash of defaced images with relevant information necessary to register them
Function that will determine the name of the defaced outputs and check that the defaced outputs indeed exists in the file system. If all files are found in the filesystem, it will return a hash with all information necessary for registration of the defaced image.
INPUTS:
- $ref_file : hash with info about the reference t1w file used to deface
- $session_files : list of other files than the reference t1w file to deface
- $output_basename: output basename to be used by
deface_minipipe.pl
RETURNS: hash of defaced images with relevant information necessary to register them
Registers the defaced images using register_processed_data.pl
.
INPUT: hash with the defaced images storing their input FileID and scan type
Function that inserts a new scan type in mri_scan_type
if the scan type does not
already exists in mri_scan_type
.
INPUT: the scan type to look for or insert in the mri_scan_type
table
License: GPLv3
LORIS community loris.info@mcin.ca and McGill Centre for Integrative Neuroscience