From 6d4dc347f16b65bb06a5091b722373b44b741ad9 Mon Sep 17 00:00:00 2001 From: "sandipsamal117@gmail.com" Date: Mon, 21 Oct 2024 16:45:28 -0400 Subject: [PATCH] set timezone to eastern --- Dockerfile | 3 +++ dicommake.py | 8 +++++--- requirements.txt | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32cc320..3649192 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,9 @@ # FROM docker.io/fnndsc/conda:python3.10.2-cuda11.6.0 FROM docker.io/python:3.11.0-slim-bullseye +# set timezone to EDT +RUN ln -sf /usr/share/zoneinfo/America/New_York /etc/timezone + LABEL org.opencontainers.image.authors="FNNDSC " \ org.opencontainers.image.title="DICOM image make" \ org.opencontainers.image.description="A ChRIS plugin that creates a new DICOM file from an existing DICOM and a new image" diff --git a/dicommake.py b/dicommake.py index 116928c..a056d9f 100644 --- a/dicommake.py +++ b/dicommake.py @@ -10,11 +10,13 @@ from pflog import pflog from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from functools import partial +from pytz import timezone import os, sys import pudb import pydicom import datetime os.environ['XDG_CONFIG_HOME'] = '/tmp' # For root/non root container sanity +eastern = timezone('US/Eastern') from PIL import Image import numpy as np @@ -36,7 +38,7 @@ -__version__ = '2.3.8' +__version__ = '2.3.9' DISPLAY_TITLE = r""" _ _ _ _ @@ -118,8 +120,8 @@ def image_intoDICOMinsert(image: Image.Image, ds: pydicom.Dataset) -> pydicom.Da Returns: pydicom.Dataset: a DICOM Dataset with the new image """ - AcquisitionDate = lambda : datetime.datetime.now().strftime('%Y%m%d') - AcquisitionTime = lambda : datetime.datetime.now().strftime('%H%M%S') + AcquisitionDate = lambda : datetime.datetime.now(eastern).strftime('%Y%m%d') + AcquisitionTime = lambda : datetime.datetime.now(eastern).strftime('%H%M%S') def npimage_get(image): interpretation:str = "" diff --git a/requirements.txt b/requirements.txt index afc436f..14e6041 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,4 +5,5 @@ numpy loguru pftag==1.2.22 pflog==1.2.26 -pftel-client \ No newline at end of file +pftel-client +pytz # for timezone \ No newline at end of file