-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to using C-order for image data (#9)
Within the realm of computing, there are two ways of storing multidimensional data: * **C-order:** Gets its name from C where you typically create a multidimensional array like so `int data[z][y][x]`. This is backwards from traditional mathematics where you represent coordinates as (x, y, z). This format of storing data can also be thought of as slowest-varying to fastest-varying. The z-axis typically varies slowest, followed by y-axis, finished with the x axis. * **Fortran-order:** Direct opposite of C-order and is how MATLAB and Fortran handle multidimensional array indexing. This method follows the traditional mathematical representation of (x, y, z). It makes sense that MATLAB and Fortran use this method because they are languages geared towards data scientists. This format of indexing data can be thought of as fastest-varying to slowest-varying. Previously, this package wasn't using C-order or Fortran-order but did a weird collage of both. This could be confusing to new users and I wanted to stick to a particular syntax. # Why switch to C-order? Python, Numpy, and many other libraries use this format for storing and indexing data. Numpy provides support for changing the order but it can be a pain to include for each call. Thus, I decided to stick with this syntax that Python follows. # What changes were made? Here is the general thought process I used. When returning coordinates, Fortran-order was used because that is intuitive for the average user who is familiar with coordinates from math courses. For example, it is much more intuitive to use (x, y) for a point rather than (y, x). The polar domain equivalent is (r, theta). Images and image shapes or sizes are in C-order to stick with the overwhelming agreement in the Python community. Color channels are considered to be faster varying than the x axis. For example, let's assume you have 50 RGB images with a width of 1024px and height of 2048px. The Numpy array of the images should be (50, 2048, 50, 3). This is what `polarTransform` expects when given an image. Let's say that you convert it to the polar domain, the resulting image will have a shape of (50, angular size, radial size, 3). Color images with channels > 1 must be specified by using the parameter `hasColor`. This is handled by moving the color channel to the front of the dimensions, performing transformation, and then moving back after transformation is complete.
- Loading branch information
1 parent
0069bfc
commit a6f2a6c
Showing
27 changed files
with
306 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.