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
Diese Übung ist Teil des Kurses
Biomedical Image Analysis in Python
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Find image center of mass
com = ____
# Calculate amount of shift needed
d0 = 128 - _____
d1 = ____
# Translate the brain towards the center
xfm = ndi.shift(____, shift=____)