xnattools 1.0.0__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.
Files changed (30) hide show
  1. xnattools-1.0.0/.gitignore +39 -0
  2. xnattools-1.0.0/LICENSE +7 -0
  3. xnattools-1.0.0/PKG-INFO +159 -0
  4. xnattools-1.0.0/README.md +96 -0
  5. xnattools-1.0.0/pyproject.toml +214 -0
  6. xnattools-1.0.0/src/xnattools/__init__.py +17 -0
  7. xnattools-1.0.0/src/xnattools/cli.py +328 -0
  8. xnattools-1.0.0/src/xnattools/core.py +367 -0
  9. xnattools-1.0.0/src/xnattools/dataclasses/__init__.py +0 -0
  10. xnattools-1.0.0/src/xnattools/dataclasses/core.py +242 -0
  11. xnattools-1.0.0/src/xnattools/dataclasses/datmat.py +91 -0
  12. xnattools-1.0.0/src/xnattools/dataclasses/dcm2nifti.py +130 -0
  13. xnattools-1.0.0/src/xnattools/dataclasses/dcm2snapshots.py +75 -0
  14. xnattools-1.0.0/src/xnattools/dataclasses/dcmsort.py +214 -0
  15. xnattools-1.0.0/src/xnattools/dataclasses/returntypes.py +13 -0
  16. xnattools-1.0.0/src/xnattools/dataclasses/scanmetadata.py +99 -0
  17. xnattools-1.0.0/src/xnattools/datmat.py +143 -0
  18. xnattools-1.0.0/src/xnattools/dcm2nifti.py +692 -0
  19. xnattools-1.0.0/src/xnattools/dcm2snapshots.py +191 -0
  20. xnattools-1.0.0/src/xnattools/dcmsort.py +235 -0
  21. xnattools-1.0.0/src/xnattools/logger_config.py +48 -0
  22. xnattools-1.0.0/src/xnattools/map.py +44 -0
  23. xnattools-1.0.0/src/xnattools/utils/__init__.py +0 -0
  24. xnattools-1.0.0/src/xnattools/utils/datmat.py +170 -0
  25. xnattools-1.0.0/src/xnattools/utils/dcm2nifti.py +64 -0
  26. xnattools-1.0.0/src/xnattools/utils/dcm2snaphots.py +190 -0
  27. xnattools-1.0.0/src/xnattools/utils/dcmsort.py +765 -0
  28. xnattools-1.0.0/src/xnattools/utils/download.py +590 -0
  29. xnattools-1.0.0/src/xnattools/utils/filters.py +39 -0
  30. xnattools-1.0.0/src/xnattools/utils/utils.py +261 -0
@@ -0,0 +1,39 @@
1
+ # Pycharm
2
+ .idea
3
+
4
+ # Cache
5
+ *.pyc
6
+ *__pycache__*
7
+ .pytest_cache
8
+
9
+ # Django
10
+ *migrations
11
+
12
+ # Tox
13
+ .tox
14
+ *.egg-info
15
+
16
+ # Test
17
+ tests_output
18
+ test_image
19
+ lai_erasmusmc
20
+ project_example.py
21
+ /XNATTools_old
22
+ /XNATExplorer
23
+ /logs
24
+ .coverage
25
+
26
+ requirements.txt
27
+ # VSCode
28
+ .vscode
29
+
30
+ # env files
31
+ .env.local
32
+ .venv
33
+
34
+ # created diretories
35
+ xnattools_dcm2nii_*
36
+
37
+ # created docs
38
+ public/
39
+ doc/_build
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2026-present Biomedical Imaging Group Rotterdam, Department of Radiology and Nuclear Medicine, Erasmus MC, Rotterdam, The Netherlands
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: xnattools
3
+ Version: 1.0.0
4
+ Summary: Python scripts for handy operations on XNAT data.
5
+ Project-URL: Documentation, https://radiology.gitlab.io/radiomics/xnattools/
6
+ Project-URL: Homepage, https://gitlab.com/radiology/radiomics/xnattools
7
+ Project-URL: Issues, https://gitlab.com/radiology/radiomics/xnattools/-/issues
8
+ Author-email: "Martijn P. A. Starmans" <m.starmans@erasmusmc.nl>, "Erik H.M. Kemper" <e.h.m.kemper@erasmusmc.nl>, Frederik Hartmann <f.hartmann@erasmusmc.nl>
9
+ License: Copyright (c) 2026-present Biomedical Imaging Group Rotterdam, Department of Radiology and Nuclear Medicine, Erasmus MC, Rotterdam, The Netherlands
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ License-File: LICENSE
17
+ Keywords: data,medical imaging,research,science,xnat
18
+ Classifier: Development Status :: 3 - Alpha
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: Intended Audience :: Science/Research
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Natural Language :: English
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Requires-Python: >=3.10
30
+ Requires-Dist: click<9.0.0,>=8.1.7
31
+ Requires-Dist: dcm2niix<2.0.0,>=1.0.20241211
32
+ Requires-Dist: dicom2nifti==2.4.11
33
+ Requires-Dist: matplotlib<4.0.0,>=3.10.1
34
+ Requires-Dist: numpy<3.0.0,>=2.2.4
35
+ Requires-Dist: pandas>=2.3.3
36
+ Requires-Dist: pydantic>=2.12.3
37
+ Requires-Dist: pydicom<3.0.2,>=2.4.4
38
+ Requires-Dist: pytest-mock>=3.15.1
39
+ Requires-Dist: pytest>=9.0.2
40
+ Requires-Dist: python-dotenv>=1.1.1
41
+ Requires-Dist: simpleitk<3.0.0,>=2.4.1
42
+ Requires-Dist: tk>=0.1.0
43
+ Requires-Dist: tox<5.0.0,>=4.25.0
44
+ Requires-Dist: tqdm>=4.67.1
45
+ Requires-Dist: urllib3>=2.7.0
46
+ Requires-Dist: xnat<0.8.0,>=0.7.1
47
+ Provides-Extra: dev
48
+ Requires-Dist: bump-my-version>=1.2.7; extra == 'dev'
49
+ Requires-Dist: ruff>=0.15.4; extra == 'dev'
50
+ Provides-Extra: docs
51
+ Requires-Dist: furo>=2025.12.19; extra == 'docs'
52
+ Requires-Dist: myst-parser>=4.0.1; extra == 'docs'
53
+ Requires-Dist: sphinx-autoapi>=3.7.0; extra == 'docs'
54
+ Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'docs'
55
+ Requires-Dist: sphinx-design>=0.6.1; extra == 'docs'
56
+ Requires-Dist: sphinx>=8.1.3; extra == 'docs'
57
+ Provides-Extra: test
58
+ Requires-Dist: pytest-cov>=7.0.0; extra == 'test'
59
+ Requires-Dist: pytest>=9.0.2; extra == 'test'
60
+ Requires-Dist: requests>=2.33.1; extra == 'test'
61
+ Requires-Dist: xnat4tests>=0.4.1; extra == 'test'
62
+ Description-Content-Type: text/markdown
63
+
64
+ # xnattools
65
+
66
+ xnattools is a python package for handy operations on XNAT data.
67
+
68
+ # Documentation
69
+ The complete documentation is available at [https://radiology.gitlab.io/radiomics/xnattools/](https://radiology.gitlab.io/radiomics/xnattools/) . The following example is a small part of [tutorials](https://radiology.gitlab.io/radiomics/xnattools/tutorials.html). Please refer to the documentation for additional tutorials, examples, how-to guides, and developer guides.
70
+
71
+ ## Prerequisites
72
+
73
+ Before you begin, make sure you have:
74
+
75
+ 1. Installed `xnattools`. For example using pip:
76
+ ```shell
77
+ pip install xnattools
78
+ ```
79
+ 2. Set up your XNAT credentials using one of these methods:
80
+
81
+ **Option 1: Using `.netrc` file** (recommended)
82
+
83
+ Create or edit `~/.netrc` with your XNAT credentials:
84
+
85
+ ```text
86
+ machine xnat.example.com
87
+ login your-xnat-username
88
+ password your-xnat-password
89
+ ```
90
+
91
+ **Option 2: Using `.env.local` file**
92
+
93
+ Create a `.env.local` file in your project directory:
94
+
95
+ ```text
96
+ XNAT_USER=your-xnat-username
97
+ XNAT_PASS=your-xnat-password
98
+ ```
99
+
100
+ 3. Access to an XNAT server with at least one project.
101
+
102
+ ## Basic Example: Running `dcm2nifti`
103
+
104
+ This example shows how to convert DICOM files to NIfTI format for a specific subject.
105
+
106
+ ### Python API
107
+
108
+ ```python
109
+ from pathlib import Path
110
+ import xnattools as xt
111
+
112
+ tools = [xt.Dcm2niftiSettings()]
113
+ settings = xt.GeneralSettings(
114
+ system_url="https://xnat.example.com",
115
+ project_id="MY_XNAT_PROJECT",
116
+ subjects=["SUBJECT_001"],
117
+ output_dir=Path.cwd(),
118
+ )
119
+ xt.run_tools(tools_to_run=tools, general_settings=settings)
120
+ ```
121
+
122
+ ### Command Line
123
+
124
+ ```shell
125
+ xnattools dcm2nifti https://xnat.example.com YOUR_PROJECT_ID \
126
+ --subjects SUBJECT_001
127
+ ```
128
+
129
+ Replace `YOUR_PROJECT_ID` with your actual XNAT project ID and `SUBJECT_001` with a valid subject ID from your project.
130
+
131
+ To use a custom output directory for intermediate files:
132
+
133
+ ### Python API
134
+
135
+ ```python
136
+ from pathlib import Path
137
+ import xnattools as xt
138
+
139
+ tools = [xt.Dcm2niftiSettings()]
140
+ settings = xt.GeneralSettings(
141
+ system_url="https://xnat.example.com",
142
+ project_id="MY_XNAT_PROJECT",
143
+ subjects=["SUBJECT_001"],
144
+ output_dir=Path.cwd(),
145
+ )
146
+ xt.run_tools(tools_to_run=tools, general_settings=settings)
147
+ ```
148
+
149
+ ### Command Line
150
+
151
+ ```shell
152
+ xnattools dcm2nifti https://xnat.example.com YOUR_PROJECT_ID \
153
+ --subjects SUBJECT_001 \
154
+ --output-dir /path/to/temp
155
+ ```
156
+ # Authors
157
+ - [Martijn P. A. Starmans](https://gitlab.com/MStarmans91) : [m.starmans@erasmusmc.nl](mailto:m.starmans@erasmusmc.nl)
158
+ - [Erik Kemper](https://gitlab.com/EHMKemper) : [e.h.m.kemper@erasmusmc.nl](mailto:e.h.m.kemper@erasmusmc.nl@erasmusmc.nl)
159
+ - [Frederik Hartmann](https://gitlab.com/Frederik-Hartmann) : [f.hartmann@erasmusmc.nl](mailto:f.hartmann@erasmusmc.nl)
@@ -0,0 +1,96 @@
1
+ # xnattools
2
+
3
+ xnattools is a python package for handy operations on XNAT data.
4
+
5
+ # Documentation
6
+ The complete documentation is available at [https://radiology.gitlab.io/radiomics/xnattools/](https://radiology.gitlab.io/radiomics/xnattools/) . The following example is a small part of [tutorials](https://radiology.gitlab.io/radiomics/xnattools/tutorials.html). Please refer to the documentation for additional tutorials, examples, how-to guides, and developer guides.
7
+
8
+ ## Prerequisites
9
+
10
+ Before you begin, make sure you have:
11
+
12
+ 1. Installed `xnattools`. For example using pip:
13
+ ```shell
14
+ pip install xnattools
15
+ ```
16
+ 2. Set up your XNAT credentials using one of these methods:
17
+
18
+ **Option 1: Using `.netrc` file** (recommended)
19
+
20
+ Create or edit `~/.netrc` with your XNAT credentials:
21
+
22
+ ```text
23
+ machine xnat.example.com
24
+ login your-xnat-username
25
+ password your-xnat-password
26
+ ```
27
+
28
+ **Option 2: Using `.env.local` file**
29
+
30
+ Create a `.env.local` file in your project directory:
31
+
32
+ ```text
33
+ XNAT_USER=your-xnat-username
34
+ XNAT_PASS=your-xnat-password
35
+ ```
36
+
37
+ 3. Access to an XNAT server with at least one project.
38
+
39
+ ## Basic Example: Running `dcm2nifti`
40
+
41
+ This example shows how to convert DICOM files to NIfTI format for a specific subject.
42
+
43
+ ### Python API
44
+
45
+ ```python
46
+ from pathlib import Path
47
+ import xnattools as xt
48
+
49
+ tools = [xt.Dcm2niftiSettings()]
50
+ settings = xt.GeneralSettings(
51
+ system_url="https://xnat.example.com",
52
+ project_id="MY_XNAT_PROJECT",
53
+ subjects=["SUBJECT_001"],
54
+ output_dir=Path.cwd(),
55
+ )
56
+ xt.run_tools(tools_to_run=tools, general_settings=settings)
57
+ ```
58
+
59
+ ### Command Line
60
+
61
+ ```shell
62
+ xnattools dcm2nifti https://xnat.example.com YOUR_PROJECT_ID \
63
+ --subjects SUBJECT_001
64
+ ```
65
+
66
+ Replace `YOUR_PROJECT_ID` with your actual XNAT project ID and `SUBJECT_001` with a valid subject ID from your project.
67
+
68
+ To use a custom output directory for intermediate files:
69
+
70
+ ### Python API
71
+
72
+ ```python
73
+ from pathlib import Path
74
+ import xnattools as xt
75
+
76
+ tools = [xt.Dcm2niftiSettings()]
77
+ settings = xt.GeneralSettings(
78
+ system_url="https://xnat.example.com",
79
+ project_id="MY_XNAT_PROJECT",
80
+ subjects=["SUBJECT_001"],
81
+ output_dir=Path.cwd(),
82
+ )
83
+ xt.run_tools(tools_to_run=tools, general_settings=settings)
84
+ ```
85
+
86
+ ### Command Line
87
+
88
+ ```shell
89
+ xnattools dcm2nifti https://xnat.example.com YOUR_PROJECT_ID \
90
+ --subjects SUBJECT_001 \
91
+ --output-dir /path/to/temp
92
+ ```
93
+ # Authors
94
+ - [Martijn P. A. Starmans](https://gitlab.com/MStarmans91) : [m.starmans@erasmusmc.nl](mailto:m.starmans@erasmusmc.nl)
95
+ - [Erik Kemper](https://gitlab.com/EHMKemper) : [e.h.m.kemper@erasmusmc.nl](mailto:e.h.m.kemper@erasmusmc.nl@erasmusmc.nl)
96
+ - [Frederik Hartmann](https://gitlab.com/Frederik-Hartmann) : [f.hartmann@erasmusmc.nl](mailto:f.hartmann@erasmusmc.nl)
@@ -0,0 +1,214 @@
1
+ # see documentation, e.g.
2
+ # - https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata
3
+ # - https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
4
+ # - https://www.python.org/dev/peps/pep-0621/
5
+
6
+ # ---- Project Info and Dependencies ----
7
+
8
+ [project.urls] # adjust these when publishing
9
+ Documentation = "https://radiology.gitlab.io/radiomics/xnattools/"
10
+ Homepage = "https://gitlab.com/radiology/radiomics/xnattools"
11
+ Issues = "https://gitlab.com/radiology/radiomics/xnattools/-/issues"
12
+
13
+ # command line interface (CLI) entry points
14
+ [project.scripts]
15
+ xnattools = "xnattools.cli:main"
16
+
17
+ [project]
18
+ name = "xnattools"
19
+ version = "1.0.0"
20
+ description = "Python scripts for handy operations on XNAT data."
21
+ authors = [
22
+ { name = "Martijn P. A. Starmans", email = "m.starmans@erasmusmc.nl" },
23
+ { name = "Erik H.M. Kemper", email = "e.h.m.kemper@erasmusmc.nl" },
24
+ { name = "Frederik Hartmann", email = "f.hartmann@erasmusmc.nl" },
25
+ ]
26
+ requires-python = ">=3.10"
27
+ keywords = ["xnat","research","science","medical imaging"," data"]
28
+ license = {file = "LICENSE"}
29
+ readme = {file = "README.md", content-type = "text/markdown"}
30
+
31
+ # classifiers are used to categorize the project, adjust as needed
32
+ # see https://pypi.org/classifiers/
33
+ classifiers = [
34
+ "License :: OSI Approved :: MIT License",
35
+ "Natural Language :: English", # Natural language of the project
36
+ "Intended Audience :: Developers", # Intended audience
37
+ "Intended Audience :: Science/Research",
38
+ "Development Status :: 3 - Alpha", # Development status, e.g., 1 - Planning, 2 - Pre-Alpha, 3 - Alpha, 4 - Beta, 5 - Production/Stable
39
+ "Programming Language :: Python :: 3", # Supported Python versions
40
+ "Programming Language :: Python :: 3.10",
41
+ "Programming Language :: Python :: 3.11",
42
+ "Programming Language :: Python :: 3.12",
43
+ "Programming Language :: Python :: 3.13",
44
+ "Programming Language :: Python :: 3.14",
45
+ ]
46
+
47
+ # ---- Main dependencies ----
48
+
49
+ dependencies = [
50
+ "click (>=8.1.7,<9.0.0)",
51
+ "tox>=4.25.0,<5.0.0",
52
+ "numpy>=2.2.4,<3.0.0",
53
+ "simpleitk (>=2.4.1,<3.0.0)",
54
+ "pydicom>=2.4.4,<3.0.2",
55
+ "xnat>=0.7.1,<0.8.0",
56
+ "dcm2niix>=1.0.20241211,<2.0.0",
57
+ "dicom2nifti==2.4.11",
58
+ "matplotlib (>=3.10.1,<4.0.0)",
59
+ "python-dotenv>=1.1.1",
60
+ "tqdm>=4.67.1",
61
+ "tk>=0.1.0",
62
+ "pydantic>=2.12.3",
63
+ "pandas>=2.3.3",
64
+ "pytest>=9.0.2",
65
+ "pytest-mock>=3.15.1",
66
+ "urllib3>=2.7.0",
67
+ ]
68
+
69
+
70
+ # ---- Additional dependency groups ----
71
+
72
+ [project.optional-dependencies]
73
+ dev = [
74
+ "bump-my-version>=1.2.7",
75
+ "ruff>=0.15.4",
76
+ ]
77
+
78
+ docs = [
79
+ "furo>=2025.12.19",
80
+ "myst-parser>=4.0.1",
81
+ "sphinx>=8.1.3",
82
+ "sphinx-autoapi>=3.7.0",
83
+ "sphinx-copybutton>=0.5.2",
84
+ "sphinx-design>=0.6.1",
85
+ ]
86
+ test = [
87
+ "pytest>=9.0.2",
88
+ "pytest-cov>=7.0.0",
89
+ "requests>=2.33.1",
90
+ "xnat4tests>=0.4.1",
91
+ ]
92
+
93
+ # ---- Build system ----
94
+
95
+ [build-system]
96
+ requires = ["hatchling"]
97
+ build-backend = "hatchling.build"
98
+
99
+ [tool.hatch.build.targets.sdist]
100
+ include = [
101
+ "/src",
102
+ ]
103
+
104
+ # ---- Hatch virtual environment settings ----
105
+
106
+ # main dependencies
107
+ [tool.hatch.envs.default]
108
+ installer = "uv"
109
+
110
+ # dev dependencies
111
+ [tool.hatch.envs.dev]
112
+ installer = "uv"
113
+ features = ["dev"]
114
+
115
+ [tool.hatch.envs.dev.scripts]
116
+ bump = "bump-my-version {args}"
117
+
118
+ # docs dependencies
119
+ [tool.hatch.envs.docs]
120
+ installer = "uv"
121
+ features = ["docs"]
122
+
123
+ [tool.hatch.envs.docs.scripts]
124
+ coverage = "sphinx-build -b coverage doc doc/_build/coverage"
125
+ build-html = "sphinx-build -b html ./doc public"
126
+ doctest = "sphinx-build -b doctest doc doc/_build/doctest"
127
+
128
+ # hatch test dependencies
129
+ [tool.hatch.envs.hatch-test]
130
+ installer = "uv"
131
+ features = ["test"]
132
+ default-args = ["tests"]
133
+
134
+ [[tool.hatch.envs.hatch-test.matrix]]
135
+ python = ["3.14", "3.13", "3.12", "3.11", "3.10"]
136
+
137
+ # ---- pytest settings ----
138
+
139
+ [tool.pytest.ini_options]
140
+ testpaths = ["tests"]
141
+ python_files = ["*.py"]
142
+ python_classes = ["Test*"]
143
+ python_functions = ["test_*"]
144
+ markers = [
145
+ "slow_docker_test: Tests that require a running docker (XNAT) which is slow to setup"
146
+ ]
147
+
148
+ # ---- ruff settings ----
149
+
150
+ [tool.ruff]
151
+ line-length = 120
152
+ output-format = "concise"
153
+ extend-exclude = ["docs"]
154
+
155
+ [tool.ruff.lint]
156
+ # Allow unused variables when underscore-prefixed.
157
+ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
158
+
159
+ # Enable Pyflakes `E` and `F` codes by default.
160
+ select = ["ALL"]
161
+ ignore = [
162
+ "ANN204", # Missing return type annotation for special (dunder) method
163
+ "ANN401", # Allow Any
164
+ "COM812", # Resolve absence of a trailing comma
165
+ "FBT", # Using boolean function arguments
166
+ "TD", # TODOs
167
+ "FIX001", # Resolve FIXMEs
168
+ "FIX002", # Resolve TODOs
169
+ "B028", # No explicit `stacklevel` keyword argument found in warning
170
+ # No docstrings required in the following cases
171
+ "D100", # Missing module docstring
172
+ "D104", # Missing public package docstring
173
+ "D105", # Missing docstring in magic method
174
+ "D107", # Missing docstring in `__init__`
175
+ "D415", # Missing period in first line of docstring
176
+ ]
177
+ pydocstyle.convention = "google"
178
+
179
+ [tool.ruff.lint.per-file-ignores]
180
+ # Tests can ignore a few extra rules
181
+ "tests/**.py" = [
182
+ "ANN201", # Missing return type annotation for public function
183
+ "ANN205", # Missing return type annotation for staticmethod
184
+ "PT011", # Missing `match` parameter in `pytest.raises()`
185
+ "S101", # Use of assert is detected
186
+ "SLF001", # Access of private members
187
+ ]
188
+
189
+ [tool.ruff.lint.isort]
190
+ known-first-party = ["xnattools"]
191
+ force-single-line = true
192
+ no-lines-before = ["future","standard-library","third-party","first-party","local-folder"]
193
+
194
+ [tool.ruff.lint.flake8-type-checking]
195
+ runtime-evaluated-base-classes = ["pydantic.BaseModel", "tomllib"]
196
+
197
+ [tool.ruff.lint.pep8-naming]
198
+ ignore-names = ["SimpleITK"] # allow import as sitk despite N813
199
+
200
+ # ---- bumpversion settings ----
201
+
202
+ [tool.bumpversion]
203
+ current_version = "1.0.0"
204
+ tag = false
205
+ tag_name = "v{new_version}"
206
+ commit = true
207
+ commit_args = "--no-verify" # pre-commit ruff settings are not parsed correctly in bump-my-verion
208
+ message = "Bump version: {current_version} → {new_version}"
209
+
210
+ [[tool.bumpversion.files]]
211
+ filename = "pyproject.toml"
212
+
213
+ #[[tool.bumpversion.files]]
214
+ #filename = "CITATION.cff"
@@ -0,0 +1,17 @@
1
+ from importlib.metadata import version
2
+ from xnattools.core import run_tools
3
+ from xnattools.dataclasses.core import GeneralSettings
4
+ from xnattools.dataclasses.datmat import DatMatSettings
5
+ from xnattools.dataclasses.dcm2nifti import Dcm2niftiSettings
6
+ from xnattools.dataclasses.dcm2snapshots import Dcm2snapshotsSettings
7
+ from xnattools.dataclasses.scanmetadata import ScanMetaDataSettings
8
+
9
+ __version__ = version("xnattools")
10
+ __all__ = [
11
+ "DatMatSettings",
12
+ "Dcm2niftiSettings",
13
+ "Dcm2snapshotsSettings",
14
+ "GeneralSettings",
15
+ "ScanMetaDataSettings",
16
+ "run_tools",
17
+ ]