<jupyter_start><jupyter_text>This notebook is intended to demonstrate how registration methods of ITKTubeTK operate.There are many other (more effective) registration methods available in other pages (e.g., NiftiReg, ANTS).  However, the method in ITKTubeTK is often sufficient and is easy to control.  So, if it works for your problem...<jupyter_code>import itk
from itk import TubeTK as ttk

from itkwidgets import view

import numpy as np
im1 = itk.imread("Data/MRI-Cases/mra.mha", itk.F)
im2 = itk.imread("Data/MRI-Cases/mri_t1_sag.mha", itk.F)
ImageType = itk.Image[itk.F,3]

reg2To1 = ttk.RegisterImages[ImageType].New(FixedImage=im1, MovingImage=im2)
reg2To1.SetReportProgress(True)
reg2To1.SetExpectedOffsetMagnitude(5)
reg2To1.SetExpectedRotationMagnitude(0.005)
reg2To1.SetRegistration("PIPELINE_AFFINE")
reg2To1.SetMetric("MATTES_MI_METRIC")
reg2To1.Update()
im2Reg = reg2To1.ResampleImage()
im2RegMath = ttk.ImageMath[ImageType,ImageType].New(Input=im2Reg)
im2RegMath.IntensityCorrection(100,4,im1)
im2RegInt = im2RegMath.GetOutput()
cb12 = itk.CheckerBoardImageFilter[ImageType].New(Input1=im1, Input2=im2RegInt)
cb12.Update()
im12 = ImageType.New()
im12 = cb12.GetOutput()
view(im12)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10920945395273024, 'fraction_numerical': 0.044009779951100246, 'mean_word_length': 7.1866666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '66440', 'license': 'Apache-2.0', 'n_tokens_mistral': 483, 'n_tokens_neox': 463, 'n_words': 94, 'path': 'examples/Demo-ImageRegistration.ipynb', 'repo_name': 'thewtex/TubeTK', 'size': '1227'}