nion-software / nionswift

Nion Swift is open source scientific image processing software integrating hardware control, data acquisition, visualization, processing, and analysis using Python. Nion Swift is easily extended using Python. It runs on Windows, Linux, and macOS.
http://nion.com/swift
GNU General Public License v3.0
45 stars 33 forks source link

Ensure that output from align sequence is displayed as stacked line plots #1087

Open cmeyer opened 4 months ago

cmeyer commented 4 months ago

Data is displayed in two main modes: as an image or as a plot.

For many data items, the description of the data is sufficient to determine the display type. For instance, simple 1D data, or a sequence/collection of 1D data is displayed as a line plot; likewise simple 2D data, or a sequence/collection of 2D is displayed as an image.

However, there are some side cases that have historically used heuristics to determine the display mode. For instance, a 2D image with width >> height (e.g. 2048x4) has been displayed as a line plot with each row being a separate plot.

However, in the case of sequence/collection alignment, the resulting data is a sequence/collection of pairs of points representing the shift for the particular position in the sequence/collection. Aligning a sequence of 100 images would result in a sequence of 100 2x1 images (numpy array dimensions (100, 1, 2)). Aligning a 8x8 collection of spectra would result in a 20x20 collection 1x1 images (numpy array dimensions (20, 20, 1, 1)?).

In the image case, the (100, 1, 2) array would be described as a sequence of 2x1 images. So purely by using the data description, there is no way to determine definitively how to display the data. So we need to (a) add a short term heuristic or hint from the alignment processing to display as two stacked line plots (x and y shifts) that are length 100; (b) consider expanding data descriptors to allow for description of vector-valued data arrays.

jamesrussell216 commented 4 months ago

@Tiomat85 can you put your explanation you just gave me of this in here please?!

jamesrussell216 commented 3 months ago

@Tiomat85 nudge

cmeyer commented 3 months ago

I updated the main description of the bug. Is that sufficient?

Tiomat85 commented 3 months ago

What Chris has put there is a far better description than you would have got from me. I like the idea of a display hint going along with the data, as somewhere in the software should have some context as to what the data actually represents.

jamesrussell216 commented 3 months ago

Yes thank you both - that's a big help, I actually understand the problem now!

Picking up on what @Tiomat85 said @cmeyer - we have that in the metadata somewhere at the moment? Like a property that is data item "type" or are most things just inferred of dims?