Skip to content
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

Suggestion: Loading subset of image as defined by coordinate set only #15

Open
Gewerd-Strauss opened this issue Mar 12, 2024 · 1 comment

Comments

@Gewerd-Strauss
Copy link

Hello,

this is kind of related to #14, but only tangentially so.

Image-loading takes quite a bit of time if you are processing 4k x 6k sized images.

In fact it takes so prohibitively long that I am currently trying to figure out how to load subset of an image only. Imager does not allow for this; but RBioFormats does. However, setting up that package properly has turned out to be very complicated.

A good amount of the image is unlikely to be relevant for me, and I'd rather just not load it to begin with and save myself a lot of time and resources.

Could imager::load.image() be expanded by 4 parameters x1,x2,y1,y2 defining the range of pixel locations imported?

As a reference, the RBioFormats has a suitable function that does this in principal.

RBioFormats::read.image(
                                file = image.path,
                                ...,
                                subset = list(x=x1:x2,y1:y2)
                            )

Unfortunately, I have found that its image-data is not 1-to-1 with the data loaded by imager. I would not have assumed those to load identical data, but I certainly hoped for it. At this point I am not sure if the value differences are small enough so that I can deprecate imager::load.image() for RBioFormats::read.image() to implement this; because I have not come around to testing this particular change.

Nonetheless I would prefer a native support in imager so that I don't have to worry about these value diffs. Additionally, setting up RBioFormats() is somewhat of a pain to manage; particularly when you must consider it in the scope of a package, instead of a "normal" script-environment.

Is something like this possible in principal?

Thank you.
Sincerely,
~Gw

@asgr
Copy link
Owner

asgr commented Mar 12, 2024

It’s not something we would plan to work on. Most pre-existing functions are being supported in maintenance mode only. We would aim to fix bugs, but not add features. You are welcome to investigate this functionality on CImg itself and submit a pull request though.

Note there are many packages that can also read in images, and it is relatively painless to convert different formats to CImg.

@asgr asgr closed this as completed Mar 12, 2024
@asgr asgr reopened this Mar 13, 2024
@asgr asgr assigned asgr and unassigned asgr Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants