2D Classes

These are the 2-Dimensional Classes.

Data Representation

Data is always represented as an np.ndarray. The dimensions of the array is always 3D. It has the X, Y and the Z dimension. The Z dimension is referred to as the Channel Dimension.

This is because Z dim holds all channel information!

Despite having a 3D structure, we call helper classes 2D because it’s the source dimension.

Intuition

We can think of this representation like a layered cake:

Side View              Bird Eye View
                       (1st Channel)
|-------| (Channel 1)    [A][B][C]
|-------| (Channel 2)    [B][A][D]
|-------| (Channel 3)    [A][B][C]

Each layer is like a channel in the image:

Side View            Bird Eye View
                     (1st Channel)
|-------| (RED)     [010][100][075]
|-------| (GREEN)   [120][200][100]
|-------| (BLUE)    [200][050][000]

                 [All values are 0-255]

If we were to add more layers, we can just append it as a new layer:

Side View
|-------| (RED)
|-------| (GREEN)
|-------| (BLUE)
|-------| (SPECTRAL_0)
|-------| (SPECTRAL_1)

Hence, the data can be imagined as a 3-dimensional object regardless of how many channels we add.

Channel Dimension

The Channel Dimension is where all channel data resides. XY is implicitly represented based on the cell location!

If we were to bring XY information down to the Channel Dimension, they will still be called the XY Channels. This is to keep convention and prevent confusion between Channels, Indices, Spatial Indices etc.

Due to frequency of array indexing, it can become confusing to differentiate array indexes and index values.

There are multiple ways to getting more channels in Frame2D Channels.

Loading

If you’re attempting to load in an image, use the Frame2D class.

For videos, use Video2D. From there, convert to Frame2D.