cvd-simulator 1.1.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.
- cvd_simulator-1.1.1/.zenodo.json +60 -0
- cvd_simulator-1.1.1/CHANGELOG.md +45 -0
- cvd_simulator-1.1.1/CITATION.cff +95 -0
- cvd_simulator-1.1.1/LICENSE +21 -0
- cvd_simulator-1.1.1/MANIFEST.in +17 -0
- cvd_simulator-1.1.1/PKG-INFO +348 -0
- cvd_simulator-1.1.1/README.md +303 -0
- cvd_simulator-1.1.1/docs/Makefile +26 -0
- cvd_simulator-1.1.1/docs/_static/custom.css +53 -0
- cvd_simulator-1.1.1/docs/algorithms.rst +119 -0
- cvd_simulator-1.1.1/docs/api.rst +90 -0
- cvd_simulator-1.1.1/docs/changelog.rst +85 -0
- cvd_simulator-1.1.1/docs/conf.py +96 -0
- cvd_simulator-1.1.1/docs/contributing.rst +115 -0
- cvd_simulator-1.1.1/docs/index.rst +68 -0
- cvd_simulator-1.1.1/docs/installation.rst +82 -0
- cvd_simulator-1.1.1/docs/usage.rst +154 -0
- cvd_simulator-1.1.1/examples/original_script.py +55 -0
- cvd_simulator-1.1.1/pyproject.toml +153 -0
- cvd_simulator-1.1.1/requirements-dev.txt +33 -0
- cvd_simulator-1.1.1/requirements.txt +5 -0
- cvd_simulator-1.1.1/setup.cfg +4 -0
- cvd_simulator-1.1.1/src/cvd_simulator/__init__.py +91 -0
- cvd_simulator-1.1.1/src/cvd_simulator/config.py +370 -0
- cvd_simulator-1.1.1/src/cvd_simulator/core/__init__.py +23 -0
- cvd_simulator-1.1.1/src/cvd_simulator/core/image_loader.py +188 -0
- cvd_simulator-1.1.1/src/cvd_simulator/core/output_writer.py +237 -0
- cvd_simulator-1.1.1/src/cvd_simulator/core/simulator.py +509 -0
- cvd_simulator-1.1.1/src/cvd_simulator/core/video_processor.py +353 -0
- cvd_simulator-1.1.1/src/cvd_simulator/enums.py +159 -0
- cvd_simulator-1.1.1/src/cvd_simulator/exceptions.py +208 -0
- cvd_simulator-1.1.1/src/cvd_simulator/interfaces/__init__.py +9 -0
- cvd_simulator-1.1.1/src/cvd_simulator/interfaces/cli.py +403 -0
- cvd_simulator-1.1.1/src/cvd_simulator/presets.py +322 -0
- cvd_simulator-1.1.1/src/cvd_simulator/utils/__init__.py +10 -0
- cvd_simulator-1.1.1/src/cvd_simulator/utils/logging_config.py +146 -0
- cvd_simulator-1.1.1/src/cvd_simulator/utils/metadata.py +319 -0
- cvd_simulator-1.1.1/src/cvd_simulator/utils/profiling.py +343 -0
- cvd_simulator-1.1.1/src/cvd_simulator/utils/validators.py +286 -0
- cvd_simulator-1.1.1/src/cvd_simulator.egg-info/PKG-INFO +348 -0
- cvd_simulator-1.1.1/src/cvd_simulator.egg-info/SOURCES.txt +58 -0
- cvd_simulator-1.1.1/src/cvd_simulator.egg-info/dependency_links.txt +1 -0
- cvd_simulator-1.1.1/src/cvd_simulator.egg-info/entry_points.txt +2 -0
- cvd_simulator-1.1.1/src/cvd_simulator.egg-info/requires.txt +22 -0
- cvd_simulator-1.1.1/src/cvd_simulator.egg-info/top_level.txt +1 -0
- cvd_simulator-1.1.1/tests/__init__.py +1 -0
- cvd_simulator-1.1.1/tests/benchmarks/test_performance.py +275 -0
- cvd_simulator-1.1.1/tests/conftest.py +86 -0
- cvd_simulator-1.1.1/tests/integration/__init__.py +1 -0
- cvd_simulator-1.1.1/tests/integration/test_end_to_end.py +126 -0
- cvd_simulator-1.1.1/tests/property/test_properties.py +265 -0
- cvd_simulator-1.1.1/tests/unit/__init__.py +1 -0
- cvd_simulator-1.1.1/tests/unit/test_cli.py +303 -0
- cvd_simulator-1.1.1/tests/unit/test_config.py +143 -0
- cvd_simulator-1.1.1/tests/unit/test_image_loader.py +92 -0
- cvd_simulator-1.1.1/tests/unit/test_metadata.py +241 -0
- cvd_simulator-1.1.1/tests/unit/test_presets.py +187 -0
- cvd_simulator-1.1.1/tests/unit/test_profiling.py +256 -0
- cvd_simulator-1.1.1/tests/unit/test_simulator.py +135 -0
- cvd_simulator-1.1.1/tests/unit/test_validators.py +145 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "CVD Simulator: A Scientifically-Validated Tool for Color Vision Deficiency Simulation",
|
|
3
|
+
"description": "A comprehensive Python package for simulating color vision deficiencies (CVD) including protanopia, deuteranopia, tritanopia, and achromatopsia. Unifies multiple peer-reviewed algorithms (Brettel 1997, Viénot 1999, Machado 2009) with configurable severity levels, batch processing, and production-ready features.",
|
|
4
|
+
"creators": [
|
|
5
|
+
{
|
|
6
|
+
"name": "Semoglou, Michail",
|
|
7
|
+
"orcid": "0009-0003-3268-5657",
|
|
8
|
+
"affiliation": "College of Design and Innovation, Tongji University"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"version": "1.1.1",
|
|
12
|
+
"license": {
|
|
13
|
+
"id": "MIT"
|
|
14
|
+
},
|
|
15
|
+
"upload_type": "software",
|
|
16
|
+
"access_right": "open",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"color vision deficiency",
|
|
19
|
+
"color blindness",
|
|
20
|
+
"accessibility",
|
|
21
|
+
"image processing",
|
|
22
|
+
"daltonization",
|
|
23
|
+
"protanopia",
|
|
24
|
+
"deuteranopia",
|
|
25
|
+
"tritanopia",
|
|
26
|
+
"achromatopsia",
|
|
27
|
+
"scientific computing",
|
|
28
|
+
"human-computer interaction",
|
|
29
|
+
"inclusive design",
|
|
30
|
+
"Python"
|
|
31
|
+
],
|
|
32
|
+
"related_identifiers": [
|
|
33
|
+
{
|
|
34
|
+
"scheme": "url",
|
|
35
|
+
"identifier": "https://github.com/MichailSemoglou/types-of-cvd-simulator-app",
|
|
36
|
+
"relation": "isSupplementTo"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"scheme": "url",
|
|
40
|
+
"identifier": "https://pypi.org/project/cvd-simulator/",
|
|
41
|
+
"relation": "isIdenticalTo"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"scheme": "doi",
|
|
45
|
+
"identifier": "10.1364/JOSAA.14.002647",
|
|
46
|
+
"relation": "references"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"scheme": "doi",
|
|
50
|
+
"identifier": "10.1002/(SICI)1520-6378(199908)24:4<243::AID-COL5>3.0.CO;2-3",
|
|
51
|
+
"relation": "references"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"scheme": "doi",
|
|
55
|
+
"identifier": "10.1109/TVCG.2009.113",
|
|
56
|
+
"relation": "references"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"notes": "Published via the Zenodo-GitHub integration. Each GitHub release automatically triggers a new Zenodo deposit."
|
|
60
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the **CVD Simulator** project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [1.1.1] — 2026-02-13
|
|
11
|
+
|
|
12
|
+
### New Features
|
|
13
|
+
|
|
14
|
+
- **Multiple Simulation Algorithms** — Support for Brettel (1997), Viénot (1999), Machado (2009), Vischeck, and an auto-select mode that picks the best algorithm for the requested CVD type.
|
|
15
|
+
- **All CVD Types** — Simulate protanopia, deuteranopia, tritanopia, and achromatopsia (full grayscale) with adjustable severity from 0.0 to 1.0.
|
|
16
|
+
- **Batch Processing** — Process multiple images in a single invocation with `tqdm` progress bars and `rich` console output.
|
|
17
|
+
- **Configuration Presets** — Built-in presets for common workflows: Web Design, Print Media, Scientific Visualization, and more (`PresetType` enum / `apply_preset()`).
|
|
18
|
+
- **Video Frame Extraction** — Basic video processing via FFmpeg integration (`VideoProcessor`).
|
|
19
|
+
- **Metadata Export** — JSON sidecar files recording algorithm, severity, CVD type, and timing for full reproducibility (`SimulationMetadata`, `export_metadata()`).
|
|
20
|
+
- **Performance Profiling** — Built-in `PerformanceProfiler` and `Timer` utilities for benchmarking simulation pipelines.
|
|
21
|
+
- **Flexible Configuration** — Configure via Python API (`SimulationConfig`), environment variables, CLI arguments, or presets. Optional Pydantic model available (`SimulationConfigPydantic`).
|
|
22
|
+
- **Async Support** — `AsyncCVDSimulator` for non-blocking batch processing in asynchronous applications.
|
|
23
|
+
- **Security & Validation** — Input validation, path sanitization, and file-size limits to harden against malicious inputs (`validators` module).
|
|
24
|
+
- **Type Safety** — Fully typed codebase with `mypy --strict` compliance; custom exception hierarchy (`CVDSimulatorError`, `ImageProcessingError`, `SecurityError`, `ValidationError`, `ConfigurationError`).
|
|
25
|
+
- **CLI** — Feature-rich command-line interface (`cvd-simulator`) with support for `--list-algorithms`, `--list-cvd-types`, format selection, output directories, and more.
|
|
26
|
+
- **Comprehensive Test Suite** — Unit, integration, property-based (Hypothesis), and benchmark (pytest-benchmark) tests with coverage reporting.
|
|
27
|
+
- **Documentation** — Sphinx-based docs (RST) with autodoc, type hints, and Read the Docs–compatible configuration.
|
|
28
|
+
- **Docker Support** — `Dockerfile` and `docker-compose.yml` for containerised usage.
|
|
29
|
+
- **CI/CD** — GitHub Actions workflow for automated PyPI publishing on release.
|
|
30
|
+
|
|
31
|
+
### Known Issues
|
|
32
|
+
|
|
33
|
+
- Zenodo DOI: [10.5281/zenodo.18639546](https://doi.org/10.5281/zenodo.18639546)
|
|
34
|
+
- Video processing requires a system-installed FFmpeg binary; it is not bundled with the package.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## [Unreleased]
|
|
39
|
+
|
|
40
|
+
_No unreleased changes._
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
[1.1.1]: https://github.com/MichailSemoglou/types-of-cvd-simulator-app/releases/tag/v1.1.1
|
|
45
|
+
[Unreleased]: https://github.com/MichailSemoglou/types-of-cvd-simulator-app/compare/v1.1.1...HEAD
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this software, please cite it using the metadata from this file."
|
|
3
|
+
type: software
|
|
4
|
+
title: "CVD Simulator: A Scientifically-Validated Tool for Color Vision Deficiency Simulation"
|
|
5
|
+
abstract: >-
|
|
6
|
+
A comprehensive Python package for simulating color vision deficiencies (CVD)
|
|
7
|
+
including protanopia, deuteranopia, tritanopia, and achromatopsia. CVD Simulator
|
|
8
|
+
unifies multiple peer-reviewed algorithms (Brettel 1997, Viénot 1999, Machado 2009)
|
|
9
|
+
with configurable severity levels, batch processing capabilities, and production-ready
|
|
10
|
+
features including security validation, comprehensive testing, and type safety.
|
|
11
|
+
authors:
|
|
12
|
+
- family-names: "Semoglou"
|
|
13
|
+
given-names: "Michail"
|
|
14
|
+
orcid: "https://orcid.org/0009-0003-3268-5657"
|
|
15
|
+
affiliation: "College of Design and Innovation, Tongji University"
|
|
16
|
+
repository-code: "https://github.com/MichailSemoglou/types-of-cvd-simulator-app"
|
|
17
|
+
url: "https://github.com/MichailSemoglou/types-of-cvd-simulator-app"
|
|
18
|
+
license: MIT
|
|
19
|
+
version: "1.1.1"
|
|
20
|
+
date-released: "2026-02-13"
|
|
21
|
+
keywords:
|
|
22
|
+
- color vision deficiency
|
|
23
|
+
- color blindness
|
|
24
|
+
- accessibility
|
|
25
|
+
- image processing
|
|
26
|
+
- daltonization
|
|
27
|
+
- protanopia
|
|
28
|
+
- deuteranopia
|
|
29
|
+
- tritanopia
|
|
30
|
+
- achromatopsia
|
|
31
|
+
- scientific computing
|
|
32
|
+
- human-computer interaction
|
|
33
|
+
- inclusive design
|
|
34
|
+
- Python
|
|
35
|
+
identifiers:
|
|
36
|
+
- type: doi
|
|
37
|
+
value: "10.5281/zenodo.18639546"
|
|
38
|
+
description: "The DOI for version 1.1.1"
|
|
39
|
+
preferred-citation:
|
|
40
|
+
type: software
|
|
41
|
+
title: "CVD Simulator: A Scientifically-Validated Tool for Color Vision Deficiency Simulation"
|
|
42
|
+
authors:
|
|
43
|
+
- family-names: "Semoglou"
|
|
44
|
+
given-names: "Michail"
|
|
45
|
+
orcid: "https://orcid.org/0009-0003-3268-5657"
|
|
46
|
+
affiliation: "College of Design and Innovation, Tongji University"
|
|
47
|
+
year: 2026
|
|
48
|
+
url: "https://github.com/MichailSemoglou/types-of-cvd-simulator-app"
|
|
49
|
+
version: "1.1.1"
|
|
50
|
+
references:
|
|
51
|
+
- type: article
|
|
52
|
+
authors:
|
|
53
|
+
- family-names: "Brettel"
|
|
54
|
+
given-names: "Hans"
|
|
55
|
+
- family-names: "Viénot"
|
|
56
|
+
given-names: "Françoise"
|
|
57
|
+
- family-names: "Mollon"
|
|
58
|
+
given-names: "John D."
|
|
59
|
+
title: "Computerized simulation of color appearance for dichromats"
|
|
60
|
+
year: 1997
|
|
61
|
+
journal: "Journal of the Optical Society of America A"
|
|
62
|
+
volume: 14
|
|
63
|
+
issue: 10
|
|
64
|
+
pages: "2647-2655"
|
|
65
|
+
doi: 10.1364/JOSAA.14.002647
|
|
66
|
+
- type: article
|
|
67
|
+
authors:
|
|
68
|
+
- family-names: "Viénot"
|
|
69
|
+
given-names: "Françoise"
|
|
70
|
+
- family-names: "Brettel"
|
|
71
|
+
given-names: "Hans"
|
|
72
|
+
- family-names: "Mollon"
|
|
73
|
+
given-names: "John D."
|
|
74
|
+
title: "Digital video colourmaps for checking the legibility of displays by dichromats"
|
|
75
|
+
year: 1999
|
|
76
|
+
journal: "Color Research & Application"
|
|
77
|
+
volume: 24
|
|
78
|
+
issue: 4
|
|
79
|
+
pages: "243-252"
|
|
80
|
+
doi: 10.1002/(SICI)1520-6378(199908)24:4<243::AID-COL5>3.0.CO;2-3
|
|
81
|
+
- type: article
|
|
82
|
+
authors:
|
|
83
|
+
- family-names: "Machado"
|
|
84
|
+
given-names: "Gustavo M."
|
|
85
|
+
- family-names: "Oliveira"
|
|
86
|
+
given-names: "Manuel M."
|
|
87
|
+
- family-names: "Fernandes"
|
|
88
|
+
given-names: "Leandro A. F."
|
|
89
|
+
title: "A physiologically-based model for simulation of color vision deficiency"
|
|
90
|
+
year: 2009
|
|
91
|
+
journal: "IEEE Transactions on Visualization and Computer Graphics"
|
|
92
|
+
volume: 15
|
|
93
|
+
issue: 6
|
|
94
|
+
pages: "1291-1298"
|
|
95
|
+
doi: 10.1109/TVCG.2009.113
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Michail Semoglou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Root metadata files
|
|
2
|
+
include LICENSE CITATION.cff CHANGELOG.md README.md
|
|
3
|
+
include .zenodo.json
|
|
4
|
+
include requirements.txt requirements-dev.txt
|
|
5
|
+
|
|
6
|
+
# Documentation (Sphinx sources + assets)
|
|
7
|
+
recursive-include docs *.rst *.py *.css
|
|
8
|
+
include docs/Makefile
|
|
9
|
+
|
|
10
|
+
# Examples
|
|
11
|
+
recursive-include examples *.py
|
|
12
|
+
|
|
13
|
+
# Tests (allows running tests from the sdist)
|
|
14
|
+
recursive-include tests *.py
|
|
15
|
+
|
|
16
|
+
# Prevent build artifacts from leaking into the sdist
|
|
17
|
+
global-exclude *.pyc *.pyo *.pyd __pycache__ .DS_Store Thumbs.db
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cvd-simulator
|
|
3
|
+
Version: 1.1.1
|
|
4
|
+
Summary: A comprehensive tool for simulating color vision deficiencies
|
|
5
|
+
Author: Michail Semoglou
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MichailSemoglou/types-of-cvd-simulator-app
|
|
8
|
+
Project-URL: Repository, https://github.com/MichailSemoglou/types-of-cvd-simulator-app.git
|
|
9
|
+
Project-URL: Issues, https://github.com/MichailSemoglou/types-of-cvd-simulator-app/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: daltonlens==0.1.5
|
|
24
|
+
Requires-Dist: Pillow==12.1.1
|
|
25
|
+
Requires-Dist: numpy>=2.0.0
|
|
26
|
+
Requires-Dist: tqdm>=4.66.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-benchmark>=4.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
33
|
+
Requires-Dist: hypothesis>=6.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: flake8>=7.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: mypy>=1.10.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pydantic>=2.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: psutil>=5.9.0; extra == "dev"
|
|
39
|
+
Requires-Dist: sphinx>=7.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "dev"
|
|
41
|
+
Requires-Dist: sphinx-autodoc-typehints>=1.25.0; extra == "dev"
|
|
42
|
+
Requires-Dist: setuptools>=61.0; extra == "dev"
|
|
43
|
+
Requires-Dist: wheel>=0.37.0; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# CVD Simulator
|
|
47
|
+
|
|
48
|
+
[](https://doi.org/10.5281/zenodo.18639546)
|
|
49
|
+
|
|
50
|
+
A comprehensive Python package for simulating color vision deficiencies (CVD), including protanopia, deuteranopia, and tritanopia. This tool uses scientifically-validated algorithms to simulate how images appear to individuals with different types of color blindness.
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **Multiple Simulation Algorithms**: Support for Brettel (1997), Viénot (1999), Machado (2009), Vischeck, and Auto-select algorithms
|
|
55
|
+
- **All CVD Types**: Simulate protanopia, deuteranopia, tritanopia, and grayscale (achromatopsia)
|
|
56
|
+
- **Batch Processing**: Process multiple images efficiently with progress bars
|
|
57
|
+
- **Configuration Presets**: Quick presets for Web Design, Print Media, Scientific Visualization, and more
|
|
58
|
+
- **Video Frame Extraction**: Basic video processing with FFmpeg integration
|
|
59
|
+
- **Metadata Export**: JSON sidecar files for reproducibility
|
|
60
|
+
- **Performance Profiling**: Built-in timing and performance analysis
|
|
61
|
+
- **Flexible Configuration**: Configure via code, environment variables, CLI arguments, or presets
|
|
62
|
+
- **Security**: Built-in input validation and path sanitization
|
|
63
|
+
- **Type Hints**: Fully typed codebase for better IDE support
|
|
64
|
+
- **Comprehensive Testing**: Unit and integration test suite
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
### From PyPI (Recommended)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install cvd-simulator
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### From Source
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/MichailSemoglou/types-of-cvd-simulator-app.git
|
|
78
|
+
cd types-of-cvd-simulator-app
|
|
79
|
+
pip install -e .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Video Processing (Optional)
|
|
83
|
+
|
|
84
|
+
For video frame extraction capabilities:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# macOS
|
|
88
|
+
brew install ffmpeg
|
|
89
|
+
|
|
90
|
+
# Ubuntu/Debian
|
|
91
|
+
sudo apt-get install ffmpeg
|
|
92
|
+
|
|
93
|
+
# Windows (via Chocolatey)
|
|
94
|
+
choco install ffmpeg
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Development Installation
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install -e ".[dev]"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Quick Start
|
|
104
|
+
|
|
105
|
+
### Command Line Interface
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Process a single image
|
|
109
|
+
cvd-simulator input.jpg
|
|
110
|
+
|
|
111
|
+
# Process with specific algorithm and severity
|
|
112
|
+
cvd-simulator input.jpg -a MACHADO_2009 -s 0.7
|
|
113
|
+
|
|
114
|
+
# Process multiple images
|
|
115
|
+
cvd-simulator img1.jpg img2.jpg img3.jpg
|
|
116
|
+
|
|
117
|
+
# Output as PNG with custom directory
|
|
118
|
+
cvd-simulator input.jpg -f PNG -o ./my_outputs
|
|
119
|
+
|
|
120
|
+
# List available algorithms
|
|
121
|
+
cvd-simulator --list-algorithms
|
|
122
|
+
|
|
123
|
+
# List available CVD types
|
|
124
|
+
cvd-simulator --list-types
|
|
125
|
+
|
|
126
|
+
# Use a preset configuration (v1.1.1+)
|
|
127
|
+
cvd-simulator input.jpg --preset web_design
|
|
128
|
+
|
|
129
|
+
# Show progress bar during batch processing (v1.1.1+)
|
|
130
|
+
cvd-simulator img1.jpg img2.jpg img3.jpg --progress
|
|
131
|
+
|
|
132
|
+
# Export metadata for reproducibility (v1.1.1+)
|
|
133
|
+
cvd-simulator input.jpg --export-metadata
|
|
134
|
+
|
|
135
|
+
# Enable performance profiling (v1.1.1+)
|
|
136
|
+
cvd-simulator input.jpg --profile
|
|
137
|
+
|
|
138
|
+
# List available presets (v1.1.1+)
|
|
139
|
+
cvd-simulator --list-presets
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Python API
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
from pathlib import Path
|
|
146
|
+
from cvd_simulator import CVDSimulator, SimulationConfig
|
|
147
|
+
from cvd_simulator.enums import Algorithm, CVDType, OutputFormat
|
|
148
|
+
|
|
149
|
+
# Create configuration
|
|
150
|
+
config = SimulationConfig(
|
|
151
|
+
algorithm=Algorithm.MACHADO_2009,
|
|
152
|
+
severity=0.8,
|
|
153
|
+
output_format=OutputFormat.PNG,
|
|
154
|
+
output_directory=Path("./outputs"),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
# Initialize simulator
|
|
158
|
+
simulator = CVDSimulator(config)
|
|
159
|
+
|
|
160
|
+
# Process a single image
|
|
161
|
+
results = simulator.process_image(Path("input.jpg"))
|
|
162
|
+
|
|
163
|
+
# Access specific CVD simulation
|
|
164
|
+
protan_path = results[CVDType.PROTAN]
|
|
165
|
+
deutan_path = results[CVDType.DEUTAN]
|
|
166
|
+
tritan_path = results[CVDType.TRITAN]
|
|
167
|
+
bw_path = results[CVDType.GRAYSCALE]
|
|
168
|
+
|
|
169
|
+
# Process specific CVD type only
|
|
170
|
+
image = simulator.loader.load(Path("input.jpg"))
|
|
171
|
+
simulated = simulator.simulate(image, CVDType.PROTAN)
|
|
172
|
+
|
|
173
|
+
# Batch processing
|
|
174
|
+
image_paths = [Path("img1.jpg"), Path("img2.jpg")]
|
|
175
|
+
batch_results = simulator.process_batch(image_paths)
|
|
176
|
+
|
|
177
|
+
# Using configuration presets (v1.1.1+)
|
|
178
|
+
from cvd_simulator.presets import apply_preset, PresetType
|
|
179
|
+
|
|
180
|
+
config = apply_preset(PresetType.WEB_DESIGN)
|
|
181
|
+
simulator = CVDSimulator(config)
|
|
182
|
+
|
|
183
|
+
# Export metadata for reproducibility (v1.1.1+)
|
|
184
|
+
from cvd_simulator.utils.metadata import create_metadata, export_metadata, generate_sidecar_path
|
|
185
|
+
|
|
186
|
+
results = simulator.process_image(Path("input.jpg"))
|
|
187
|
+
metadata = create_metadata(
|
|
188
|
+
Path("input.jpg"),
|
|
189
|
+
results,
|
|
190
|
+
config,
|
|
191
|
+
notes="Research batch 2026-02"
|
|
192
|
+
)
|
|
193
|
+
sidecar_path = generate_sidecar_path("input.jpg")
|
|
194
|
+
export_metadata(metadata, sidecar_path)
|
|
195
|
+
|
|
196
|
+
# Performance profiling (v1.1.1+)
|
|
197
|
+
from cvd_simulator.utils.profiling import PerformanceProfiler
|
|
198
|
+
|
|
199
|
+
profiler = PerformanceProfiler()
|
|
200
|
+
with profiler.time_operation("batch_process"):
|
|
201
|
+
results = simulator.process_batch(image_paths)
|
|
202
|
+
|
|
203
|
+
print(profiler.get_summary())
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Configuration via Environment Variables
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
export CVD_SIMULATOR_ALGORITHM=MACHADO_2009
|
|
210
|
+
export CVD_SIMULATOR_SEVERITY=0.7
|
|
211
|
+
export CVD_SIMULATOR_OUTPUT_FORMAT=PNG
|
|
212
|
+
export CVD_SIMULATOR_OUTPUT_DIRECTORY=./my_outputs
|
|
213
|
+
|
|
214
|
+
cvd-simulator input.jpg
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Project Structure
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
cvd-simulator/
|
|
221
|
+
├── src/
|
|
222
|
+
│ ├── cvd_simulator/
|
|
223
|
+
│ │ ├── __init__.py
|
|
224
|
+
│ │ ├── exceptions.py # Custom exceptions
|
|
225
|
+
│ │ ├── enums.py # Enumerations (CVDType, Algorithm, etc.)
|
|
226
|
+
│ │ ├── config.py # Configuration management
|
|
227
|
+
│ │ ├── core/
|
|
228
|
+
│ │ │ ├── __init__.py
|
|
229
|
+
│ │ │ ├── simulator.py # Main CVDSimulator class
|
|
230
|
+
│ │ │ ├── image_loader.py
|
|
231
|
+
│ │ │ └── output_writer.py
|
|
232
|
+
│ │ ├── interfaces/
|
|
233
|
+
│ │ │ ├── __init__.py
|
|
234
|
+
│ │ │ └── cli.py # Command-line interface
|
|
235
|
+
│ │ └── utils/
|
|
236
|
+
│ │ ├── __init__.py
|
|
237
|
+
│ │ ├── validators.py # Security validation
|
|
238
|
+
│ │ └── logging_config.py
|
|
239
|
+
│ └── main.py
|
|
240
|
+
├── tests/
|
|
241
|
+
│ ├── unit/
|
|
242
|
+
│ ├── integration/
|
|
243
|
+
│ └── conftest.py
|
|
244
|
+
├── docs/
|
|
245
|
+
├── examples/
|
|
246
|
+
├── outputs/ # Default output directory
|
|
247
|
+
├── requirements.txt
|
|
248
|
+
├── setup.py
|
|
249
|
+
├── pyproject.toml
|
|
250
|
+
└── README.md
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Algorithms
|
|
254
|
+
|
|
255
|
+
The simulator supports multiple scientifically-validated algorithms:
|
|
256
|
+
|
|
257
|
+
| Algorithm | Description |
|
|
258
|
+
| ------------------ | --------------------------------------------------------- |
|
|
259
|
+
| **Brettel (1997)** | Classic algorithm, widely used, computationally efficient |
|
|
260
|
+
| **Viénot (1999)** | Improved accuracy for severe deficiencies |
|
|
261
|
+
| **Machado (2009)** | Modern approach, handles severity levels well |
|
|
262
|
+
| **Vischeck** | Based on the popular Vischeck tool |
|
|
263
|
+
| **Auto-select** | Automatically chooses the best algorithm |
|
|
264
|
+
|
|
265
|
+
## CVD Types
|
|
266
|
+
|
|
267
|
+
| Type | Description |
|
|
268
|
+
| ------------- | --------------------------------------------------- |
|
|
269
|
+
| **Protan** | Protanopia - missing or defective L-cones (red) |
|
|
270
|
+
| **Deutan** | Deuteranopia - missing or defective M-cones (green) |
|
|
271
|
+
| **Tritan** | Tritanopia - missing or defective S-cones (blue) |
|
|
272
|
+
| **Grayscale** | Achromatopsia - complete color blindness |
|
|
273
|
+
|
|
274
|
+
## Testing
|
|
275
|
+
|
|
276
|
+
Run the test suite:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Run all tests
|
|
280
|
+
pytest
|
|
281
|
+
|
|
282
|
+
# Run with coverage
|
|
283
|
+
pytest --cov=cvd_simulator
|
|
284
|
+
|
|
285
|
+
# Run only unit tests
|
|
286
|
+
pytest tests/unit
|
|
287
|
+
|
|
288
|
+
# Run only integration tests
|
|
289
|
+
pytest tests/integration
|
|
290
|
+
|
|
291
|
+
# Run with verbose output
|
|
292
|
+
pytest -v
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Development
|
|
296
|
+
|
|
297
|
+
### Code Formatting
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# Format with black
|
|
301
|
+
black src tests
|
|
302
|
+
|
|
303
|
+
# Type checking
|
|
304
|
+
mypy src
|
|
305
|
+
|
|
306
|
+
# Linting
|
|
307
|
+
flake8 src tests
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Building Documentation
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
cd docs
|
|
314
|
+
make html
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## References
|
|
318
|
+
|
|
319
|
+
- Brettel, H., Viénot, F., & Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. _Journal of the Optical Society of America A_, _14_(10), 2647–2655. https://doi.org/10.1364/JOSAA.14.002647
|
|
320
|
+
- Viénot, F., Brettel, H., & Mollon, J. D. (1999). Digital video colourmaps for checking the legibility of displays by dichromats. _Color Research & Application_, _24_(4), 243–252. https://doi.org/10.1002/(SICI)1520-6378(199908)24:4<243::AID-COL5>3.0.CO;2-3
|
|
321
|
+
- Machado, G. M., Oliveira, M. M., & Fernandes, L. A. F. (2009). A physiologically-based model for simulation of color vision deficiency. _IEEE Transactions on Visualization and Computer Graphics_, _15_(6), 1291–1298. https://doi.org/10.1109/TVCG.2009.113
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
326
|
+
|
|
327
|
+
## Citation
|
|
328
|
+
|
|
329
|
+
If you use CVD Simulator in your research, please cite:
|
|
330
|
+
|
|
331
|
+
```bibtex
|
|
332
|
+
@software{semoglou2026cvd,
|
|
333
|
+
author = {Semoglou, Michail},
|
|
334
|
+
title = {CVD Simulator: A Scientifically-Validated Tool for Color Vision Deficiency Simulation},
|
|
335
|
+
year = {2026},
|
|
336
|
+
version = {1.1.1},
|
|
337
|
+
url = {https://github.com/MichailSemoglou/types-of-cvd-simulator-app},
|
|
338
|
+
doi = {10.5281/zenodo.18639546}
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
See [CITATION.cff](CITATION.cff) for additional citation formats.
|
|
343
|
+
|
|
344
|
+
## Acknowledgments
|
|
345
|
+
|
|
346
|
+
- [DaltonLens](https://github.com/DaltonLens) library for the core simulation algorithms
|
|
347
|
+
- [Pillow](https://python-pillow.org/) for image processing
|
|
348
|
+
- [NumPy](https://numpy.org/) for numerical operations
|