ome / omero-iviewer

An OMERO.web app allowing to view images
https://www.openmicroscopy.org/omero/iviewer/
Other
19 stars 30 forks source link

Query timestamps from all planes when C or Z dimensions are not filled #486

Closed Tom-TBT closed 1 week ago

Tom-TBT commented 1 month ago

Hello, we found a bug on the timestamps display. We have data where the channel at index 0 was acquired only for the first and last frames.

Because the query to get timestamps was restricted to Z=0 and C=0, most timestamps were missing: we only got a list of two (instead of ~400). -> Consequently, the last timepoint was assigned to the frame n°2, while all other frames had NaN values for timestamps.

To fix it, I added a condition that if the number of timestamps returned from the query is smaller than the number of frames, we do a second query. As such, it will impact performance (and results) only for images requiring it.

Return one arbitrary plane per theT. It does not ensure that it's the lowest theC/theZ, but seems acceptable for those edge cases.

FROM PlaneInfo Info WHERE Info.pixels.id = :pid 
AND Info.id IN (
    SELECT min(subInfo.id) FROM PlaneInfo subInfo
    WHERE subInfo.pixels.id = :pid GROUP BY subInfo.theT
)

(ensuring here that the minimum possible theC/theZ combination is returned increases the complexity of the query by a lot, because min(theC) is not always the same plane as min(theZ))

will-moore commented 1 week ago

I don't suppose you have a sample image that you can share to help with testing? Otherwise I can just test the query locally