How to plot an annotation slice map with solid boundaries and transparent filling for the interior?

I am working on manually registering the ultrasound NII file(as shown below) obtained from my experiment with the adult mouse atlas.

How can I perform affine transformations and similar operations on the original image, and overlay an external solid line with a more internal transparent filling on the left original image(ultrasound doppler image), as shown right in the image?

My code is shown below:

import numpy as np
from allensdk.core.reference_space_cache import ReferenceSpaceCache
import matplotlib.pyplot as plt

# load data
resolution = 25
reference_space_key = 'annotation/ccf_2017'
rspc = ReferenceSpaceCache(resolution, reference_space_key, manifest='manifest.json')

# get annotation and template
annotation_volume, _ = rspc.get_annotation_volume()
template_volume, _ = rspc.get_template_volume()

def show_coronal_slice(annotation, template, slice_idx=None):
    if slice_idx is None:
        slice_idx = annotation.shape[0] // 2 
    
    plt.figure(figsize=(15, 5))

    plt.subplot(121)
    plt.imshow(template[slice_idx], cmap='gray')
    plt.title(f'Template - Coronal Slice {slice_idx}')
    plt.colorbar()
    
    plt.subplot(122)
    plt.imshow(annotation[slice_idx], cmap='Pastel1', vmin=0, vmax=1000)
    plt.title(f'Annotation - Coronal Slice {slice_idx}')
    plt.colorbar()
    
    plt.tight_layout()
    plt.show()

# show middle slice
show_coronal_slice(annotation_volume, template_volume)

Hello,

Thank you for your question! Unfortunately, we don’t have any tools available that do the kind of registration and visualization you’re working on here. However, this post highlights several different tools that you may find useful:

I hope this helps!

Best,
Ray

thanks a lot for your help!!! :raised_hands:
your advice is what i need!