eyepy.io.he.e2e_reader
E2EFileStructure()
Bases: E2EStructureMixin
E2E File Structure.
Source code in src/eyepy/io/he/e2e_reader.py
add_folder(folder)
Add a folder to the File Structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder |
E2EFolder
|
The folder to add. |
required |
Source code in src/eyepy/io/he/e2e_reader.py
E2EFolder
dataclass
Folder data class.
Note
Folders are created during initialization of the HeE2eReader. For accessing the data the respective HeE2eReader has to be used as a Context Manager. This opens the E2E file and allows the E2EFolder to access the data.
data: Any
property
Return the data.
file_object: BufferedReader
property
Return the file object.
This refers to the the HeE2eReader file object.
header: ContainerHeader
property
Return the data header.
get_bytes()
Return the bytes of the data.
This only works if the HeE2eReader is used as a Context Manager or during initialization of the HeE2eReader. Otherwise the E2E file is not open.
Source code in src/eyepy/io/he/e2e_reader.py
parse_spec(data_construct, offset=0)
Parse a data specification.
This only works if the HeE2eReader is used as a Context Manager or during initialization of the HeE2eReader. Otherwise the E2E file is not open.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_construct |
Construct
|
The construct to parse the data with. You can Constructs defined in the construct library or those defined in the e2e_format module. |
required |
offset |
int
|
The offset in bytes, 0 by default. |
0
|
Source code in src/eyepy/io/he/e2e_reader.py
E2EPatientStructure(id)
Bases: E2EStructureMixin
E2E Patient Structure.
Source code in src/eyepy/io/he/e2e_reader.py
add_folder(folder)
Add a folder to the Patient Structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder |
E2EFolder
|
The folder to add. |
required |
Source code in src/eyepy/io/he/e2e_reader.py
E2ESeriesStructure(id)
Bases: E2EStructureMixin
E2E Series Structure.
This structure contains folders with data for a single Series/OCT- Volume and provides convenience functions for accessing the data.
Source code in src/eyepy/io/he/e2e_reader.py
n_bscans: int
property
Return the number of B-scans in the series.
slices: dict[int, E2ESliceStructure]
property
Alias for substructure.
add_folder(folder)
Add a folder to the Series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder |
E2EFolder
|
The folder to add. |
required |
Source code in src/eyepy/io/he/e2e_reader.py
get_bscan_meta()
Return EyeBscanMeta objects for all B-scans in the series.
Source code in src/eyepy/io/he/e2e_reader.py
get_layers()
Return layer height maps for the series as dict of numpy arrays where the key is the layer id.
Source code in src/eyepy/io/he/e2e_reader.py
get_localizer()
Return EyeEnface object for the localizer image.
Source code in src/eyepy/io/he/e2e_reader.py
get_meta()
Return EyeVolumeMeta object for the series.
Source code in src/eyepy/io/he/e2e_reader.py
get_volume()
Return EyeVolume object for the series.
Source code in src/eyepy/io/he/e2e_reader.py
inspect(recursive=False, ind_prefix='', tables=False)
Inspect the series.
Custom inspect
method to print a summary table for the slices belonging to the series.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recursive |
bool
|
If True inspect lower level structures recursively. |
False
|
ind_prefix |
str
|
Indentation for showing information from lower level structures. |
''
|
tables |
bool
|
If True add markdown table overview of the contained folder types. |
False
|
Source code in src/eyepy/io/he/e2e_reader.py
localizer_meta()
Return EyeEnfaceMeta object for the localizer image.
Source code in src/eyepy/io/he/e2e_reader.py
E2ESliceStructure(id)
Bases: E2EStructureMixin
E2E Slice Structure.
This structure contains folders with data for a single Slice/B-csan and provide convenience functions for accessing the data.
Source code in src/eyepy/io/he/e2e_reader.py
add_folder(folder)
Add a folder to the slice.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder |
E2EFolder
|
The folder to add. |
required |
get_bscan()
Return the slice image (B-scan)
Source code in src/eyepy/io/he/e2e_reader.py
get_layers()
Return the layers as a dictionary of layer id and layer data.
Source code in src/eyepy/io/he/e2e_reader.py
get_localizer()
Return the slice image (Localizer/Fundus) For the scanpattern "OCT Bscan" a localizer might be stored in the E2ESliceStructure and not the E2ESeriesStructure.
Source code in src/eyepy/io/he/e2e_reader.py
get_meta()
Return the slice meta data.
Source code in src/eyepy/io/he/e2e_reader.py
E2EStructureMixin
A Mixin for shared functionality between structures in the E2E hierarchy.
get_folder_data(folder_type, offset=0, data_construct=None)
Return the data of a folder type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder_type |
Union[TypesEnum, int]
|
Either one of TypesEnum or the type id (int). |
required |
offset |
int
|
Offset to the data in bytes. |
0
|
data_construct |
Optional[Union[Construct, str]]
|
A construct to parse the data with (Python construct package) or a string describing one of the basic constructs from the construct package like "Int8ul", or "Float32l" |
None
|
Returns:
Type | Description |
---|---|
Any
|
Parsed data or None if no folder of the given type was found. |
Source code in src/eyepy/io/he/e2e_reader.py
inspect(recursive=False, ind_prefix='', tables=False)
Inspect the E2E structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recursive |
bool
|
If True inspect lower level structures recursively. |
False
|
ind_prefix |
str
|
Indentation for showing information from lower level structures. |
''
|
tables |
bool
|
If True add markdown table overview of the contained folder types. |
False
|
Returns:
Type | Description |
---|---|
str
|
Information about the E2E structure. |
Source code in src/eyepy/io/he/e2e_reader.py
E2EStudyStructure(id)
Bases: E2EStructureMixin
E2E Study Structure.
Source code in src/eyepy/io/he/e2e_reader.py
add_folder(folder)
Add a folder to the Study.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder |
E2EFolder
|
The folder to add. |
required |
Source code in src/eyepy/io/he/e2e_reader.py
HeE2eReader(path)
Bases: AbstractContextManager
Index an E2E file.
Initialization of the HeE2eReader class indexes the specified E2E file. This allows for printing the reader object for a quick overview of the files contents. If you want to access the data, the reader has to be used as a Context Manager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Union[str, Path]
|
Path to the e2e file. |
required |
Source code in src/eyepy/io/he/e2e_reader.py
patients: list[E2EPatientStructure]
property
List of all patients in the file as E2EPatient objects.
series: list[E2ESeriesStructure]
property
List of all series in the file as E2ESeries objects.
studies: list[E2EStudyStructure]
property
List of all studies in the file as E2EStudy objects.
volume: EyeVolume
property
First EyeVolume object in the E2E file.
Returns:
Type | Description |
---|---|
EyeVolume
|
EyeVolume object for the first Series in the e2e file. |
volumes: list[EyeVolume]
property
All EyeVolume objects in the E2E file.
Returns:
Type | Description |
---|---|
list[EyeVolume]
|
List with EyeVolume objects for every Series in the e2e file. |
find_float(value, excluded_folders=['images', 'layers'], slice_id=None, **kwargs)
Find a float value in the e2e file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
float
|
The value to find. |
required |
excluded_folders |
list[Union[int, str]]
|
A list of folders to exclude from the search. None: Exclude no folders. "images": Exclude image data from search. "layers": Exclude layer data from search. |
['images', 'layers']
|
slice_id |
Optional[int]
|
The slice to search in. Specify 0 if you do not want to search through all slices but one slice per volume is enough. |
None
|
**kwargs |
Keyword arguments passed to |
{}
|
Returns:
Type | Description |
---|---|
dict[int, dict[int, dict[str, list[int]]]]
|
A dictionary of the form {series_id(int): {folder_type(int): {fmt_string(str): [positions(int)]}}} |
Source code in src/eyepy/io/he/e2e_reader.py
find_int(value, excluded_folders=['images', 'layers'], slice_id=None, **kwargs)
Find an integer value in the e2e file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to find. |
required |
excluded_folders |
list[Union[int, str]]
|
A list of folders to exclude from the search. None: Exclude no folders. "images": Exclude image data from search. "layers": Exclude layer data from search. |
['images', 'layers']
|
slice_id |
Optional[int]
|
The slice id to search in. |
None
|
**kwargs |
Keyword arguments passed to |
{}
|
Returns:
Type | Description |
---|---|
dict[int, dict[int, dict[str, list[int]]]]
|
A dictionary of the form {series_id(int): {folder_type(int): {fmt_string(str): [positions(int)]}}} |
Source code in src/eyepy/io/he/e2e_reader.py
find_number(value, excluded_folders=['images', 'layers'], slice_id=None, **kwargs)
Find a number value in the e2e file.
Use this function if you don't know if the value is an integer or a float.
This is just a shortcut for calling find_int
and find_float
individually.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Union[int, float]
|
The value to find. |
required |
excluded_folders |
list[Union[int, str]]
|
A list of folders to exclude from the search. None: Exclude no folders. "images": Exclude image data from search. "layers": Exclude layer data from search. |
['images', 'layers']
|
slice_id |
Optional[int]
|
The slice to search in. Specify 0 if you do not want to search through all slices but one slice per volume is enough. |
None
|
**kwargs |
Keyword arguments passed to |
{}
|
Returns:
Type | Description |
---|---|
dict[int, dict[int, dict[str, list[int]]]]
|
A dictionary of the form {series_id(int): {folder_type(int): {fmt_string(str): [positions(int)]}}} |
Source code in src/eyepy/io/he/e2e_reader.py
inspect(recursive=False, ind_prefix='', tables=True)
Inspect the file hierarchy (contents) of the file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recursive |
bool
|
If True inspect lower level structures recursively. |
False
|
ind_prefix |
str
|
Indentation for showing information from lower level structures. |
''
|
tables |
bool
|
If True add markdown table overview of the contained folder types. |
True
|