copyxnat.xnat.xml_cleaner module¶
Remove and remap XML tags for xml transfer between XNAT servers
- class copyxnat.xnat.xml_cleaner.XmlCleaner(app_settings, reporter)[source]¶
Bases:
object
Remove and remap XML tags for xml transfer between XNAT servers
- ATTRS_TO_DELETE = {'ID', 'project'}¶
- ATTR_SECONDARY_PROJECT_ID = 'secondary_ID'¶
- IDS_TO_MAP = {<XnatType.PROJECT: 'project'>: <XnatType.PROJECT: 'project'>, <XnatType.SUBJECT: 'subject'>: <XnatType.SUBJECT: 'subject'>, <XnatType.EXPERIMENT: 'experiment'>: <XnatType.EXPERIMENT: 'experiment'>, <XnatType.ASSESSOR: 'assessor'>: <XnatType.EXPERIMENT: 'experiment'>, <XnatType.RECONSTRUCTION: 'reconstruction'>: <XnatType.RECONSTRUCTION: 'reconstruction'>, <XnatType.SCAN: 'scan'>: <XnatType.SCAN: 'scan'>}¶
- MODALITY_TO_SCAN = {'CT': '{http://nrg.wustl.edu/xnat}CTScan', 'MR': '{http://nrg.wustl.edu/xnat}MRScan', 'PT': '{http://nrg.wustl.edu/xnat}PETScan', 'US': '{http://nrg.wustl.edu/xnat}USScan'}¶
- TAGS_TO_DELETE = {'{http://nrg.wustl.edu/xnat}assessors', '{http://nrg.wustl.edu/xnat}experiments', '{http://nrg.wustl.edu/xnat}in', '{http://nrg.wustl.edu/xnat}out', '{http://nrg.wustl.edu/xnat}prearchivePath', '{http://nrg.wustl.edu/xnat}reconstructions', '{http://nrg.wustl.edu/xnat}resources', '{http://nrg.wustl.edu/xnat}scans', '{http://nrg.wustl.edu/xnat}sharing'}¶
- TAGS_TO_REMAP = {'{http://icr.ac.uk/icr}subjectID': XnatType.SUBJECT, '{http://nrg.wustl.edu/xnat}imageScan_ID': XnatType.SCAN, '{http://nrg.wustl.edu/xnat}imageSession_ID': XnatType.EXPERIMENT, '{http://nrg.wustl.edu/xnat}image_session_ID': XnatType.EXPERIMENT, '{http://nrg.wustl.edu/xnat}scanID': XnatType.SCAN, '{http://nrg.wustl.edu/xnat}session_id': XnatType.EXPERIMENT, '{http://nrg.wustl.edu/xnat}subject_ID': XnatType.SUBJECT}¶
- XNAT_FILE_TAG = '{http://nrg.wustl.edu/xnat}file'¶
- XNAT_IMAGE_SCAN_DATA_TAG = '{http://nrg.wustl.edu/xnat}imageScanData'¶
- XNAT_MODALITY_TAG = '{http://nrg.wustl.edu/xnat}modality'¶
- XNAT_OTHER_SCAN = 'xnat:OtherDicomScan'¶
- XNAT_PROJECT_NAME_TAG = '{http://nrg.wustl.edu/xnat}name'¶
- add_tag_remaps(src_item, dst_item)[source]¶
Update the remapping dictionary to add add before and after ID values for the tags in the map @param src_item: item on the source server @param dst_item: item on the destination server ID describes
- clean_xml(xml_root, src_item, dst_item)[source]¶
Remove or XML remap tags that change between XNAT servers
@param xml_root: ElementTree root of the XML to remap @param src_item: XNAT item on source server @param dst_item: XNAT item on destination server @return: