Пример #1
0
of = open(pattern_file, "w")
of.write("Reg_C<001-%03d>.tif" % chan_count)
of.close()

# retrieve channel names from csv file
cf = pd.read_csv(OUT_PATH_csv, ",")
chans = cf["Markers"]
if exps_avail:
    exposures = cf["ExpTime"]

physsize = args.pixsize

tif = TIFF.open(example_file, mode = 'r')
xs = tif.GetField("ImageWidth")
ys = tif.GetField("ImageLength")
TIFF.close(tif)

OUT_PATH_ometiff = '{}.ome.tif'.format(outname + grid_coor)

if args.verbose: print("Creating a single OME.TIFF file of %d by %d pixels (pixel spacing: %s) with %d channels" % (xs, ys, physsize, chan_count))


# create the OME-XML header
part1 = """<?xml version="1.0" encoding="UTF-8"?>
<!-- Warning: this comment is an OME-XML metadata block, which contains crucial dimensional parameters and other important metadata. Please edit cautiously (if at all), and back up the original data before doing so. For more information, see the OME-TIFF web site: https://docs.openmicroscopy.org/latest/ome-model/ome-tiff/. -->
<OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Creator="OME Bio-Formats 6.2.1" UUID="urn:uuid:f44e8e82-3f44-4733-b6a3-43ac52b810e3" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2016-06 http://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd">
   <Instrument ID="Instrument:0">
      <Microscope Type="Upright" Model="Aperio AT2" Manufacturer="Leica Biosystems"/>
      <Detector ID="Detector:0" Type="CCD" Model="Unknown-22C" Manufacturer="Unknown"/>
      <Objective ID="Objective:1" Model="Plan-Apochromat 20x/0.75 NA" Immersion="Air" LensNA="0.75" NominalMagnification="20.0" WorkingDistance="620.0"/>
   </Instrument>\n"""
Пример #2
0
 def clearTifHandler(self):
     if len(self.tifHandlers) > 0:
         for f in self.tifHandlers:
             TIFF.close(f)
         self.tifHandlers = list()