girder / large_image

Python modules to work with large multiresolution images.
http://girder.github.io/large_image/
Apache License 2.0
196 stars 43 forks source link

Improved image creation #1002

Open manthey opened 2 years ago

manthey commented 2 years ago

Currently, the vips source adds a new method that, when used with addTile, can take a series of images (PIL or numpy or vips) and output a file in a few formats. The addTile method species where in the single frame image the new data is located and allows for masking the data as it is added.

We want to expand this capability:

One method of storing this data internally would be a hdf5 file via the h5py module. We could make a new hdf5 source (limited to just files we create) to allow reading the data as it is being created.

We always want the property that the last data added "wins", overwriting any existing data at its location. If the added data has a mask, it should only change the appropriate locations. If it has an alpha channel, this should be applied as it is added. As part of this, we may want to have a default alpha channel that is transparent until any data is added. Note that if data is added to the same location multiple times with alpha values that are 0 < a < 1, we need to make sure that they mix in the expected proportion.

As a starting point, we should create tests that will exercise the existing features and then expand the tests as we add features.

manthey commented 2 years ago

@annehaley Initially, what I'd like to see is a test that can be expanded to include features as we add them. There are a bunch of tests in https://github.com/girder/large_image/blob/master/test/test_source_vips.py, so the first test might just be a variant where we generate synthetic data rather than reading from an existing source. Alternately, using the test tile source which can generate multi-frame fractal data might work, too, though that might be limited because it won't be a range of numpy dtypes.

annehaley commented 2 years ago

Should all of this work go with the vips source or will it likely be its own source?

manthey commented 2 years ago

Should all of this work go with the vips source or will it likely be its own source?

Another test could go in the test_source_vips.py file, but I think we will end up creating a new hdf5 source and tests files for that since vips won't efficiently handle creating multi-frame images of arbitrary dimensions.

You could also create a new test file with an appropriate name (test_image_creation.py?).

manthey commented 8 months ago

A lot of this has been added with #1446.