brainmint 0.1.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 (207) hide show
  1. brainmint-0.1.0/.github/workflows/ci.yml +116 -0
  2. brainmint-0.1.0/.github/workflows/release.yml +36 -0
  3. brainmint-0.1.0/.github/workflows/testpypi.yml +37 -0
  4. brainmint-0.1.0/.gitignore +90 -0
  5. brainmint-0.1.0/CHANGELOG.md +20 -0
  6. brainmint-0.1.0/LICENSE +21 -0
  7. brainmint-0.1.0/PKG-INFO +109 -0
  8. brainmint-0.1.0/README.md +57 -0
  9. brainmint-0.1.0/brainmint/__init__.py +12 -0
  10. brainmint-0.1.0/brainmint/_version.py +24 -0
  11. brainmint-0.1.0/brainmint/callbacks/log_images.py +341 -0
  12. brainmint-0.1.0/brainmint/callbacks/modality_completion_schedule.py +315 -0
  13. brainmint-0.1.0/brainmint/data/__init__.py +1 -0
  14. brainmint-0.1.0/brainmint/data/brainscape.py +401 -0
  15. brainmint-0.1.0/brainmint/data/brainscape_paired.py +945 -0
  16. brainmint-0.1.0/brainmint/data/transforms/__init__.py +1 -0
  17. brainmint-0.1.0/brainmint/data/transforms/conditioning.py +52 -0
  18. brainmint-0.1.0/brainmint/data/transforms/copy_paths.py +44 -0
  19. brainmint-0.1.0/brainmint/data/transforms/demographics.py +378 -0
  20. brainmint-0.1.0/brainmint/data/transforms/intensity.py +50 -0
  21. brainmint-0.1.0/brainmint/data/transforms/modality_choice.py +287 -0
  22. brainmint-0.1.0/brainmint/data/transforms/mri_vae.py +308 -0
  23. brainmint-0.1.0/brainmint/data/transforms/segmentation.py +478 -0
  24. brainmint-0.1.0/brainmint/data/transforms/stream_mapping.py +226 -0
  25. brainmint-0.1.0/brainmint/data/transforms/synthetic_mask.py +580 -0
  26. brainmint-0.1.0/brainmint/data/utils.py +35 -0
  27. brainmint-0.1.0/brainmint/external/__init__.py +20 -0
  28. brainmint-0.1.0/brainmint/external/registry.py +78 -0
  29. brainmint-0.1.0/brainmint/external/repo_manager.py +333 -0
  30. brainmint-0.1.0/brainmint/external/sys_path.py +32 -0
  31. brainmint-0.1.0/brainmint/inference/__init__.py +1 -0
  32. brainmint-0.1.0/brainmint/inference/controlnet/__init__.py +5 -0
  33. brainmint-0.1.0/brainmint/inference/controlnet/controlnet_inference.py +548 -0
  34. brainmint-0.1.0/brainmint/inference/core/__init__.py +23 -0
  35. brainmint-0.1.0/brainmint/inference/core/context.py +76 -0
  36. brainmint-0.1.0/brainmint/inference/core/interfaces.py +70 -0
  37. brainmint-0.1.0/brainmint/inference/core/runner.py +93 -0
  38. brainmint-0.1.0/brainmint/inference/core/scheduler.py +98 -0
  39. brainmint-0.1.0/brainmint/inference/diffusion/__init__.py +2 -0
  40. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/__init__.py +2 -0
  41. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/base.py +67 -0
  42. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/common/__init__.py +1 -0
  43. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/common/class_labels.py +83 -0
  44. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/common/constant.py +155 -0
  45. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/common/demographics.py +85 -0
  46. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/common/random_vec.py +35 -0
  47. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/common/vector_ops.py +33 -0
  48. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/ldm/__init__.py +1 -0
  49. brainmint-0.1.0/brainmint/inference/diffusion/conditioning/ldm/fixed_4vec.py +41 -0
  50. brainmint-0.1.0/brainmint/inference/diffusion/latent/__init__.py +2 -0
  51. brainmint-0.1.0/brainmint/inference/diffusion/latent/base.py +7 -0
  52. brainmint-0.1.0/brainmint/inference/diffusion/latent/common/__init__.py +1 -0
  53. brainmint-0.1.0/brainmint/inference/diffusion/latent/common/fixed_shape.py +54 -0
  54. brainmint-0.1.0/brainmint/inference/diffusion/latent/common/from_autoencoder_encode.py +43 -0
  55. brainmint-0.1.0/brainmint/inference/diffusion/latent/common/from_batch.py +30 -0
  56. brainmint-0.1.0/brainmint/inference/diffusion/latent/common/from_image_shape.py +52 -0
  57. brainmint-0.1.0/brainmint/inference/diffusion/pipelines/__init__.py +1 -0
  58. brainmint-0.1.0/brainmint/inference/diffusion/pipelines/base.py +121 -0
  59. brainmint-0.1.0/brainmint/inference/diffusion/pipelines/generation/__init__.py +1 -0
  60. brainmint-0.1.0/brainmint/inference/diffusion/pipelines/generation/ldm/__init__.py +1 -0
  61. brainmint-0.1.0/brainmint/inference/diffusion/pipelines/generation/ldm/ukb_ddim.py +14 -0
  62. brainmint-0.1.0/brainmint/inference/diffusion/samplers/__init__.py +2 -0
  63. brainmint-0.1.0/brainmint/inference/diffusion/samplers/base.py +85 -0
  64. brainmint-0.1.0/brainmint/inference/diffusion/samplers/common/cond_unet.py +69 -0
  65. brainmint-0.1.0/brainmint/inference/diffusion/samplers/common/monai_unet.py +240 -0
  66. brainmint-0.1.0/brainmint/inference/diffusion/samplers/ldm/__init__.py +1 -0
  67. brainmint-0.1.0/brainmint/inference/diffusion/samplers/ldm/ukb_ddim.py +50 -0
  68. brainmint-0.1.0/brainmint/inference/dynamic_inference.py +33 -0
  69. brainmint-0.1.0/brainmint/inference/generation/__init__.py +1 -0
  70. brainmint-0.1.0/brainmint/inference/generation/batch_builders/__init__.py +1 -0
  71. brainmint-0.1.0/brainmint/inference/generation/batch_builders/med_ddpm.py +50 -0
  72. brainmint-0.1.0/brainmint/inference/generation/pipelines/__init__.py +1 -0
  73. brainmint-0.1.0/brainmint/inference/generation/pipelines/common.py +6 -0
  74. brainmint-0.1.0/brainmint/inference/generation/pipelines/external.py +13 -0
  75. brainmint-0.1.0/brainmint/inference/generation/pipelines/hagan.py +43 -0
  76. brainmint-0.1.0/brainmint/inference/generation/pipelines/maisi.py +52 -0
  77. brainmint-0.1.0/brainmint/inference/generation/pipelines/med_ddpm.py +89 -0
  78. brainmint-0.1.0/brainmint/inference/generation/pipelines/wdm3d.py +58 -0
  79. brainmint-0.1.0/brainmint/inference/io/__init__.py +5 -0
  80. brainmint-0.1.0/brainmint/inference/io/base.py +33 -0
  81. brainmint-0.1.0/brainmint/inference/io/dataset_writers.py +125 -0
  82. brainmint-0.1.0/brainmint/inference/io/readers.py +56 -0
  83. brainmint-0.1.0/brainmint/inference/io/writers.py +191 -0
  84. brainmint-0.1.0/brainmint/inference/postprocess/__init__.py +3 -0
  85. brainmint-0.1.0/brainmint/inference/postprocess/base.py +13 -0
  86. brainmint-0.1.0/brainmint/inference/postprocess/brats_pipeline.py +317 -0
  87. brainmint-0.1.0/brainmint/inference/postprocess/reorient.py +101 -0
  88. brainmint-0.1.0/brainmint/inference/translation/__init__.py +17 -0
  89. brainmint-0.1.0/brainmint/inference/translation/generators/__init__.py +12 -0
  90. brainmint-0.1.0/brainmint/inference/translation/generators/aldm.py +7 -0
  91. brainmint-0.1.0/brainmint/inference/translation/generators/cwdm.py +7 -0
  92. brainmint-0.1.0/brainmint/inference/translation/pipelines/__init__.py +1 -0
  93. brainmint-0.1.0/brainmint/integrations/__init__.py +1 -0
  94. brainmint-0.1.0/brainmint/integrations/aldm/__init__.py +10 -0
  95. brainmint-0.1.0/brainmint/integrations/aldm/ldm.py +47 -0
  96. brainmint-0.1.0/brainmint/integrations/aldm/repo.py +132 -0
  97. brainmint-0.1.0/brainmint/integrations/aldm/vqgan.py +136 -0
  98. brainmint-0.1.0/brainmint/integrations/brainsynth/__init__.py +7 -0
  99. brainmint-0.1.0/brainmint/integrations/brainsynth/inferer.py +91 -0
  100. brainmint-0.1.0/brainmint/integrations/brainsynth/vendor_vqvae.py +569 -0
  101. brainmint-0.1.0/brainmint/integrations/brasyn/__init__.py +7 -0
  102. brainmint-0.1.0/brainmint/integrations/brasyn/io.py +154 -0
  103. brainmint-0.1.0/brainmint/integrations/brasyn/missing_mri.py +181 -0
  104. brainmint-0.1.0/brainmint/integrations/brasyn/modalities.py +71 -0
  105. brainmint-0.1.0/brainmint/integrations/brasyn/runtime.py +347 -0
  106. brainmint-0.1.0/brainmint/integrations/cwdm/__init__.py +8 -0
  107. brainmint-0.1.0/brainmint/integrations/cwdm/repo.py +31 -0
  108. brainmint-0.1.0/brainmint/integrations/cwdm/translator.py +103 -0
  109. brainmint-0.1.0/brainmint/integrations/hagan/__init__.py +8 -0
  110. brainmint-0.1.0/brainmint/integrations/hagan/generator.py +35 -0
  111. brainmint-0.1.0/brainmint/integrations/hagan/repo.py +31 -0
  112. brainmint-0.1.0/brainmint/integrations/maisi/__init__.py +8 -0
  113. brainmint-0.1.0/brainmint/integrations/maisi/autoencoder.py +15 -0
  114. brainmint-0.1.0/brainmint/integrations/maisi/generator.py +301 -0
  115. brainmint-0.1.0/brainmint/integrations/maisi/repo.py +31 -0
  116. brainmint-0.1.0/brainmint/integrations/med_ddpm/__init__.py +8 -0
  117. brainmint-0.1.0/brainmint/integrations/med_ddpm/generator.py +68 -0
  118. brainmint-0.1.0/brainmint/integrations/med_ddpm/repo.py +31 -0
  119. brainmint-0.1.0/brainmint/integrations/wdm3d/__init__.py +8 -0
  120. brainmint-0.1.0/brainmint/integrations/wdm3d/generator.py +148 -0
  121. brainmint-0.1.0/brainmint/integrations/wdm3d/repo.py +31 -0
  122. brainmint-0.1.0/brainmint/lightning/__init__.py +7 -0
  123. brainmint-0.1.0/brainmint/lightning/controlnet_module.py +1377 -0
  124. brainmint-0.1.0/brainmint/lightning/diffusion_inference_module.py +110 -0
  125. brainmint-0.1.0/brainmint/lightning/diffusion_module.py +1250 -0
  126. brainmint-0.1.0/brainmint/lightning/export_latents_module.py +135 -0
  127. brainmint-0.1.0/brainmint/lightning/generic_inference_module.py +78 -0
  128. brainmint-0.1.0/brainmint/lightning/vae_module.py +324 -0
  129. brainmint-0.1.0/brainmint/losses/__init__.py +1 -0
  130. brainmint-0.1.0/brainmint/losses/mask_recon_loss.py +100 -0
  131. brainmint-0.1.0/brainmint/losses/utils.py +23 -0
  132. brainmint-0.1.0/brainmint/losses/vae_loss_manager.py +272 -0
  133. brainmint-0.1.0/brainmint/metrics/__init__.py +1 -0
  134. brainmint-0.1.0/brainmint/metrics/diffusion_metrics.py +552 -0
  135. brainmint-0.1.0/brainmint/metrics/reconstruction.py +462 -0
  136. brainmint-0.1.0/brainmint/models/__init__.py +1 -0
  137. brainmint-0.1.0/brainmint/models/blocks/__init__.py +8 -0
  138. brainmint-0.1.0/brainmint/models/blocks/haar_dwt.py +205 -0
  139. brainmint-0.1.0/brainmint/models/blocks/haar_wavelet_fusion.py +187 -0
  140. brainmint-0.1.0/brainmint/models/compression/__init__.py +8 -0
  141. brainmint-0.1.0/brainmint/models/compression/aldm_vqgan.py +37 -0
  142. brainmint-0.1.0/brainmint/models/compression/brainsynth_vqvae.py +59 -0
  143. brainmint-0.1.0/brainmint/models/compression/dwt.py +52 -0
  144. brainmint-0.1.0/brainmint/models/compression/ldm_vae.py +61 -0
  145. brainmint-0.1.0/brainmint/models/compression/maisi_vae_gan.py +53 -0
  146. brainmint-0.1.0/brainmint/models/compression/wavelet_fusion.py +714 -0
  147. brainmint-0.1.0/brainmint/models/compression/wavelet_vae.py +500 -0
  148. brainmint-0.1.0/brainmint/models/conditioning/demographics_encoder.py +241 -0
  149. brainmint-0.1.0/brainmint/models/controlnet/__init__.py +5 -0
  150. brainmint-0.1.0/brainmint/models/controlnet/controlnet.py +195 -0
  151. brainmint-0.1.0/brainmint/models/controlnet/controlnet_monai.py +472 -0
  152. brainmint-0.1.0/brainmint/models/generation/__init__.py +8 -0
  153. brainmint-0.1.0/brainmint/models/generation/diffusion_unet.py +411 -0
  154. brainmint-0.1.0/brainmint/models/generation/hagan.py +106 -0
  155. brainmint-0.1.0/brainmint/models/generation/maisi.py +134 -0
  156. brainmint-0.1.0/brainmint/models/generation/med_ddpm.py +125 -0
  157. brainmint-0.1.0/brainmint/models/generation/wdm3d.py +166 -0
  158. brainmint-0.1.0/brainmint/models/schedulers/__init__.py +1 -0
  159. brainmint-0.1.0/brainmint/models/schedulers/rflow_scheduler.py +23 -0
  160. brainmint-0.1.0/brainmint/models/translation/__init__.py +8 -0
  161. brainmint-0.1.0/brainmint/models/translation/aldm.py +347 -0
  162. brainmint-0.1.0/brainmint/models/translation/brasyn.py +45 -0
  163. brainmint-0.1.0/brainmint/models/translation/cwdm.py +160 -0
  164. brainmint-0.1.0/brainmint/models/translation/utils.py +106 -0
  165. brainmint-0.1.0/brainmint/py.typed +0 -0
  166. brainmint-0.1.0/brainmint/utils/__init__.py +1 -0
  167. brainmint-0.1.0/brainmint/utils/batch.py +32 -0
  168. brainmint-0.1.0/brainmint/utils/ema.py +329 -0
  169. brainmint-0.1.0/brainmint/utils/gpumem_utils.py +50 -0
  170. brainmint-0.1.0/brainmint/utils/schedules.py +199 -0
  171. brainmint-0.1.0/brainmint/utils/spatial.py +71 -0
  172. brainmint-0.1.0/brainmint/utils/state_dict_loader.py +371 -0
  173. brainmint-0.1.0/brainmint/visualization/__init__.py +3 -0
  174. brainmint-0.1.0/brainmint/visualization/slices.py +46 -0
  175. brainmint-0.1.0/brainmint.egg-info/PKG-INFO +109 -0
  176. brainmint-0.1.0/brainmint.egg-info/SOURCES.txt +205 -0
  177. brainmint-0.1.0/brainmint.egg-info/dependency_links.txt +1 -0
  178. brainmint-0.1.0/brainmint.egg-info/requires.txt +44 -0
  179. brainmint-0.1.0/brainmint.egg-info/top_level.txt +1 -0
  180. brainmint-0.1.0/pyproject.toml +104 -0
  181. brainmint-0.1.0/setup.cfg +4 -0
  182. brainmint-0.1.0/tests/README.md +46 -0
  183. brainmint-0.1.0/tests/conftest.py +70 -0
  184. brainmint-0.1.0/tests/data/test_brainscape.py +95 -0
  185. brainmint-0.1.0/tests/data/test_brainscape_latent_variants.py +164 -0
  186. brainmint-0.1.0/tests/data/test_brainscape_latents.py +235 -0
  187. brainmint-0.1.0/tests/data/test_brainscape_paired.py +349 -0
  188. brainmint-0.1.0/tests/data/test_demographics_transform.py +224 -0
  189. brainmint-0.1.0/tests/data/test_export_brainscape_latents.py +124 -0
  190. brainmint-0.1.0/tests/data/test_modality_choice_transform.py +169 -0
  191. brainmint-0.1.0/tests/data/test_synthetic_mask_transform.py +190 -0
  192. brainmint-0.1.0/tests/data/test_translation_configs.py +125 -0
  193. brainmint-0.1.0/tests/external/test_repo_manager.py +45 -0
  194. brainmint-0.1.0/tests/losses/test_vae_losses.py +75 -0
  195. brainmint-0.1.0/tests/metrics/test_report_metrics_utils.py +106 -0
  196. brainmint-0.1.0/tests/models/test_demographics_encoder.py +145 -0
  197. brainmint-0.1.0/tests/models/test_maisi_controlnet.py +103 -0
  198. brainmint-0.1.0/tests/models/test_maisi_diffusion.py +282 -0
  199. brainmint-0.1.0/tests/models/test_maisi_vae.py +40 -0
  200. brainmint-0.1.0/tests/models/test_wavelet_fusion_vae.py +40 -0
  201. brainmint-0.1.0/tests/package/test_import.py +8 -0
  202. brainmint-0.1.0/tests/package/test_import_surfaces.py +43 -0
  203. brainmint-0.1.0/tests/trainer/test_controlnet.py +231 -0
  204. brainmint-0.1.0/tests/trainer/test_diffusion.py +414 -0
  205. brainmint-0.1.0/tests/trainer/test_vae.py +159 -0
  206. brainmint-0.1.0/tests/utils/test_schedules.py +56 -0
  207. brainmint-0.1.0/tests/utils/test_state_dict_loader.py +59 -0
@@ -0,0 +1,116 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["dev", "main"]
6
+ pull_request:
7
+ branches: ["main"]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ import-no-deps:
18
+ name: Import without dependencies
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 10
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - uses: actions/setup-python@v5
28
+ with:
29
+ python-version: "3.12"
30
+ cache: "pip"
31
+
32
+ - name: Install package without dependencies
33
+ run: |
34
+ python -m pip install --upgrade pip
35
+ python -m pip install --no-deps -e .
36
+
37
+ - name: Check lightweight root import
38
+ run: python -c "import brainmint; print(brainmint.__version__)"
39
+
40
+ package-tests:
41
+ name: Package tests (Python ${{ matrix.python-version }})
42
+ runs-on: ubuntu-latest
43
+ timeout-minutes: 25
44
+
45
+ strategy:
46
+ fail-fast: false
47
+ matrix:
48
+ python-version: ["3.10", "3.11", "3.12"]
49
+
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ with:
53
+ fetch-depth: 0
54
+
55
+ - uses: actions/setup-python@v5
56
+ with:
57
+ python-version: ${{ matrix.python-version }}
58
+ cache: "pip"
59
+
60
+ - name: Install package
61
+ run: |
62
+ python -m pip install --upgrade pip
63
+ python -m pip install -e ".[dev]"
64
+
65
+ - name: Check installed package metadata
66
+ run: python -m pip check
67
+
68
+ - name: Compile package and tests
69
+ run: python -m compileall -q brainmint tests
70
+
71
+ - name: Run tests
72
+ run: python -m pytest
73
+
74
+ lint:
75
+ name: Lint package-safe surface
76
+ runs-on: ubuntu-latest
77
+ timeout-minutes: 10
78
+
79
+ steps:
80
+ - uses: actions/checkout@v4
81
+
82
+ - uses: actions/setup-python@v5
83
+ with:
84
+ python-version: "3.12"
85
+ cache: "pip"
86
+
87
+ - name: Install lint tools
88
+ run: |
89
+ python -m pip install --upgrade pip
90
+ python -m pip install "ruff>=0.6"
91
+
92
+ - name: Run Ruff
93
+ run: |
94
+ ruff check .
95
+
96
+ build:
97
+ name: Build distribution
98
+ runs-on: ubuntu-latest
99
+ timeout-minutes: 15
100
+
101
+ steps:
102
+ - uses: actions/checkout@v4
103
+ with:
104
+ fetch-depth: 0
105
+
106
+ - uses: actions/setup-python@v5
107
+ with:
108
+ python-version: "3.12"
109
+ cache: "pip"
110
+
111
+ - name: Build package
112
+ run: |
113
+ python -m pip install --upgrade pip
114
+ python -m pip install build twine
115
+ python -m build
116
+ python -m twine check dist/*
@@ -0,0 +1,36 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ environment:
13
+ name: pypi
14
+ url: https://pypi.org/p/brainmint
15
+
16
+ permissions:
17
+ id-token: write
18
+ contents: read
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - name: Build
30
+ run: |
31
+ python -m pip install --upgrade pip build twine
32
+ python -m build
33
+ twine check dist/*
34
+
35
+ - name: Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,37 @@
1
+ name: Publish to TestPyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: ["dev"]
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment:
12
+ name: testpypi
13
+ url: https://test.pypi.org/p/brainmint
14
+ permissions:
15
+ id-token: write
16
+ contents: read
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: "3.12"
26
+
27
+ - name: Build
28
+ run: |
29
+ python -m pip install --upgrade pip build twine
30
+ python -m build
31
+ twine check dist/*
32
+
33
+ - name: Publish to TestPyPI
34
+ uses: pypa/gh-action-pypi-publish@release/v1
35
+ with:
36
+ repository-url: https://test.pypi.org/legacy/
37
+ skip-existing: true
@@ -0,0 +1,90 @@
1
+ # Byte-compiled / optimized / extension files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.dll
7
+
8
+ # Build and packaging
9
+ build/
10
+ dist/
11
+ *.egg-info/
12
+ .eggs/
13
+ wheels/
14
+ MANIFEST
15
+ brainmint/_version.py
16
+
17
+ # Test, lint, type, and coverage artifacts
18
+ .pytest_cache/
19
+ .ruff_cache/
20
+ .mypy_cache/
21
+ .pyre/
22
+ .pytype/
23
+ .coverage
24
+ .coverage.*
25
+ coverage.xml
26
+ htmlcov/
27
+ .tox/
28
+ .nox/
29
+
30
+ # Environments and local package managers
31
+ .env
32
+ .envrc
33
+ .venv/
34
+ venv/
35
+ env/
36
+ ENV/
37
+ __pypackages__/
38
+ .pdm-python
39
+ .pdm-build/
40
+ .pixi/
41
+
42
+ # Editors and OS files
43
+ .vscode/
44
+ .idea/
45
+ *.code-workspace
46
+ .DS_Store
47
+ Thumbs.db
48
+ Desktop.ini
49
+ *~
50
+ .nfs*
51
+
52
+ # Logs and job artifacts
53
+ *.log
54
+ *.out
55
+ *.err
56
+ slurm-*.out
57
+ slurm-*.err
58
+ job-*.out
59
+ job-*.err
60
+ *.sbatch
61
+ *.slurm
62
+ *.sl
63
+
64
+ # Notebooks and local scratch
65
+ .ipynb_checkpoints/
66
+ scratch/
67
+ tmp/
68
+ *.tmp
69
+
70
+ # BrainMint research artifacts that do not belong in the package repo
71
+ /data/
72
+ /models/
73
+ /checkpoints/
74
+ /outputs/
75
+ /out/
76
+ /_out*/
77
+ /wandb/
78
+ /lightning_logs/
79
+ /nobackup_ds/
80
+ /z_temp_data/
81
+ /external/repos/
82
+ /repos/
83
+ *.ckpt
84
+ *.pt
85
+ *.pth
86
+ *.nii
87
+ *.nii.gz
88
+
89
+ # Publishing credentials
90
+ .pypirc
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ <!-- ## [Unreleased]
4
+
5
+ ### Added
6
+
7
+ ### Changed
8
+
9
+ ### Fixed -->
10
+
11
+ ## [0.1.0] - 2026-06-06
12
+
13
+ ### Added
14
+
15
+ * Initial public release of **BrainMint**.
16
+ * Added the standalone `brainmint` Python package.
17
+ * Added package metadata, version handling, typed-package marker, tests, and CI/publishing workflows.
18
+
19
+ <!-- [Unreleased]: https://github.com/yasinzaii/brainmint/compare/v0.1.0...HEAD -->
20
+ [0.1.0]: https://github.com/yasinzaii/brainmint/releases/tag/v0.1.0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Muhammad Nabi Yasinzai
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,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: brainmint
3
+ Version: 0.1.0
4
+ Summary: Brain MRI synthesis, compression, modality translation, and evaluation toolkit.
5
+ Author: Muhammad Nabi Yasinzai
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/yasinzaii/brainmint
8
+ Project-URL: Repository, https://github.com/yasinzaii/brainmint
9
+ Project-URL: Issues, https://github.com/yasinzaii/brainmint/issues
10
+ Keywords: MRI,brain MRI,neuroimaging,medical imaging,diffusion models,synthetic data,modality translation,deep learning
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: einops>=0.7
15
+ Requires-Dist: numpy>=1.24
16
+ Requires-Dist: omegaconf>=2.3
17
+ Requires-Dist: torch>=2.1
18
+ Requires-Dist: monai>=1.3
19
+ Requires-Dist: nibabel>=5.2
20
+ Requires-Dist: hydra-core>=1.3
21
+ Provides-Extra: external
22
+ Requires-Dist: huggingface-hub>=0.20; extra == "external"
23
+ Provides-Extra: io
24
+ Requires-Dist: pillow>=10; extra == "io"
25
+ Provides-Extra: medical
26
+ Requires-Dist: scipy>=1.11; extra == "medical"
27
+ Provides-Extra: metrics
28
+ Requires-Dist: medmetric[monai]>=0.1.1; extra == "metrics"
29
+ Requires-Dist: tqdm>=4.66; extra == "metrics"
30
+ Provides-Extra: train
31
+ Requires-Dist: pytorch-lightning>=2.2; extra == "train"
32
+ Requires-Dist: tabulate>=0.9; extra == "train"
33
+ Requires-Dist: tensorboard>=2.15; extra == "train"
34
+ Requires-Dist: torchmetrics>=1.3; extra == "train"
35
+ Provides-Extra: dev
36
+ Requires-Dist: build>=1.2; extra == "dev"
37
+ Requires-Dist: pytest>=8; extra == "dev"
38
+ Requires-Dist: pytest-cov>=5; extra == "dev"
39
+ Requires-Dist: ruff>=0.5; extra == "dev"
40
+ Requires-Dist: twine>=5; extra == "dev"
41
+ Provides-Extra: all
42
+ Requires-Dist: huggingface-hub>=0.20; extra == "all"
43
+ Requires-Dist: medmetric[monai]>=0.1.1; extra == "all"
44
+ Requires-Dist: pillow>=10; extra == "all"
45
+ Requires-Dist: pytorch-lightning>=2.2; extra == "all"
46
+ Requires-Dist: scipy>=1.11; extra == "all"
47
+ Requires-Dist: tabulate>=0.9; extra == "all"
48
+ Requires-Dist: tensorboard>=2.15; extra == "all"
49
+ Requires-Dist: torchmetrics>=1.3; extra == "all"
50
+ Requires-Dist: tqdm>=4.66; extra == "all"
51
+ Dynamic: license-file
52
+
53
+ # BrainMint
54
+
55
+ BrainMint is a Python package for brain MRI synthesis, compression, modality translation, inference utilities, and evaluation support.
56
+
57
+ This repository is the reusable package extracted from the original GenMRI study repository. It should contain library code, package-safe tests, and package documentation only. Study configs, private paths, datasets, checkpoints, generated outputs, and cloned external repositories should stay outside this repository.
58
+
59
+ ## Install
60
+
61
+ Install the base package with pip:
62
+
63
+ ```bash
64
+ pip install brainmint
65
+ ```
66
+
67
+ Common optional installs:
68
+
69
+ | Use case | Install command |
70
+ | --- | --- |
71
+ | Metrics and evaluation | `pip install "brainmint[metrics]"` |
72
+ | Training utilities | `pip install "brainmint[train]"` |
73
+ | Full runtime stack | `pip install "brainmint[all]"` |
74
+
75
+ Smaller targeted extras are kept in `pyproject.toml` for dependency control, but the commands above are the ones most users should need.
76
+
77
+ ## External Repositories
78
+
79
+ External model repositories are materialized outside the package tree. For research runs, set:
80
+
81
+ ```bash
82
+ export BRAINMINT_EXTERNAL_ROOT=/path/to/external
83
+ ```
84
+
85
+ or configure it in Python:
86
+
87
+ ```python
88
+ import brainmint.external
89
+
90
+ brainmint.external.set_external_repo_root("/path/to/external")
91
+ ```
92
+
93
+ ## Tests
94
+
95
+ Default tests are package-safe and do not require study Hydra configs, GPU, checkpoints, network access, or cloned external repositories:
96
+
97
+ ```bash
98
+ python -m pytest
99
+ ```
100
+
101
+ Copied study-era tests are opt-in while BrainMint is being separated from the original study repository:
102
+
103
+ ```bash
104
+ python -m pytest --run-study-config-tests
105
+ ```
106
+
107
+ ## License
108
+
109
+ MIT. See `LICENSE`.
@@ -0,0 +1,57 @@
1
+ # BrainMint
2
+
3
+ BrainMint is a Python package for brain MRI synthesis, compression, modality translation, inference utilities, and evaluation support.
4
+
5
+ This repository is the reusable package extracted from the original GenMRI study repository. It should contain library code, package-safe tests, and package documentation only. Study configs, private paths, datasets, checkpoints, generated outputs, and cloned external repositories should stay outside this repository.
6
+
7
+ ## Install
8
+
9
+ Install the base package with pip:
10
+
11
+ ```bash
12
+ pip install brainmint
13
+ ```
14
+
15
+ Common optional installs:
16
+
17
+ | Use case | Install command |
18
+ | --- | --- |
19
+ | Metrics and evaluation | `pip install "brainmint[metrics]"` |
20
+ | Training utilities | `pip install "brainmint[train]"` |
21
+ | Full runtime stack | `pip install "brainmint[all]"` |
22
+
23
+ Smaller targeted extras are kept in `pyproject.toml` for dependency control, but the commands above are the ones most users should need.
24
+
25
+ ## External Repositories
26
+
27
+ External model repositories are materialized outside the package tree. For research runs, set:
28
+
29
+ ```bash
30
+ export BRAINMINT_EXTERNAL_ROOT=/path/to/external
31
+ ```
32
+
33
+ or configure it in Python:
34
+
35
+ ```python
36
+ import brainmint.external
37
+
38
+ brainmint.external.set_external_repo_root("/path/to/external")
39
+ ```
40
+
41
+ ## Tests
42
+
43
+ Default tests are package-safe and do not require study Hydra configs, GPU, checkpoints, network access, or cloned external repositories:
44
+
45
+ ```bash
46
+ python -m pytest
47
+ ```
48
+
49
+ Copied study-era tests are opt-in while BrainMint is being separated from the original study repository:
50
+
51
+ ```bash
52
+ python -m pytest --run-study-config-tests
53
+ ```
54
+
55
+ ## License
56
+
57
+ MIT. See `LICENSE`.
@@ -0,0 +1,12 @@
1
+ """BrainMint models, integrations, and inference tools for medical image synthesis."""
2
+
3
+ from importlib.metadata import PackageNotFoundError
4
+ from importlib.metadata import version as _metadata_version
5
+
6
+ try:
7
+ from ._version import __version__
8
+ except (ImportError, ModuleNotFoundError):
9
+ try:
10
+ __version__ = _metadata_version("brainmint")
11
+ except PackageNotFoundError:
12
+ __version__ = "0.0.0"
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.1.0'
22
+ __version_tuple__ = version_tuple = (0, 1, 0)
23
+
24
+ __commit_id__ = commit_id = 'ge80ffa22a'