Difference between revisions of "NiftyReg Segmentation Propagation Tutorial"
m (Mmodat moved page NiftyReg Segmention Propagation Tutorial to NiftyReg Segmentation Propagation Tutorial: misspelt title) |
|||
Line 2: | Line 2: | ||
Assuming a template image (template.nii) and its associated segmentation (labels.nii), on can transfer the label information into the space of another image (new_image.nii). | Assuming a template image (template.nii) and its associated segmentation (labels.nii), on can transfer the label information into the space of another image (new_image.nii). | ||
+ | |||
For this example, we used the file 1000_3.nii from [http://www.neuromorphometrics.com neuromorphometrics] and its associated segmentation as template and subject 1001_3.nii from the same database as new image. Below are shown the ortho-views (mid-plane along each axis) of the three input images: | For this example, we used the file 1000_3.nii from [http://www.neuromorphometrics.com neuromorphometrics] and its associated segmentation as template and subject 1001_3.nii from the same database as new image. Below are shown the ortho-views (mid-plane along each axis) of the three input images: | ||
[[File:Template.png|center|500px|thumb|template.nii]] | [[File:Template.png|center|500px|thumb|template.nii]] | ||
Line 8: | Line 9: | ||
− | + | The first step is to globally (affine) register the image, the template.nii image is used as a floating image and the new_image.nii image is used as a reference: | |
:<code> reg_aladin -ref new_image.nii -flo template.nii -res ref_template_flo_new_image_affine_result.nii \</code> | :<code> reg_aladin -ref new_image.nii -flo template.nii -res ref_template_flo_new_image_affine_result.nii \</code> | ||
::<code> -aff ref_template_flo_new_image_affine_matrix.txt</code> | ::<code> -aff ref_template_flo_new_image_affine_matrix.txt</code> | ||
Line 26: | Line 27: | ||
Since the labels are binary, we specify to use a nearest-neighbor interpolation scheme: | Since the labels are binary, we specify to use a nearest-neighbor interpolation scheme: | ||
:<code>reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii \</code> | :<code>reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii \</code> | ||
− | ::<code>- | + | ::<code>-trans ref_template_flo_new_image_nrr_cpp.nii -inter 0</code> |
Note that while resampling, only the non-linear parametrisation is specified, not the affine. The non-linear parametrisation contains the affine since it was used to initialise the non-linear registration. | Note that while resampling, only the non-linear parametrisation is specified, not the affine. The non-linear parametrisation contains the affine since it was used to initialise the non-linear registration. | ||
Line 33: | Line 34: | ||
[[File:labels affine.png|center|500px|thumb|Propagated labels with affine registration]] | [[File:labels affine.png|center|500px|thumb|Propagated labels with affine registration]] | ||
[[File:labels nonlin.png|center|500px|thumb|Propagated labels with non-linear registration]] | [[File:labels nonlin.png|center|500px|thumb|Propagated labels with non-linear registration]] | ||
+ | The labels overlap without registration has been generated using the following commands respectively: | ||
+ | :<code>reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii -inter 0</code> | ||
+ | :<code>reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii \</code> | ||
+ | ::<code>-trans ref_template_flo_new_image_affine_matrix.txt -inter 0</code> |
Revision as of 11:58, 10 March 2015
Segmentation propagation uses image registration to transfer segmentations (or labels) from the space of one image to the space of another.
Assuming a template image (template.nii) and its associated segmentation (labels.nii), on can transfer the label information into the space of another image (new_image.nii).
For this example, we used the file 1000_3.nii from neuromorphometrics and its associated segmentation as template and subject 1001_3.nii from the same database as new image. Below are shown the ortho-views (mid-plane along each axis) of the three input images:
The first step is to globally (affine) register the image, the template.nii image is used as a floating image and the new_image.nii image is used as a reference:
reg_aladin -ref new_image.nii -flo template.nii -res ref_template_flo_new_image_affine_result.nii \
-aff ref_template_flo_new_image_affine_matrix.txt
The following images show the difference images before and after the affine registration.
The affine matrix obtained with reg_aladin, ref_template_flo_new_image_affine_matrix.txt, can now be used to initialise the non-linear registration step:
reg_f3d -ref new_image.nii -flo template.nii -res ref_template_flo_new_image_nrr_result.nii \
-aff ref_template_flo_new_image_affine_matrix.txt -cpp ref_template_flo_new_image_nrr_cpp.nii
The following image shows the difference after the non-linear registration.
By using the two commands above, we used the default parameters for both reg_aladin and reg_f3d. To see all available options, see reg_aladin -help
and reg_f3d -help
.
The non-linear transformation parametrisation, ref_template_flo_new_image_nrr_cpp.nii, can now be used to propagate the labels.nii image into the space of template.nii. Since the labels are binary, we specify to use a nearest-neighbor interpolation scheme:
reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii \
-trans ref_template_flo_new_image_nrr_cpp.nii -inter 0
Note that while resampling, only the non-linear parametrisation is specified, not the affine. The non-linear parametrisation contains the affine since it was used to initialise the non-linear registration.
Images below show the propagated labels into the space of new_image.nii, with no registration, with affine only and with non-linear registration.
The labels overlap without registration has been generated using the following commands respectively:
reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii -inter 0
reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii \
-trans ref_template_flo_new_image_affine_matrix.txt -inter 0