Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

[INSTALLATION HELP] opening .h5 instead of .tiff #105

Closed
s-j-k opened this issue Jun 3, 2022 · 0 comments
Closed

[INSTALLATION HELP] opening .h5 instead of .tiff #105

s-j-k opened this issue Jun 3, 2022 · 0 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@s-j-k
Copy link

s-j-k commented Jun 3, 2022

Hello folks,

if you are using .h5's, Modules>Load Images only has an option for .tiff's, you can work around this by doing the following:

import h5py as h5py

#see h5py documentation, 'r' is for read
aa=h5py.File(datapath,'r')   

# find the name of the dataset object
list(aa.keys())  

 #call the dataset object 
dset=aa['data']  
#convert from h5 dataset to numpy array
a=dset[()] 
a.shape #in t,x,y
type(a) # make sure it's a numpyarray
meta = \
    {
         "origin": "Tutorial example",
         "fps":    10.0,
         "date":    "20220602_cd036_000",
         "scanner_pos":  [0,1,2,3,4,5,6]
    }

# Create ImgData instance
imgdata = ImgData(a.T, meta)  # use a.T to get [x, y, t] (time last)

# Create a work environment instance
work_env = ViewerWorkEnv(imgdata)

# Set the current Viewer Work Environment from this new instance
vi.viewer.workEnv = work_env

# Update the viewer with the new work environment
# this MUST be run whenever you replace the viewer work environment (the previous line)
update_workEnv()
@s-j-k s-j-k added the help wanted Extra attention is needed label Jun 3, 2022
@s-j-k s-j-k closed this as completed Jun 3, 2022
kushalkolar added a commit that referenced this issue Jun 3, 2022
docs on how to open imaging data in hdf5 files in the viewer, see #105
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants