SlideIO: A New Python Library for Reading Medical Images5 Jan 2025 | 6 min read IntroductionMedical images - images generated by microscopes, scanners, and other devices are not the same as regular pictures. Their size is one of the key distinctions. These pictures might be rather big. These days, gigabyte-sized presentations are not that uncommon. The quantity of dimensions is another distinction. Several bio-image formats support three and four dimensions (volumes and time series). Some formats provide scanner-specific characteristics, such as phase index, rotation (for data collected from different angles), and focus distance, in addition to the standard dimensions. A multi-gigapixel image cannot be encoded using standard compression techniques. When using image codecs like JPEG or PNG, the entire picture must be saved to the computer's memory in order to be viewed on a screen, or even only a tiny portion of it can be read. Bio-formats use zoom pyramids and the tiling technique to overcome the challenges. It uses the least amount of memory and processing power possible to read any area of a picture at any scale. A collection of picture duplicates of various sizes is called a zoom pyramid. ![]() The purpose of the Slideio library is to interpret medical pictures as efficiently as possible by utilising their intrinsic structure. Slideio is not the first library to offer this kind of feature. I made extensive use of a variety of libraries during my image analysis practice. However, I haven't come across a library that can meet all of my needs for picture analysis thus far. I made the decision to make my own, which should compile all of my knowledge in this field. There is a driver architecture in the library. Each driver supports one or more picture formats. Four drivers are available with the first slideio version:
Slideio library's object structure is straightforward: ![]() Image drivers create slide objects. A single picture file (or folder, depending on the image type) is represented by a slide object. At least one Scene object, which is a continuous raster area (two-dimensional picture, volume, time series, etc.), is contained in a Slide object. A single scene, such as a single tissue scan, is supported by some picture formats. Multiple tissue areas can be stored in a file using certain formats. A 2D scene's pixels are all the same size and resolution. Every slice in a 3D volume, if a scene is one, has the same dimensions and resolution. For time series, the same holds. The snippet of code below demonstrates how to use the "SVS" image driver to open a slide: Image metadataThe Slideio library offers many degrees of picture information. The "raw_metadata" field of the slide object shows unaltered text that was taken from the picture. The text's content is unique to the file type. Regarding the Aperio SVS slide, it is a text string that has been taken out of the "Image Information" tiff file. The Zeiss CZI file, in this instance, is an XML document that contains all of the file metadata. The following code excerpt may be used to extract metadata from an Aperio SVS file: This is what the code example produced as an output: Raster accessThe primary object for raster data access is a scene. It makes the following details visible:
The scene name, rectangle, and resolution are retrieved by the code snippet that follows. It generates the subsequent result: The picture is 19445 pixels high and 19919 pixels wide. It is 0.4962 mkm in both x and y directions for each pixel. There are three channels in the picture. The picture format determines the meaning of a channel in bio images. The colours for the bright field photos are limited to red, green, and blue. These photos have three 8-bit channels. The functions get_chanel_data_type and get_channel_name provide access to channel attributes. Output: uint8 uint8 uint8 The read_block method gets the continuous region's pixel values. When the method is run without any arguments, the entire scene is returned to its original size. Usually, the big size makes it impossible to read the entire image at the original scale. In this scenario, the application has three options: it may either get a portion of the image or downscale it to a reasonable size. Below is a sample of code. pulls up the entire image and enlarges it to a 500-pixel wide image. It should be noted that when the picture height is zero, it means that an automated calculation is required to maintain the same scale in both the x and y axes. ![]() The following code snippet reads a rectangular section from the picture and reduces its width to 500 pixels. ![]() Reading a single channel or a selection of channels is feasible: ![]() Reading of volumes and time series is possible with additional tuple-parameters slices and frames: Code: Output: (1000, 1000, 27) Code: InstallationThe slideio library can be installed with pip: Only Windows and Linux builds are supported at this time. ConclusionA Python tool called Slideio interprets medical pictures. It enables reading of both entire slides and specific areas of slides. Large slides can be efficiently reduced in size. To expedite the scaling process, the module uses internal zoom pyramids of photos. Slideio can handle time series and 3D data sets in addition to 2D presentations. The library works with several well-known image analysis packages, including opencv, and provides rasters as numpy arrays. As of right now, it can read general formats, Zeiss CZI files, and Aperio SVS and AFI files. Drivers for the following formats will soon be available:
|
ChromaDB is the state of the art, open-source vector database that is optimized for I/O and management of the embeddings. Embeddings are numerical entities that are derived from machine learning techniques which helps in coding the context of the data such as the text, images or...
6 min read
Equivalent to Matlab's Images in Python Matplotlib Understanding Maltab Matlab is a high-level programming language and interactive environment primarily used for numerical computing, visualization, and data analysis. Originally developed by MathWorks, Matlab allows users to perform matrix manipulations, implement algorithms, create user interfaces, and visualize data, among...
22 min read
In the world of programming, asterisk (*) is not merely a symbol; it's a versatile and powerful operator with a multitude of applications. Python, a popular and user-friendly programming language, fully embraces the asterisk's capabilities. In this comprehensive guide, we will delve into the various...
6 min read
? Introduction: In the realm of data science and analysis, efficient data handling is paramount. One of the most alent data formats is the Comma-Separated Values (CSV) file, which serves as a standard for storing tabular data. To harness the power of Python for data manipulation, the...
4 min read
SQL stands for Structured Query Language. SQL is a programming language in which queries are made on relational databases. SQL is used widely in the field of Data Science, and SQL is used with Python to make the work easy. Structured query language is used...
9 min read
? Overview of Pandas Pandas is a famous open-source information control and examination library for Python. It gives information designs to proficiently putting away and controlling huge datasets and instruments for working with organized information consistently. The essential information structures in Pandas are Series and Data Frame." Pandas:...
9 min read
Naïve Time Series Forecasting in Python The naïve forecasting method is one of the simplest forms of demand forecasting used commonly by the sales and finance departments. This method operates on the principle of simplicity: it supposes that future demand is best modeled by the pattern observed...
10 min read
Positional-only arguments in Python are a feature introduced in Python 3.8 that allows you to specify function parameters that can only be provided by position rather than by keyword. This feature improves the readability and usability of functions, particularly when you want to impose a...
4 min read
Introduction to Distributed Processing In today's computing world, data production and handling have grown. This growth has created a need for stronger computational methods and infrastructure. Distributed processing is an approach that tackles the challenges of scaling computation to handle huge datasets and complex algorithms. This method...
9 min read
Python is a high-level, interpreted programming language recognized for its simplicity and clarity. Created by way of Guido van Rossum and first launched in 1991, Python emphasizes code readability with its use of tremendous indentation. It supports multiple programming paradigms, such as procedural, item-oriented, and...
4 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India