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

Add ophys devices from ndx-ophys-devices #22

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 44 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ classDiagram
links
--------------------------------------
microscope : Microscope
light_source : MicroscopyLightSource
optical_channel : MicroscopyOpticalChannel
excitation_light_path : ExcitationLightPath
emission_light_path : EmissionLightPath
}

class PlanarMicroscopySeries {
Expand Down Expand Up @@ -86,6 +86,32 @@ classDiagram
imaging_space : VolumetricImageSpace
}

class MultiChannelMicroscopyVolume {
<<NWBDataInterface>>

--------------------------------------
attributes
--------------------------------------
description : text, optional
unit : text, optional
conversion : numeric, optional
offset : numeric, optional

--------------------------------------
datasets
--------------------------------------
data : numeric, frame x height x width x depth x emission_light_paths
--> unit : text
excitation_light_paths : ExcitationLightPath, excitation_light_paths
emission_light_paths : EmissionLightPath, emission_light_paths

--------------------------------------
links
--------------------------------------
imaging_space : VolumetricImageSpace
microscope : Microscope
}

class ImagingSpace{
<<NWBContainer>>

Expand Down Expand Up @@ -132,36 +158,34 @@ classDiagram
reference_frame : text, optional
}

class MicroscopyOpticalChannel{
class ExcitationLightPath{
<<NWBContainer>>

--------------------------------------
datasets
links
--------------------------------------
description : text
excitation_source : ExcitationSource, optional
excitation_filter : OpticalFilter, optional

--------------------------------------
attributes
--------------------------------------
indicator : text
filter_description : text, optional
emission_wavelength_in_nm : numeric, optional
excitation_wavelength_in_nm : numeric
}

class MicroscopyLightSource{
<<Device>>
class EmissionLightPath{
<<NWBContainer>>

--------------------------------------
links
--------------------------------------
photodetector : Photodetector, optional
emission_filter : OpticalFilter, optional

--------------------------------------
attributes
--------------------------------------
model : text, optional
filter_description : text, optional
excitation_wavelength_in_nm : numeric, optional
peak_power_in_W : numeric, optional
peak_pulse_energy_in_J : numeric, optional
intensity_in_W_per_m2 : numeric, optional
exposure_time_in_s : numeric, optional
pulse_rate_in_Hz : numeric, optional
emission_wavelength_in_nm : numeric
}

class Microscope{
Expand All @@ -182,8 +206,8 @@ classDiagram
PlanarImagingSpace *-- ImagingSpace : extends
VolumetricImagingSpace *-- ImagingSpace : extends
MicroscopySeries ..> Microscope : links
MicroscopySeries ..> MicroscopyLightSource : links
MicroscopySeries ..> MicroscopyOpticalChannel : links
MicroscopySeries ..> ExcitationLightPath : links
MicroscopySeries ..> EmissionLightPath : links
```

---
Expand Down
2 changes: 2 additions & 0 deletions requirements-min.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pynwb
git+https://github.com/catalystneuro/ndx-ophys-devices.git@main#egg=ndx-ophys-devices

128 changes: 51 additions & 77 deletions spec/ndx-microscopy.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,45 @@ groups:
attributes:
- name: model
dtype: text
doc: Model identifier of the light source device.
doc: Model identifier of the microscope.
required: false

- neurodata_type_def: MicroscopyLightSource
neurodata_type_inc: Device
doc: Light source used to illuminate an imaging space.
- neurodata_type_def: ExcitationLightPath
neurodata_type_inc: NWBContainer
doc: Excitation light path that illuminates an imaging space.
attributes:
- name: model
dtype: text
doc: Model identifier of the light source device.
required: false
- name: filter_description
dtype: text
doc: Filter used to obtain the excitation wavelength of light, e.g. 'Short pass at 1040 nm'.
required: false
- name: excitation_wavelength_in_nm
dtype: numeric
doc: Excitation wavelength of light, in nanometers.
links:
- name: excitation_source
target_type: ExcitationSource
doc: Link to ExcitationSource object which contains metadata about the excitation source device. If it is a pulsed excitation source link a PulsedExcitationSource object.
required: false
- name: peak_power_in_W
dtype: numeric
doc: Incident power of stimulation device (in Watts).
required: false
- name: peak_pulse_energy_in_J
dtype: numeric
doc: If device is pulsed light source, pulse energy (in Joules).
required: false
- name: intensity_in_W_per_m2
dtype: numeric
doc: Intensity of the excitation in W/m^2, if known.
- name: excitation_filter
target_type: OpticalFilter
doc: Link to OpticalFilter object which contains metadata about the optical filter in this excitation light path. It can be either a BandOpticalFilter (e.g., 'Bandpass', 'Bandstop', 'Longpass', 'Shortpass') or a EdgeOpticalFilter (Longpass or Shortpass).
required: false
- name: exposure_time_in_s

- neurodata_type_def: EmissionLightPath
neurodata_type_inc: NWBContainer
doc: Emission light path from an imaging space.
attributes:
- name: emission_wavelength_in_nm
dtype: numeric
doc: Exposure time of the sample (in sec).
doc: Emission wavelength of light, in nanometers.
links:
- name: photodetector
target_type: Photodetector
doc: Link to Photodetector object which contains metadata about the photodetector device.
required: false
- name: pulse_rate_in_Hz
dtype: numeric
doc: If device is pulsed light source, pulse rate (in Hz) used for stimulation.
- name: emission_filter
target_type: OpticalFilter
doc: Link to OpticalFilter object which contains metadata about the optical filter in this emission light path. It can be either a BandOpticalFilter (e.g., 'Bandpass', 'Bandstop', 'Longpass', 'Shortpass') or a EdgeOpticalFilter (Longpass or Shortpass).
required: false

# Microscopy is added on to this only to differentiate from the OpticalChannel in the core namespace
# It would be removed when this structure is merged to core
- neurodata_type_def: MicroscopyOpticalChannel
neurodata_type_inc: LabMetaData # Would prefer basic NWBContainer
doc: An optical channel used to filter light emission from an imaging space.
datasets:
- name: description
doc: Description or other notes about the channel.
dtype: text
attributes:
- name: indicator
doc: Identifier for the indicator pertaining to this optical channel.
dtype: text
- name: filter_description
doc: Metadata information about the filter used by this optical channel.
dtype: text
required: false
- name: emission_wavelength_in_nm
doc: Emission wavelength for this optical channel, in nanometers.
dtype: numeric
required: false
- name: indicator
target_type: Indicator
doc: Link to Indicator object which contains metadata about the indicator used in this light path.

- neurodata_type_def: ImagingSpace
neurodata_type_inc: LabMetaData # Would prefer basic NWBContainer
Expand Down Expand Up @@ -97,10 +75,6 @@ groups:
Use standard atlas names for anatomical regions when possible.
Specify 'whole brain' if the entire brain is strictly contained within the space.
required: false
links:
- name: microscope
target_type: Microscope
doc: Link to Microscope object which contains metadata about the device which imaged this space.

- neurodata_type_def: PlanarImagingSpace
neurodata_type_inc: ImagingSpace
Expand Down Expand Up @@ -273,13 +247,13 @@ groups:
- name: microscope
doc: Link to a Microscope object containing metadata about the device used to acquire this imaging data.
target_type: Microscope
- name: light_source
doc: Link to a MicroscopyLightSource object containing metadata about the device used to illuminate the imaging space.
target_type: MicroscopyLightSource
- name: optical_channel
doc: Link to a MicroscopyOpticalChannel object containing metadata about the indicator and filters used to collect
- name: excitation_light_path
doc: Link to a ExcitationLightPath object containing metadata about the device used to illuminate the imaging space.
target_type: ExcitationLightPath
- name: emission_light_path
doc: Link to a EmissionLightPath object containing metadata about the indicator and filters used to collect
this data.
target_type: MicroscopyOpticalChannel
target_type: EmissionLightPath

- neurodata_type_def: PlanarMicroscopySeries
neurodata_type_inc: MicroscopySeries
Expand Down Expand Up @@ -386,30 +360,30 @@ groups:
- height
- width
- depths
- optical_channels
- emission_light_paths
shape:
- null
- null
- null
- null
- name: light_sources
doc: An ordered list of references to MicroscopyLightSource objects containing metadata about the excitation methods.
- name: excitation_light_paths
doc: An ordered list of references to ExcitationLightPath objects containing metadata about the excitation methods.
neurodata_type_inc: VectorData
dtype:
reftype: object
target_type: MicroscopyLightSource
target_type: ExcitationLightPath
dims:
- light_sources
- excitation_light_paths
shape:
- null
- name: optical_channels
doc: An ordered list of references to MicroscopyOpticalChannel objects containing metadata about the indicator and filters used to collect this data. This maps to the last dimension of `data`, i.e., the i-th MicroscopyOpticalChannel contains metadata about the indicator and filters used to collect the volume at `data[:,:,:,i]`.
- name: emission_light_paths
doc: An ordered list of references to EmissionLightPath objects containing metadata about the indicator and filters used to collect this data. This maps to the last dimension of `data`, i.e., the i-th MicroscopyOpticalChannel contains metadata about the indicator and filters used to collect the volume at `data[:,:,:,i]`.
neurodata_type_inc: VectorData
dtype:
reftype: object
target_type: MicroscopyOpticalChannel
target_type: EmissionLightPath
dims:
- optical_channels
- emission_light_paths
shape:
- null
links:
Expand Down Expand Up @@ -478,24 +452,24 @@ groups:
- depths
shape:
- null
- name: light_sources
doc: An ordered list of references to MicroscopyLightSource objects containing metadata about the excitation methods.
- name: excitation_light_paths
doc: An ordered list of references to ExcitationLightPath objects containing metadata about the excitation methods.
neurodata_type_inc: VectorData
dtype:
reftype: object
target_type: MicroscopyLightSource
target_type: ExcitationLightPath
dims:
- light_sources
- excitation_light_paths
shape:
- null
- name: optical_channels
doc: An ordered list of references to MicroscopyOpticalChannel objects containing metadata about the indicator and filters used to collect this data. This maps to the last dimension of `data`, i.e., the i-th MicroscopyOpticalChannel contains metadata about the indicator and filters used to collect the volume at `data[:,:,:,i]`.
- name: emission_light_paths
doc: An ordered list of references to EmissionLightPath objects containing metadata about the indicator and filters used to collect this data. This maps to the last dimension of `data`, i.e., the i-th MicroscopyOpticalChannel contains metadata about the indicator and filters used to collect the volume at `data[:,:,:,i]`.
neurodata_type_inc: VectorData
dtype:
reftype: object
target_type: MicroscopyOpticalChannel
target_type: EmissionLightPath
dims:
- optical_channels
- emission_light_paths
shape:
- null
links:
Expand Down
1 change: 1 addition & 0 deletions spec/ndx-microscopy.namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ namespaces:
- [email protected]
schema:
- namespace: core
- namespace: ndx-ophys-devices
- source: ndx-microscopy.extensions.yaml
version: 0.1.0
13 changes: 8 additions & 5 deletions src/pynwb/ndx_microscopy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

from pynwb import get_class, load_namespaces

from pynwb.spec import NWBNamespaceBuilder
try:
from importlib.resources import files
except ImportError:
Expand All @@ -19,10 +19,11 @@
__spec_path = __location_of_this_file.parent.parent.parent / "spec" / f"{extension_name}.namespace.yaml"

load_namespaces(str(__spec_path))
from ndx_ophys_devices import ExcitationSource, Indicator, OpticalFilter, Photodetector

Microscope = get_class("Microscope", extension_name)
MicroscopyLightSource = get_class("MicroscopyLightSource", extension_name)
MicroscopyOpticalChannel = get_class("MicroscopyOpticalChannel", extension_name)
ExcitationLightPath = get_class("ExcitationLightPath", extension_name)
EmissionLightPath = get_class("EmissionLightPath", extension_name)
ImagingSpace = get_class("ImagingSpace", extension_name)
PlanarImagingSpace = get_class("PlanarImagingSpace", extension_name)
VolumetricImagingSpace = get_class("VolumetricImagingSpace", extension_name)
Expand All @@ -40,9 +41,11 @@


__all__ = [
"OpticalFilter",
"ExcitationSource",
"Indicator",
"Photodetector",
"Microscope",
"MicroscopyLightSource",
"MicroscopyOpticalChannel",
"ImagingSpace",
"PlanarImagingSpace",
"VolumetricImagingSpace",
Expand Down
8 changes: 4 additions & 4 deletions src/pynwb/ndx_microscopy/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from ._mock import (
mock_EmissionLightPath,
mock_ExcitationLightPath,
mock_Microscope,
mock_MicroscopyLightSource,
mock_MicroscopyOpticalChannel,
mock_MicroscopyPlaneSegmentation,
mock_MicroscopyResponseSeries,
mock_MicroscopyResponseSeriesContainer,
Expand All @@ -17,8 +17,8 @@

__all__ = [
"mock_Microscope",
"mock_MicroscopyLightSource",
"mock_MicroscopyOpticalChannel",
"mock_ExcitationLightPath",
"mock_EmissionLightPath",
"mock_PlanarImagingSpace",
"mock_VolumetricImagingSpace",
"mock_MicroscopySegmentations",
Expand Down
Loading
Loading