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

Dataset dimension/axis label renaming #322

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

elevans
Copy link
Member

@elevans elevans commented Mar 27, 2025

This PR address issue #304 by adding support for dimension label renaming on net.imagej.Dataset objects via the to_dataset() method (with dim order hints). Below is a list of what this PR brings:

  • Added dimension label renaming for net.imagej.Dataset
    • This works for both DefaultLinearAxis and EnumeratedAxis type.
  • Updated the Dataset conversion tests to test dim renaming.
  • Added a new section to notebook 06-Working-with-images, 6.11, demonstrating how to use the renaming features.

This commit adds support for dimension renaming with net.imagej.Dataset
objects. The _rename_dataset_dims() function matches the
_rename_xarray_dims() function in that it *only* renames the dimensions
of the input data. It does not transpose the data array or modify the
coordinates/calibration. Users should use transpose and permute with
their respective xarray and dataset objects.

The _rename_dataset_dims() function gets the axis type from new dim
order sequencs and creates a new axis with the old scale and origin
values, preserving the axis coordinates. This implementation only
supports DefaultLinearAxis.
Instead of creating new DefaultLinearAxis or EnumeratedAxis, simply set
the axis type on the existing axes. Both DefaultLinearAxis and
EnumeratedAxis both inherit net.imagej.TypedAxis.
This commit makes updates the dataset to dataset conversion tests with
new and expected dimension label outcomes.
This commit adds a new section to the Working-with-Images notebook
demonstrating how to rename the dimension labels on both Python and Java
images. Note that I added this section as 6.11 and incremented all
following heading numbers by 1.
@elevans elevans requested review from ctrueden and gselzer March 27, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant