Skip to content

Commit

Permalink
[Enhancement III] Swap to um for depth (#18)
Browse files Browse the repository at this point in the history
* add multichannel volume

* swap to datainterface

* fix import

* fix test name

* fix intercompatability

* fix light sources

* fix

* add plane segmentation stuff

* fix autogenerated arg

* variable depth volume

* swap to um

* ryans suggestion

* adjust to use full list

* adjust constructor test

* reorder kwargs in mock

* adjust kwargs order in mock

* Implement lists of object references with tests

* Adjust constructor test to match

* fix outer spec to match altered one

* Update spec/ndx-microscopy.extensions.yaml

* Update spec/ndx-microscopy.extensions.yaml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* alessandras comments and tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix import

* fix import

* fix import

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* debug

* debugs

* debugs

* debugs

* debugs

* debugs

* debugs

* debugs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update README.md

---------

Co-authored-by: CodyCBakerPhD <codycbakerphd@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 19, 2024
1 parent fb8c627 commit eea8167
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ classDiagram
--------------------------------------
data : numeric, frame x height x width
--> unit : text
depth_per_frame : numeric, length of frames
-- > unit : text, default="micrometers"
depth_per_frame_in_um : numeric, length of frames
--------------------------------------
links
Expand Down
9 changes: 4 additions & 5 deletions spec/ndx-microscopy.extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ groups:
doc: Volumetric imaging data acquired over an irregular number and amount of depths; for instance, when using an
electrically tunable lens.
datasets:
- name: depth_per_frame_in_mm
doc: Depth of each frame in the data array.
- name: depth_per_frame_in_um
doc: Depth in micrometers of each frame in the data array.
These values offset the 'z' value of the `origin_coordinates` of the linked `imaging_space` object.
dtype: numeric
dims:
Expand Down Expand Up @@ -471,9 +471,8 @@ groups:
- null
- null
- null
- name: depth_per_frame_in_mm
doc: Depth of each frame in the data array.
These values offset the 'z' value of the `origin_coordinates` of the linked `imaging_space` object.
- name: depth_per_frame_in_um
doc: Depth in micrometers of each frame in the data array.
dtype: numeric
dims:
- depths
Expand Down
26 changes: 14 additions & 12 deletions src/pynwb/ndx_microscopy/testing/_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def mock_VariableDepthMicroscopySeries(
name: Optional[str] = None,
description: str = "This is a mock instance of a PlanarMicroscopySeries type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
depth_per_frame_in_mm: Optional[np.ndarray] = None,
depth_per_frame_in_um: Optional[np.ndarray] = None,
unit: str = "a.u.",
conversion: float = 1.0,
offset: float = 0.0,
Expand All @@ -233,10 +233,11 @@ def mock_VariableDepthMicroscopySeries(
) -> ndx_microscopy.VariableDepthMicroscopySeries:
series_name = name or name_generator("VariableDepthMicroscopySeries")
series_data = data if data is not None else np.ones(shape=(15, 5, 5))
series_depth_per_frame_in_mm = (
depth_per_frame_in_mm
if depth_per_frame_in_mm is not None
else np.linspace(start=0.0, stop=1.0, num=series_data.shape[0])

depth_per_frame_in_um = (
depth_per_frame_in_um
if depth_per_frame_in_um is not None
else np.linspace(start=0.0, stop=30.0, num=series_data.shape[0])
)

if timestamps is None:
Expand Down Expand Up @@ -265,7 +266,7 @@ def mock_VariableDepthMicroscopySeries(
imaging_space=imaging_space,
optical_channel=optical_channel,
data=series_data,
depth_per_frame_in_mm=series_depth_per_frame_in_mm,
depth_per_frame_in_um=depth_per_frame_in_um,
unit=unit,
conversion=conversion,
offset=offset,
Expand Down Expand Up @@ -371,18 +372,19 @@ def mock_VariableDepthMultiChannelMicroscopyVolume(
name: Optional[str] = None,
description: str = "This is a mock instance of a MultiChannelMicroscopyVolume type to be used for rapid testing.",
data: Optional[np.ndarray] = None,
depth_per_frame_in_mm: Optional[np.ndarray] = None,
depth_per_frame_in_um: Optional[np.ndarray] = None,
unit: str = "n.a.",
conversion: float = 1.0,
offset: float = 0.0,
) -> ndx_microscopy.VariableDepthMultiChannelMicroscopyVolume:
series_name = name or name_generator("MultiChannelMicroscopyVolume")

series_data = data if data is not None else np.ones(shape=(15, 5, 5))
volume_depth_per_frame_in_mm = (
depth_per_frame_in_mm
if depth_per_frame_in_mm is not None
else np.linspace(start=0.0, stop=1.0, num=series_data.shape[0])

volume_depth_per_frame_in_um = (
depth_per_frame_in_um
if depth_per_frame_in_um is not None
else np.linspace(start=0.0, stop=30.0, num=series_data.shape[0])
)

imaging_data = data if data is not None else np.ones(shape=(10, 20, 7, 3))
Expand All @@ -394,7 +396,7 @@ def mock_VariableDepthMultiChannelMicroscopyVolume(
light_sources=light_sources,
optical_channels=optical_channels,
data=imaging_data,
depth_per_frame_in_mm=volume_depth_per_frame_in_mm,
depth_per_frame_in_um=volume_depth_per_frame_in_um,
unit=unit,
conversion=conversion,
offset=offset,
Expand Down

0 comments on commit eea8167

Please sign in to comment.