fix header process by date, add store log when killed, modularize workflow function
This commit is contained in:
@@ -39,6 +39,7 @@ class DicomRetriever:
|
||||
# Add storage presentation contexts (needed for receiving the images)
|
||||
# for context in StoragePresentationContexts:
|
||||
# self.ae.add_requested_context(context.abstract_syntax)
|
||||
|
||||
storage_uids = [
|
||||
'1.2.840.10008.5.1.4.1.1.1', # CR Storage
|
||||
'1.2.840.10008.5.1.4.1.1.1.1', # Digital X-Ray Image Storage
|
||||
|
||||
@@ -6,11 +6,15 @@ import glob
|
||||
import pydicom
|
||||
import shutil
|
||||
from pydicom.dataset import Dataset
|
||||
from pynetdicom import AE, StoragePresentationContexts, evt
|
||||
from pynetdicom import AE, StoragePresentationContexts, evt, build_role
|
||||
from config import settings
|
||||
from utils.logger import main_logger as logger
|
||||
from utils.error_handler import DicomStoreError, dicom_retry
|
||||
from utils.dicom_utils import create_directory_if_not_exists
|
||||
from pynetdicom.sop_class import (
|
||||
StudyRootQueryRetrieveInformationModelGet,
|
||||
PatientRootQueryRetrieveInformationModelGet
|
||||
)
|
||||
|
||||
class DicomSender:
|
||||
"""
|
||||
@@ -27,9 +31,32 @@ class DicomSender:
|
||||
self.pacs_config = pacs_config or settings.DESTINATION_PACS
|
||||
self.ae = AE(ae_title=settings.SOURCE_AET)
|
||||
|
||||
# Add storage presentation contexts (all standard transfer syntaxes for each SOP class)
|
||||
for context in StoragePresentationContexts:
|
||||
self.ae.add_requested_context(context.abstract_syntax)
|
||||
# Add the Query/Retrieve SOP classes
|
||||
self.ae.add_requested_context(StudyRootQueryRetrieveInformationModelGet)
|
||||
self.ae.add_requested_context(PatientRootQueryRetrieveInformationModelGet)
|
||||
|
||||
# Add storage presentation contexts (needed for receiving the images)
|
||||
# for context in StoragePresentationContexts:
|
||||
# self.ae.add_requested_context(context.abstract_syntax)
|
||||
|
||||
storage_uids = [
|
||||
'1.2.840.10008.5.1.4.1.1.1', # CR Storage
|
||||
'1.2.840.10008.5.1.4.1.1.1.1', # Digital X-Ray Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.2', # CT Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.4', # MR Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.7', # Secondary Capture Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.6.1', # Ultrasound Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.128', # PET Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.20', # Nuclear Medicine Image Storage
|
||||
'1.2.840.10008.5.1.4.1.1.9.1.1', # 12-lead ECG Waveform Storage
|
||||
'1.2.840.10008.5.1.4.1.1.9.1.2', # General ECG Waveform Storage
|
||||
]
|
||||
self.ext_neg = []
|
||||
for uid in storage_uids:
|
||||
self.ae.add_requested_context(uid)
|
||||
role = build_role(uid, scp_role=True)
|
||||
self.ext_neg.append(role)
|
||||
|
||||
|
||||
logger.info(f"DicomSender initialized with destination PACS: {self.pacs_config['aet']}@{self.pacs_config['host']}:{self.pacs_config['port']}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user