-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from fmi-faim/channel_metadata
Add test for ImageXpress transmitted light
- Loading branch information
Showing
5 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+15.4 KB
resources/ImageXpress/exp126-d0_C03_thumbA6B0784C-19ED-4F35-9E6A-0A306794BB11.tif
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
from typing import Optional, Union | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel, NonNegativeInt, PositiveFloat, PositiveInt | ||
from pydantic import BaseModel, NonNegativeInt, PositiveFloat | ||
|
||
|
||
class ChannelMetadata(BaseModel): | ||
channel_index: NonNegativeInt | ||
channel_name: str | ||
display_color: str | ||
spatial_calibration_x: float | ||
spatial_calibration_y: float | ||
spatial_calibration_x: PositiveFloat | ||
spatial_calibration_y: PositiveFloat | ||
spatial_calibration_units: str | ||
z_spacing: Optional[PositiveFloat] | ||
wavelength: Union[PositiveInt, str] | ||
exposure_time: Optional[PositiveFloat] | ||
exposure_time_unit: Optional[str] | ||
z_spacing: Optional[PositiveFloat] = None | ||
wavelength: NonNegativeInt | ||
exposure_time: Optional[PositiveFloat] = None | ||
exposure_time_unit: Optional[str] = None | ||
objective: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from faim_ipa.io.MetaSeriesTiff import load_metaseries_tiff_metadata | ||
from faim_ipa.io.ChannelMetadata import ChannelMetadata | ||
|
||
from pathlib import Path | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def transmission_sample_image_path(): | ||
return ( | ||
Path(__file__).parent.parent.parent | ||
/ "resources" | ||
/ "ImageXpress" | ||
/ "exp126-d0_C03_thumbA6B0784C-19ED-4F35-9E6A-0A306794BB11.tif" | ||
) | ||
|
||
|
||
def test_transmission_metadata(transmission_sample_image_path): | ||
metadata = load_metaseries_tiff_metadata(transmission_sample_image_path) | ||
channel_metadata = ChannelMetadata( | ||
channel_index=0, | ||
channel_name="test_channel", | ||
display_color="FFFFFF", | ||
spatial_calibration_x=metadata["spatial-calibration-x"], | ||
spatial_calibration_y=metadata["spatial-calibration-y"], | ||
spatial_calibration_units=metadata["spatial-calibration-units"], | ||
objective="4x", | ||
**metadata, | ||
) | ||
assert channel_metadata.spatial_calibration_x == 43.3613 | ||
assert channel_metadata.spatial_calibration_y == 54.2016 | ||
assert channel_metadata.wavelength == 0 |