Skip to content

Commit

Permalink
fix rule testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Wiggins authored and Roy Wiggins committed Aug 10, 2023
1 parent 36b6c82 commit 0bcebef
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 29 deletions.
2 changes: 1 addition & 1 deletion common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ProcessingLogsConfig(BaseModel):


class DicomReceiverConfig(BaseModel):
additional_tags: List[str] = []
additional_tags: Dict[str,str] = {}


class Config(BaseModel, Compat):
Expand Down
2 changes: 1 addition & 1 deletion getdcmtags/tags_list.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmdata/dcdeftag.h"

static auto main_tags_list = {
DCM_Modality,
Expand Down
13 changes: 6 additions & 7 deletions receiver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ if [ ! -f $config ]; then
fi

# Now read the needed values
incoming=$(cat $config | jq -r '.incoming_folder')
port=$(cat $config | jq '.port')
bookkeeper=$(cat $config | jq -r '.bookkeeper')
accept_compressed=$(cat $config | jq -r '.accept_compressed_images')
incoming=$(jq -r '.incoming_folder' $config)
port=$(jq '.port' $config)
bookkeeper=$(jq -r '.bookkeeper' $config)
accept_compressed=$(jq -r '.accept_compressed_images' $config)
bookkeeper_api_key=$(jq -r '.bookkeeper_api_key' $config)
jq -r ".dicom_receiver.additional_tags // {} | keys_unsorted[]" $config > "./dcm_extra_tags" || echo "Failed to parse and configure dicom tags to collect." && exit 1

bookkeeper_api_key=$(cat $config | jq -r '.bookkeeper_api_key')

cat $config | jq -r .dicom_receiver.additional_tags[] > "./dcm_extra_tags"

# Check if incoming folder exists
if [ ! -d "$incoming" ]; then
Expand Down
70 changes: 50 additions & 20 deletions webinterface/tagslist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,60 @@
Helper functions for displaying a list of DICOM tags available for routing in the graphical user interface of mercure.
"""

# Standard python includes
import os
import re
from typing import Dict

tagslist_source = os.path.realpath(os.path.dirname(os.path.realpath(__file__)) + "/../getdcmtags/main.cpp")

alltags: Dict[str, str] = {}
sortedtags = []

alltags: Dict[str, str] = {
"SpecificCharacterSet":"ISO_IR 100",
"Modality":"MR",
"BodyPartExamined":"BRAIN",
"ProtocolName":"COR T1 PIT(POST)",
"RetrieveAETitle":"STORESCP",
"StationAETitle":"ANY-SCP",
"Manufacturer":"mercure",
"ManufacturerModelName":"Router",
"StudyDescription":"NEURO^HEAD",
"CodeValue":"IMG11291",
"CodeMeaning":"MRI BRAIN PITUITARY WITH AND WITHOUT IV CONTRAST",
"SeriesDescription":"COR T1 POST",
"PatientName":"Knight^Michael",
"PatientID":"987654321",
"PatientBirthDate":"20100101",
"PatientSex":"M",
"AccessionNumber":"1234567",
"ReferringPhysicianName":"Tanner^Willie",
"StudyID":"243211348",
"SeriesNumber":"99",
"SOPInstanceUID":"1.2.256.0.7220020.3.1.3.541411159.31.1254476944.91518",
"SeriesInstanceUID":"1.2.256.0.7230020.3.1.3.531431169.31.1254476944.91508",
"StudyInstanceUID":"1.2.226.0.7231010.3.1.2.531431169.31.1554576944.99502",
"SeriesDate":"20190131",
"SeriesTime":"134112.100000",
"AcquisitionDate":"20190131",
"AcquisitionTime":"134112.100000",
"SequenceName":"*se2d1",
"ScanningSequence":"SE",
"SequenceVariant":"SP\OSP",
"MagneticFieldStrength":"1.5",
"StationName":"MR20492",
"DeviceSerialNumber":"12345",
"DeviceUID":"1.2.276.0.7230010.3.1.4.8323329.22517.1564764826.40200",
"SoftwareVersions":"mercure MR A10",
"ContrastBolusAgent":"8.0 ML JUICE",
"ImageComments":"Comment on image",
"SliceThickness":"3",
"InstanceNumber":"12",
"AcquisitionNumber":"15",
"InstitutionName":"Some institution",
"MediaStorageSOPClassUID":"1.2.840.10008.5.1.4.1.1.4",
"AcquisitionType":"SPIRAL",
"ImageType":"ORIGINAL"
}
import common.config as config

def read_tagslist() -> None:
"""Reads the list of supported DICOM tags with example values. This list is parsed from the C code of the getseqparam module."""
global alltags
alltags = {}
with open(tagslist_source, "r") as f:
lines = f.readlines()
for l in lines:
# Get the tag information and exemplary value from the INSERTTAG statements
match = re.search(r'INSERTTAG\("([A-Z][a-zA-Z].*)"(.*)"(.*)"', l)
if match:
alltags[match.group(1)] = match.group(3)
# Stop the parsing when the next function is reached
if "READTAG(TAG, SOURCE, VAR)" in l:
break
global sortedtags
"""Reads the list of supported DICOM tags with example values."""
global alltags, sortedtags
alltags = {**alltags, **config.mercure.dicom_receiver.additional_tags}
sortedtags = sorted(alltags)

0 comments on commit 0bcebef

Please sign in to comment.