BioLib  3.6.2
A GUI-less version of Bio .NET library for editing & annotating various microscopy image formats.
Loading...
Searching...
No Matches
BioLib.SlideSliceLayer Class Reference

Slide slice layer. More...

Inheritance diagram for BioLib.SlideSliceLayer:

Public Member Functions

 SlideSliceLayer (ISlideSource slideSource)
 
override IEnumerable< IFeature > GetFeatures (MRect box, double resolution)
 

Detailed Description

Slide slice layer.

Definition at line 20 of file SlideSliceLayer.cs.

Constructor & Destructor Documentation

◆ SlideSliceLayer()

BioLib.SlideSliceLayer.SlideSliceLayer ( ISlideSource slideSource)

Definition at line 27 of file SlideSliceLayer.cs.

27 : base()
28 {
29 _slideSource = slideSource;
30 Name = "SliceLayer";
31 Extent = slideSource.Schema.Extent.ToMRect();
32 }

Member Function Documentation

◆ GetFeatures()

override IEnumerable< IFeature > BioLib.SlideSliceLayer.GetFeatures ( MRect box,
double resolution )

Definition at line 34 of file SlideSliceLayer.cs.

35 {
36 if (box is null) return Enumerable.Empty<IFeature>();
37 // Repaint on debouncing, resolution changed(zoom map) or box changed(resize control) .
38 if (_lastExtent.ToMRect().Centroid.Distance(box.Centroid) > 2 * resolution || _lastResolution != resolution || _lastExtent.Width != box.Width || _lastExtent.Height != box.Height)
39 {
40 _lastExtent = box.ToExtent();
41 _lastResolution = resolution;
42 MRect box2 = box.Grow(SymbolStyle.DefaultWidth * 2.0 * resolution, SymbolStyle.DefaultHeight * 2.0 * resolution);
43 var sliceInfo = new SliceInfo() { Extent = box2.ToExtent(), Resolution = resolution };
44 var bytes = _slideSource.GetSlice(sliceInfo);
45 if (bytes != null && _lastFeatures.FirstOrDefault() is IFeature feature)
46 {
47 feature = new RasterFeature(new MRaster(bytes.Result, box2));
48 }
49 }
50 return _lastFeatures;
51 }
Task< byte[]> GetSlice(SliceInfo sliceInfo)
Get slice.

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