# itk montage tiff without ome-tiff header

**URL:** <https://discourse.itk.org/t/itk-montage-tiff-without-ome-tiff-header/4948>\
**Category:** Beginner Questions\
**Tags:** registration, python\
**Created:** [April 27, 2022, 12:59pm UTC](https://discourse.itk.org/t/itk-montage-tiff-without-ome-tiff-header/4948 "2022-04-27T12:59:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![allen](https://discourse.itk.org/letter_avatar_proxy/v4/letter/a/bbce88/32.png) [@allen](https://discourse.itk.org/u/allen)\
**Post date:** [April 27, 2022, 12:59pm UTC](https://discourse.itk.org/t/itk-montage-tiff-without-ome-tiff-header/4948/1 "2022-04-27T12:59:19Z")

</div>

hello, i use the itk montage stitching tiles and get a tiff file, but it is not standard tiff format i think, which can not be opened in [openslide](https://openslide.org/)  
 ![image](https://discourse.itk.org/uploads/default/original/2X/4/4bb976e487757bc176efc583060c96d0f77dccad.png)  
is there a way to get a OME-XML metadata to the tiff file of itk montage output, or any other fomat supported by openslide above  
the itk montage has a warning message dealing with an unsuported image format, but its hard to figure out the exact format by the ImageIO name

```auto
itk::ImageFileWriterException (000000E7A472EFC0)
Location: "unknown" 
File: D:\projects\ITK\Modules\IO\ImageBase\include\itkImageFileWriter.hxx
Line: 117
Description: Could not create IO object for writing file F:\projects\ITKMontage\examples\output_micro/montage.ngff
  Tried to create one of the following:
    BMPImageIO
    BioRadImageIO
    Bruker2dseqImageIO
    GDCMImageIO
    GE4ImageIO
    GE5ImageIO
    GiplImageIO
    HDF5ImageIO
    JPEGImageIO
    JPEG2000ImageIO
    LSMImageIO
    MINCImageIO
    MRCImageIO
    MetaImageIO
    NiftiImageIO
    NrrdImageIO
    PNGImageIO
    StimulateImageIO
    TIFFImageIO
    VTKImageIO
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.

```

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [April 27, 2022, 1:55pm UTC](https://discourse.itk.org/t/itk-montage-tiff-without-ome-tiff-header/4948/2 "2022-04-27T13:55:30Z")

</div>

No file IO in ITK knows about `.ngff` file format extension. But ITK can [read and write TIFF](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/TIFF/src/itkTIFFImageIO.cxx) (probably generic variant) files. Support for [ZarrNGFF](https://github.com/dzenanz/ITKIOOMEZarrNGFF) is a work in progress.

It is possible to add whatever metadata you want to the tiff file of ITK montage output, including [OME-XML metadata](https://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd), but that is not implemented. You are the first person to ask for it, so if you want it you will probably have to implement it yourself.

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [April 27, 2022, 3:06pm UTC](https://discourse.itk.org/t/itk-montage-tiff-without-ome-tiff-header/4948/3 "2022-04-27T15:06:02Z")

</div>

Could the ITK remote module [SCIFIO](https://github.com/scifio/scifio-imageio) be helpful here?

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [May 13, 2022, 10:35am UTC](https://discourse.itk.org/t/itk-montage-tiff-without-ome-tiff-header/4948/4 "2022-05-13T10:35:48Z")

</div>

Hi,

We should add OME-TIFF metadata input / output support into ITK TIFF’s ImageIO. [Tracking issue](https://github.com/InsightSoftwareConsortium/ITK/issues/3427).

An OME-TIFF could be generated in Python with [tifffile](https://pypi.org/project/tifffile/) with something like:

```python
import itk
import tifffile
import numpy as np

image = itk.imread('montage.mha')
with tifffile.TiffWriter('montage.ome.tif', ometiff=True) as tiff:
    options = dict(photometric='minisblack', tile=(128, 128), compression='zlib')
    axes = 'YX'
    metadata={'axes': axes}
    metadata['PhysicalSizeX'] = image.GetSpacing()[0]
    metadata['PhysicalSizeY'] = image.GetSpacing()[1]
    tiff.write(np.asarray(image), **options, metadata=metadata)

```

`itk.Image` `Origin` and z-spacing could be set with per-`Plane`: `PositionX`, `PositionY`, `PositionZ`.
