fmi-faim / faim-ipa

A collection of Image Processing and Analysis (IPA) functions used at the Facility for Advanced Imaging and Microscopy (FAIM)
BSD 3-Clause "New" or "Revised" License
8 stars 6 forks source link

Support single-channel data from ImageXpress #89

Closed imagejan closed 8 months ago

imagejan commented 8 months ago

The MolecularDevices ImageXpress (Metamorph) format supports single-channel data where the channel name is not included in the filename. We need to update our regex patterns (1, 2, 3) to support this. What makes this a little complicated is the absence of a divider between the stage position (_s*) and the UUID, so that we need to know the number of digits used for the position index (is it always 2?):

240124d3_B05_s22A31C13E-3314-476F-B62C-5CDC65915F2B.tif
240124d3_B05_s151E1E486E-D339-44E8-9990-9A8894C2D5CA.tif
240124d3_D05_s2866465035-BBD2-4C57-BF9C-185859741902.tif

(As far as I can tell, the filename scheme with UUID suffix goes beyond the Metamorph nd/stk specification here: https://support.moleculardevices.com/s/article/MDA-file-formats)

/cc @tibuch @jluethi

imagejan commented 8 months ago

(is it always 2?)

Actually, no, it's never padded. But the first part of the UUID is always eight characters, so we can adapt the pattern to be general. I'll follow up with a pull request.

tibuch commented 8 months ago

I talked to Sabine and learned that stage position is dropped if only one position is acquired. So even more fun ;)

I would vote for a dedicated implementation SingleChannelStackAcquisition which overwrites the regex pattern. I find it easier to keep the use-cases separated. But happy to be convinced otherwise!

imagejan commented 8 months ago

Hm, I think regexes with optional match groups are not so bad, and I somehow dislike the idea of maintaining different but similar regex pattern in 6+ different places ({mixed, single-plane, stack} x {multi-channel, single-channel} x {multi-pos, single-pos}).

How about using a common pattern with optional match groups, and separating the implementations just depending on the presence/absence of the optional group in the match, -- with minimal duplication of code 😄? I'll try to come up with a suggestion..

tibuch commented 8 months ago

Sounds great!

One thing to keep in mind is that the final files-dataframe needs the columns field and channel i.e. they must be set, even if it is just 0. Otherwise the rest of the processing will fail.

tibuch commented 8 months ago

@imagejan I had already started with a SingleChannelStackAcquistion implementation on https://github.com/fmi-faim/faim-hcs/tree/single-plane-md and found a few edge cases that needed to be resolved. So far it works, but it is not as nice as your suggestion. I will use it tomorrow to convert the data from Clara, but I would not merge it this state and wait for you much better version :)