Glencoe has released a statement regarding the conversion of complex formats to pyramidal ome.tiff
https://www.glencoesoftware.com/blog/2019/12/09/converting-whole-slide-images-to-OME-TIFF.html
== Workflow Summary ==
The Glencoe protocol describes a two-step process.
1. Convert vendor data to 'raw' data using `bioformats2raw`
2. Convert 'raw' data to ome.tiff using `raw2ometiff`
The need for the two separate protocols seems to stem from licensing and dependencies on separate vendor-specific libraries.
== Advantages ==
All reading and writing is streamed to the disk in parallel, making this the fastest conversion tool available. On a test with one RGB dataset in .mrxs format, it went from ~4h using [[ https://github.com/BIOP/ijp-kheops | KHEOPS ]] to about 10 minutes using these two tools.
= Installation =
NOTE: Because this protocol makes use of very modern file storage and compression systems, there is a dependency on a tool called `c-blosc`
== Installing `c-blosc` ==
=== In windows ===
The procedure is described in https://github.com/glencoesoftware/bioformats2raw (and re-summarized here):
* download the latest pre-built blosc DLLs available from the [Fiji project](https://sites.imagej.net/N5/lib/win64/).
* Rename the downloaded DLL to `blosc.dll` and place it in a fixed location (for instance `C:\path\to\blosc\folder`)
* then set a system environment variable named `JAVA_OPTS` which value is set to `-Djna.library.path=C:\path\to\blosc\folder`
=== Not windows ===
`c-blosc` can also be compiled, see legacy documentation below and readme of https://github.com/glencoesoftware/bioformats2raw
=== Installing `bioformats2raw` ===
Unzip this somewhere
https://github.com/glencoesoftware/bioformats2raw/releases
=== Installing `raw2ometiff` ===
Unzip this somewhere
https://github.com/glencoesoftware/raw2ometiff/releases
=== Adding to the PATH ===
Add the two unzipped `bin` folders to your `PATH` system environment variable so you can call these two functions from anywhere. Alternatively, you can set the path explicitly in the provided groovy script macro:
```
//bf2rawPath = "bioformats2raw.bat"
//raw2ometiffPath = "raw2ometiff.bat"
bf2rawPath = "C:/whatever/.../bioformats2raw.bat"
raw2ometiffPath = "C:/whatever/.../raw2ometiff.bat"
```
== Using this workflow within Fiji ==
You can use the [bf2ometiff gist](https://gist.github.com/NicoKiaru/15e8d39d4d18174a22402c2ca939bb81) and click batch to batch convert your files.
== Using This workflow with the command line ==
Example: Dataset called `D:\ToConvert\Kidney.mrxs` which is RGB
```
bioformats2raw.bat --resolutions=4 D:\ToConvert\Kidney.mrxs D:\ToConvert\Kidney
```
Other arguments are available with bioformats2raw.bat --help
Converting to OME.TIFF
```
raw2ometiff.bat --compression="JPEG-2000" --rgb D:\ToConvert\kidney D:\ToConvert\Kidney.ome.tiff
```
IMPORTANT: RGB images must be explictely concerted using the `--rgb` flag. Otherwise it will be a 3 channel image.
----
== Installing `c-blosc` from source ==
=== Dependencies ===
**Download **[[ https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019 | Build Tools for Visual Studio 2019 ]]
Install the packages
- `MSVC v142 - VS 2019 C++ x64/x86 build tools`
- `Windows 10 SDK (10.0.18362.0)`
**Download **[[ https://cmake.org/download/ | CMake ]] (msi installer) and install with checking `Add CMAKE Path to all users`.
NOTE: If you followed the StarDist with gpu-tools installation, you have all the prerequisites except for [[ https://cmake.org/download/ | CMake ]]. Otherwise please follow the installation of the [[ bioimaging_and_optics_platform_biop/computers-servers/software/gpu-deep-learning/#stardist-prerequisites | StarDist Prerequisites ]]
=== Installation ===
1. Clone https://github.com/Blosc/c-blosc
2. Create a folder in your `C:\` drive called `Dev Tools`
2. Open a command line and do the following
```
cd c-blosc
mkdir build
cmake -DCMAKE_INSTALL_PREFIX="C:\Dev Tools"
cmake --build . --target install
```