-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tiffsequence with pattern and axesorder #76
Comments
Can you explain what shape and axes you are expecting, at which indices the files should be, and where in the file name the indices are encoded? Axes labels are single letters, indices are integers. |
For every group I expected an extra dimension, even if length one. and in this particular example, I would expect an array of NA for the case where sampleid=B1, frameid=1 and sampleid=A1, frameid=2 Sorry, I don't understand axes labels vs indices and it sounds like I'm missing something fundamental here. |
Thank you. I understand now. The current implementation does not handle categories (like A1, B1) but requires indices in form of numbers or characters (which can be converted to numbers) for each dimension. You can probably work around this if your categories all have distinct characters at certain positions, e.g.: import tifffile
import imagecodecs
pattern = r'(?P<A>[A-Z])\d-(?P<B>d)oi-\d{8}T\d{6}-PSII0-(?P<C>\d)'
with tifffile.TiffSequence(
'dataset-A1-20200531/*.png', imread=imagecodecs.imread, pattern=pattern
) as pngs:
print(pngs)
print(pngs.asarray().shape) Output:
You might be better off with a DataFrame or database than with a numpy or zarr array to handle your data. Check if similar tools like PIMS can handle categories... |
Ok, Thanks. I did not realize axes could only be individual letters. Thanks for the alternative suggestions. I was trying to avoid rolling my own solution and zarr seemed like a potential solution but it seems I am pushing this beyond where it is. I will check out PIMS too. |
This can be done with v2021.10.10: import tifffile
import imagecodecs
with tifffile.FileSequence(
imagecodecs.imread,
'dataset-A1-20200531/*.png',
pattern=(
r'(?P<sampleid>.{2})-'
r'(?P<experiment>.+)-\d{8}T\d{6}-PSII0-'
r'(?P<frameid>\d)'
),
categories={'sampleid': {'A1': 0, 'B1': 1}, 'experiment': {'doi': 0}},
) as pngs:
print(pngs)
print(pngs.asarray().shape)
|
this seems like its getting off topic from the original thread but i wanted to ask more about higher dimension arrays
This one works:
can you clarify why this doesnt work? it doesn't like the lack of the 2nd group even though that regex works too at regex101.
FileSequence: failed to parse file names (axes do not match within image sequence)
Also, based on your example I thought I could give an axes per group in the regex. is that not correct?
gives
IndexError: list index out of range
my files are:
The text was updated successfully, but these errors were encountered: