datman.scan_list module

This script contains code to generate a scans.csv for instances where the subject ID in the dicom headers is wrong in a systematic way. That is, this script can be used when the dicom headers and/or file name contains enough information to derive a correct datman ID, but the PatientName field is not already formatted that way.

To make use of this library, the calling script should create a subclass of ScanEntryABC and define the function get_target_name() to return the intended datman ID. generate_scan_list() can then be called by passing in this class, a list of zip files and the destination directory for the scans.csv file.

Example:

class ExampleScanEntry(datman.scan_list.ScanEntryABC):

def __init__(self, scan_path):

super(ExampleScanEntry, self).__init__(scan_path)

def get_target_name(self):

… (code to generate correct datman ID goes here) … return datman_id

datman.scan_list.generate_scan_list(ExampleScanEntry,

my_zip_list, metadata_path)

class datman.scan_list.ScanEntryABC(scan_path)[source]

Bases: object

abstract get_target_name()[source]
datman.scan_list.generate_scan_list(scan_entry_class, zip_files, dest_dir)[source]

Use this function to generate a scans.csv file of the expected format.

scan_entry_class: A subclass of ScanEntryABC that will be used to

generate each entry in scans.csv

zip_files: A list of zip files to manage

dest_dir: The directory where scans.csv will be saved

datman.scan_list.get_scan_list_contents(scans_csv)[source]
datman.scan_list.make_new_entries(processed_scans, zip_files, EntryClass)[source]
datman.scan_list.start_new_scan_list(output)[source]
datman.scan_list.update_scans_csv(output, new_entries)[source]