Channels Vs length on an image

Hi,

I normally think of a channel as the depth of an image. So with an RGB image the channel is simply the depth in the (height, width, depth) matrix. In the AI4M_C1_W3_lecture_ex_03 notebook, “length” is used to replace “depth” to avoid confusion with the depth of the U-net. I thought this length would be same as channel, but in the Input shape, channel was another separate parameter, giving

  • num_channels: 4
  • height: 160
  • width: 160
  • length: 16
    Could anyone help to explain this?
    Winson

Hi @ai_curious, thanks for the reply. My question is really asking, why I’m dealing with 4 dimensions. I was expecting 3.

I think I found the answer in the final assignment. and it is due to MRI images come in sequences:

“”"
The first file is an image file containing a 4D array of MR image in the shape of (240, 240, 155, 4).

  • The first 3 dimensions are the X, Y, and Z values for each point in the 3D volume, which is commonly called a voxel.
  • The 4th dimension is the values for 4 different sequences
    • 0: FLAIR: “Fluid Attenuated Inversion Recovery” (FLAIR)
    • 1: T1w: “T1-weighted”
    • 2: t1gd: “T1-weighted with gadolinium contrast enhancement” (T1-Gd)
    • 3: T2w: “T2-weighted”

“”"

Hi, @Winson_Lam

Basically, the 4 dimension is from the 3D volume of the MR image.

In the case of an image, an array is 3 dimensions, i.e., height, width, and color.
On the other hand, a dimension for 3D volume is 4, where it is necessary to consider “depth” too.

In the assignment, as you expected, the 4 dimension is from the 3D volume(3 dimensions) and sequences(1 dimension).