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

[Enhancement IV] Add roi response series #19

Merged
merged 67 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
97bfa20
add multichannel volume
CodyCBakerPhD Jun 24, 2024
91db41b
swap to datainterface
CodyCBakerPhD Jun 24, 2024
200eb9b
fix import
CodyCBakerPhD Jun 24, 2024
b84aa0b
fix test name
CodyCBakerPhD Jun 24, 2024
c27778f
Merge branch 'avoid_name_collision' into both_prs_together
CodyCBakerPhD Jun 26, 2024
c8b5dfd
fix intercompatability
CodyCBakerPhD Jun 26, 2024
ad6b5e7
fix light sources
CodyCBakerPhD Jun 26, 2024
8b69db4
fix
CodyCBakerPhD Jun 26, 2024
00d2270
add plane segmentation stuff
CodyCBakerPhD Jun 26, 2024
c6b529c
fix autogenerated arg
CodyCBakerPhD Jun 26, 2024
22836ed
variable depth volume
CodyCBakerPhD Jun 26, 2024
9ad9f4b
swap to um
CodyCBakerPhD Jun 26, 2024
13be731
Merge branch 'main' into add_multichannel_volume
CodyCBakerPhD Jun 27, 2024
da5a1b2
Merge branch 'add_multichannel_volume' into both_prs_together
CodyCBakerPhD Jun 27, 2024
f9c93a2
Merge pull request #16 from catalystneuro/both_prs_together
CodyCBakerPhD Jun 27, 2024
a00fa42
Merge branch 'add_multichannel_volume' into all_previous_prs_and_vari…
CodyCBakerPhD Jun 27, 2024
7b1d5f2
Merge branch 'all_previous_prs_and_variable_depth_static' into swap_t…
CodyCBakerPhD Jun 27, 2024
56f7085
override for roi response to avoid construct error
CodyCBakerPhD Jun 27, 2024
dd166ad
add container too
CodyCBakerPhD Jun 27, 2024
0423071
ryans suggestion
CodyCBakerPhD Jul 11, 2024
dd9ecb5
adjust to use full list
CodyCBakerPhD Jul 11, 2024
dbdad41
adjust constructor test
CodyCBakerPhD Jul 11, 2024
963e894
reorder kwargs in mock
CodyCBakerPhD Jul 11, 2024
0962561
adjust kwargs order in mock
CodyCBakerPhD Jul 11, 2024
7a7ae66
Implement lists of object references with tests
Jul 11, 2024
4a6444a
Adjust constructor test to match
Jul 11, 2024
4912507
fix outer spec to match altered one
Jul 11, 2024
523d972
Merge branch 'add_multichannel_volume' into all_previous_prs_and_vari…
CodyCBakerPhD Jul 12, 2024
5b645de
Update spec/ndx-microscopy.extensions.yaml
CodyCBakerPhD Jul 12, 2024
eb9ee22
Update spec/ndx-microscopy.extensions.yaml
CodyCBakerPhD Jul 12, 2024
2b5ef41
Merge branch 'all_previous_prs_and_variable_depth_static' into swap_t…
CodyCBakerPhD Jul 15, 2024
b94acc3
Merge branch 'swap_to_um' into add_roi_response_series
CodyCBakerPhD Jul 15, 2024
5f12ff7
resolve conflicts
CodyCBakerPhD Jul 17, 2024
bb380a4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 17, 2024
94ee228
alessandras comments and tests
CodyCBakerPhD Jul 17, 2024
0501249
Merge branch 'all_previous_prs_and_variable_depth_static' of https://…
CodyCBakerPhD Jul 17, 2024
e583e39
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 17, 2024
eaf57c9
Merge branch 'all_previous_prs_and_variable_depth_static' into swap_t…
CodyCBakerPhD Jul 17, 2024
635cdf4
Merge branch 'swap_to_um' into add_roi_response_series
CodyCBakerPhD Jul 17, 2024
b581087
fix import
CodyCBakerPhD Jul 17, 2024
4a5e9c5
Merge branch 'all_previous_prs_and_variable_depth_static' of https://…
CodyCBakerPhD Jul 17, 2024
c4e8f3a
fix import
CodyCBakerPhD Jul 17, 2024
ff59317
Merge branch 'all_previous_prs_and_variable_depth_static' into swap_t…
CodyCBakerPhD Jul 17, 2024
3f7961b
Merge branch 'swap_to_um' into add_roi_response_series
CodyCBakerPhD Jul 17, 2024
93a72a8
fix import
CodyCBakerPhD Jul 17, 2024
a300f9d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 17, 2024
335c81d
debug
CodyCBakerPhD Jul 17, 2024
70fa119
debugs
CodyCBakerPhD Jul 17, 2024
a3ea976
Merge branch 'all_previous_prs_and_variable_depth_static' into swap_t…
CodyCBakerPhD Jul 17, 2024
24ff701
Merge branch 'swap_to_um' into add_roi_response_series
CodyCBakerPhD Jul 17, 2024
5ac7eef
debugs
CodyCBakerPhD Jul 17, 2024
7effd8e
debugs
CodyCBakerPhD Jul 17, 2024
1d6fede
debugs
CodyCBakerPhD Jul 17, 2024
1d68a4a
debugs
CodyCBakerPhD Jul 17, 2024
5400462
debugs
CodyCBakerPhD Jul 18, 2024
8e67e51
Merge branch 'all_previous_prs_and_variable_depth_static' into swap_t…
CodyCBakerPhD Jul 18, 2024
1e372e9
Merge branch 'swap_to_um' into add_roi_response_series
CodyCBakerPhD Jul 18, 2024
bb24934
debugs
CodyCBakerPhD Jul 18, 2024
6f7e49d
Merge branch 'swap_to_um' into add_roi_response_series
CodyCBakerPhD Jul 18, 2024
8daadce
Merge branch 'main' into add_roi_response_series
CodyCBakerPhD Jul 19, 2024
00a13e0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 19, 2024
0c434b3
Merge branch 'main' into add_roi_response_series
CodyCBakerPhD Aug 27, 2024
4c5fa1e
start adding tests
CodyCBakerPhD Aug 27, 2024
3d66f79
start adding tests
CodyCBakerPhD Aug 27, 2024
5110cd8
complete tests
CodyCBakerPhD Aug 27, 2024
8b0fe29
debug
CodyCBakerPhD Aug 27, 2024
c024490
debug
CodyCBakerPhD Aug 27, 2024
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
28 changes: 28 additions & 0 deletions spec/ndx-microscopy.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -506,3 +506,31 @@ groups:
doc: Link to VolumetricImagingSpace object containing metadata about the region of physical space this imaging data
was recorded from.
target_type: VolumetricImagingSpace


- neurodata_type_def: MicroscopyResponseSeries
neurodata_type_inc: TimeSeries
doc: ROI responses extracted from optical imaging.
datasets:
- name: data
dtype: numeric
dims:
- - number_of_frames
- number_of_rois
shape:
- - null
- null
doc: Signals from ROIs.
- name: table_region
neurodata_type_inc: DynamicTableRegion
doc: DynamicTableRegion referencing plane segmentation containing more information about the ROIs
stored in this series.

- neurodata_type_def: MicroscopyResponseSeriesContainer
neurodata_type_inc: NWBDataInterface
default_name: MicroscopyResponseSeriesContainer
doc: A container of many MicroscopyResponseSeries.
groups:
- neurodata_type_inc: MicroscopyResponseSeries
doc: MicroscopyResponseSeries object(s) containing fluorescence data for a ROI.
quantity: '+'
6 changes: 6 additions & 0 deletions src/pynwb/ndx_microscopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
MultiChannelMicroscopyVolume = get_class("MultiChannelMicroscopyVolume", extension_name)
VariableDepthMultiChannelMicroscopyVolume = get_class("VariableDepthMultiChannelMicroscopyVolume", extension_name)

MicroscopyResponseSeries = get_class("MicroscopyResponseSeries", extension_name)
MicroscopyResponseSeriesContainer = get_class("MicroscopyResponseSeriesContainer", extension_name)


__all__ = [
"Microscope",
"MicroscopyLightSource",
Expand All @@ -50,4 +54,6 @@
"VolumetricMicroscopySeries",
"MultiChannelMicroscopyVolume",
"VariableDepthMultiChannelMicroscopyVolume",
"MicroscopyResponseSeries",
"MicroscopyResponseSeriesContainer",
]
4 changes: 4 additions & 0 deletions src/pynwb/ndx_microscopy/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
mock_MicroscopyLightSource,
mock_MicroscopyOpticalChannel,
mock_MicroscopyPlaneSegmentation,
mock_MicroscopyResponseSeries,
mock_MicroscopyResponseSeriesContainer,
mock_MicroscopySegmentations,
mock_MultiChannelMicroscopyVolume,
mock_PlanarImagingSpace,
Expand All @@ -25,5 +27,7 @@
"mock_VariableDepthMicroscopySeries",
"mock_VolumetricMicroscopySeries",
"mock_MultiChannelMicroscopyVolume",
"mock_MicroscopyResponseSeries",
"mock_MicroscopyResponseSeriesContainer",
"mock_VariableDepthMultiChannelMicroscopyVolume",
]
89 changes: 78 additions & 11 deletions src/pynwb/ndx_microscopy/testing/_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def mock_Microscope(
*,
name: Optional[str] = None,
description: str = "This is a mock instance of a Microscope type to be used for rapid testing.",
description: str = "A mock instance of a Microscope type to be used for rapid testing.",
manufacturer: str = "A fake manufacturer of the mock microscope.",
model: str = "A fake model of the mock microscope.",
) -> ndx_microscopy.Microscope:
Expand All @@ -27,7 +27,7 @@ def mock_Microscope(
def mock_MicroscopyLightSource(
*,
name: Optional[str] = None,
description: str = "This is a mock instance of a MicroscopyLightSource type to be used for rapid testing.",
description: str = "A mock instance of a MicroscopyLightSource type to be used for rapid testing.",
manufacturer: str = "A fake manufacturer of the mock light source.",
model: str = "A fake model of the mock light source.",
filter_description: str = "A description about the fake filter used by the mock light source.",
Expand Down Expand Up @@ -57,7 +57,7 @@ def mock_MicroscopyLightSource(
def mock_MicroscopyOpticalChannel(
*,
name: Optional[str] = None,
description: str = "This is a mock instance of a MicroscopyOpticalChannel type to be used for rapid testing.",
description: str = "A mock instance of a MicroscopyOpticalChannel type to be used for rapid testing.",
indicator: str = "The indicator targeted by the mock optical channel.",
filter_description: str = "A description about the fake filter used by the mock optical channel.",
emission_wavelength_in_nm: float = 450.0,
Expand All @@ -76,7 +76,7 @@ def mock_PlanarImagingSpace(
*,
microscope: ndx_microscopy.Microscope,
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarImagingSpace type to be used for rapid testing.",
description: str = "A mock instance of a PlanarImagingSpace type to be used for rapid testing.",
origin_coordinates: Tuple[float, float, float] = (-1.2, -0.6, -2),
grid_spacing_in_um: Tuple[float, float, float] = (20, 20),
location: str = "The location targeted by the mock imaging space.",
Expand All @@ -98,7 +98,7 @@ def mock_VolumetricImagingSpace(
*,
microscope: ndx_microscopy.Microscope,
name: Optional[str] = None,
description: str = "This is a mock instance of a VolumetricImagingSpace type to be used for rapid testing.",
description: str = "A mock instance of a VolumetricImagingSpace type to be used for rapid testing.",
origin_coordinates: Tuple[float, float, float] = (-1.2, -0.6, -2),
grid_spacing_in_um: Tuple[float, float, float] = (20, 20, 50),
location: str = "The location targeted by the mock imaging space.",
Expand Down Expand Up @@ -140,7 +140,7 @@ def mock_MicroscopyPlaneSegmentation(
*,
imaging_space: ndx_microscopy.ImagingSpace,
name: Optional[str] = None,
description: str = "This is a mock instance of a MicroscopyPlaneSegmentation type to be used for rapid testing.",
description: str = "A mock instance of a MicroscopyPlaneSegmentation type to be used for rapid testing.",
number_of_rois: int = 5,
image_shape: Tuple[int, int] = (10, 10),
) -> ndx_microscopy.MicroscopyPlaneSegmentation:
Expand All @@ -166,7 +166,7 @@ def mock_PlanarMicroscopySeries(
imaging_space: ndx_microscopy.PlanarImagingSpace,
optical_channel: ndx_microscopy.MicroscopyOpticalChannel,
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
description: str = "A mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
Expand Down Expand Up @@ -221,7 +221,7 @@ def mock_VariableDepthMicroscopySeries(
imaging_space: ndx_microscopy.PlanarImagingSpace,
optical_channel: ndx_microscopy.MicroscopyOpticalChannel,
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
description: str = "A mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
depth_per_frame_in_um: Optional[np.ndarray] = None,
unit: str = "a.u.",
Expand Down Expand Up @@ -284,7 +284,7 @@ def mock_VolumetricMicroscopySeries(
imaging_space: ndx_microscopy.VolumetricImagingSpace,
optical_channel: ndx_microscopy.MicroscopyOpticalChannel,
name: Optional[str] = None,
description: str = "This is a mock instance of a VolumetricMicroscopySeries type to be used for rapid testing.",
description: str = "A mock instance of a VolumetricMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
Expand Down Expand Up @@ -339,7 +339,7 @@ def mock_MultiChannelMicroscopyVolume(
light_sources: pynwb.base.VectorData,
optical_channels: pynwb.base.VectorData,
name: Optional[str] = None,
description: str = "This is a mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
description: str = "A mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "n.a.",
conversion: float = 1.0,
Expand All @@ -363,14 +363,81 @@ def mock_MultiChannelMicroscopyVolume(
return volumetric_microscopy_series


def mock_MicroscopyResponseSeries(
*,
table_region: pynwb.core.DynamicTableRegion,
name: Optional[str] = None,
description: str = "A mock instance of a MicroscopyResponseSeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
offset: float = 0.0,
starting_time: Optional[float] = None,
rate: Optional[float] = None,
timestamps: Optional[np.ndarray] = None,
) -> ndx_microscopy.MicroscopyResponseSeries:
series_name = name or name_generator("MicroscopyResponseSeries")

number_of_frames = 100
number_of_rois = len(table_region.data)
series_data = data if data is not None else np.ones(shape=(number_of_frames, number_of_rois))

if timestamps is None:
series_starting_time = starting_time or 0.0
series_rate = rate or 10.0
series_timestamps = None
else:
if starting_time is not None or rate is not None:
warnings.warn(
message=(
"Timestamps were provided in addition to either rate or starting_time! "
"Please specify only timestamps, or both starting_time and rate. Timestamps will take precedence."
),
stacklevel=2,
)

series_starting_time = None
series_rate = None
series_timestamps = timestamps

microscopy_response_series = ndx_microscopy.MicroscopyResponseSeries(
name=series_name,
description=description,
table_region=table_region,
data=series_data,
unit=unit,
conversion=conversion,
offset=offset,
starting_time=series_starting_time,
rate=series_rate,
timestamps=series_timestamps,
)

return microscopy_response_series


def mock_MicroscopyResponseSeriesContainer(
*,
microscopy_response_series: List[ndx_microscopy.MicroscopyResponseSeries],
name: Optional[str] = None,
) -> ndx_microscopy.MicroscopyResponseSeriesContainer:
container_name = name or name_generator("MicroscopyResponseSeriesContainer")

microscopy_response_series_container = ndx_microscopy.MicroscopyResponseSeriesContainer(
name=container_name, microscopy_response_series=microscopy_response_series
)

return microscopy_response_series_container


def mock_VariableDepthMultiChannelMicroscopyVolume(
*,
microscope: ndx_microscopy.Microscope,
imaging_space: ndx_microscopy.VolumetricImagingSpace,
light_sources: pynwb.base.VectorData,
optical_channels: pynwb.base.VectorData,
name: Optional[str] = None,
description: str = "This is a mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
description: str = "A mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
depth_per_frame_in_um: Optional[np.ndarray] = None,
unit: str = "n.a.",
Expand Down
Loading
Loading