How to use the aicsimageio.vendor.omexml.OMEXML function in aicsimageio

To help you get started, we’ve selected a few aicsimageio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def Pixels(self):
            """The OME/Image/Pixels element.

            Example:
            >>> md = bioformats.omexml.OMEXML(xml)
            >>> pixels = omemetadata.image(i).Pixels
            >>> channel_count = pixels.SizeC
            >>> stack_count = pixels.SizeZ
            >>> timepoint_count = pixels.SizeT

            """
            return OMEXML.Pixels(self.node.find(qn(self.ns['ome'], "Pixels")))
github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def __getitem__(self, key):
            plates = self.root.findall(qn(self.ns['spw'], "Plate"))
            if isinstance(key, slice):
                return [OMEXML.Plate(plate) for plate in plates[key]]
            return OMEXML.Plate(plates[key])
github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def set_channel_count(self, value):
            assert value >= 0
            channel_count = self.channel_count
            if channel_count > value:
                channels = self.node.findall(qn(self.ns['ome'], "Channel"))
                for channel in channels[value:]:
                    self.node.remove(channel)
            else:
                for _ in range(channel_count, value):
                    new_channel = OMEXML.Channel(
                        ElementTree.SubElement(self.node, qn(self.ns['ome'], "Channel")))
                    new_channel.ID = str(uuid.uuid4())
                    new_channel.Name = new_channel.ID
                    new_channel.SamplesPerPixel = 1
github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def get_Sample(self):
            return OMEXML.WellSampleDucktype(self.node)
github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def __iter__(self):
            """Return the standard name for all wells on the plate

            for instance, 'B03' for a well with Row=1, Column=2 for a plate
            with the standard row and column naming convention
            """
            all_wells = self.plate_node.findall(qn(self.ns['spw'], "Well"))
            well = OMEXML.Well(None)
            for w in all_wells:
                well.node = w
                yield self.plate.get_well_name(well)
github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def get_Well(self):
            '''The well dictionary / list'''
            return OMEXML.WellsDucktype(self)
        Well = property(get_Well)
github AllenCellModeling / aicsimageio / aicsimageio / readers / ome_tiff_reader.py View on Github external
def _lazy_init_metadata(self) -> omexml.OMEXML:
        with TiffFile(self._file) as tiff:
            if self._metadata is None and tiff.is_ome:
                description = tiff.pages[0].description.strip()
                if not (
                    description.startswith("")
                ):
                    raise ValueError(
                        f"Description does not conform to OME specification: "
                        f"{description[:100]}"
                    )
                self._metadata = omexml.OMEXML(description)
        return self._metadata
github AllenCellModeling / aicsimageio / aicsimageio / vendor / omexml.py View on Github external
def Plane(self, index=0):
            """Get the indexed plane from the Pixels element"""
            plane = self.node.findall(qn(self.ns['ome'], "Plane"))[index]
            return OMEXML.Plane(plane)
github AllenCellModeling / aicsimageio / aicsimageio / writers / ome_tiff_writer.py View on Github external
... writer.save(image)

        Using the context manager to close the write once done.

        >>> image2 = numpy.ndarray([5, 486, 210])
        ... with ome_tiff_writer.OmeTiffWriter("file2.ome.tif") as writer2:
        ...     writer2.save(image2)

        Convert a CZI file into OME-Tiff

        >>> reader = cziReader.CziReader("file3.czi")
        ... with ome_tiff_writer.OmeTiffWriter("file3.ome.tif") as writer3:
        ...     writer.save(reader.load())
        """
        self.file_path = file_path
        self.omeMetadata = omexml.OMEXML()
        self.silent_pass = False
        if os.path.isfile(self.file_path):
            if overwrite_file:
                os.remove(self.file_path)
            elif overwrite_file is None:
                raise IOError(
                    "File {} exists but user has chosen not to overwrite it".format(
                        self.file_path
                    )
                )
            elif overwrite_file is False:
                self.silent_pass = True