pynwb.image module

class pynwb.image.ImageSeries(name, data=None, unit=None, format=None, external_file=None, starting_frame=None, bits_per_pixel=None, dimension=None, resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0, device=None)[source]

Bases: TimeSeries

General image data that is common between acquisition and stimulus time series. The image data can be stored in the HDF5 file or it will be stored as an external image file.

Parameters:
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Can be 3D or 4D. The first dimension must be time (frame). The second and third dimensions represent x and y. The optional fourth dimension represents z. Either data or external_file must be specified (not None), but not both. If data is not specified, data will be set to an empty 3D array.

  • unit (str) – The unit of measurement of the image data, e.g., values between 0 and 255. Required when data is specified. If unit (and data) are not specified, then unit will be set to “unknown”.

  • format (str) – Format of image. Three types - 1) Image format; tiff, png, jpg, etc. 2) external 3) raw.

  • external_file (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Path or URL to one or more external file(s). Field only present if format=external. Either external_file or data must be specified (not None), but not both.

  • starting_frame (Iterable) – Each entry is a frame number that corresponds to the first frame of each file listed in external_file within the full ImageSeries.

  • bits_per_pixel (int) – DEPRECATED: Number of bits per image pixel

  • dimension (Iterable) – Number of pixels on x, y, (and z) axes.

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • timestamps (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Timestamps for samples stored in data

  • starting_time (float) – The timestamp of the first sample

  • rate (float) – Sampling rate in Hz

  • comments (str) – Human-readable comments about this TimeSeries dataset

  • description (str) – Description of this TimeSeries dataset

  • control (Iterable) – Numerical labels that apply to each element in data

  • control_description (Iterable) – Description of each control value

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

  • device (Device) – Device used to capture the images/video.

DEFAULT_DATA = array([], shape=(0, 0, 0), dtype=uint8)
property bits_per_pixel
property device

Device used to capture the images/video.

property dimension

Number of pixels on x, y, (and z) axes.

property external_file

Path or URL to one or more external file(s). Field only present if format=external. Either external_file or data must be specified (not None), but not both.

property format

Format of image. Three types - 1) Image format; tiff, png, jpg, etc. 2) external 3) raw.

namespace = 'core'
neurodata_type = 'ImageSeries'
property starting_frame

Each entry is a frame number that corresponds to the first frame of each file listed in external_file within the full ImageSeries.

class pynwb.image.IndexSeries(name, data, unit, indexed_timeseries=None, indexed_images=None, resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0)[source]

Bases: TimeSeries

Stores indices to image frames stored in an ImageSeries. The purpose of the IndexSeries is to allow a static image stack to be stored somewhere, and the images in the stack to be referenced out-of-order. This can be for the display of individual images, or of movie segments (as a movie is simply a series of images). The data field stores the index of the frame in the referenced ImageSeries, and the timestamps array indicates when that image was displayed.

Parameters:
  • name (str) – The name of this TimeSeries dataset

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Must be 1D, where the first dimension must be time (frame)

  • unit (str) – The base unit of measurement (should be SI unit)

  • indexed_timeseries (TimeSeries) – Link to TimeSeries containing images that are indexed.

  • indexed_images (Images) – Link to Images object containing an ordered set of images that are indexed. The Images object must contain a ‘ordered_images’ dataset specifying the order of the images in the Images type.

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • timestamps (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Timestamps for samples stored in data

  • starting_time (float) – The timestamp of the first sample

  • rate (float) – Sampling rate in Hz

  • comments (str) – Human-readable comments about this TimeSeries dataset

  • description (str) – Description of this TimeSeries dataset

  • control (Iterable) – Numerical labels that apply to each element in data

  • control_description (Iterable) – Description of each control value

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

property indexed_timeseries

Link to TimeSeries containing images that are indexed.

namespace = 'core'
neurodata_type = 'IndexSeries'
class pynwb.image.ImageMaskSeries(name, masked_imageseries, data=None, unit=None, format=None, external_file=None, starting_frame=None, bits_per_pixel=None, dimension=None, resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, offset=0.0, device=None)[source]

Bases: ImageSeries

An alpha mask that is applied to a presented visual stimulus. The data[] array contains an array of mask values that are applied to the displayed image. Mask values are stored as RGBA. Mask can vary with time. The timestamps array indicates the starting time of a mask, and that mask pattern continues until it’s explicitly changed.

Parameters:
  • name (str) – The name of this TimeSeries dataset

  • masked_imageseries (ImageSeries) – Link to ImageSeries that mask is applied to.

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – The data values. Can be 3D or 4D. The first dimension must be time (frame). The second and third dimensions represent x and y. The optional fourth dimension represents z. Either data or external_file must be specified (not None), but not both. If data is not specified, data will be set to an empty 3D array.

  • unit (str) – The unit of measurement of the image data, e.g., values between 0 and 255. Required when data is specified. If unit (and data) are not specified, then unit will be set to “unknown”.

  • format (str) – Format of image. Three types - 1) Image format; tiff, png, jpg, etc. 2) external 3) raw.

  • external_file (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Path or URL to one or more external file(s). Field only present if format=external. Either external_file or data must be specified (not None), but not both.

  • starting_frame (Iterable) – Each entry is a frame number that corresponds to the first frame of each file listed in external_file within the full ImageSeries.

  • bits_per_pixel (int) – DEPRECATED: Number of bits per image pixel

  • dimension (Iterable) – Number of pixels on x, y, (and z) axes.

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • timestamps (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Timestamps for samples stored in data

  • starting_time (float) – The timestamp of the first sample

  • rate (float) – Sampling rate in Hz

  • comments (str) – Human-readable comments about this TimeSeries dataset

  • description (str) – Description of this TimeSeries dataset

  • control (Iterable) – Numerical labels that apply to each element in data

  • control_description (Iterable) – Description of each control value

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

  • device (Device) – Device used to capture the mask data. This field will likely not be needed. The device used to capture the masked ImageSeries data should be stored in the ImageSeries.

property masked_imageseries

Link to ImageSeries that mask is applied to.

namespace = 'core'
neurodata_type = 'ImageMaskSeries'
class pynwb.image.OpticalSeries(name, distance, field_of_view, orientation, data=None, unit=None, format=None, external_file=None, starting_frame=None, bits_per_pixel=None, dimension=None, resolution=-1.0, conversion=1.0, timestamps=None, starting_time=None, rate=None, comments='no comments', description='no description', control=None, control_description=None, device=None, offset=0.0)[source]

Bases: ImageSeries

Image data that is presented or recorded. A stimulus template movie will be stored only as an image. When the image is presented as stimulus, additional data is required, such as field of view (eg, how much of the visual field the image covers, or how what is the area of the target being imaged). If the OpticalSeries represents acquired imaging data, orientation is also important.

Parameters:
  • name (str) – The name of this TimeSeries dataset

  • distance (float) – Distance from camera/monitor to target/eye.

  • field_of_view (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Width, height and depth of image, or imaged area (meters).

  • orientation (str) – Description of image relative to some reference frame (e.g., which way is up). Must also specify frame of reference.

  • data (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Images presented to subject, either grayscale or RGB. May be 3D or 4D. The first dimension must be time (frame). The second and third dimensions represent x and y. The optional fourth dimension must be length 3 and represents the RGB value for color images. Either data or external_file must be specified, but not both.

  • unit (str) – The unit of measurement of the image data, e.g., values between 0 and 255. Required when data is specified. If unit (and data) are not specified, then unit will be set to “unknown”.

  • format (str) – Format of image. Three types - 1) Image format; tiff, png, jpg, etc. 2) external 3) raw.

  • external_file (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO) – Path or URL to one or more external file(s). Field only present if format=external. Either external_file or data must be specified (not None), but not both.

  • starting_frame (Iterable) – Each entry is a frame number that corresponds to the first frame of each file listed in external_file within the full ImageSeries.

  • bits_per_pixel (int) – DEPRECATED: Number of bits per image pixel

  • dimension (Iterable) – Number of pixels on x, y, (and z) axes.

  • resolution (float) – The smallest meaningful difference (in specified unit) between values in data

  • conversion (float) – Scalar to multiply each element in data to convert it to the specified unit

  • timestamps (ndarray or list or tuple or Dataset or Array or StrDataset or HDMFDataset or AbstractDataChunkIterator or DataIO or TimeSeries) – Timestamps for samples stored in data

  • starting_time (float) – The timestamp of the first sample

  • rate (float) – Sampling rate in Hz

  • comments (str) – Human-readable comments about this TimeSeries dataset

  • description (str) – Description of this TimeSeries dataset

  • control (Iterable) – Numerical labels that apply to each element in data

  • control_description (Iterable) – Description of each control value

  • device (Device) – Device used to capture the images/video.

  • offset (float) – Scalar to add to each element in the data scaled by ‘conversion’ to finish converting it to the specified unit.

property distance

Distance from camera/monitor to target/eye.

property field_of_view

Width, height and depth of image, or imaged area (meters).

property orientation

Description of image relative to some reference frame (e.g., which way is up). Must also specify frame of reference.

namespace = 'core'
neurodata_type = 'OpticalSeries'
class pynwb.image.GrayscaleImage(name, data, resolution=None, description=None)[source]

Bases: Image

Parameters:
namespace = 'core'
neurodata_type = 'GrayscaleImage'
class pynwb.image.RGBImage(name, data, resolution=None, description=None)[source]

Bases: Image

Parameters:
namespace = 'core'
neurodata_type = 'RGBImage'
class pynwb.image.RGBAImage(name, data, resolution=None, description=None)[source]

Bases: Image

Parameters:
namespace = 'core'
neurodata_type = 'RGBAImage'