Band class

Represents a horizontal band (aka strip) in an image/document.

A Band contains multiple Artifact objects and provides methods for analyzing their layout and characteristics.

Constructors

Band()
Creates a new Band instance.
Band.splitArtifactIntoBand({required Artifact regionMatrix, required IntOffset offset})
Creates a Band from an artifact region matrix.
factory

Properties

artifacts List<Artifact>
List of artifacts contained within this band.
getter/setter pair
averageKerning int
Gets the average kerning between adjacent artifacts in the band.
no setter
averageWidth int
Gets the average width of artifacts in the band.
no setter
hashCode int
The hash code for this object.
no setterinherited
kerningWidth int
Kerning between each artifact when applying packing
getter/setter pair
rectangleAdjusted IntRect
The bounding rectangle that encompasses all artifacts in the band.
no setter
rectangleOriginal IntRect
Gets the bounding rectangle of this object.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spacesCount int
Returns the count of space characters in the artifacts.
no setter

Methods

addArtifact(Artifact artifact) → void
Adds the given artifact to the band.
addArtifacts(List<Artifact> artifacts) → void
Adds all the given artifacts to the band.
calculateSpaceThreshold() int
Calculates an appropriate threshold for determining if a gap should be considered a space
clearStats() → void
Resets the cached statistics for kerning and width.
getText() String
Retrieves the concatenated text from all artifacts in the band.
getWideChunks() List<Artifact>
Identifies artifacts that are significantly wider than average.
identifySpacesInBand() → void
Identifies and inserts space artifacts between existing artifacts in the band.
identifySuspiciousLargeArtifacts() → void
Using the average artifact width, fine the ones that have an outlier width and tag them needsInspection=true
insertArtifactForSpace({required List<Artifact> artifacts, required int insertAtIndex, required int cols, required int rows, required IntOffset locationFoundAt}) → void
Inserts a space artifact at a specified position in the artifacts list.
mergeArtifactsBasedOnVerticalAlignment() → void
Merges connected artifacts based on specified thresholds.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
packArtifactLeftToRight() → void
Adjusts the positions of artifacts to pack them from left to right.
padVerticallyArtifactToMatchTheBand() → void
Vertically pads artifacts to match the height of the band.
removeEmptyArtifacts() → void
Removes all empty artifacts from the band's artifact list.
replaceOneArtifactWithMore(Artifact artifactToReplace, List<Artifact> artifactsToInsert) → void
Replaces a single artifact with multiple artifacts in the band.
shouldMergeArtifacts(Artifact artifact1, Artifact artifact2) bool
Determines if two artifacts should be merged based on their spatial relationship.
sortArtifactsLeftToRight() → void
Sorts the artifacts in this band from left to right.
splitChunk(Artifact artifactToSplit) List<Artifact>
Splits an artifact into multiple artifacts based on detected valleys.
toString() String
Returns a string representation of this Band.
override
updateStatistics() → void
Calculates the average Kerning between adjacent artifacts and their average width.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getBoundingBox(List<Artifact> artifacts, {bool useAdjustedRect = true}) IntRect
Calculates the bounding rectangle that encloses a list of artifacts.