Translations
In this chapter, we'll leverage data use data from the Open Access Series of Imaging Studies to compare the brains of different populations: young and old, male and female, healthy and diseased.
To start, center a single slice of a 3D brain volume (im
). First, find the center point in the image array and the center of mass of the brain. Then, translate the image to the center.
This chapter's exercises have all had the following imports:
import imageio
import numpy as np
import scipy.ndimage as ndi
import matplotlib.pyplot as plt
This exercise is part of the course
Biomedical Image Analysis in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Find image center of mass
com = ____
# Calculate amount of shift needed
d0 = 128 - _____
d1 = ____
# Translate the brain towards the center
xfm = ndi.shift(____, shift=____)