BioCore  4.0.1
A .NET library & program for annotating, editing various microscopy imaging formats using Bioformats supported images. Including whole slide, pyramidal, and series.
All Classes Namespaces Functions Enumerations Properties
BioCore.SlideImage Class Reference

openslide wrapper More...

Inheritance diagram for BioCore.SlideImage:

Public Member Functions

 SlideImage ()
 
ImageDimension GetLevelDimension (int level)
 Get the dimensions of a level. More...
 
IEnumerable< ImageDimension > GetLevelDimensions ()
 Get all level dimensions. More...
 
unsafe byte[] ReadRegion (int level, long x, long y, long width, long height)
 Copy pre-multiplied BGRA data from a whole slide image. More...
 
unsafe bool TryReadRegion (int level, long x, long y, long width, long height, out byte[] data, ZCT zct)
 Copy pre-multiplied BGRA data from a whole slide image. More...
 
void Close ()
 
void Dispose ()
 
async Task< byte[]> ReadRegionAsync (int level, long curLevelOffsetXPixel, long curLevelOffsetYPixel, int curTileWidth, int curTileHeight, ZCT coord)
 

Static Public Member Functions

static string DetectVendor (string filename)
 Quickly determine whether a whole slide image is recognized. More...
 
static void Initialize (string path=null)
 Add .dll directory to PATH More...
 
static SlideImage Open (BioImage b)
 Open. More...
 
static double CalculateBaseFactor (int originalResolution, int lastLevelResolution, int totalLevels)
 Calculates the base downsampling factor between two levels of a slide. More...
 
static List< double > GetLevelDownsamples (double baseDownsampleFactor, int totalLevels)
 Calculates the downsample factors for each level of a slide. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Dispose More...
 

Properties

BioImage BioImage [get, set]
 
int LevelCount [get]
 Get the number of levels in the whole slide image. More...
 
ImageDimension Dimensions [get]
 Get the dimensions of level 0 (the largest level). Exactly equivalent to calling GetLevelDimensions(0). More...
 

Detailed Description

openslide wrapper

Definition at line 19 of file SlideImage.cs.

Constructor & Destructor Documentation

◆ SlideImage()

BioCore.SlideImage.SlideImage ( )

Parameters
handle
isOwnerclose handle when disposed
Exceptions
OpenSlideException

Definition at line 49 of file SlideImage.cs.

Member Function Documentation

◆ CalculateBaseFactor()

static double BioCore.SlideImage.CalculateBaseFactor ( int  originalResolution,
int  lastLevelResolution,
int  totalLevels 
)
static

Calculates the base downsampling factor between two levels of a slide.

Parameters
originalDimensionThe dimension (width or height) of the original level.
nextLevelDimensionThe dimension (width or height) of the next level.
Returns
The base downsampling factor.

Definition at line 151 of file SlideImage.cs.

◆ Close()

void BioCore.SlideImage.Close ( )

Definition at line 256 of file SlideImage.cs.

◆ DetectVendor()

static string BioCore.SlideImage.DetectVendor ( string  filename)
static

Quickly determine whether a whole slide image is recognized.

If OpenSlide recognizes the file referenced by filename , return a string identifying the slide format vendor.This is equivalent to the value of the NativeMethods.VENDOR property. Calling Open(string) on this file will return a valid OpenSlide object or an OpenSlide object in error state.

Otherwise, return null.Calling Open(string) on this file will also return null.

Parameters
filenameThe filename to check. On Windows, this must be in UTF-8.
Returns
An identification of the format vendor for this file, or NULL.

Definition at line 39 of file SlideImage.cs.

◆ Dispose() [1/2]

void BioCore.SlideImage.Dispose ( )

Definition at line 291 of file SlideImage.cs.

◆ Dispose() [2/2]

virtual void BioCore.SlideImage.Dispose ( bool  disposing)
protectedvirtual

Dispose

Parameters
disposing

Definition at line 269 of file SlideImage.cs.

◆ GetLevelDimension()

ImageDimension BioCore.SlideImage.GetLevelDimension ( int  level)

Get the dimensions of a level.

Parameters
levelThe desired level.
Exceptions
OpenSlideException

Definition at line 127 of file SlideImage.cs.

◆ GetLevelDimensions()

IEnumerable< ImageDimension > BioCore.SlideImage.GetLevelDimensions ( )

Get all level dimensions.

Returns
Exceptions
OpenSlideException

Definition at line 137 of file SlideImage.cs.

◆ GetLevelDownsamples()

static List< double > BioCore.SlideImage.GetLevelDownsamples ( double  baseDownsampleFactor,
int  totalLevels 
)
static

Calculates the downsample factors for each level of a slide.

Parameters
baseDownsampleFactorThe downsample factor between each level.
totalLevelsTotal number of levels in the slide.
Returns
A list of downsample factors for each level.

Definition at line 173 of file SlideImage.cs.

◆ Initialize()

static void BioCore.SlideImage.Initialize ( string  path = null)
static

Add .dll directory to PATH

Parameters
path
Exceptions
OpenSlideException

Definition at line 59 of file SlideImage.cs.

◆ Open()

static SlideImage BioCore.SlideImage.Open ( BioImage  b)
static

Open.

Parameters
filename
Returns
Exceptions
OpenSlideException

Definition at line 74 of file SlideImage.cs.

◆ ReadRegion()

unsafe byte[] BioCore.SlideImage.ReadRegion ( int  level,
long  x,
long  y,
long  width,
long  height 
)

Copy pre-multiplied BGRA data from a whole slide image.

Parameters
levelThe desired level.
xThe top left x-coordinate, in the level 0 reference frame.
yThe top left y-coordinate, in the level 0 reference frame.
widthThe width of the region. Must be non-negative.
heightThe height of the region. Must be non-negative.
Returns
The pixel data of this region.
Exceptions
ArgumentOutOfRangeException
Exceptions
OpenSlideException

Definition at line 225 of file SlideImage.cs.

◆ ReadRegionAsync()

async Task< byte[]> BioCore.SlideImage.ReadRegionAsync ( int  level,
long  curLevelOffsetXPixel,
long  curLevelOffsetYPixel,
int  curTileWidth,
int  curTileHeight,
ZCT  coord 
)

Definition at line 297 of file SlideImage.cs.

◆ TryReadRegion()

unsafe bool BioCore.SlideImage.TryReadRegion ( int  level,
long  x,
long  y,
long  width,
long  height,
out byte[]  data,
ZCT  zct 
)

Copy pre-multiplied BGRA data from a whole slide image.

Parameters
levelThe desired level.
xThe top left x-coordinate, in the level 0 reference frame.
yThe top left y-coordinate, in the level 0 reference frame.
widthThe width of the region. Must be non-negative.
heightThe height of the region. Must be non-negative.
dataThe BGRA pixel data of this region.
Returns

summary> Close an OpenSlide object. /summary> remarks> No other threads may be using the object. After this call returns, the object cannot be used anymore. /remarks>

Definition at line 240 of file SlideImage.cs.

Property Documentation

◆ BioImage

BioImage BioCore.SlideImage.BioImage
getset

Definition at line 21 of file SlideImage.cs.

◆ Dimensions

ImageDimension BioCore.SlideImage.Dimensions
get

Get the dimensions of level 0 (the largest level). Exactly equivalent to calling GetLevelDimensions(0).

Exceptions
OpenSlideException

Definition at line 107 of file SlideImage.cs.

◆ LevelCount

int BioCore.SlideImage.LevelCount
get

Get the number of levels in the whole slide image.

<return>The number of levels, or -1 if an error occurred.</return>

Exceptions
OpenSlideException

Definition at line 86 of file SlideImage.cs.


The documentation for this class was generated from the following file: