imreggroupwise
Description
The imreggroupwise
function uses the total variation method to
perform deformable registration of slices in a series of grayscale images. You can use this
function to reduce sliding motion between slices in a series of medical images, such as a
timeseries. Registering all slices of the series to one of the slices using deformable
registration in a for
loop can introduce bias towards the artifacts of one
slice in all the slices. In contrast, the imreggroupwise
function reduces
the overall range of sliding motion across all slices.
[
specifies options for the total variation method using one or more optional name-value
arguments.dispField
,reg
] = imreggroupwise(moving
,Name=Value
)
Examples
Groupwise Registration of MRI Image Series
Load an MRI volume into the workspace.
imgs = load("mristack.mat");
imgs = squeeze(imgs.mristack);
Pad the slices of the MRI volume to allow for rotation.
imgs = padarray(imgs,[10 10],"both");
Extract the 10th slice of the MRI volume, to use to generate the moving image series.
paddedSlice = imgs(:,:,10);
Generate the moving image series by rotating the slice by different angles.
moving = zeros(276,276,27); for i = 1:27 moving(:,:,i) = imrotate(paddedSlice,i,"crop"); end
Perform groupwise registration of the slices of the moving image series.
[dispField,reg] = imreggroupwise(moving,GridRegularization=0.05);
--------------------------- Pyramid Level = 3 -------------------------------- Closeness to Iteration f(x) Step-size optimal solution 1 160720.92 11.50 18.19431 2 146622.17 41.61 31.55621 3 137582.30 54.80 37.51630 4 131892.89 21.32 30.22352 5 129146.80 12.05 27.98123 6 126260.51 18.80 34.57209 7 123292.77 21.42 32.76271 8 119756.72 34.44 26.53227 9 117145.16 27.64 33.13160 10 114257.37 28.72 39.06536 11 111212.99 50.30 35.02401 12 108848.93 28.47 27.27366 13 106838.15 16.68 21.59996 14 104141.37 48.40 29.34133 15 103034.70 43.98 36.78617 16 101421.24 11.33 21.98658 17 99846.91 25.65 19.28558 18 98950.73 20.29 22.02194 19 97683.82 55.50 23.47823 20 97058.47 35.79 56.52787 21 95693.10 12.29 39.94096 22 94308.28 31.93 50.77296 23 93620.93 21.01 23.42839 24 92756.49 43.04 26.44428 25 92160.48 39.07 20.02188 26 91649.86 20.14 23.32969 27 90848.45 52.28 12.75790 28 90785.24 35.18 50.98939 29 89193.25 13.04 24.02603 30 87913.57 26.84 23.86608 31 87261.74 13.25 27.18752 32 86609.40 28.99 20.23212 33 86403.18 36.29 19.85028 34 86171.97 12.29 14.73627 35 85991.59 43.41 19.17823 36 85880.43 31.97 52.82440 37 84848.06 22.60 38.11074 38 83896.58 24.78 26.63796 39 83221.23 17.79 31.42078 40 82422.75 15.26 17.38349 41 82386.70 42.07 30.26392 42 82118.45 10.10 20.60638 43 81714.94 31.01 27.63559 44 81475.85 25.61 35.72504 45 81219.57 11.81 30.83450 46 80900.59 42.13 21.99698 47 80701.15 27.56 46.08761 48 79735.79 18.84 29.77860 49 78885.47 19.72 21.33987 50 78443.85 14.00 33.84345 51 78025.38 19.61 21.81821 52 77820.46 10.80 27.58759 53 77566.30 14.89 14.12064 54 77356.17 16.30 24.02455 55 77210.20 17.62 13.38399 56 77175.39 16.57 13.65389 57 77139.47 16.67 14.31732 58 77103.48 16.91 14.75186 59 77052.18 18.54 13.45865 60 77007.15 17.58 11.45708 61 76995.53 6.92 12.12129 --------------------------- Pyramid Level = 2 -------------------------------- Closeness to Iteration f(x) Step-size optimal solution 1 90397.57 9.98 16.07776 2 88598.63 13.10 23.03916 3 86659.87 23.18 36.97704 4 85346.69 26.94 46.28403 5 83821.96 9.70 20.80432 6 82514.48 16.43 25.34133 7 81522.62 18.21 27.43884 8 80714.91 45.26 44.56642 9 79515.86 16.33 17.96243 10 78667.76 10.10 25.12929 11 77756.18 24.19 27.73775 12 77571.40 32.06 51.91825 13 76629.12 7.86 22.85993 14 75929.67 19.14 31.05180 15 75590.59 16.23 14.57161 16 75563.08 47.79 52.11658 17 74964.02 19.25 34.85287 18 74383.90 8.57 36.63964 19 73887.61 25.26 20.34162 20 73676.18 8.94 12.66080 21 73360.07 26.43 19.09864 22 73190.90 31.92 33.94272 23 73032.36 10.59 20.21763 24 72764.07 32.08 14.04518 25 72626.99 24.21 27.84766 26 72493.83 30.79 28.66531 27 72090.89 18.12 17.14031 28 71660.52 18.11 11.76067 29 71269.90 15.98 24.21175 30 71067.73 22.38 15.58385 31 70985.12 8.50 14.58411 32 70888.81 11.41 13.56274 33 70796.71 14.63 12.23691 34 70729.12 15.27 12.57831 35 70721.71 14.16 12.59730 36 70716.14 5.36 12.87683 --------------------------- Pyramid Level = 1 -------------------------------- Closeness to Iteration f(x) Step-size optimal solution 1 80123.51 13.71 13.80900 2 78453.64 14.18 11.56824 3 76729.32 27.24 26.34447 4 75799.10 26.53 37.72128 5 74508.05 9.21 19.73064 6 73460.13 20.96 27.40239 7 72800.90 16.67 26.18356 8 71919.69 32.43 14.43351 9 71545.75 30.56 32.57132 10 70717.01 15.97 18.49375 11 70052.45 19.04 22.48044 12 69587.50 17.23 23.88982 13 69094.55 28.76 22.76715 14 68720.48 24.05 24.80507 15 68212.79 16.41 14.46844 16 67766.80 23.74 14.20388 17 67589.19 23.70 29.27166 18 67121.86 14.29 13.96609 19 66779.83 23.35 12.63738 20 66611.24 19.61 21.53575 21 66390.03 23.81 15.41449 22 66226.75 9.53 10.36505 23 66174.37 35.33 14.71976 24 66046.98 6.29 11.75380 25 65777.74 20.41 21.22998 26 65694.36 26.64 37.03862 27 65478.70 9.46 33.20081 28 65330.62 28.51 30.64879 29 65193.94 14.45 30.87433 30 64969.61 20.04 27.73873 31 64863.63 7.47 23.45422 32 64742.49 10.56 18.98134 33 64655.24 11.63 19.72796 34 64589.34 12.86 11.98109 35 64575.96 6.52 13.75064 36 64563.45 8.01 13.59998 37 64558.37 3.78 12.33042
Visualize the output of the groupwise registration. The mean image of the moving image series shows that the slices are misaligned. In contrast, the mean image of the registered image series indicates alignment across slices.
figure imshow([paddedSlice,mean(moving,3),mean(reg,3)]) title("Original Image | Mean Image of Moving Image Series " + ... "| Mean Image of Registered Image Series")
Input Arguments
moving
— Image series to be registered
3-D numeric array
Image series to be registered, specified as a 3-D numeric array. The slices in the image series must capture the same anatomical slice of the body. For example, the image series can be a collection of the same slice imaged at different times.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: [dispField,reg] = imreggroupwise(moving,NumPyramidLevels=6)
registers the slices of moving
using six pyramid levels.
GridSpacing
— Grid spacing
[4 4]
(default) | two-element numeric vector
Grid spacing, specified as a two-element numeric vector. Smaller values of
GridSpacing
specify a finer grid resolution.
Data Types: double
PixelResolution
— Pixel size
[1 1]
(default) | two-element numeric vector
Pixel size, specified as a two-element numeric vector. Specify values in
millimeters. For best results, specify this value when known, especially for images
with unequal spacing between dimensions. The function uses the pixel size to calculate
the displacement field, and then converts displacement values back to pixel units
before returning dispField
.
Data Types: double
NumPyramidLevels
— Number of multiresolution pyramid levels
3
(default) | positive integer
Number of multiresolution pyramid levels, specified as a positive integer.
If moving
is of size
M-by-N-by-P, then the value
of NumPyramidlevels
must satisfy the condition min([M N
P]) > (2^NumPyramidLevels)*0.7
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
GridRegularization
— Weighing factor for grid displacement regularization
0.11
(default) | nonnegative scalar
Weighing factor for grid displacement regularization, specified as a nonnegative scalar.
A large value for GridRegularization
can create a smooth output
displacement field, whereas a small value can create more localized
displacements.
Data Types: double
DisplayProgress
— Progress information output
true
or 1
(default) | false
or 0
Progress information output, specified as a numeric or logical
1
(true
) or 0
(false
). Specify DisplayProgress
as
true
to display information such as the number of iterations,
normalized root mean square error (RMSE), function local minima, step size, and
closeness to optimal solution.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
Output Arguments
dispField
— Displacement field
4-D numeric array
Displacement field, returned as a 4-D numeric array. Displacement values are in
pixels, even if you specify the PixelResolution
.
If moving
is of size
M-by-N-by-P, the displacement
field dispField
is a 4-D numeric array of size
M-by-N-by-2-by-P, where
dispField(:,:,1,:)
and dispField(:,:,2,:)
contain the displacements for each of the slices in the X- and
Y- directions, respectively.
reg
— Registered image series
3-D numeric array
Registered image series, returned with the same size and data type as
moving
.
References
[1] Vishnevskiy, Valery, Tobias Gass, Gabor Szekely, Christine Tanner, and Orcun Goksel. “Isotropic Total Variation Regularization of Displacements in Parametric Image Registration.” IEEE Transactions on Medical Imaging 36, no. 2 (February 2017): 385–95. https://doi.org/10.1109/TMI.2016.2610583.
Version History
Introduced in R2022b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)