Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed wrong condition for dicom metadata #1347

Merged
merged 3 commits into from
Mar 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ def _get_analyzer_results(
supported_entity="PERSON", deny_list=phi_list
)

if type(ad_hoc_recognizers) is None:
if ad_hoc_recognizers is None:
ad_hoc_recognizers = [deny_list_recognizer]
elif type(ad_hoc_recognizers) is list:
ad_hoc_recognizers.append(deny_list_recognizer)
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ def test_redact_image_correctly(engine_builder: Callable, dcm_filepath: Path):
)


def test_compare_original_to_redacted():
"""Test the redact_and_return_bbox function."""
input_path = Path(RESOURCES_PARENT_DIR, "0_ORIGINAL.dcm")
input_image = pydicom.dcmread(input_path)
redacted_path = Path(RESOURCES_PARENT_DIR, "0_ORIGINAL_redacted.dcm")
expected_redacted = pydicom.dcmread(redacted_path)
engine = DicomImageRedactorEngine()
actual_redacted, bboxes = engine.redact_and_return_bbox(
image=input_image,
use_metadata=True
)
assert np.array_equal(expected_redacted.pixel_array, actual_redacted.pixel_array)


@pytest.mark.parametrize("engine_builder", all_engines_required())
def test_redact_from_single_file_correctly(engine_builder: Callable):
"""Test the redact_from_file function with single file case.
Expand Down
Loading