Skip to content

Commit

Permalink
removed bundled czifile, using current PyPI/conda czifile now
Browse files Browse the repository at this point in the history
  • Loading branch information
csachs committed Mar 23, 2020
1 parent 74f64c9 commit bfa9790
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1,217 deletions.
8 changes: 0 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,3 @@ General remarks: :code:`--tty` is used to allocate a tty, necessary for interact
The :code:`--rm` switch tells docker to remove the container (not image) again after use.
As aforementioned, docker is containerized, i.e. unless explicitly stated, no communication with the outside is possible.
Therefore via :code:`--volume` the current working directory is mapped into the container.

Third Party Licenses
--------------------
Note that this software contains the following portions from other authors, under the following licenses (all BSD-flavoured):

mycelyso/pilyso/imagestack/readers/external/czifile.py:
czifile.py by Christoph Gohlke, licensed BSD (see file head).
Copyright (c) 2013-2015, Christoph Gohlke, 2013-2015, The Regents of the University of California
27 changes: 12 additions & 15 deletions mycelyso/pilyso/imagestack/readers/czi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@

import warnings

with warnings.catch_warnings():
warnings.simplefilter('ignore')
# code tend to throw warnings because of missing C extensions
from .external.czifile import CziFile, TimeStamps, etree as czifile_etree
from czifile import CziFile


def _is_dimension_oi(d):
Expand Down Expand Up @@ -68,15 +65,17 @@ def open(self, location, **kwargs):

self.size = _dim_shape_to_dict(self.czi.axes, self.czi.shape)

self.metadata = ElementTree.fromstring(czifile_etree.tostring(self.czi.metadata))
self.metadata = self.czi.metadata(raw=False)

scaling = self.metadata['ImageDocument']['Metadata']['Scaling']['Items']['Distance']

# /ImageDocument
calibration_x = float(
self.metadata.find("./Metadata/Scaling/Items/Distance[@Id='X']/Value").text
next(iter([scale for scale in scaling if scale['Id'] == 'X']))['Value']
) * 1E6

calibration_y = float(
self.metadata.find("./Metadata/Scaling/Items/Distance[@Id='Y']/Value").text
next(iter([scale for scale in scaling if scale['Id'] == 'Y']))['Value']
) * 1E6

assert calibration_x == calibration_y
Expand All @@ -86,20 +85,18 @@ def open(self, location, **kwargs):
timestamps = None

for entry in self.czi.attachment_directory:
entry_data = entry.data_segment().data()
if isinstance(entry_data, TimeStamps):
timestamps = entry_data
if entry.name == 'TimeStamps':
timestamps = entry.data_segment().data()
break

self.timestamps = timestamps

positions = []

for scene in sorted(
self.metadata.findall("./Metadata/Information/Image/Dimensions/S/Scenes/Scene"),
key=lambda scene: int(scene.attrib['Index'])):
center_position = next(child.text for child in scene.getchildren() if child.tag == "CenterPosition")
x, y = center_position.split(',')
for scene in sorted(self.metadata['ImageDocument'
]['Metadata']['Information']['Image']['Dimensions']['S']['Scenes']['Scene'],
key=lambda scene_: int(scene_['Index'])):
x, y = scene['CenterPosition'].split(',')
positions.append((float(x), float(y)))

self.positions = positions
Expand Down
Empty file.

0 comments on commit bfa9790

Please sign in to comment.