-
Notifications
You must be signed in to change notification settings - Fork 52
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
Tifimage: problem to use getframe function for stacks of single image files #501
Comments
The module was re-written by @vallsv some time ago ... he is the one knowing best the changes he made (4 years back ...) |
Indeed this is a bug since the fabio is expected to search in fileseries... but I think I remember that there is now a file-series class to handle explicitly the case. |
I had a chat with @vallsv : the behaviour has changed on purpose and to play within file-series, there is a specific class which makes things cleaner. It is documented here: |
Hi Jerome, Thanks for the update and it might be me, but currently I find it a bit complex for the average Joe to use the get_frame/getframe to jump forth and back in file series. It might be that is just an update of the documentation (the page you linked to in your last comment) that is needed. In the section under "FabIO old-fashion file series" there is this example:
Is this purely a historic use of fabio? When I read the documentation it appears to me that it should still work, but there are better ways to handle this. If this example is not working anymore, I think we need to mark this more clearly. Please, don't get me wrong, I think it is great that the code has developed and new and faster ways of dealing with reading large amount of data have been introduced. But our original vision was also to make it really easy to open a file a move around in a stack of images without knowing too many Python tricks. Instead of the old way, I also tried the new "random" way.
I can see that I can use this fairly similar to the old way:
apparently because TiffFrame is something different from Tiffimage. A similar situation is the same for all the "gets" .getstddev, .getmean etc Sequential reading: If I follow the example below:
I get Attribute errors for index, file_index, file_container, e.g.
Sorry, this got a bit long and possibly some this should have been move to a separate issue. BR |
A small update. I played a bit more with the sequential reading and I believe this example might help the user:
the objects in myframes seems to working in the usual way. E.g.
|
There are bugs in the documentation which deserve correction ... Reopen this as iteration over |
Sounds good, Jerome. Thanks. |
Do you want to have a look at #516 ? |
Of course. I will have a look. |
As mentioned in my comment (to reviewing #516) the doc is now consistent with the code. I have testet tiff files (both including single images and multiple images) and I find that the present function is a bit inconsistent. Wouldn't it make sense that all formats worked the same even if some has a possibility of being multiple image files. I believe that most data sets of tiff files (or edf files) or stored as single image files, despite the ability to store more images in one file. The example now given in the documentation with the mar2300 data can be used: im1 = fabio.open("200mMmgso4_001.mar2300") im4 = im1.getframe(4) whereas im1.getframe(4) results in the following error despite im1.nframes is 1:Exception Traceback (most recent call last) File ~/Documents/Github/fabio/build/lib.macosx-11.0-arm64-cpython-310/fabio/tifimage.py:231, in TifImage.getframe(self, num) Exception: getframe out of range What do you think? |
To me That's unefficient and it mix concepts of frames and file series. That's in the end, difficult to maintain, difficult to predict, and difficult to adapt. |
Apparently, there is a problem in tif image when using getframe to jump to another image. It seems related to tifimage expecting a multi-image file and not a series of images (possibly therefore it doesn't inherit the fabioutils version of getframe).
Example:
Exception: getframe out of range
it ends up here in tifimage.py:
where nframes is 1 because of only having one image in the file.
The code has changed quite a bit since I last looked at it, so I am unsure if I am expected to use another function for jumping to another file in the stack of tiffs but generally it should capture that it is a series (actually .next() and .previous() does work) and therefore try to goto to another file if there is no stack of images in the file itself, or?
The text was updated successfully, but these errors were encountered: