-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reformat with black, cleanup based on flake8 (#38)
* replaced hardcoded IP addresses and Ports with those loaded from a configuration json file (ApplicationEntities.json) * reformatted with black -l 127 reformatted with isort --profile black * cleaned out unused imports per flake8 using treatment_delivery_type in rtbdi_factory (real bug caught by flake8) instead of hardcoded TREATMENT * enforce more comprehensive flake8 now that the ui files from Qt Creator have per file excludes and the entire repo has been tidied
- Loading branch information
1 parent
5f5299b
commit 304c0c8
Showing
25 changed files
with
733 additions
and
854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,39 @@ | ||
import logging | ||
import os | ||
import sys | ||
from argparse import Namespace | ||
from configparser import ConfigParser | ||
from datetime import datetime | ||
from typing import Tuple | ||
|
||
from time import sleep | ||
import pydicom.config | ||
from tdwii_plus_examples.TDWII_PPVS_subscriber.nevent_receiver_handlers import handle_echo | ||
|
||
from pynetdicom import ( | ||
AE, | ||
ALL_TRANSFER_SYNTAXES, | ||
UnifiedProcedurePresentationContexts, | ||
_config, | ||
_handlers, | ||
evt, | ||
) | ||
from pynetdicom.apps.common import setup_logging | ||
from pynetdicom.sop_class import Verification | ||
from pynetdicom.utils import set_ae | ||
|
||
|
||
from tdwii_plus_examples.TDWII_PPVS_subscriber.basescp import BaseSCP | ||
from tdwii_plus_examples.TDWII_PPVS_subscriber.nevent_receiver_handlers import ( | ||
handle_echo, | ||
) | ||
|
||
|
||
class EchoSCP: | ||
def __init__(self, | ||
ae_title:str="ECHO_SCP", | ||
port:int=11112, | ||
logger=None, | ||
bind_address:str="" | ||
): | ||
|
||
BaseSCP.__init__(self, | ||
ae_title=ae_title, | ||
port=port, | ||
logger=logger, | ||
bind_address=bind_address) | ||
|
||
def __init__(self, ae_title: str = "ECHO_SCP", port: int = 11112, logger=None, bind_address: str = ""): | ||
|
||
BaseSCP.__init__(self, ae_title=ae_title, port=port, logger=logger, bind_address=bind_address) | ||
|
||
def _add_contexts(self): | ||
BaseSCP._add_contexts(self) | ||
self.ae.add_supported_context(Verification, ALL_TRANSFER_SYNTAXES) | ||
|
||
|
||
|
||
def _add_handlers(self): | ||
BaseSCP._add_handlers(self) | ||
self.handlers.append((evt.EVT_C_ECHO, handle_echo, [None, self.logger])) | ||
|
||
|
||
|
||
BaseSCP._add_handlers(self) | ||
self.handlers.append((evt.EVT_C_ECHO, handle_echo, [None, self.logger])) | ||
|
||
def run(self): | ||
# Listen for incoming association requests | ||
BaseSCP.run(self) | ||
|
||
if __name__ == '__main__': | ||
|
||
if __name__ == "__main__": | ||
myecho_scp = EchoSCP() | ||
myecho_scp.run() | ||
while True: sleep(100) # sleep forever | ||
|
||
while True: | ||
sleep(100) # sleep forever |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.