{"id":19728757,"url":"https://github.com/swharden/scitif","last_synced_at":"2025-08-22T10:39:48.784Z","repository":{"id":57912909,"uuid":"147956604","full_name":"swharden/SciTIF","owner":"swharden","description":"A .NET library for working with scientific image data in TIFF files","archived":false,"fork":false,"pushed_at":"2023-09-21T17:30:46.000Z","size":40702,"stargazers_count":7,"open_issues_count":14,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-08T12:17:06.925Z","etag":null,"topics":["image","image-analysis","imaging","microscopy","science","tif","tiff"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/SciTIF","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swharden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-09-08T17:48:14.000Z","updated_at":"2024-05-31T09:38:51.000Z","dependencies_parsed_at":"2023-01-18T07:31:00.158Z","dependency_job_id":"d4ee827f-cbf1-41ab-a546-e75a7fff531a","html_url":"https://github.com/swharden/SciTIF","commit_stats":{"total_commits":197,"total_committers":1,"mean_commits":197.0,"dds":0.0,"last_synced_commit":"0de38f0f44a1fe0112a2013bcbfbf588f2933470"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swharden%2FSciTIF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swharden%2FSciTIF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swharden%2FSciTIF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swharden%2FSciTIF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swharden","download_url":"https://codeload.github.com/swharden/SciTIF/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224193129,"owners_count":17271238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image","image-analysis","imaging","microscopy","science","tif","tiff"],"created_at":"2024-11-12T00:07:41.795Z","updated_at":"2024-11-12T00:07:42.405Z","avatar_url":"https://github.com/swharden.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SciTIF\n\n[![CI](https://github.com/swharden/SciTIF/actions/workflows/ci.yaml/badge.svg)](https://github.com/swharden/SciTIF/actions/workflows/ci.yaml)\n\n**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).\n\n## Quickstart\n\n```cs\n// Open a 16-bit TIFF with pixel values that exceed 255\nvar tif = new TifFile(\"input.tif\");\n\n// Get a channel of interest from the 5D TIFF file\nImage slice = tif.GetImage(frame: 0, slice: 0, channel: 0);\n\n// Analyze or manipulate images by iterating the flat pixel value array\ndouble[] allValues = slice.Values;\n\n// ...or manipulate individual pixels as desired\ndouble pxValue = slice.GetPixel(13, 42);\nslice.SetPixel(13, 42, 123);\n\n// Scale the pixel values down to 0-255 and save as a PNG file\nslice.AutoScale(max: 255);\nslice.Save(\"output.png\");\n```\n\n![](dev/diagrams/autoscale.png)\n\n## Lookup Table (LUT)\n\nThis example takes a grayscale image and applies a lookup table (LUT) to represent pixel values as colors.\n\n```cs\nTifFile tif = new(\"graycale.tif\");\nImage slice = tif.GetImage(frame: 0, slice: 0, channel: 0);\nslice.AutoScale();\nslice.LUT = new LUTs.Viridis(); // apply a custom color lookup table\nslice.Save_TEST(\"viridis.png\");\n```\n\n![](dev/diagrams/autoscale-viridis.png)\n\n## RGB Merge\n\nIf you have 3 grayscale images representing red, green, and blue, you can easily merge them into a color image.\n\n```cs\n// read grayscale images from a multi-channel TIF\nTifFile tif = new(\"multichannel.tif\");\nImage red = tif.GetImage(channel: 0);\nImage green = tif.GetImage(channel: 1);\nImage blue = tif.GetImage(channel: 2);\n\nImageRGB rgb = new(red, green, blue); // merge 3 grayscale images\nrgb.Save(\"merge.png\");\n```\n\n![](dev/diagrams/merge-rgb.png)\n\n## Multi-Channel Merge\n\nThis example shows how to merge two grayscale channels into a color image using custom colors (Magenta and Green).\n\n```cs\nTifFile tif = new(\"multichannel.tif\");\n\n// scale each channel (0-255) and set the color lookup table (LUT)\nImage ch1 = tif.GetImage(channel: 0);\nch1.AutoScale();\nch1.LUT = new LUTs.Magenta();\n\nImage ch2 = tif.GetImage(channel: 1);\nch2.AutoScale();\nch2.LUT = new LUTs.Green();\n\n// create a new stack containing just the channels to merge\nImage[] images = { ch1, ch2 };\nImageStack stack = new(images);\n\n// project the stack by merging colors\nImageRGB merged = stack.Merge();\nmerged.Save_TEST(\"merge.png\");\n```\n\n![](dev/diagrams/merge-channels.png)\n\n## 3D Image Projection\n\nThis 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.\n\n```cs\nTifFile tif = new(\"stack.tif\");\nImageStack stack = tif.GetImageStack();\nImage projection = stack.ProjectMax();\nprojection.AutoScale(); \nprojection.Save(\"projection.png\");\n```\n\n![](dev/diagrams/projection-max.png)\n\n## 3D Image Projection with LUT\n\nA 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.\n\n```cs\nTifFile tif = new(\"stack.tif\");\nImageStack stack = tif.GetImageStack();\nstack.AutoScale(); \nILUT lut = new LUTs.Jet();\nImageRGB projection = stack.Project(lut);\nprojection.Save(\"rainbow.png\");\n```\n\n![](dev/diagrams/projection-color.png)\n\n## Notes\n\n* Warning: SciTIF is still version 0 so its API may change as it continues to evolve.\n\n* Note: RGB images are automatically split into 5D TIF files containing 4 channels: Red, Green, Blue, and Alpha.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswharden%2Fscitif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswharden%2Fscitif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswharden%2Fscitif/lists"}