You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.1 KiB

9 years ago
9 years ago
9 years ago
  1. class Metadata(object):
  2. """ A simple container for ND2 metadata. """
  3. def __init__(self, height, width, channels, date, fields_of_view, frames, z_levels, total_images_per_channel):
  4. self._height = height
  5. self._width = width
  6. self._channels = channels
  7. self._date = date
  8. self._fields_of_view = fields_of_view
  9. self._frames = frames
  10. self._z_levels = z_levels
  11. self._total_images_per_channel = total_images_per_channel
  12. @property
  13. def height(self):
  14. """
  15. The image height in pixels.
  16. :rtype: int
  17. """
  18. return self._height
  19. @property
  20. def width(self):
  21. """
  22. The image width in pixels.
  23. :rtype: int
  24. """
  25. return self._width
  26. @property
  27. def date(self):
  28. """
  29. The date and time when acquisition began.
  30. :rtype: datetime.datetime()
  31. """
  32. return self._date
  33. @property
  34. def channels(self):
  35. """
  36. These are labels created by the NIS Elements user. Typically they may a short description of the filter cube
  37. used (e.g. "bright field", "GFP", etc.)
  38. :rtype: list
  39. """
  40. return self._channels
  41. @property
  42. def fields_of_view(self):
  43. """
  44. The metadata contains information about fields of view, but it contains it even if some fields
  45. of view were cropped. We can't find anything that states which fields of view are actually
  46. in the image data, so we have to calculate it. There probably is something somewhere, since
  47. NIS Elements can figure it out, but we haven't found it yet.
  48. :rtype: list
  49. """
  50. return self._fields_of_view
  51. @property
  52. def frames(self):
  53. """
  54. The number of cycles.
  55. :rtype: list
  56. """
  57. return self._frames
  58. @property
  59. def z_levels(self):
  60. """
  61. The different levels in the Z-plane. Just a sequence from 0 to n.
  62. :rtype: list
  63. """
  64. return self._z_levels
  65. @property
  66. def total_images_per_channel(self):
  67. return self._total_images_per_channel