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

importing tiff stack for target space #55

Open
shermas opened this issue Oct 8, 2021 · 0 comments
Open

importing tiff stack for target space #55

shermas opened this issue Oct 8, 2021 · 0 comments

Comments

@shermas
Copy link

shermas commented Oct 8, 2021

Hey,

I am unable to use my 3D imaging data when assigning locations.
I kept on getting the following errors: “IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed “
After running the command: “locations_from_image = novosparc.gm.create_target_space_from_image(tissue_path)”
The tissue path leads to a binarized .tif 3D expression image.

I ended changing the function in the following way:

tissue_path = '/…/_template_binarized_inverted.tif'
img = io.imread(tissue_path)
img_width = img.shape[2]
img_height = img.shape[1]
img_depth = img.shape[0]

locations = np.array([(x, y, z) for x in range(img_width) for y in range(img_height) for z in range(img_depth)
if sum(img[z, y, x, :] == np.array([0, 0, 0]))])

It would be good if this could be implemented in novosparc.

Best,
Shachar

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

1 participant