SciTIF 0.1.4

dotnet add package SciTIF --version 0.1.4
NuGet\Install-Package SciTIF -Version 0.1.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SciTIF" Version="0.1.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SciTIF --version 0.1.4
#r "nuget: SciTIF, 0.1.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SciTIF as a Cake Addin
#addin nuget:?package=SciTIF&version=0.1.4

// Install SciTIF as a Cake Tool
#tool nuget:?package=SciTIF&version=0.1.4

SciTIF is a .NET Standard library for working with scientific imaging data stored in TIFF files. Many libraries that read TIF files struggle to interpret 16-bit, 32-bit, and 8-bit indexed color TIFF files used for scientific imaging. If you've ever tried to open a scientific TIF file and been presented with an all-black or all-white image, you've experienced this problem too! SciTIF supports 5D TIF files with separate axes for X, Y, C (channel), Z (slice), and T (frame).

Quickstart

// Open a 16-bit TIFF with pixel values that exceed 255
var tif = new TifFile("input.tif");

// Get a channel of interest from the 5D TIFF file
Image slice = tif.GetImage(frame: 0, slice: 0, channel: 0);

// Analyze or manipulate images by iterating the flat pixel value array
double[] allValues = slice.Values;

// ...or manipulate individual pixels as desired
double pxValue = slice.GetPixel(13, 42);
slice.SetPixel(13, 42, 123);

// Scale the pixel values down to 0-255 and save as a PNG file
slice.AutoScale(max: 255);
slice.Save("output.png");

alternate text is missing from this package README image

Lookup Table (LUT)

This example takes a grayscale image and applies a lookup table (LUT) to represent pixel values as colors.

TifFile tif = new("graycale.tif");
Image slice = tif.GetImage(frame: 0, slice: 0, channel: 0);
slice.AutoScale();
slice.LUT = new LUTs.Viridis(); // apply a custom color lookup table
slice.Save_TEST("viridis.png");

alternate text is missing from this package README image

RGB Merge

If you have 3 grayscale images representing red, green, and blue, you can easily merge them into a color image.

// read grayscale images from a multi-channel TIF
TifFile tif = new("multichannel.tif");
Image red = tif.GetImage(channel: 0);
Image green = tif.GetImage(channel: 1);
Image blue = tif.GetImage(channel: 2);

ImageRGB rgb = new(red, green, blue); // merge 3 grayscale images
rgb.Save("merge.png");

alternate text is missing from this package README image

Multi-Channel Merge

This example shows how to merge two grayscale channels into a color image using custom colors (Magenta and Green).

TifFile tif = new("multichannel.tif");

// scale each channel (0-255) and set the color lookup table (LUT)
Image ch1 = tif.GetImage(channel: 0);
ch1.AutoScale();
ch1.LUT = new LUTs.Magenta();

Image ch2 = tif.GetImage(channel: 1);
ch2.AutoScale();
ch2.LUT = new LUTs.Green();

// create a new stack containing just the channels to merge
Image[] images = { ch1, ch2 };
ImageStack stack = new(images);

// project the stack by merging colors
ImageRGB merged = stack.Merge();
merged.Save_TEST("merge.png");

alternate text is missing from this package README image

3D Image Projection

This examples shows how to create a maximum-intensity projection along the Z axis of a 5D TIF image. This can be used to create all-in-focus maximum projection of a collection of single optical sections.

TifFile tif = new("stack.tif");
ImageStack stack = tif.GetImageStack();
Image projection = stack.ProjectMax();
projection.AutoScale(); 
projection.Save("projection.png");

alternate text is missing from this package README image

3D Image Projection with LUT

A stack of grayscale images can be projected such that each slice is given a different color according to a lookup table (LUT). This achieves a depth-coded effect where color indicates the Z position of the structures visible in the final image.

TifFile tif = new("stack.tif");
ImageStack stack = tif.GetImageStack();
stack.AutoScale(); 
ILUT lut = new LUTs.Jet();
ImageRGB projection = stack.Project(lut);
projection.Save("rainbow.png");

alternate text is missing from this package README image

Notes

  • Warning: SciTIF is still version 0 so its API may change as it continues to evolve.

  • Note: RGB images are automatically split into 5D TIF files containing 4 channels: Red, Green, Blue, and Alpha.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.4 583 9/14/2022
0.1.3 443 8/28/2022
0.1.2 358 8/28/2022
0.1.1 374 8/26/2022