Image Registration Module
Image registration functions using cucim, scikit-image, and SimpleITK.
This module contains functions for image registration leveraging tools like cucim, scikit-image, and SimpleITK, optimized for use with qi2lab 3D MERFISH data.
History:
- 2025/07:
- Changed to anisotropic downsampling for registration.
- Changed to GPU-accelerated pixel warping strategy
- 2024/12: Refactored repo structure.
- 2024/07: Prepared to remove all Dask usage and integrate functions into the DataRegistration class as static methods.
- 2024/01: Updated for qi2lab MERFISH file format v0.1.
- 2023/07: Initial commit.
Functions:
| Name | Description |
|---|---|
apply_transform | Apply simpleITK transform |
compute_rigid_transform | Calculate initial translation transform using scikit-image |
compute_warpfield | Compute the warpfield to warp a target image to a reference image. |
apply_transform(image1, image2, transform)
Apply simpleITK transform
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image1 | ArrayLike | reference image | required |
image2 | ArrayLike | moving image | required |
transform | Transform | simpleITK transform object | required |
Returns:
| Name | Type | Description |
|---|---|---|
resampled_image | ArrayLike | transformed moving image |
Source code in src/merfish3danalysis/utils/registration.py
compute_rigid_transform(image1, image2, downsample_factors=[2, 6, 6], mask=None, projection=None, gpu_id=0)
Calculate initial translation transform using scikit-image phase cross correlation. Create simpleITK transform using shift.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image1 | ArrayLike | reference image | required |
image2 | ArrayLike | moving image | required |
downsample_factor | amount of zyx downsampling applied before calling registration | required | |
use_mask | use provided mask | required | |
projection | Optional[str] | projection method to use | None |
Returns:
| Name | Type | Description |
|---|---|---|
transform | simpleITK transform | translation transform |
shift_xyz | Sequence[float] | xyz shifts in pixels |
Source code in src/merfish3danalysis/utils/registration.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
compute_warpfield(img_ref, img_trg, gpu_id=0)
Compute the warpfield to warp a target image to a reference image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img_ref | ArrayLike | reference image | required |
img_trg | ArrayLike | moving image | required |
gpu_id | int | GPU ID to use for computation | 0 |
Returns:
| Name | Type | Description |
|---|---|---|
warp_field | ArrayLike | warpfield matrix |