Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ To configure a new project, follow these steps:
git switch -c <branch-name>
```

1. Copy the `template_config.yaml` file to a new file in the `projects/config` directory and fill
1. Copy the [template_config.yaml](./template_config.yaml) file to a new file in the `projects/config` directory and fill
in the details.
1. The filename of the project config should be `<project-slug>`.yaml

Expand Down
4 changes: 2 additions & 2 deletions orthanc/orthanc-anon/plugin/pixl.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def _anonymise_study_and_upload(

with logger.contextualize(pseudo_study_uid=anonymised_study_uid):
_upload_instances(anonymised_instances_bytes)
logger.info("Anonymised and uploaded study")
logger.success("Anonymised and uploaded study '{}', {}", project_name, study_info)

return anonymised_study_uid

Expand Down Expand Up @@ -517,7 +517,7 @@ def _anonymise_study_instances(
"The anonymisation introduced the following validation errors:\n{}",
parse_validation_results(dicom_validation_errors),
)
logger.success("Finished anonymising project: '{}', {}", project_name, study_info)
logger.info("Finished anonymising project '{}', {}", project_name, study_info)
return anonymised_instances_bytes, anonymised_study_uid


Expand Down
2 changes: 1 addition & 1 deletion pixl_dcmd/src/pixl_dcmd/dicom_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _redirect_stdout_to_debug(_logger: Logger) -> Generator[None, None, None]:
thread_local.stdout.seek(0)
output = thread_local.stdout.readlines()
for line in output:
_logger.debug(line.strip())
_logger.trace(line.strip())


@dataclass
Expand Down
11 changes: 5 additions & 6 deletions pixl_dcmd/src/pixl_dcmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def anonymise_dicom(
"""

study_info = get_study_info(dataset)
logger.debug(
logger.trace(
f"Processing instance for project {config.project.name}: {study_info}"
)

Expand All @@ -205,7 +205,7 @@ def anonymise_dicom(
msg = f"Dropping DICOM Modality: {dataset.Modality}"
raise PixlSkipInstanceError(msg)

logger.debug("Anonymising instance for: {}", study_info)
logger.trace("Anonymising instance for: {}", study_info)

# Apply any pixel cleaning prior to tag anonymisation
# Do before anonymisation as some tag operations may rely on pixel data (e.g. burned in pixel detection).
Expand Down Expand Up @@ -245,7 +245,6 @@ def _clean_dicom_image_pixels(
:param config: Project config to use for pixel cleaning
"""
study_info = get_study_info(dataset)
logger.debug(f"Cleaning pixels for project {config.project.name}: {study_info}")

image_operations = load_image_operations(config)
deid_recipe_path = image_operations.deid_recipes
Expand All @@ -254,11 +253,11 @@ def _clean_dicom_image_pixels(
) # current implementation permits only one recipe file

if not deid_recipe_path:
logger.debug(
logger.trace(
"No deid recipe provided for pixel cleaning, skipping pixel cleaning."
)
return

logger.debug(f"Cleaning pixels for project {config.project.name}: {study_info}")
burned_pixels = has_burned_pixels(dataset, deid=deid_recipe)
cleaned_pixels = clean_pixel_data(dicom_file=dataset, results=burned_pixels)

Expand Down Expand Up @@ -331,7 +330,7 @@ def _secure_hash(

if tag in dataset:
message = f"Securely hashing: (0x{grp:04x},0x{el:04x})"
logger.debug(f"\t{message}")
logger.trace(message)
if dataset[grp, el].VR == "LO":
pat_value = str(dataset[grp, el].value)
hashed_value = _hash_values(pat_value, project_slug, hash_len=64)
Expand Down
8 changes: 8 additions & 0 deletions projects/configs/README.md
Comment thread
stefpiatek marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Project configurations for PIXL extractions

This directory contains:

- Configuration files for specific projects, including automated test cases, these reference the the sub-directories for their anonymisation rules. These are copied from [template_config.yaml](/template_config.yaml). Expand the [Setup PIXL in GAE section](/README.md#setup-pixl-in-gae) of the main readme find the `Configure a new project` section for more information
- [image-operations](./image-operations/): Methods for removing identifiable information from the pixel data of DICOM data
- [tag-operations](./tag-operations/): Allowlist for each DICOM tag. All projects are expected to use [tag-operations/base.yaml](./tag-operations/base.yaml), adding in extra configurations for each modality. Any DICOM tag not defined will be removed in anonymisation.
- In some cases, [tag-operations/manufacturer-overrides/](./tag-operations/manufacturer-overrides/) will be defined private DICOM tags are required from a manufacturer.
2 changes: 1 addition & 1 deletion projects/configs/tag-operations/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
- name: "Scan Options"
group: 0x0018
element: 0x0022
op: "replace"
op: "keep"
#CT, MR, X-Ray
- name: Slice Thickness
group: 0x0018
Expand Down
25 changes: 25 additions & 0 deletions projects/configs/tag-operations/thrombosis-af.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) University College London Hospitals NHS Foundation Trust
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Default `base.yaml` configuration file with commented links to their respective image modalities
# `base.yaml` configuration file is expected to be part of all projects configuration files

#################################### 0008 Group ###################################
#
#

- name: "Study Date"
group: 0x0008
element: 0x0020
op: "keep"
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) University College London Hospitals NHS Foundation Trust
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project:
name: "uclh-investigating-correlations-of-thrombosis-risk-in-af"
modalities: ["CT"] # DICOM dataset modalities to retain
azure_kv_alias: null # Optional field to allow for a common secret prefix to be used

tag_operation_files: # DICOM tag anonymisation operations
base:
- "base.yaml" # Base schema
- "ct.yaml"
- "thrombosis-af.yaml"
manufacturer_overrides: [] # Manufactuer-dependendent overrides

allowed_manufacturers:
- regex: ".*"
exclude_series_numbers: []

# Filter out any series with a single instance (e.g. PACS reports, screenshots)
min_instances_per_series: 6

series_filters:
- "localizer"
- "localiser"
- "scout"
- "positioning"
- "mip" # for PET studies these series have PID

destination:
dicom: "ftps" # alternatives: "dicomweb", "xnat", "none"
parquet: "ftps" # alternatives: "none"
Loading