BioLib  4.3.0
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.

Constructor & Destructor Documentation

◆ SlideSliceLayer()

BioLib.SlideSliceLayer.SlideSliceLayer ( ISlideSource slideSource)
24 : base()
25 {
26 _slideSource = slideSource;
27 Name = "SliceLayer";
28 Extent = slideSource.Schema.Extent.ToMRect();
29 }

Member Function Documentation

◆ GetFeatures()

override IEnumerable< IFeature > BioLib.SlideSliceLayer.GetFeatures ( MRect box,
double resolution )
32 {
33 if (box is null) return Enumerable.Empty<IFeature>();
34 // Repaint on debouncing, resolution changed(zoom map) or box changed(resize control) .
35 if (_lastExtent.ToMRect().Centroid.Distance(box.Centroid) > 2 * resolution || _lastResolution != resolution || _lastExtent.Width != box.Width || _lastExtent.Height != box.Height)
36 {
37 _lastExtent = box.ToExtent();
38 _lastResolution = resolution;
39 MRect box2 = box.Grow(SymbolStyle.DefaultWidth * 2.0 * resolution, SymbolStyle.DefaultHeight * 2.0 * resolution);
40 var sliceInfo = new SliceInfo() { Extent = box2.ToExtent(), Resolution = resolution };
41 var bytes = _slideSource.GetSlice(sliceInfo, new AForge.PointD(box.MinX,box.MinY), new AForge.Size((int)box.Width,(int) box.Height));
42 if (bytes != null && _lastFeatures.FirstOrDefault() is IFeature feature)
43 {
44 feature = new RasterFeature(new MRaster(bytes.Result, box2));
45 }
46 }
47 return _lastFeatures;
48 }

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