# How can I register/align shifted image stacks?

**URL:** <https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244>\
**Category:** General Usage\
**Tags:** images\
**Created:** [September 27, 2019, 8:05pm UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244 "2019-09-27T20:05:22Z")\
**Posts on this page:** 6\
**Page:** 3

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 15, 2020, 8:47am UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/41 "2020-10-15T08:47:55Z")

</div>

If you just need translation, I’d recommend the pure-Julia `register_translate`:

```julia
julia> using RegisterMismatch

help?> register_translate
search: register_translate

  shift = register_translate(fixed, moving, maxshift, [thresh]) computes the integer-valued translation which best aligns images fixed and moving. All shifts up to size maxshift are considered.
  Optionally specify thresh, the fraction (0<=thresh<=1) of overlap required between fixed and moving (default 0.25).

```

You’ll want to add [HolyLabRegistry](https://github.com/HolyLab/HolyLabRegistry) (as a registry, not a package) to get it.

---

<div class="post-metadata">

**Author:** ![babaq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/babaq/32/891_2.png) [@babaq](https://discourse.julialang.org/u/babaq)\
**Post date:** [February 24, 2022, 3:43am UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/42 "2022-02-24T03:43:08Z")

</div>

@tim.holy, I tried instructions you listed for windows, but stack at `]registry add git@github.com:HolyLab/HolyLabRegistry.git` as follows:

```julia
(@v1.7) pkg> registry add git@github.com:HolyLab/HolyLabRegistry.git
     Cloning registry from "git@github.com:HolyLab/HolyLabRegistry.git"
Private key location for 'git@github.com' [C:\Users\fff00\.ssh\id_rsa]:

```

and it fails at three attempts.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [February 24, 2022, 7:15am UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/43 "2022-02-24T07:15:10Z")

</div>

Use `https`, not `git`. (You need commit privileges for `git`.) [How can I register/align shifted image stacks? - #7 by tim.holy](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/7)

---

<div class="post-metadata">

**Author:** ![babaq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/babaq/32/891_2.png) [@babaq](https://discourse.julialang.org/u/babaq)\
**Post date:** [February 28, 2022, 2:33am UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/44 "2022-02-28T02:33:40Z")

</div>

it worked, Thanks.

---

<div class="post-metadata">

**Author:** ![brainandforce](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brainandforce/32/211054_2.png) [@brainandforce](https://discourse.julialang.org/u/brainandforce)\
**Post date:** [September 23, 2025, 2:09am UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/45 "2025-09-23T02:09:16Z")

</div>

I have a large dataset of monochrome lunar images (20 GB uncompressed, infrared, red, green, and blue) which I’d like to get registered and stacked to build a lunar mosaic. The images are all distorted by the atmosphere in small but random amounts, so simple shifts and rotations will not suffice. Would BlockRegistration.jl be the best tool to use here?

Ideally, I don’t want to have to rely on a single reference image since every individual image is going to be distorted in some way. However, processing time isn’t a significant issue, and I’d happily use a tool that does global optimization if it produces significantly better results.

A lot of lunar image processing software is geared towards one-shot color cameras, so assembling a Julia pipeline to get all of my infrared (pictured below) and RGB data registered simultaneously, stacked into single-channel images, and composited into IRG/RGB images is the goal.

 ![Moon_in_NIR_with_Rupes_Recta](https://global.discourse-cdn.com/julialang/original/3X/9/5/95dcaa571d7aa9a420c9719718323092257a8f1f.jpeg)

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [September 26, 2025, 6:03pm UTC](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244/46 "2025-09-26T18:03:13Z")

</div>

BlockRegistration might work, but it has mostly been designed to track changes over time in 2d and 3d (volumetric) imaging. Other options include [GitHub - timholy/ANTsRegistration.jl: Convenience wrapper for image registration using the Advanced Normalization Tools](https://github.com/timholy/ANTsRegistration.jl) and surely many others.

[Previous page](https://discourse.julialang.org/t/how-can-i-register-align-shifted-image-stacks/29244.md?page=2)
