voxelmorph 0.1__tar.gz → 0.3__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 (49) hide show
  1. voxelmorph-0.3/LICENSE.md +201 -0
  2. voxelmorph-0.3/PKG-INFO +245 -0
  3. voxelmorph-0.3/README.md +217 -0
  4. voxelmorph-0.3/pyproject.toml +42 -0
  5. voxelmorph-0.3/setup.py +41 -0
  6. voxelmorph-0.3/tests/test_functional.py +1402 -0
  7. voxelmorph-0.3/tests/test_imports.py +1 -0
  8. voxelmorph-0.3/tests/test_models.py +245 -0
  9. voxelmorph-0.3/tests/test_modules.py +444 -0
  10. voxelmorph-0.3/tests/test_neurite_integration.py +180 -0
  11. voxelmorph-0.3/voxelmorph/__init__.py +53 -0
  12. voxelmorph-0.3/voxelmorph/functional.py +1296 -0
  13. voxelmorph-0.3/voxelmorph/nn/__init__.py +29 -0
  14. voxelmorph-0.3/voxelmorph/nn/functional.py +826 -0
  15. voxelmorph-0.3/voxelmorph/nn/losses.py +80 -0
  16. voxelmorph-0.3/voxelmorph/nn/models.py +280 -0
  17. voxelmorph-0.3/voxelmorph/nn/modules.py +287 -0
  18. voxelmorph-0.3/voxelmorph/py/__init__.py +15 -0
  19. {voxelmorph-0.1/voxelmorph → voxelmorph-0.3/voxelmorph/py}/generators.py +183 -93
  20. {voxelmorph-0.1 → voxelmorph-0.3}/voxelmorph/py/utils.py +232 -42
  21. voxelmorph-0.3/voxelmorph.egg-info/PKG-INFO +245 -0
  22. voxelmorph-0.3/voxelmorph.egg-info/SOURCES.txt +24 -0
  23. {voxelmorph-0.1 → voxelmorph-0.3}/voxelmorph.egg-info/requires.txt +4 -2
  24. voxelmorph-0.1/PKG-INFO +0 -14
  25. voxelmorph-0.1/README.md +0 -138
  26. voxelmorph-0.1/setup.py +0 -26
  27. voxelmorph-0.1/voxelmorph/__init__.py +0 -24
  28. voxelmorph-0.1/voxelmorph/py/__init__.py +0 -1
  29. voxelmorph-0.1/voxelmorph/tf/__init__.py +0 -6
  30. voxelmorph-0.1/voxelmorph/tf/layers.py +0 -615
  31. voxelmorph-0.1/voxelmorph/tf/losses.py +0 -406
  32. voxelmorph-0.1/voxelmorph/tf/modelio.py +0 -123
  33. voxelmorph-0.1/voxelmorph/tf/networks.py +0 -882
  34. voxelmorph-0.1/voxelmorph/tf/synthseg/__init__.py +0 -3
  35. voxelmorph-0.1/voxelmorph/tf/synthseg/labels_to_image_model.py +0 -313
  36. voxelmorph-0.1/voxelmorph/tf/synthseg/model_input_generator.py +0 -330
  37. voxelmorph-0.1/voxelmorph/tf/synthseg/utils.py +0 -1142
  38. voxelmorph-0.1/voxelmorph/tf/utils.py +0 -424
  39. voxelmorph-0.1/voxelmorph/torch/__init__.py +0 -4
  40. voxelmorph-0.1/voxelmorph/torch/layers.py +0 -97
  41. voxelmorph-0.1/voxelmorph/torch/losses.py +0 -103
  42. voxelmorph-0.1/voxelmorph/torch/modelio.py +0 -76
  43. voxelmorph-0.1/voxelmorph/torch/networks.py +0 -232
  44. voxelmorph-0.1/voxelmorph/torch/utils.py +0 -1
  45. voxelmorph-0.1/voxelmorph.egg-info/PKG-INFO +0 -14
  46. voxelmorph-0.1/voxelmorph.egg-info/SOURCES.txt +0 -27
  47. {voxelmorph-0.1 → voxelmorph-0.3}/setup.cfg +0 -0
  48. {voxelmorph-0.1 → voxelmorph-0.3}/voxelmorph.egg-info/dependency_links.txt +0 -0
  49. {voxelmorph-0.1 → voxelmorph-0.3}/voxelmorph.egg-info/top_level.txt +0 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.4
2
+ Name: voxelmorph
3
+ Version: 0.3
4
+ Summary: Image Registration with Convolutional Networks
5
+ Home-page: https://github.com/voxelmorph/voxelmorph
6
+ Author: Adrian V. Dalca, Malte Hoffmann, Andrew Hoopes
7
+ License-Expression: Apache-2.0
8
+ Project-URL: GitHub, https://github.com/voxelmorph/voxelmorph
9
+ Project-URL: PyPI, https://pypi.org/project/voxelmorph/
10
+ Keywords: python,pytorch,medical-imaging,registration,medical-image-computing
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.md
17
+ Requires-Dist: torch
18
+ Requires-Dist: scikit-image
19
+ Requires-Dist: packaging
20
+ Requires-Dist: numpy
21
+ Requires-Dist: scipy
22
+ Requires-Dist: nibabel
23
+ Requires-Dist: h5py
24
+ Requires-Dist: neurite>=0.2
25
+ Dynamic: home-page
26
+ Dynamic: license-file
27
+ Dynamic: requires-python
28
+
29
+ # VoxelMorph: learning-based image registration
30
+
31
+ **VoxelMorph** is a general purpose library for learning-based tools for alignment/registration, and more generally modelling with deformations.
32
+
33
+ > ⚠️ **Warning**: VoxelMorph pytorch is under active development. Interfaces may change.
34
+
35
+ > **For users who want to use the stable TensorFlow version**, pull or clone the [`dev-tensorflow`](https://github.com/voxelmorph/voxelmorph/tree/dev-tensorflow) branch.
36
+
37
+ ## Install
38
+
39
+ Install the published package from PyPI:
40
+
41
+ ```
42
+ pip install voxelmorph
43
+ ```
44
+
45
+ To work from a source checkout, clone this repository and install the requirements listed in `setup.py`.
46
+
47
+ ### Pre-commit hooks
48
+
49
+ This repo uses `pre-commit` to run `pycodestyle` before commits.
50
+
51
+ Install once after cloning:
52
+
53
+ ```bash
54
+ pip install pre-commit
55
+ pre-commit install
56
+ ```
57
+
58
+ You can also run the check manually:
59
+
60
+ ```bash
61
+ pre-commit run pycodestyle --all-files
62
+ ```
63
+
64
+ # Tutorial
65
+
66
+ We have several VoxelMorph tutorials:
67
+ - the main [VoxelMorph tutorial](http://tutorial.voxelmorph.net/) explains VoxelMorph and learning-based registration
68
+ - a [deformable SynthMorph demo](https://colab.research.google.com/drive/1zaDnAJGUokS0knqWttuTgrRJMb6zxukI?usp=sharing) showing how to train a registration model without data
69
+ - an [affine SynthMorph demo](https://colab.research.google.com/drive/1QClknfaZIYklBjmBy-nUn83h85bpo8r0?usp=sharing) on learning anatomy-aware and acquisition-agnostic affine registration
70
+ - a [CT-to-MRI SynthMorph demo](https://colab.research.google.com/drive/1aWbFiyQw5mtJbTglpniAOMimGo_l8BYP?usp=drive_link) clipping the Hounsfield scale for multi-modal registration
71
+ - a [SynthMorph shapes demo](https://colab.research.google.com/drive/14s2h0j_Aoncp587vmpjsQBe6PQTxyVP5) that walks through the steps of running a trained 3D shapes model
72
+ - a [tutorial on training VoxelMorph](https://colab.research.google.com/drive/1ZefmWXBupRNsnIbBbGquhVDsk-7R7L1S?usp=sharing) on [OASIS data](https://github.com/adalca/medical-datasets/blob/master/neurite-oasis.md), which we processed and released for free for HyperMorph
73
+ - an [additional small tutorial](https://colab.research.google.com/drive/1V0CutSIfmtgDJg1XIkEnGteJuw0u7qT-#scrollTo=h1KXYz-Nauwn) on warping annotations together with images
74
+ - another tutorial on [template (atlas) construction](https://colab.research.google.com/drive/1SkQbrWTQHpQFrG4J2WoBgGZC9yAzUas2?usp=sharing) with VoxelMorph
75
+ - visualize [warp](https://colab.research.google.com/drive/1F8f1imh5WfyBv-crllfeJBFY16-KHl9c?usp=sharing) as warped grid
76
+ - [inverting warps](https://colab.research.google.com/drive/1juAJRYhPPDNbO9yRtlc0VGhbIFSuhpJ2?usp=sharing) that are not diffeomorphisms
77
+
78
+
79
+ # Instructions
80
+
81
+ To use the VoxelMorph library from source, clone this repository and install the requirements listed in `setup.py`.
82
+
83
+ > **Note**: For source development, install from GitHub instead:
84
+
85
+ ```
86
+ pip install git+https://github.com/voxelmorph/voxelmorph.git
87
+ ```
88
+
89
+ ## Pre-trained models
90
+
91
+ See list of pre-trained models available [here](data/readme.md#models).
92
+
93
+ ## Training
94
+
95
+ If you would like to train your own model, you will likely need to customize some of the data-loading code in `voxelmorph/generators.py` for your own datasets and data formats. However, it is possible to run many of the example scripts out-of-the-box, assuming that you provide a list of filenames in the training dataset. Training data can be in the NIfTI, MGZ, or npz (numpy) format, and it's assumed that each npz file in your data list has a `vol` parameter, which points to the image data to be registered, and an optional `seg` variable, which points to a corresponding discrete segmentation (for semi-supervised learning). It's also assumed that the shape of all training image data is consistent, but this, of course, can be handled in a customized generator if desired.
96
+
97
+ For a given image list file `/images/list.txt` and output directory `/models/output`, the following script will train an image-to-image registration network (described in MICCAI 2018 by default) with an unsupervised loss. Model weights will be saved to a path specified by the `--model-dir` flag.
98
+
99
+ ```
100
+ ./scripts/tf/train.py --img-list /images/list.txt --model-dir /models/output --gpu 0
101
+ ```
102
+
103
+ The `--img-prefix` and `--img-suffix` flags can be used to provide a consistent prefix or suffix to each path specified in the image list. Image-to-atlas registration can be enabled by providing an atlas file, e.g. `--atlas atlas.npz`. If you'd like to train using the original dense CVPR network (no diffeomorphism), use the `--int-steps 0` flag to specify no flow integration steps. Use the `--help` flag to inspect all of the command line options that can be used to fine-tune network architecture and training.
104
+
105
+
106
+ ## Registration
107
+
108
+ If you simply want to register two images, you can use the `register.py` script with the desired model file. For example, if we have a model `model.h5` trained to register a subject (moving) to an atlas (fixed), we could run:
109
+
110
+ ```
111
+ ./scripts/tf/register.py --moving moving.nii.gz --fixed atlas.nii.gz --moved warped.nii.gz --model model.h5 --gpu 0
112
+ ```
113
+
114
+ This will save the moved image to `warped.nii.gz`. To also save the predicted deformation field, use the `--save-warp` flag. Both npz or nifty files can be used as input/output in this script.
115
+
116
+
117
+ ## Testing (measuring Dice scores)
118
+
119
+ To test the quality of a model by computing dice overlap between an atlas segmentation and warped test scan segmentations, run:
120
+
121
+ ```
122
+ ./scripts/tf/test.py --model model.h5 --atlas atlas.npz --scans scan01.npz scan02.npz scan03.npz --labels labels.npz
123
+ ```
124
+
125
+ Just like for the training data, the atlas and test npz files include `vol` and `seg` parameters and the `labels.npz` file contains a list of corresponding anatomical labels to include in the computed dice score.
126
+
127
+
128
+ ## Parameter choices
129
+
130
+
131
+ ### CVPR version
132
+
133
+ For the CC loss function, we found a reg parameter of 1 to work best. For the MSE loss function, we found 0.01 to work best.
134
+
135
+
136
+ ### MICCAI version
137
+
138
+ For our data, we found `image_sigma=0.01` and `prior_lambda=25` to work best.
139
+
140
+ In the original MICCAI code, the parameters were applied after the scaling of the velocity field. With the newest code, this has been "fixed", with different default parameters reflecting the change. We recommend running the updated code. However, if you'd like to run the very original MICCAI2018 mode, please use `xy` indexing and `use_miccai_int` network option, with MICCAI2018 parameters.
141
+
142
+
143
+ ## Spatial transforms and integration
144
+
145
+ - The spatial transform code, found at `voxelmorph.layers.SpatialTransformer`, accepts N-dimensional affine and dense transforms, including linear and nearest neighbor interpolation options. Note that original development of VoxelMorph used `xy` indexing, whereas we are now emphasizing `ij` indexing.
146
+
147
+ - For the MICCAI2018 version, we integrate the velocity field using `voxelmorph.layers.VecInt`. By default we integrate using scaling and squaring, which we found efficient.
148
+
149
+
150
+ # VoxelMorph papers
151
+
152
+ If you use VoxelMorph or some part of the code, please cite (see [bibtex](citations.bib)):
153
+
154
+ * HyperMorph, avoiding the need to tune registration hyperparameters:
155
+
156
+ **Learning the Effect of Registration Hyperparameters with HyperMorph**
157
+ Andrew Hoopes, [Malte Hoffmann](https://malte.cz), Bruce Fischl, [John Guttag](https://people.csail.mit.edu/guttag/), [Adrian V. Dalca](http://adalca.mit.edu)
158
+ MELBA: Machine Learning for Biomedical Imaging. 2022. [eprint arXiv:2203.16680](https://arxiv.org/abs/2203.16680)
159
+
160
+ **HyperMorph: Amortized Hyperparameter Learning for Image Registration.**
161
+ Andrew Hoopes, [Malte Hoffmann](https://malte.cz), Bruce Fischl, [John Guttag](https://people.csail.mit.edu/guttag/), [Adrian V. Dalca](http://adalca.mit.edu)
162
+ IPMI: Information Processing in Medical Imaging. 2021. [eprint arXiv:2101.01035](https://arxiv.org/abs/2101.01035)
163
+
164
+ * [SynthMorph](https://synthmorph.voxelmorph.net), avoiding the need to have data at training (!):
165
+
166
+ **Anatomy-aware and acquisition-agnostic joint registration with SynthMorph.**
167
+ [Malte Hoffmann](https://malte.cz), Andrew Hoopes, Douglas N. Greve, Bruce Fischl, [Adrian V. Dalca](http://adalca.mit.edu)
168
+ Imaging Neuroscience. 2024. [eprint arXiv:2301.11329](https://arxiv.org/abs/2301.11329)
169
+
170
+ **Anatomy-specific acquisition-agnostic affine registration learned from fictitious images.**
171
+ [Malte Hoffmann](https://malte.cz), Andrew Hoopes, Bruce Fischl, [Adrian V. Dalca](http://adalca.mit.edu)
172
+ SPIE Medical Imaging: Image Processing. 2023.
173
+
174
+ **SynthMorph: learning contrast-invariant registration without acquired images.**
175
+ [Malte Hoffmann](https://malte.cz), Benjamin Billot, [Juan Eugenio Iglesias](https://scholar.harvard.edu/iglesias), Bruce Fischl, [Adrian V. Dalca](http://adalca.mit.edu)
176
+ IEEE TMI: Transactions on Medical Imaging. 2022. [eprint arXiv:2004.10282](https://arxiv.org/abs/2004.10282)
177
+
178
+ * For the atlas formation model:
179
+
180
+ **Learning Conditional Deformable Templates with Convolutional Networks**
181
+ [Adrian V. Dalca](http://adalca.mit.edu), [Marianne Rakic](https://mariannerakic.github.io/), [John Guttag](https://people.csail.mit.edu/guttag/), [Mert R. Sabuncu](http://sabuncu.engineering.cornell.edu/)
182
+ NeurIPS 2019. [eprint arXiv:1908.02738](https://arxiv.org/abs/1908.02738)
183
+
184
+ * For the diffeomorphic or probabilistic model:
185
+
186
+ **Unsupervised Learning of Probabilistic Diffeomorphic Registration for Images and Surfaces**
187
+ [Adrian V. Dalca](http://adalca.mit.edu), [Guha Balakrishnan](http://people.csail.mit.edu/balakg/), [John Guttag](https://people.csail.mit.edu/guttag/), [Mert R. Sabuncu](http://sabuncu.engineering.cornell.edu/)
188
+ MedIA: Medial Image Analysis. 2019. [eprint arXiv:1903.03545](https://arxiv.org/abs/1903.03545)
189
+
190
+ **Unsupervised Learning for Fast Probabilistic Diffeomorphic Registration**
191
+ [Adrian V. Dalca](http://adalca.mit.edu), [Guha Balakrishnan](http://people.csail.mit.edu/balakg/), [John Guttag](https://people.csail.mit.edu/guttag/), [Mert R. Sabuncu](http://sabuncu.engineering.cornell.edu/)
192
+ MICCAI 2018. [eprint arXiv:1805.04605](https://arxiv.org/abs/1805.04605)
193
+
194
+ * For the original CNN model, MSE, CC, or segmentation-based losses:
195
+
196
+ **VoxelMorph: A Learning Framework for Deformable Medical Image Registration**
197
+ [Guha Balakrishnan](http://people.csail.mit.edu/balakg/), [Amy Zhao](http://people.csail.mit.edu/xamyzhao/), [Mert R. Sabuncu](http://sabuncu.engineering.cornell.edu/), [John Guttag](https://people.csail.mit.edu/guttag/), [Adrian V. Dalca](http://adalca.mit.edu)
198
+ IEEE TMI: Transactions on Medical Imaging. 2019.
199
+ [eprint arXiv:1809.05231](https://arxiv.org/abs/1809.05231)
200
+
201
+ **An Unsupervised Learning Model for Deformable Medical Image Registration**
202
+ [Guha Balakrishnan](http://people.csail.mit.edu/balakg/), [Amy Zhao](http://people.csail.mit.edu/xamyzhao/), [Mert R. Sabuncu](http://sabuncu.engineering.cornell.edu/), [John Guttag](https://people.csail.mit.edu/guttag/), [Adrian V. Dalca](http://adalca.mit.edu)
203
+ CVPR 2018. [eprint arXiv:1802.02604](https://arxiv.org/abs/1802.02604)
204
+
205
+
206
+ # Notes
207
+ - **keywords**: machine learning, convolutional neural networks, alignment, mapping, registration
208
+ - **data in papers**:
209
+ In our initial papers, we used publicly available data, but unfortunately we cannot redistribute it (due to the constraints of those datasets). We do a certain amount of pre-processing for the brain images we work with, to eliminate sources of variation and be able to compare algorithms on a level playing field. In particular, we perform FreeSurfer `recon-all` steps up to skull stripping and affine normalization to Talairach space, and crop the images via `((48, 48), (31, 33), (3, 29))`.
210
+
211
+ We encourage users to download and process their own data. See [a list of medical imaging datasets here](https://github.com/adalca/medical-datasets). Note that you likely do not need to perform all of the preprocessing steps, and indeed VoxelMorph has been used in other work with other data.
212
+
213
+
214
+ # Creation of deformable templates
215
+
216
+ To experiment with this method, please use `train_template.py` for unconditional templates and `train_cond_template.py` for conditional templates, which use the same conventions as VoxelMorph (please note that these files are less polished than the rest of the VoxelMorph library).
217
+
218
+ We've also provided an unconditional atlas in `data/generated_uncond_atlas.npz.npy`.
219
+
220
+ Models in h5 format weights are provided for [unconditional atlas here](http://people.csail.mit.edu/adalca/voxelmorph/atlas_creation_uncond_NCC_1500.h5), and [conditional atlas here](http://people.csail.mit.edu/adalca/voxelmorph/atlas_creation_cond_NCC_1022.h5).
221
+
222
+ **Explore the atlases [interactively here](http://voxelmorph.mit.edu/atlas_creation/)** with tipiX!
223
+
224
+
225
+ # SynthMorph
226
+
227
+ SynthMorph is a strategy for learning registration without acquired imaging data, producing powerful networks agnostic to contrast induced by MRI ([eprint arXiv:2004.10282](https://arxiv.org/abs/2004.10282)). For a video and a demo showcasing the steps of generating random label maps from noise distributions and using these to train a network, visit [synthmorph.voxelmorph.net](https://synthmorph.voxelmorph.net).
228
+
229
+ We provide model files for a ["shapes" variant](https://surfer.nmr.mgh.harvard.edu/ftp/data/voxelmorph/synthmorph/shapes-dice-vel-3-res-8-16-32-256f.h5) of SynthMorph, that we train using images synthesized from random shapes only, and a ["brains" variant](https://surfer.nmr.mgh.harvard.edu/ftp/data/voxelmorph/synthmorph/brains-dice-vel-0.5-res-16-256f.h5), that we train using images synthesized from brain label maps. We train the brains variant by optimizing a loss term that measures volume overlap of a [selection of brain labels](https://surfer.nmr.mgh.harvard.edu/ftp/data/voxelmorph/synthmorph/fs-labels.npy). For registration with either model, please use the `register.py` script with the respective model weights.
230
+
231
+ Accurate registration requires the input images to be min-max normalized, such that voxel intensities range from 0 to 1, and to be resampled in the affine space of a [reference image](https://surfer.nmr.mgh.harvard.edu/ftp/data/voxelmorph/synthmorph/ref.nii.gz). The affine registration can be performed with a variety of packages, and we choose FreeSurfer. First, we skull-strip the images with [SAMSEG](https://surfer.nmr.mgh.harvard.edu/fswiki/Samseg), keeping brain labels only. Second, we run [mri_robust_register](https://surfer.nmr.mgh.harvard.edu/fswiki/mri_robust_register):
232
+
233
+ ```
234
+ mri_robust_register --mov in.nii.gz --dst out.nii.gz --lta transform.lta --satit --iscale
235
+ mri_robust_register --mov in.nii.gz --dst out.nii.gz --lta transform.lta --satit --iscale --ixform transform.lta --affine
236
+ ```
237
+
238
+ where we replace `--satit --iscale` with `--cost NMI` for registration across MRI contrasts.
239
+
240
+
241
+ # Data
242
+ While we cannot release most of the data used in the VoxelMorph papers as they prohibit redistribution, we thorough processed and [re-released OASIS1](https://github.com/adalca/medical-datasets/blob/master/neurite-oasis.md) while developing [HyperMorph](http://hypermorph.voxelmorph.net/). We now include a quick [VoxelMorph tutorial](https://colab.research.google.com/drive/1ZefmWXBupRNsnIbBbGquhVDsk-7R7L1S?usp=sharing) to train VoxelMorph on neurite-oasis data.
243
+
244
+ # Contact
245
+ For any code-related problems or questions please [open an issue](https://github.com/voxelmorph/voxelmorph/issues/new?labels=voxelmorph) or [start a discussion](https://github.com/voxelmorph/voxelmorph/discussions) of general registration/VoxelMorph topics.