f5665c4258e60c7e93b3cac79bebefd5906af6fd,doc/examples/syn_registration_3d.py,,,#,48

Before Change



warped, affine_init = affine_registration(nib_static, nib_moving)
static = nib_static.get_data().squeeze().astype(np.float32)
moving = warped.get_data().squeeze().astype(np.float32)

def renormalize_image(image):
    m=np.min(image)
    M=np.max(image)

After Change


the pyramid. The 0-th level corresponds to the finest resolution.  


opt_iter = [5, 10, 10]
registration_optimizer = SymmetricDiffeomorphicRegistration(metric, opt_iter)


Execute the optimization, which returns a DiffeomorphicMap object,
that can be used to register images back and forth between the static and moving
domains


mapping = registration_optimizer.optimize(static, moving, 
                                          static_affine, moving_affine, pre_align)


Now let"s warp the moving image and see if it gets similar to the static image


warped_moving = mapping.transform(moving)


To visually check the overlap of the static image with the transformed moving
image, we can plot them on top of each other with different channels to see
where the differences are located


overlay_middle_slices_coronal(static, warped_moving, "Static", "Warped moving", "warped_moving.png")


.. figure:: warped_moving.png
    :align: center

**Moving image transformed under the (direct) transformation in green
on top of the static image (in red)**.



And we can also apply the inverse mapping to verify that the warped static image
is similar to the moving image 


warped_static = mapping.transform_inverse(static)

overlay_middle_slices_coronal(warped_static, moving, "Warped static", "Moving", "warped_static.png")

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: nipy/dipy
Commit Name: f5665c4258e60c7e93b3cac79bebefd5906af6fd
Time: 2014-04-13
Author: jomaroceguedag@gmail.com
File Name: doc/examples/syn_registration_3d.py
Class Name:
Method Name:


Project Name: tensorflow/models
Commit Name: 90f63a1e1653bfa17fde8260a4aa20231b269b7d
Time: 2017-06-29
Author: alexleegk@gmail.com
File Name: video_prediction/prediction_model.py
Class Name:
Method Name: cdna_transformation


Project Name: tensorflow/tpu
Commit Name: 11b0078497d44560e1528343b6744451b3400928
Time: 2019-11-01
Author: pengchong@google.com
File Name: models/official/detection/dataloader/maskrcnn_parser.py
Class Name: Parser
Method Name: _parse_train_data


Project Name: tensorflow/models
Commit Name: e12bd6a5e5195e158384059da3d5d47638ba12a1
Time: 2019-11-01
Author: pengchong@google.com
File Name: official/vision/detection/dataloader/maskrcnn_parser.py
Class Name: Parser
Method Name: _parse_train_data