-
Notifications
You must be signed in to change notification settings - Fork 82
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
xarray.DataArray imagej
metadata and improved axis/scale logic
#247
base: main
Are you sure you want to change the base?
Commits on Apr 14, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 728619c - Browse repository at this point
Copy the full SHA 728619cView commit details -
Add _create_image_metadata function
This function creates a metadata dictionary meant to be stored in a newly created xarray.DataArray's global attributes. The initial metadata created stores scale type of the axis (linear, enumerated or none).
Configuration menu - View commit details
-
Copy full SHA for 53d23ea - Browse repository at this point
Copy the full SHA 53d23eaView commit details -
Update _assign_axes to use "imagej" metadata
This commit changes how the linear and enumerated axes are assigned. We now look for the "imagej" key in the xarray's global attributes. If the key is present we look for dim + "_axis_scale" to assign linear or enumerated axes.
Configuration menu - View commit details
-
Copy full SHA for d5375dc - Browse repository at this point
Copy the full SHA d5375dcView commit details -
Add metadata for all CalibratedAxis types
Although the only calibrated axes used by nearly everyone are DefaultLinearAxis and EnumeratedAxis, I added metadata support for all CalibratedAxis types (e.g. PolynomialAxis etc...) just to be thorough. This metadata will be used for matching the Calibrated Axis type when going back to ImageJ/Java land.
Configuration menu - View commit details
-
Copy full SHA for 9adf026 - Browse repository at this point
Copy the full SHA 9adf026View commit details -
This commit refactors dims._assign_axes() to use imagej specific metadata attached to a given xarray.DataArray. If the "imagej" attribute is present in the xarray's global attributes then information like scale, origin and the type of CalibratedAxis (e.g. DefaultLinearAxis, EnumeratedAxis, etc...) can be used to assign the correct calibrated axis per given dimension during the net.imagej.Dataset conversion process. If the desired calibrated axis is not available or the axis is unknown then we fall back to a DefaultLinearAxis and attempt to get scale/origin data from the coordinates.
Configuration menu - View commit details
-
Copy full SHA for ed8f794 - Browse repository at this point
Copy the full SHA ed8f794View commit details -
Configuration menu - View commit details
-
Copy full SHA for 719fe25 - Browse repository at this point
Copy the full SHA 719fe25View commit details -
Check for "Hello" key in attributes
The new "imagej" metadata attribute may not always be present (depending on the origin of the xarray). Checking for all attributes makes this kind of hard, so lets just check for the key we put in!
Configuration menu - View commit details
-
Copy full SHA for 1c0f385 - Browse repository at this point
Copy the full SHA 1c0f385View commit details -
Add case for singleton coordinates array
If a singleton dimension is detected, assign a scale/slope of 1.
Configuration menu - View commit details
-
Copy full SHA for ab2238c - Browse repository at this point
Copy the full SHA ab2238cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8cf19e5 - Browse repository at this point
Copy the full SHA 8cf19e5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ed5fa4 - Browse repository at this point
Copy the full SHA 8ed5fa4View commit details -
Configuration menu - View commit details
-
Copy full SHA for d58d255 - Browse repository at this point
Copy the full SHA d58d255View commit details -
Configuration menu - View commit details
-
Copy full SHA for fac7f33 - Browse repository at this point
Copy the full SHA fac7f33View commit details -
This commit adds a new metadata submodule to handle all image related metadata functions (e.g. creating/updating the xarray.DataArray metadata attribute). All metadata related functions should exist in this submodule.
Configuration menu - View commit details
-
Copy full SHA for 0f175dd - Browse repository at this point
Copy the full SHA 0f175ddView commit details -
Use one-liner to fetch dict key
Gabe suggested using a nice one-liner to get the CalibratedAxis from the dict instead of the if/else statement.
Configuration menu - View commit details
-
Copy full SHA for 61a814c - Browse repository at this point
Copy the full SHA 61a814cView commit details -
Refactor metadata module to be more pythonic
The axis submodule has also been streamlined to drop the CalibratedAxis dict and instead uses a list of Strings. This avoids Java import errors if a user imports the axis submodule before initializing ImageJ.
Configuration menu - View commit details
-
Copy full SHA for 56ca272 - Browse repository at this point
Copy the full SHA 56ca272View commit details
Commits on Apr 17, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 8af2bdc - Browse repository at this point
Copy the full SHA 8af2bdcView commit details
Commits on Apr 25, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 6cd7eb8 - Browse repository at this point
Copy the full SHA 6cd7eb8View commit details -
Improve docstring for axis functions
The docstring wasn't clear about what kind of string to send to and from the calibrated axis helper functions.
Configuration menu - View commit details
-
Copy full SHA for 1956351 - Browse repository at this point
Copy the full SHA 1956351View commit details -
Configuration menu - View commit details
-
Copy full SHA for 615ee25 - Browse repository at this point
Copy the full SHA 615ee25View commit details
Commits on May 18, 2023
-
Remove axis submodule and axis to str methods
The axis data are stored in the scifio.metadata.image map under the "axes" key. Converting this to a string is unecessary.
Configuration menu - View commit details
-
Copy full SHA for 88f5040 - Browse repository at this point
Copy the full SHA 88f5040View commit details -
Configuration menu - View commit details
-
Copy full SHA for bcfa002 - Browse repository at this point
Copy the full SHA bcfa002View commit details -
Configuration menu - View commit details
-
Copy full SHA for ccee1b3 - Browse repository at this point
Copy the full SHA ccee1b3View commit details -
Use the metadata module for image metadata
This commit uses the metadata module to create the metadata for both xarray and java images. Images can now be transferred back and forth between Java and Python without loosing the metadata.
Configuration menu - View commit details
-
Copy full SHA for 80ed95a - Browse repository at this point
Copy the full SHA 80ed95aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 28ab749 - Browse repository at this point
Copy the full SHA 28ab749View commit details -
Add array module for xarray accessors
This module contains the xarray accessors that extend the xarray.DataArrays with additional methods. This module must be imported before the accessors are found. No other code is needed to attach these accessors.
Configuration menu - View commit details
-
Copy full SHA for 73c5734 - Browse repository at this point
Copy the full SHA 73c5734View commit details -
Configuration menu - View commit details
-
Copy full SHA for b88e513 - Browse repository at this point
Copy the full SHA b88e513View commit details -
Configuration menu - View commit details
-
Copy full SHA for 205cff9 - Browse repository at this point
Copy the full SHA 205cff9View commit details -
Add tree method to MetadataAccessor
Once the metadata has been set call the tree() method to print a dict tree.
Configuration menu - View commit details
-
Copy full SHA for 097c907 - Browse repository at this point
Copy the full SHA 097c907View commit details -
Configuration menu - View commit details
-
Copy full SHA for 94db806 - Browse repository at this point
Copy the full SHA 94db806View commit details -
Configuration menu - View commit details
-
Copy full SHA for e281221 - Browse repository at this point
Copy the full SHA e281221View commit details -
Configuration menu - View commit details
-
Copy full SHA for f2aef68 - Browse repository at this point
Copy the full SHA f2aef68View commit details
Commits on May 22, 2023
-
Store the metadata dict in the xarray global attr
This preserves the metadata dict between slices.
Configuration menu - View commit details
-
Copy full SHA for 4c5bba6 - Browse repository at this point
Copy the full SHA 4c5bba6View commit details -
Add _update method to MetadataAccessor
The _update() method runs any time the MetadataAccerssor is accessed. This allows us to update the metadata base by checking the state of the backing xarray.DataArray. So for example if dimensions change order or are dropped the "scifio.metadata.image" (if present) metadata should reflect these changes where appropriate.
Configuration menu - View commit details
-
Copy full SHA for 93d6ba9 - Browse repository at this point
Copy the full SHA 93d6ba9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 30c4fa3 - Browse repository at this point
Copy the full SHA 30c4fa3View commit details -
Configuration menu - View commit details
-
Copy full SHA for b8f3b6c - Browse repository at this point
Copy the full SHA b8f3b6cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 58f19b1 - Browse repository at this point
Copy the full SHA 58f19b1View commit details -
The axes were still in ImageJ order. They now match and check against the dimension order of the parent xarray.DataArray. Note that the metadata must be updated manually after creation to update the order from Java to Python.
Configuration menu - View commit details
-
Copy full SHA for 3beccd9 - Browse repository at this point
Copy the full SHA 3beccd9View commit details -
Configuration menu - View commit details
-
Copy full SHA for d0b208b - Browse repository at this point
Copy the full SHA d0b208bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 12da19e - Browse repository at this point
Copy the full SHA 12da19eView commit details -
Use MetadataAccessor to assign dataset axes
Use the MetadataAccessor class of the xarray to assign the correct axes. Fallback to a DefaultLinearAxis if the metadata is not available.
Configuration menu - View commit details
-
Copy full SHA for 5b611c4 - Browse repository at this point
Copy the full SHA 5b611c4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b1ab8b - Browse repository at this point
Copy the full SHA 0b1ab8bView commit details