Skip to content

Revise the image stack process to selectively determine what needs to be stacked

The image stack process runs when users hit the "Export Projected Frames" button. This creates an image stack, a numpy array managed with an on-disk memory map file, for all of the projected images in their full resolution. The image stack process does convert all images to grayscale before stacking, which saves a fair bit of memory, but the image_stack.dat file can still often be huge (>1-2 gigabytes).

I propose a solution that will optimize this process to take less disk space and process faster.

  1. Move the stack creation process to the Image Velocimetry step (after grid creation).
  2. Crop the input images to stack based on the input grid. This will require logic to determine what the best cropping would be:
    • Respect masks. No stacking need happen inside of a mask. Find the bounding box of the unmasked region, and use that as a base crop. Turn pixels that are masked inside this bounding box to black.
    • Set a buffer distance around all grid points equal to some factor of the search line length (or search area window size for PIV). For example, if the search line length is 100 pixels, create a buffer of 200 pixels around each point. This will enable the user to adjust the search line length without recreating the image stack. #50 (closed) includes a discussion about how to visualize this.
    • Create the stack from this cropped and buffered portion of each image. Although this probably will not save a lot of time for the grid-based approach, it will drastically reduce the image size for stacking for cross-sections and, depending on what is drawn, point methods.