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

Automatically swap dimensions using Views #147

Open
ctrueden opened this issue Jan 20, 2017 · 1 comment
Open

Automatically swap dimensions using Views #147

ctrueden opened this issue Jan 20, 2017 · 1 comment

Comments

@ctrueden
Copy link
Member

It would be nice if, when passed an ImgPlus (or wrapping Dataset) with dimensions not in XYCZT order, we automatically permuted them to XYCZT since that is the order required/assumed by ImageJ 1.x.

E.g., for an ImgLib2 image in XYZCT order, you can do:

ImgView<T> permutedImg = new ImgView<>(Views.permute(img, 2, 3));
final Dataset data = datasetService.create( permutedImg );
data.setAxes(new CalibratedAxis[] { new DefaultLinearAxis( Axes.X),
        new DefaultLinearAxis(Axes.Y), new DefaultLinearAxis(Axes.CHANNEL),
        new DefaultLinearAxis(Axes.Z), new DefaultLinearAxis(Axes.TIME) });

We would just need to generalize that, checking the axis types and acting accordingly.

@imagejan
Copy link
Member

I'm not sure if I understood the hierarchy of converters/translators correctly, but I guess the place to fix the dimensions would be here:
https://github.com/imagej/imagej-legacy/blob/master/src/main/java/net/imagej/legacy/translate/AbstractImagePlusCreator.java

Maybe the dimension swapping can be reconciled with retrieving the actual size of each dimension in this line and in LegacyUtils.

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

No branches or pull requests

2 participants