pathsafe 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pathsafe-1.0.1/LICENSE +191 -0
- pathsafe-1.0.1/PKG-INFO +405 -0
- pathsafe-1.0.1/README.md +364 -0
- pathsafe-1.0.1/pathsafe/__init__.py +57 -0
- pathsafe-1.0.1/pathsafe/anonymizer.py +606 -0
- pathsafe-1.0.1/pathsafe/cli.py +616 -0
- pathsafe-1.0.1/pathsafe/converter.py +511 -0
- pathsafe-1.0.1/pathsafe/formats/__init__.py +57 -0
- pathsafe-1.0.1/pathsafe/formats/base.py +66 -0
- pathsafe-1.0.1/pathsafe/formats/bif.py +228 -0
- pathsafe-1.0.1/pathsafe/formats/dicom.py +613 -0
- pathsafe-1.0.1/pathsafe/formats/generic_tiff.py +219 -0
- pathsafe-1.0.1/pathsafe/formats/mrxs.py +662 -0
- pathsafe-1.0.1/pathsafe/formats/ndpi.py +735 -0
- pathsafe-1.0.1/pathsafe/formats/scn.py +258 -0
- pathsafe-1.0.1/pathsafe/formats/svs.py +270 -0
- pathsafe-1.0.1/pathsafe/formats/tiff_base.py +466 -0
- pathsafe-1.0.1/pathsafe/gui/__init__.py +43 -0
- pathsafe-1.0.1/pathsafe/gui/themes.py +594 -0
- pathsafe-1.0.1/pathsafe/gui/widgets.py +158 -0
- pathsafe-1.0.1/pathsafe/gui/window.py +1332 -0
- pathsafe-1.0.1/pathsafe/gui/workers.py +763 -0
- pathsafe-1.0.1/pathsafe/gui_qt.py +6 -0
- pathsafe-1.0.1/pathsafe/log.py +226 -0
- pathsafe-1.0.1/pathsafe/models.py +96 -0
- pathsafe-1.0.1/pathsafe/openslide_utils.py +110 -0
- pathsafe-1.0.1/pathsafe/report.py +765 -0
- pathsafe-1.0.1/pathsafe/scanner.py +266 -0
- pathsafe-1.0.1/pathsafe/tiff/__init__.py +57 -0
- pathsafe-1.0.1/pathsafe/tiff/blanking.py +317 -0
- pathsafe-1.0.1/pathsafe/tiff/hashing.py +90 -0
- pathsafe-1.0.1/pathsafe/tiff/parser.py +321 -0
- pathsafe-1.0.1/pathsafe/tiff/sub_ifd.py +166 -0
- pathsafe-1.0.1/pathsafe/verify.py +58 -0
- pathsafe-1.0.1/pathsafe.egg-info/PKG-INFO +405 -0
- pathsafe-1.0.1/pathsafe.egg-info/SOURCES.txt +73 -0
- pathsafe-1.0.1/pathsafe.egg-info/dependency_links.txt +1 -0
- pathsafe-1.0.1/pathsafe.egg-info/entry_points.txt +5 -0
- pathsafe-1.0.1/pathsafe.egg-info/requires.txt +30 -0
- pathsafe-1.0.1/pathsafe.egg-info/top_level.txt +1 -0
- pathsafe-1.0.1/pyproject.toml +68 -0
- pathsafe-1.0.1/setup.cfg +4 -0
- pathsafe-1.0.1/tests/test_adversarial.py +380 -0
- pathsafe-1.0.1/tests/test_anonymizer.py +219 -0
- pathsafe-1.0.1/tests/test_bif.py +92 -0
- pathsafe-1.0.1/tests/test_cli.py +203 -0
- pathsafe-1.0.1/tests/test_cli_integration.py +254 -0
- pathsafe-1.0.1/tests/test_converter.py +599 -0
- pathsafe-1.0.1/tests/test_dicom.py +285 -0
- pathsafe-1.0.1/tests/test_exif_gps.py +342 -0
- pathsafe-1.0.1/tests/test_generic_tiff.py +205 -0
- pathsafe-1.0.1/tests/test_integration.py +337 -0
- pathsafe-1.0.1/tests/test_log.py +334 -0
- pathsafe-1.0.1/tests/test_mrxs.py +125 -0
- pathsafe-1.0.1/tests/test_ndpi.py +202 -0
- pathsafe-1.0.1/tests/test_pattern_config.py +101 -0
- pathsafe-1.0.1/tests/test_phi_bypass.py +383 -0
- pathsafe-1.0.1/tests/test_preflight.py +83 -0
- pathsafe-1.0.1/tests/test_report.py +555 -0
- pathsafe-1.0.1/tests/test_roundtrip.py +345 -0
- pathsafe-1.0.1/tests/test_scanner.py +92 -0
- pathsafe-1.0.1/tests/test_scanner_extended.py +220 -0
- pathsafe-1.0.1/tests/test_scn.py +91 -0
- pathsafe-1.0.1/tests/test_stress_concurrency.py +204 -0
- pathsafe-1.0.1/tests/test_stress_dicom.py +250 -0
- pathsafe-1.0.1/tests/test_stress_filenames.py +112 -0
- pathsafe-1.0.1/tests/test_stress_ifd_chains.py +213 -0
- pathsafe-1.0.1/tests/test_stress_rerun.py +291 -0
- pathsafe-1.0.1/tests/test_stress_strip_bounds.py +247 -0
- pathsafe-1.0.1/tests/test_stress_tag_order.py +180 -0
- pathsafe-1.0.1/tests/test_svs.py +80 -0
- pathsafe-1.0.1/tests/test_tiff.py +101 -0
- pathsafe-1.0.1/tests/test_tiff_extended.py +230 -0
- pathsafe-1.0.1/tests/test_unlink_ifd.py +478 -0
- pathsafe-1.0.1/tests/test_verify.py +60 -0
pathsafe-1.0.1/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 PathSafe Contributors
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
pathsafe-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pathsafe
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Production-tested WSI anonymizer for pathology slide files
|
|
5
|
+
Author: PathSafe Contributors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: pathology,anonymization,NDPI,SVS,TIFF,WSI,PHI,HIPAA
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.0
|
|
17
|
+
Requires-Dist: fpdf2>=2.7
|
|
18
|
+
Provides-Extra: gui
|
|
19
|
+
Requires-Dist: PySide6>=6.5; extra == "gui"
|
|
20
|
+
Provides-Extra: dicom
|
|
21
|
+
Requires-Dist: pydicom>=2.3; extra == "dicom"
|
|
22
|
+
Provides-Extra: openslide
|
|
23
|
+
Requires-Dist: openslide-python>=1.2; extra == "openslide"
|
|
24
|
+
Provides-Extra: convert
|
|
25
|
+
Requires-Dist: openslide-python>=1.2; extra == "convert"
|
|
26
|
+
Requires-Dist: tifffile>=2023.1; extra == "convert"
|
|
27
|
+
Requires-Dist: imagecodecs; extra == "convert"
|
|
28
|
+
Requires-Dist: numpy; extra == "convert"
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: PySide6>=6.5; extra == "all"
|
|
31
|
+
Requires-Dist: pydicom>=2.3; extra == "all"
|
|
32
|
+
Requires-Dist: openslide-python>=1.2; extra == "all"
|
|
33
|
+
Requires-Dist: tifffile>=2023.1; extra == "all"
|
|
34
|
+
Requires-Dist: imagecodecs; extra == "all"
|
|
35
|
+
Requires-Dist: numpy; extra == "all"
|
|
36
|
+
Requires-Dist: fpdf2>=2.7; extra == "all"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# PathSafe
|
|
43
|
+
|
|
44
|
+
**Remove patient information from pathology slide files... safely, automatically, and verifiably.**
|
|
45
|
+
|
|
46
|
+
When pathology scanners create digital slide files, they often embed hidden patient data inside the file: accession numbers, scan dates, operator names, and even photographs of the slide label. This information is invisible when viewing the slide image, but anyone with the right tools can extract it. PathSafe finds and removes all of this hidden data so your slides are safe to share for research or education.
|
|
47
|
+
|
|
48
|
+
PathSafe works with all major scanner brands, can process thousands of files at once, and double-checks its own work to make sure nothing was missed.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## What PathSafe Does
|
|
53
|
+
|
|
54
|
+
| | |
|
|
55
|
+
|-|-|
|
|
56
|
+
| **Finds hidden patient data** | Accession numbers, dates, and names can be buried inside files in places you can't see when viewing the slide |
|
|
57
|
+
| **Works with all major scanners** | Hamamatsu (NDPI), Aperio (SVS), 3DHISTECH (MRXS), Roche/Ventana (BIF), Leica (SCN), DICOM, and other TIFF-based files |
|
|
58
|
+
| **Erases label photos** | Many scanners take a photo of the physical slide label (which may show patient names) and hide it inside the file. PathSafe erases these photos |
|
|
59
|
+
| **Keeps your originals safe** | PathSafe creates cleaned copies in a separate folder -- your original files are never touched |
|
|
60
|
+
| **Double-checks everything** | After cleaning, PathSafe re-scans every file to confirm all patient data was actually removed |
|
|
61
|
+
| **Creates compliance reports** | Generates PDF reports and certificates documenting exactly what was found, what was removed, and proof that each file is clean |
|
|
62
|
+
| **Easy to use** | A visual interface guides you through four simple steps -- no typing commands required |
|
|
63
|
+
| **Handles large batches** | Process hundreds or thousands of slides at once, with parallel processing to speed things up |
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
### Quick start (recommended for most users)
|
|
70
|
+
|
|
71
|
+
Download the file for your computer:
|
|
72
|
+
|
|
73
|
+
| Your computer | Download |
|
|
74
|
+
|---------------|----------|
|
|
75
|
+
| **Windows** | [pathsafe-gui-windows.exe](https://github.com/DrSoma/PathSafe/releases/latest/download/pathsafe-gui-windows.exe) |
|
|
76
|
+
| **macOS** | [pathsafe-gui-macos.dmg](https://github.com/DrSoma/PathSafe/releases/latest/download/pathsafe-gui-macos.dmg) |
|
|
77
|
+
| **Linux** | [pathsafe-gui-linux.AppImage](https://github.com/DrSoma/PathSafe/releases/latest/download/pathsafe-gui-linux.AppImage) |
|
|
78
|
+
|
|
79
|
+
Then:
|
|
80
|
+
|
|
81
|
+
1. Open the file you downloaded.
|
|
82
|
+
2. Follow the on-screen prompts.
|
|
83
|
+
3. Launch PathSafe.
|
|
84
|
+
|
|
85
|
+
### First-launch security prompts (normal)
|
|
86
|
+
|
|
87
|
+
- **Windows**: You may see "Windows protected your PC". Click **More info** then **Run anyway**.
|
|
88
|
+
- **macOS**: If blocked, right-click `PathSafe.app` and choose **Open**.
|
|
89
|
+
- **Linux (AppImage)**: You may need to allow execution first.
|
|
90
|
+
- GUI way: Right-click file -> **Properties** -> **Allow executing file as program**
|
|
91
|
+
- Terminal way: `chmod +x ~/Downloads/pathsafe-gui-linux.AppImage`
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## How to Use PathSafe (GUI)
|
|
96
|
+
|
|
97
|
+
**Most users should use the GUI.** For a screenshot walkthrough, see the **[full instructions guide](docs/INSTRUCTIONS.md)**.
|
|
98
|
+
|
|
99
|
+
Launch PathSafe and follow four steps:
|
|
100
|
+
|
|
101
|
+
### Step 1: Select your files
|
|
102
|
+
|
|
103
|
+
Choose one file, multiple files, or a folder.
|
|
104
|
+
|
|
105
|
+
### Step 2: Scan
|
|
106
|
+
|
|
107
|
+
Click **Scan for PHI**.
|
|
108
|
+
This is a preview only. Nothing is modified yet.
|
|
109
|
+
|
|
110
|
+
### Step 3: Choose output folder
|
|
111
|
+
|
|
112
|
+
Pick where cleaned copies should be saved.
|
|
113
|
+
|
|
114
|
+
### Step 4: Anonymize
|
|
115
|
+
|
|
116
|
+
Click **Anonymize**.
|
|
117
|
+
PathSafe creates cleaned copies and verifies the result automatically.
|
|
118
|
+
Your original files stay unchanged.
|
|
119
|
+
|
|
120
|
+
A summary popup shows exactly what happened.
|
|
121
|
+
|
|
122
|
+
### Helpful keyboard shortcuts
|
|
123
|
+
|
|
124
|
+
| Action | Windows / Linux | macOS |
|
|
125
|
+
|--------|-----------------|-------|
|
|
126
|
+
| Open file | `Ctrl+O` | `Cmd+O` |
|
|
127
|
+
| Open folder | `Ctrl+Shift+O` | `Cmd+Shift+O` |
|
|
128
|
+
| Scan | `Ctrl+S` | `Cmd+S` |
|
|
129
|
+
| Anonymize | `Ctrl+R` | `Cmd+R` |
|
|
130
|
+
| Verify | `Ctrl+E` | `Cmd+E` |
|
|
131
|
+
| File info | `Ctrl+I` | `Cmd+I` |
|
|
132
|
+
| Convert | `Ctrl+T` | `Cmd+T` |
|
|
133
|
+
| Save log | `Ctrl+L` | `Cmd+L` |
|
|
134
|
+
| Stop current task | `Esc` | `Esc` |
|
|
135
|
+
|
|
136
|
+
### Other things you can do in the GUI
|
|
137
|
+
|
|
138
|
+
| Feature | How |
|
|
139
|
+
|---------|-----|
|
|
140
|
+
| Theme switch | Use View menu (your choice is remembered) |
|
|
141
|
+
| Drag and drop | Drop files/folders directly on the window |
|
|
142
|
+
| Select multiple files | Hold `Ctrl` (Windows/Linux) or `Cmd` (macOS) |
|
|
143
|
+
| Faster large batches | Increase the Workers slider (try 2-4) |
|
|
144
|
+
| Preview only | Check **Dry run** |
|
|
145
|
+
| Add institution name | Fill in Institution field (included in reports) |
|
|
146
|
+
| Export results | Use **Save Log** or **Export JSON** in Actions menu |
|
|
147
|
+
| Convert formats | Use Convert tab (NDPI/SVS/TIFF/PNG/JPEG) |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Command-Line Installation (Advanced)
|
|
152
|
+
|
|
153
|
+
If you want to run `pathsafe` in Terminal, install with `pipx`:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
python3 -m pip install --user pipx
|
|
157
|
+
python3 -m pipx ensurepath
|
|
158
|
+
pipx install "git+https://github.com/DrSoma/PathSafe.git@v1.0.0"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Then check:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pathsafe --help
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
After PyPI publishing is enabled, this will become:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
pipx install pathsafe
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
PyPI automation is already configured in this repo. See [PyPI publishing setup](docs/PYPI_PUBLISHING.md).
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## How to Use PathSafe (Command Line)
|
|
178
|
+
|
|
179
|
+
For users comfortable with a terminal. Three commands is all you need:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# 1. Scan your files (nothing is changed)
|
|
183
|
+
pathsafe scan /path/to/slides/ --verbose
|
|
184
|
+
|
|
185
|
+
# 2. Anonymize (copies to a new folder, originals safe)
|
|
186
|
+
pathsafe anonymize /path/to/slides/ --output /path/to/clean/
|
|
187
|
+
|
|
188
|
+
# 3. Verify the results
|
|
189
|
+
pathsafe verify /path/to/clean/
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Generate compliance documentation
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
pathsafe anonymize /path/to/slides/ --output /path/to/clean/ \
|
|
196
|
+
--certificate certificate.json --institution "My Hospital"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Generate a scan report
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pathsafe scan /path/to/slides/ --report scan_report.pdf --institution "My Hospital"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Export scan results as JSON (for integration with other tools)
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pathsafe scan /path/to/slides/ --json-out results.json
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Anonymize files in place (modifies originals -- make sure you have backups!)
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pathsafe anonymize /path/to/slides/ --in-place
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Convert between file formats
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
pathsafe convert slide.ndpi -o slide.tiff # Convert to pyramidal TIFF
|
|
221
|
+
pathsafe convert slide.ndpi -o slide.tiff --anonymize # Convert and anonymize
|
|
222
|
+
pathsafe convert slide.ndpi -o slide.png -t png # Convert to PNG
|
|
223
|
+
pathsafe convert slide.ndpi -o slide.jpg -t jpeg --quality 85 # Convert to JPEG
|
|
224
|
+
pathsafe convert slide.ndpi -o label.png --extract label # Extract label image
|
|
225
|
+
pathsafe convert /slides/ -o /converted/ -t tiff -w 4 # Batch convert with 4 workers
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
<details>
|
|
229
|
+
<summary>Full list of command line options (click to expand)</summary>
|
|
230
|
+
|
|
231
|
+
### All commands
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
pathsafe scan PATH Check files for patient data (read-only)
|
|
235
|
+
pathsafe anonymize PATH Remove patient data from files
|
|
236
|
+
pathsafe verify PATH Confirm anonymization was successful
|
|
237
|
+
pathsafe convert PATH Convert WSI files between formats
|
|
238
|
+
pathsafe info FILE Show metadata for a single file
|
|
239
|
+
pathsafe gui Launch the graphical interface
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Scan options
|
|
243
|
+
|
|
244
|
+
| Option | What it does |
|
|
245
|
+
|--------|-------------|
|
|
246
|
+
| `--verbose` / `-v` | Show detailed output with finding locations |
|
|
247
|
+
| `--format FORMAT` | Only scan files of a specific format (ndpi, svs, mrxs, bif, scn, dicom, tiff) |
|
|
248
|
+
| `--workers N` / `-w N` | Scan N files in parallel (faster for large batches) |
|
|
249
|
+
| `--report FILE` | Generate a PDF scan report |
|
|
250
|
+
| `--json-out FILE` | Export scan results as machine-readable JSON |
|
|
251
|
+
| `--institution NAME` | Institution name for PDF report headers |
|
|
252
|
+
| `--log FILE` | Save all output to a log file |
|
|
253
|
+
|
|
254
|
+
### Anonymize options
|
|
255
|
+
|
|
256
|
+
| Option | What it does |
|
|
257
|
+
|--------|-------------|
|
|
258
|
+
| `--output DIR` / `-o` | Save cleaned copies to this directory (originals untouched) |
|
|
259
|
+
| `--in-place` | Modify files directly instead of copying (requires explicit opt-in) |
|
|
260
|
+
| `--dry-run` | Show what would be done without making any changes |
|
|
261
|
+
| `--verbose` / `-v` | Show detailed output |
|
|
262
|
+
| `--workers N` / `-w N` | Process N files in parallel (faster for large batches) |
|
|
263
|
+
| `--certificate FILE` / `-c` | Generate a compliance certificate (JSON + PDF) |
|
|
264
|
+
| `--institution NAME` / `-i` | Institution name for PDF certificate headers |
|
|
265
|
+
| `--format FORMAT` | Only process files of a specific format |
|
|
266
|
+
| `--no-verify` | Skip the automatic re-scan after anonymization |
|
|
267
|
+
| `--no-verify-integrity` | Skip image integrity checking (enabled by default) |
|
|
268
|
+
| `--no-reset-timestamps` | Keep original file timestamps (reset by default) |
|
|
269
|
+
| `--log FILE` | Save all output to a log file |
|
|
270
|
+
|
|
271
|
+
### Verify options
|
|
272
|
+
|
|
273
|
+
| Option | What it does |
|
|
274
|
+
|--------|-------------|
|
|
275
|
+
| `--verbose` / `-v` | Show detailed output |
|
|
276
|
+
| `--format FORMAT` | Only verify files of a specific format |
|
|
277
|
+
|
|
278
|
+
### Convert options
|
|
279
|
+
|
|
280
|
+
| Option | What it does |
|
|
281
|
+
|--------|-------------|
|
|
282
|
+
| `--output FILE/DIR` / `-o` | Output file or directory (required) |
|
|
283
|
+
| `--target-format` / `-t` | Target format: `tiff` (default), `png`, or `jpeg` |
|
|
284
|
+
| `--tile-size N` | Tile size for pyramidal TIFF in pixels (default: 256) |
|
|
285
|
+
| `--quality N` | JPEG quality 1-100 (default: 90) |
|
|
286
|
+
| `--anonymize` / `-a` | Also anonymize the converted output |
|
|
287
|
+
| `--extract TYPE` | Extract a `label`, `macro`, or `thumbnail` image (single file only) |
|
|
288
|
+
| `--reset-timestamps` | Reset file timestamps on output files |
|
|
289
|
+
| `--workers N` / `-w N` | Number of parallel workers for batch conversion |
|
|
290
|
+
| `--format FORMAT` | Only convert files of a specific format (batch mode) |
|
|
291
|
+
| `--verbose` / `-v` | Show detailed output |
|
|
292
|
+
|
|
293
|
+
</details>
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Compliance Certificate
|
|
298
|
+
|
|
299
|
+
When you anonymize files (through the GUI or with `--certificate` on the command line), PathSafe generates a report documenting everything it did. This report serves as proof that your files were properly de-identified.
|
|
300
|
+
|
|
301
|
+
**What's in the certificate:**
|
|
302
|
+
|
|
303
|
+
- Which version of PathSafe was used
|
|
304
|
+
- When the batch was processed
|
|
305
|
+
- For each file: what patient data was found, what was removed, and whether the file passed verification
|
|
306
|
+
- A unique fingerprint (hash) of each cleaned file, so you can later prove the file hasn't been modified
|
|
307
|
+
- A glossary explaining each type of finding
|
|
308
|
+
|
|
309
|
+
**Why this matters:** This documentation can be used for regulatory reviews, research ethics submissions, or institutional audit trails. Keep the certificate with your anonymized files.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## What Patient Data Does PathSafe Remove?
|
|
314
|
+
|
|
315
|
+
PathSafe removes these types of hidden information from your slide files:
|
|
316
|
+
|
|
317
|
+
- **Accession numbers and case IDs** -- The primary patient/case identifiers embedded in file metadata
|
|
318
|
+
- **Patient names, IDs, and demographics** -- Found in DICOM files and some scanner formats
|
|
319
|
+
- **Scan dates and times** -- Can be cross-referenced with hospital records to identify patients
|
|
320
|
+
- **Operator and physician names** -- Who scanned or ordered the slide
|
|
321
|
+
- **Label and macro images** -- Embedded photographs of the physical slide label, which may show patient names, barcodes, or handwritten notes
|
|
322
|
+
- **Scanner and institution information** -- Serial numbers, software versions, and location data that could identify where a slide came from
|
|
323
|
+
- **Hidden metadata** -- Technical data (EXIF, GPS coordinates, color profiles) that standard viewers don't show but can still be extracted
|
|
324
|
+
- **Filenames** -- PathSafe detects patient data in filenames and warns you (filenames must be renamed manually)
|
|
325
|
+
|
|
326
|
+
PathSafe scans every layer of the file, not just the surface. It also does a final sweep of the raw file data to catch anything that might have been missed.
|
|
327
|
+
|
|
328
|
+
For a detailed technical breakdown of exactly which fields are cleaned in each format, see the [compliance documentation](docs/COMPLIANCE.md).
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Supported Scanner Formats
|
|
333
|
+
|
|
334
|
+
| Scanner brand | File type | Fully supported |
|
|
335
|
+
|---------------|-----------|:---------------:|
|
|
336
|
+
| **Hamamatsu** | .ndpi | Yes |
|
|
337
|
+
| **Aperio** | .svs | Yes |
|
|
338
|
+
| **3DHISTECH / MIRAX** | .mrxs | Yes |
|
|
339
|
+
| **Roche / Ventana** | .bif | Yes |
|
|
340
|
+
| **Leica** | .scn | Yes |
|
|
341
|
+
| **DICOM WSI** | .dcm, .dicom | Yes |
|
|
342
|
+
| **Other TIFF-based** (Philips, QPTIFF, Trestle, OME-TIFF, etc.) | .tif, .tiff | Yes (generic handler) |
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## How PathSafe Compares
|
|
347
|
+
|
|
348
|
+
PathSafe implements **Level IV** anonymization as defined by [Bisson et al. (2023)](https://doi.org/10.1177/20552076231171475), which covers filename detection, label/macro image destruction, and complete metadata removal.
|
|
349
|
+
|
|
350
|
+
| Capability | PathSafe | anonymize-slide | EMPAIA wsi-anon |
|
|
351
|
+
|------------|:--------:|:---------------:|:---------------:|
|
|
352
|
+
| Detects patient data in filenames | Yes | No | No |
|
|
353
|
+
| Erases label/macro photos | Yes | Yes | Yes |
|
|
354
|
+
| Removes all metadata | Yes | No | Partial |
|
|
355
|
+
| Scans every layer of the file | Yes | No | Unknown |
|
|
356
|
+
| Scans hidden sub-directories (EXIF, GPS) | Yes | No | No |
|
|
357
|
+
| Re-checks files after cleaning | Yes | No | No |
|
|
358
|
+
| Verifies image integrity | Yes | No | No |
|
|
359
|
+
| Generates compliance reports (PDF + JSON) | Yes | No | No |
|
|
360
|
+
| Number of formats supported | 7 | 3 | Multiple |
|
|
361
|
+
| Graphical interface | Yes | No | No |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Security
|
|
366
|
+
|
|
367
|
+
- **No internet connection**: PathSafe works entirely offline. No data ever leaves your computer.
|
|
368
|
+
- **No code execution from files**: PathSafe reads and overwrites bytes -- it never runs anything found inside slide files.
|
|
369
|
+
- **Open source**: The entire codebase is available for review.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## Dependencies
|
|
374
|
+
|
|
375
|
+
PathSafe is lightweight. The only required dependencies are `click` (command-line framework) and `fpdf2` (PDF generation). All file reading uses Python's built-in standard library.
|
|
376
|
+
|
|
377
|
+
Optional packages add extra features.
|
|
378
|
+
For source installs (from a local clone), use these extras:
|
|
379
|
+
|
|
380
|
+
| Package | What it adds | Install with |
|
|
381
|
+
|---------|-------------|--------------|
|
|
382
|
+
| PySide6 | Graphical interface | `pip install -e ".[gui]"` |
|
|
383
|
+
| pydicom | DICOM WSI support | `pip install -e ".[dicom]"` |
|
|
384
|
+
| openslide-python | Enhanced format detection | `pip install -e ".[openslide]"` |
|
|
385
|
+
| tifffile + numpy | Format conversion | `pip install -e ".[convert]"` |
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Further Reading
|
|
390
|
+
|
|
391
|
+
- **[Instructions Guide](docs/INSTRUCTIONS.md)** -- Step-by-step walkthrough of every feature
|
|
392
|
+
- **[User Guide](docs/USER_GUIDE.md)** -- Detailed usage for CLI and GUI
|
|
393
|
+
- **[Compliance Documentation](docs/COMPLIANCE.md)** -- Full technical breakdown of every field cleaned in every format
|
|
394
|
+
- **[PyPI Publishing Setup](docs/PYPI_PUBLISHING.md)** -- One-time Trusted Publisher configuration
|
|
395
|
+
- **[Developer Guide](docs/DEVELOPER.md)** -- Architecture, testing, and how to add new formats
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Acknowledgments
|
|
400
|
+
|
|
401
|
+
Developed and tested at the McGill University Health Center Research Institute, Department of Pathology.
|
|
402
|
+
|
|
403
|
+
## License
|
|
404
|
+
|
|
405
|
+
Apache 2.0
|