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

2D input data #16

Open
martinschorb opened this issue Apr 16, 2020 · 10 comments
Open

2D input data #16

martinschorb opened this issue Apr 16, 2020 · 10 comments

Comments

@martinschorb
Copy link
Contributor

martinschorb commented Apr 16, 2020

Hi,

currently pybdv only supports 3D input data. This is fine as long as I use make_bdv. I will just fake the third dimension by using np.expand_dims(data.copy(),axis=0).

However, I like to now use pybdv's convert_to_bdv to convert an existing hdf5 file and this is written as 2D. Could you apply something similar within the hdf5 file as well? Or could you add support for 2D data? BDV can somehow deal with it. Should I send you a 2D hdf5 file that is compatible with the BDV universe?

Thanks...

@constantinpape
Copy link
Owner

Or could you add support for 2D data? BDV can somehow deal with it. Should I send you a 2D hdf5 file that is compatible with the BDV universe?

Yes, that would be the best option!
If there is a way to properly support 2d in BDV without adding the artificial z-axis I can support it.

@martinschorb
Copy link
Contributor Author

2Dtest.zip

minimal example ;-)

@martinschorb
Copy link
Contributor Author

However, I see that this one still comes "3D".

cells (6942379, 4)
    16-bit integer,    1 x 256 x 256
    Number of attributes = 0

The output that I get from IMOD (from reconstructing/blending TEM tiled montages) has an image:

image (6776, 6)
    16-bit unsigned integer,    9696 x 9744
    Number of attributes = 0

Would this be a problem?
Also, how much performance gain is it to retrieve the 0th layer from a hdf5 file instead of a np-Array? Does the data still have to be read in and fed through Python for the sub-resolutions?

@constantinpape
Copy link
Owner

However, I see that this one still comes "3D".

Yes, this is still 3d, so I think whichever program writes to bdv is also adding the z axis.

Would this be a problem?
Also, how much performance gain is it to retrieve the 0th layer from a hdf5 file instead of a np-Array?

No I don't think this is a problem. I can just add something to convert_to_bdv so that it also adds the z-axis. I don't think this will make a big difference in performance.

Does the data still have to be read in and fed through Python for the sub-resolutions?

I am not quite sure what you mean by this. I also create all the downsampling in python, but it works with this kind of data already.

@constantinpape
Copy link
Owner

We discussed this and this is not really relevant for Martin's current use case.

BUT I think it would actually be nice to properly support 2d data, because this is a very important use-case. Unfortunately, there is no 'native' support for 2d in the BigDataViewer File Format yet, so the trick one has to do is to add a singleton z-axis.
I think that this should be done internally in pybdv, so that users can just pass 2d data, either to make_bdv or convert_to_bdv and then pybdv takes care of inserting the correct singleton axis were it's relevant. This has the advantage that it is easier to do this in a consistent manner AND switching to a proper 2d format if it is ever supported natively by bdv-hdf5, this just becomes an implementation detail.

@martinschorb, let me know what you think.

@martinschorb
Copy link
Contributor Author

perfect.
I will then simply comment out that part of the code (adding singleton axis 0) in my script...

@martinschorb
Copy link
Contributor Author

as I did for the type conversions to unsigned int ;-)

@constantinpape
Copy link
Owner

perfect.
I will then simply comment out that part of the code (adding singleton axis 0) in my script...

Ok, great. I will let you know once I had time too implement it :).

@martinschorb
Copy link
Contributor Author

It's not in yet, correct? Just to be sure I run the newest version...

@constantinpape
Copy link
Owner

It's not in yet, correct? Just to be sure I run the newest version...

Yes, it's not in yet.

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