Difference between revisions of "NiftyReg Tutorial Segmention Propagation"

From CMIC
Jump to: navigation, search
(Created page with "test")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
test
+
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 [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:Labels.png|center|500px|thumb|labels.nii]]
 +
[[File:New image.png|center|500px|thumb|new_image.nii]]
 +
 
 +
 
 +
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> -aff ref_template_flo_new_image_affine_matrix.txt</code>
 +
The following images show the difference images before and after the affine registration.
 +
[[File:InitialDiff.png|center|500px|thumb|Difference image prior to registration]]
 +
[[File:AffineDiff.png|center|500px|thumb|Difference image after 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:
 +
:<code>reg_f3d -ref new_image.nii -flo template.nii -res ref_template_flo_new_image_nrr_result.nii \</code>
 +
::<code>-aff ref_template_flo_new_image_affine_matrix.txt -cpp ref_template_flo_new_image_nrr_cpp.nii</code>
 +
The following image shows the difference after the non-linear registration.
 +
[[File:NonLinDiff.png|center|500px|thumb|Difference image after 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 <code>reg_aladin -help</code> and <code>reg_f3d -help</code>.
 +
 
 +
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:
 +
:<code>reg_resample -ref new_image.nii -flo labels.nii -res propagated_labels.nii \</code>
 +
::<code>-cpp 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.
 +
 
 +
Images below show the propagated labels into the space of new_image.nii, with no registration, with affine only and with non-linear registration.

Latest revision as of 15:49, 9 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:

template.nii
labels.nii
new_image.nii


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.

File:InitialDiff.png
Difference image prior to registration
File:AffineDiff.png
Difference image after 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.

File:NonLinDiff.png
Difference image after 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 \
-cpp 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.