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

Neurosfit widget for images can't display RGB #180

Open
h-mayorquin opened this issue Jun 14, 2024 · 2 comments
Open

Neurosfit widget for images can't display RGB #180

h-mayorquin opened this issue Jun 14, 2024 · 2 comments

Comments

@h-mayorquin
Copy link

import numpy as np 
import matplotlib.pyplot as plt
# Initialize an RGBA image with zeros
img = np.zeros((1000, 1000, 3))

# Set the desired region to white (1, 1, 1, 1) in RGBA
img[:, 200:400, :] = [1, 1, 1]

from pynwb.testing.mock.file import mock_NWBFile
from pynwb.image import RGBImage, Images

nwbfile = mock_NWBFile()

image = RGBImage(name='test_image', data=img)

images_container = Images(
    name="stimuli",
    images=[image],
    description=f"test image",
)

nwbfile.add_stimulus(images_container)

from pynwb import NWBHDF5IO

with NWBHDF5IO('test.nwb', 'w') as io:
    io.write(nwbfile)
    
with NWBHDF5IO('test.nwb', 'r') as io:
    nwbfile_read = io.read()
    image_data = nwbfile_read.stimulus["stimuli"].images["test_image"].data
    plt.imshow(image_data)

Error in neurosfit

image

@h-mayorquin
Copy link
Author

@h-mayorquin I got this working... but I assume values are integer between 0 and 255, so your particular example won't work.

Because of the floats.

As discussed on #179 (comment) this seems to be working on my images so probably something wrong with my example.

Thanks.

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