Learn practical skills, build real-world projects, and advance your career

AI4M Course 1 week 3 lecture notebook

Extract a sub-section

In the assignment you will be extracting sub-sections of the MRI data to train your network. The reason for this is that training on a full MRI scan would be too memory intensive to be practical. To extract a sub-section in the assignment, you will need to write a function to isolate a small "cube" of the data for training. This example is meant to show you how to do such an extraction for 1D arrays. In the assignment you will apply the same logic in 3D.

import numpy as np
import keras
import pandas as pd
Using TensorFlow backend.
# Define a simple one dimensional "image" to extract from
image = np.array([10,11,12,13,14,15])
image
array([10, 11, 12, 13, 14, 15])
# Compute the dimensions of your "image"
image_length = image.shape[0]
image_length
6