From 48958b1f9c2d8a5640ed1e82327e80907f7c4935 Mon Sep 17 00:00:00 2001 From: Andy Lassiter Date: Wed, 31 Jul 2024 09:28:43 -0600 Subject: [PATCH] Add datetime to segmentation name. --- main_xnat.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main_xnat.py b/main_xnat.py index b053c50..3c7dd9d 100644 --- a/main_xnat.py +++ b/main_xnat.py @@ -1,6 +1,7 @@ import argparse import logging import sys +import datetime import requests from requests.auth import HTTPBasicAuth @@ -59,11 +60,13 @@ def main(): try: pipeline = SegmentationPipeline(**kwargs) pipeline.run_pipeline() + + dt = datetime.datetime.now().strftime('%Y%m%d%H%M%S') for (series, segmentation_tup) in pipeline.dicom_segmentations.items(): series_short = series.split('.')[-1] for (fp, seg_ds) in segmentation_tup: upload_to_xnat(kwargs['host'], kwargs['username'], kwargs['password'], kwargs['project'], - kwargs['session_id'], f'DR2UnetSegmentation_{series_short}', fp) + kwargs['session_id'], f'DR2UnetSegmentation_{series_short}_{dt}', fp) except Exception as e: logging.error('Error running pipeline: %s', e)