Browse Source

Using Z slice coordinates from Z-data instead of Z-levels and show warning in case of mismatch

master
Gabriele Girelli 5 years ago
parent
commit
810682c667
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      nd2reader/raw_metadata.py

+ 7
- 1
nd2reader/raw_metadata.py View File

@ -2,6 +2,7 @@ import re
import xmltodict
import six
import numpy as np
import warnings
from nd2reader.common import read_chunk, read_array, read_metadata, parse_date, get_from_dict_if_exists
from nd2reader.common_raw_metadata import parse_dimension_text_line, parse_if_not_none, parse_roi_shape, parse_roi_type, get_loops_from_data, determine_sampling_interval
@ -160,7 +161,12 @@ class RawMetadata(object):
Returns:
list: the z levels, just a sequence from 0 to n.
"""
return self._parse_dimension(r""".*?Z\((\d+)\).*?""")
z_levels = self._parse_dimension(r""".*?Z\((\d+)\).*?""")
if 0 == len(z_levels):
z_levels = range(len(parse_if_not_none(self.z_data, self._parse_z_coordinates)))
if 0 != z_levels:
warnings.warn("Z-levels details missing in metadata. Using Z-coordinates instead.")
return z_levels
def _parse_z_coordinates(self):
"""The coordinate in micron for all z planes.


Loading…
Cancel
Save