diff --git a/AudioAnalysis.sln b/AudioAnalysis.sln
index 8a480992d..0acaebcb1 100644
--- a/AudioAnalysis.sln
+++ b/AudioAnalysis.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29721.120
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31410.414
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A050BD53-DEE0-40F3-BEAB-1F7474533C40}"
ProjectSection(SolutionItems) = preProject
@@ -68,6 +68,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{B3123A8D
build\update_audio_utils.ps1 = build\update_audio_utils.ps1
EndProjectSection
EndProject
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ConfigFiles", "src\AnalysisConfigFiles\ConfigFiles.shproj", "{17DF521A-7CC1-48D9-BE0D-32F6FA13BB8A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/src/AnalysisConfigFiles/ConfigFiles.projitems b/src/AnalysisConfigFiles/ConfigFiles.projitems
new file mode 100644
index 000000000..1beb91bbe
--- /dev/null
+++ b/src/AnalysisConfigFiles/ConfigFiles.projitems
@@ -0,0 +1,15 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ 17df521a-7cc1-48d9-be0d-32f6fa13bb8a
+
+
+ ConfigFiles
+
+
+
+
+
+
diff --git a/src/AnalysisConfigFiles/ConfigFiles.shproj b/src/AnalysisConfigFiles/ConfigFiles.shproj
new file mode 100644
index 000000000..c0c70ad24
--- /dev/null
+++ b/src/AnalysisConfigFiles/ConfigFiles.shproj
@@ -0,0 +1,13 @@
+
+
+
+ 17df521a-7cc1-48d9-be0d-32f6fa13bb8a
+ 14.0
+
+
+
+
+
+
+
+
diff --git a/src/AnalysisConfigFiles/Ecosounds.AED.yml b/src/AnalysisConfigFiles/Ecosounds.AED.yml
index c776673b5..f54e610f6 100644
--- a/src/AnalysisConfigFiles/Ecosounds.AED.yml
+++ b/src/AnalysisConfigFiles/Ecosounds.AED.yml
@@ -31,4 +31,4 @@ SaveIntermediateCsvFiles: false
SaveSonogramImages: Never
IndexPropertiesConfig: ".\\IndexPropertiesConfig.yml"
-...
\ No newline at end of file
+...
diff --git a/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.HighRes.yml b/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.HighRes.yml
index 7f5d1c8ad..6fdbcc05e 100644
--- a/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.HighRes.yml
+++ b/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.HighRes.yml
@@ -25,5 +25,12 @@ XAxisTicIntervalSeconds: 3600
# Only "Linear", "Linear125Octaves7Tones28Nyquist32000" work at present
FreqScale: "Linear"
YAxisTicInterval: 1000
+
+# "Chrome" is the term used to refer to all the decoration around the data.
+# If `true`, titles, axes, and grids will be drawn on the FCS.
+# If `false`, only the raw image will be output.
+# Raw images are useful if you want to use FCS in another application.
+ImageChrome: true
+
# IndexPropertiesConfig: './IndexPropertiesConfigHiRes.yml'
...
\ No newline at end of file
diff --git a/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.yml b/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.yml
index 729d8ac9b..d22db1500 100644
--- a/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.yml
+++ b/src/AnalysisConfigFiles/SpectrogramFalseColourConfig.yml
@@ -32,4 +32,10 @@ XAxisTicIntervalSeconds: 3600
#FreqScale: "Linear125Octaves7Tones28Nyquist32000"
FreqScale: "Linear"
YAxisTicInterval: 1000
+
+# "Chrome" is the term used to refer to all the decoration around the data.
+# If `true`, titles, axes, and grids will be drawn on the FCS.
+# If `false`, only the raw image will be output.
+# Raw images are useful if you want to use FCS in another application.
+ImageChrome: true
...
\ No newline at end of file
diff --git a/src/AnalysisConfigFiles/SpectrogramZoomingConfig.yml b/src/AnalysisConfigFiles/SpectrogramZoomingConfig.yml
index 2fb85a26a..2a91131c7 100644
--- a/src/AnalysisConfigFiles/SpectrogramZoomingConfig.yml
+++ b/src/AnalysisConfigFiles/SpectrogramZoomingConfig.yml
@@ -28,5 +28,6 @@ LdSpectrogramConfig:
XAxisTicIntervalSeconds: 3600
# Hertz
YAxisTicInterval: 1000
+ ImageChrome: false
IndexPropertiesConfig: './IndexPropertiesConfig.Zooming.yml'
...
\ No newline at end of file
diff --git a/src/AnalysisConfigFiles/Towsey.Acoustic.yml b/src/AnalysisConfigFiles/Towsey.Acoustic.yml
index 42d9730bf..db6a986dd 100644
--- a/src/AnalysisConfigFiles/Towsey.Acoustic.yml
+++ b/src/AnalysisConfigFiles/Towsey.Acoustic.yml
@@ -137,5 +137,11 @@ LdSpectrogramConfig:
# Future options will be: Linear62Octaves31Nyquist11025, Linear125Octaves30Nyquist11025, Octaves24Nyquist32000
FreqScale: "Linear"
YAxisTicInterval: 1000
+
+ # "Chrome" is the term used to refer to all the decoration around the data.
+ # If `true`, titles, axes, and grids will be drawn on the FCS.
+ # If `false`, only the raw image will be output.
+ # Raw images are useful if you want to use FCS in another application.
+ ImageChrome: true
...
diff --git a/src/AnalysisConfigFiles/Towsey.ContentDescription.yml b/src/AnalysisConfigFiles/Towsey.ContentDescription.yml
index 03924b430..5b5a29202 100644
--- a/src/AnalysisConfigFiles/Towsey.ContentDescription.yml
+++ b/src/AnalysisConfigFiles/Towsey.ContentDescription.yml
@@ -58,5 +58,6 @@ LdSpectrogramConfig:
XAxisTicIntervalSeconds: 3600
FreqScale: "Linear"
YAxisTicInterval: 1000
+ ImageChrome: true
...
diff --git a/src/AnalysisPrograms/AcousticIndices.cs b/src/AnalysisPrograms/AcousticIndices.cs
index e3963248b..47c7b72fa 100644
--- a/src/AnalysisPrograms/AcousticIndices.cs
+++ b/src/AnalysisPrograms/AcousticIndices.cs
@@ -76,7 +76,7 @@ public class AcousticIndicesConfig : IndexCalculateConfig
///
/// Gets or sets the LDFC spectrogram configuration.
///
- public LdSpectrogramConfig LdSpectrogramConfig { get; protected set; } = new LdSpectrogramConfig();
+ public LdSpectrogramConfig LdSpectrogramConfig { get; set; } = new LdSpectrogramConfig();
public bool TileOutput { get; private set; } = false;
@@ -318,6 +318,11 @@ public void SummariseResults(AnalysisSettings settings, FileSegment inputFileSeg
{
FileInfo indicesPropertiesConfig = acousticIndicesConfig.IndexPropertiesConfig.ToFileInfo();
+ // if needed override iamge chrome
+ if (tileOutput) {
+ ldSpectrogramConfig.ImageChrome = false;
+ }
+
// Actually draw false color / long duration spectrograms
Tuple, string>[] images =
LDSpectrogramRGB.DrawSpectrogramsFromSpectralIndices(
@@ -329,8 +334,7 @@ public void SummariseResults(AnalysisSettings settings, FileSegment inputFileSeg
basename: basename,
analysisType: this.Identifier,
indexSpectrograms: dictionaryOfSpectra,
- indexStatistics: indexDistributions,
- imageChrome: (!tileOutput).ToImageChrome());
+ indexStatistics: indexDistributions);
if (tileOutput)
{
diff --git a/src/AnalysisPrograms/ConcatenateIndexFiles.cs b/src/AnalysisPrograms/ConcatenateIndexFiles.cs
index 6160aa519..be88257e4 100644
--- a/src/AnalysisPrograms/ConcatenateIndexFiles.cs
+++ b/src/AnalysisPrograms/ConcatenateIndexFiles.cs
@@ -425,8 +425,7 @@ public static void Execute(Arguments arguments)
indexDistributions,
siteDescription,
sunriseDataFile: null,
- segmentErrors: gapsAndJoins,
- imageChrome: ImageChrome.With);
+ segmentErrors: gapsAndJoins);
}
WriteSpectralIndexFiles(resultsDir, outputFileStem, AcousticIndices.TowseyAcoustic, dictionaryOfSpectralIndices1);
@@ -549,8 +548,7 @@ public static void Execute(Arguments arguments)
indexDistributions,
siteDescription,
sunriseDataFile: null,
- segmentErrors: indexErrors,
- imageChrome: ImageChrome.With);
+ segmentErrors: indexErrors);
if (!arguments.EventDataDirectories.IsNullOrEmpty())
{
diff --git a/src/AnalysisPrograms/DrawLongDurationSpectrograms.cs b/src/AnalysisPrograms/DrawLongDurationSpectrograms.cs
index d68a684b9..a2f585e1d 100644
--- a/src/AnalysisPrograms/DrawLongDurationSpectrograms.cs
+++ b/src/AnalysisPrograms/DrawLongDurationSpectrograms.cs
@@ -176,8 +176,7 @@ public static void Execute(Arguments arguments)
analysisType: AcousticIndices.TowseyAcoustic,
indexSpectrograms: null,
indexStatistics: indexDistributionsData,
- segmentErrors: indexErrors,
- imageChrome: false.ToImageChrome());
+ segmentErrors: indexErrors);
Log.Success("Draw Long Duration Spectrograms complete!");
}
diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramConfig.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramConfig.cs
index 62a99a41f..191a627d7 100644
--- a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramConfig.cs
+++ b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramConfig.cs
@@ -64,6 +64,13 @@ public LdSpectrogramConfig()
///
public double? BlueEnhanceParameter { get; set; }
+ ///
+ /// Gets or sets a value indicating whether or not to render chrome around the FCS.
+ /// Chrome is all the decoration around the data; axes, grids, titles, etc.
+ ///
+ /// If true will render image chrome.
+ public bool ImageChrome { get; set; } = true;
+
///
/// Gets or sets the default XAxisTicInterval.
/// The default assumes one minute spectra i.e. 60 per hour
diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs
index 5a55e682e..3c6bc2b2c 100644
--- a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs
+++ b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGB.cs
@@ -75,6 +75,8 @@ public class LDSpectrogramRGB
// public static readonly string DefaultColorMap1 = "ACI, ENT, EVN";
// public static readonly string DefaultColorMap2 = "BGN, PMN, SPT";
+ public const int TrackHeight = 18;
+
// the defaults
public static readonly string DefaultColorMap1 = SpectrogramConstants.RGBMap_ACI_ENT_EVN;
public static readonly string DefaultColorMap2 = SpectrogramConstants.RGBMap_BGN_PMN_SPT;
@@ -524,7 +526,7 @@ public void LoadSpectrogramDictionary(Dictionary dictionary)
///
/// draws only those spectrograms in the passed array of keys.
///
- public void DrawGreyScaleSpectrograms(DirectoryInfo opdir, string opFileName, string[] keys)
+ public void DrawGreyScaleSpectrograms(DirectoryInfo opdir, string opFileName, string[] keys, ImageChrome chrome = ImageChrome.With)
{
foreach (string key in keys)
{
@@ -558,15 +560,22 @@ public void DrawGreyScaleSpectrograms(DirectoryInfo opdir, string opFileName, st
continue;
}
- var bmp = this.DrawGreyscaleSpectrogramOfIndex(key);
-
- var header = Drawing.NewImage(bmp.Width, 20, Color.LightGray);
- header.Mutate(g =>
+ var bmp = this.DrawGreyscaleSpectrogramOfIndex(key, chrome);
+ Image indexImage;
+ if (chrome is ImageChrome.With)
{
- g.DrawTextSafe(key, Drawing.Tahoma9, Color.Black, new PointF(4, 4));
- });
+ var header = Drawing.NewImage(bmp.Width, SpectrogramConstants.HEIGHT_OF_TITLE_BAR, Color.LightGray);
+ header.Mutate(g =>
+ {
+ g.DrawTextSafe(key, Drawing.Tahoma9, Color.Black, new PointF(4, 4));
+ });
- var indexImage = ImageTools.CombineImagesVertically(header, bmp);
+ indexImage = ImageTools.CombineImagesVertically(header, bmp);
+ }
+ else
+ {
+ indexImage = bmp;
+ }
// save the image - the directory for the path must exist
var path = FilenameHelpers.AnalysisResultPath(opdir, opFileName, key, "png");
@@ -576,7 +585,7 @@ public void DrawGreyScaleSpectrograms(DirectoryInfo opdir, string opFileName, st
///
/// Assume calling method has done all the reality checks.
- public Image DrawGreyscaleSpectrogramOfIndex(string key)
+ public Image DrawGreyscaleSpectrogramOfIndex(string key, ImageChrome chrome = ImageChrome.With)
{
var matrix = this.GetNormalisedSpectrogramMatrix(key);
if (matrix == null)
@@ -585,13 +594,18 @@ public Image DrawGreyscaleSpectrogramOfIndex(string key)
}
var bmp = ImageTools.DrawReversedMatrixWithoutNormalisation(matrix);
+
+ if (chrome is ImageChrome.Without)
+ {
+ return bmp;
+ }
+
var xAxisPixelDuration = this.IndexCalculationDuration;
var fullDuration = TimeSpan.FromTicks(xAxisPixelDuration.Ticks * bmp.Width);
- SpectrogramTools.DrawGridLinesOnImage((Image)bmp, this.StartOffset, fullDuration, xAxisPixelDuration, this.FreqScale);
- const int trackHeight = 20;
- var timeBmp = ImageTrack.DrawTimeTrack(fullDuration, this.RecordingStartDate, bmp.Width, trackHeight);
- var returnImage = ImageTools.CombineImagesVertically(bmp, timeBmp);
+ SpectrogramTools.DrawGridLinesOnImage(bmp, this.StartOffset, fullDuration, xAxisPixelDuration, this.FreqScale);
+ var timeBmp = ImageTrack.DrawTimeTrack(fullDuration, this.RecordingStartDate, bmp.Width, TrackHeight);
+ var returnImage = ImageTools.CombineImagesVertically(timeBmp, bmp, timeBmp);
return returnImage;
}
@@ -723,14 +737,13 @@ public bool ContainsMatrixForKey(string key)
public Image DrawDoubleSpectrogram(Image bmp1, Image bmp2, string colorMode)
{
var fullDuration = TimeSpan.FromSeconds(bmp2.Width); // assume one minute per pixel.
- const int trackHeight = 20;
- int imageHt = bmp2.Height + bmp1.Height + trackHeight + trackHeight + trackHeight;
+ int imageHt = bmp2.Height + bmp1.Height + TrackHeight + TrackHeight + TrackHeight;
var title =
$"FALSE COLOUR and BACKGROUND NOISE SPECTROGRAMS (scale: hours x kHz) (colour: R-G-B = {this.ColorMap}) {Meta.OrganizationTag} ";
- var titleBmp = ImageTrack.DrawTitleTrack(bmp2.Width, trackHeight, title);
+ var titleBmp = ImageTrack.DrawTitleTrack(bmp2.Width, TrackHeight, title);
var timeScale = SpectrogramConstants.X_AXIS_TIC_INTERVAL;
var offsetMinute = TimeSpan.Zero;
- var timeBmp = ImageTrack.DrawTimeTrack(fullDuration, offsetMinute, timeScale, bmp2.Width, trackHeight, "hours");
+ var timeBmp = ImageTrack.DrawTimeTrack(fullDuration, offsetMinute, timeScale, bmp2.Width, TrackHeight, "hours");
var compositeBmp = new Image(bmp2.Width, imageHt); //get canvas for entire image
compositeBmp.Mutate(gr =>
@@ -749,7 +762,7 @@ public Image DrawDoubleSpectrogram(Image bmp1, Image bmp2, string colorMo
// draw a colour spectrum of basic colours
int maxScaleLength = bmp2.Width / 3;
- var scale = DrawColourScale(maxScaleLength, trackHeight - 2);
+ var scale = DrawColourScale(maxScaleLength, TrackHeight - 2);
int xLocation = bmp2.Width * 2 / 3;
gr.DrawImage(scale, new Point(xLocation, 1), 1f); //dra
});
@@ -791,14 +804,13 @@ public static Image FrameLDSpectrogram(Image bmp1, Image ti
var xAxisPixelDuration = cs.IndexCalculationDuration;
var fullDuration = TimeSpan.FromTicks(xAxisPixelDuration.Ticks * bmp1.Width);
- int trackHeight = 18;
- Image timeBmp1 = ImageTrack.DrawTimeRelativeTrack(fullDuration, bmp1.Width, trackHeight);
+ Image timeBmp1 = ImageTrack.DrawTimeRelativeTrack(fullDuration, bmp1.Width, TrackHeight);
Image timeBmp2 = (Image)timeBmp1.Clone();
DateTimeOffset? dateTimeOffset = cs.RecordingStartDate;
if (dateTimeOffset.HasValue)
{
// draw extra time scale with absolute start time. AND THEN DO SOMETHING WITH IT.
- timeBmp2 = ImageTrack.DrawTimeTrack(fullDuration, cs.RecordingStartDate, bmp1.Width, trackHeight);
+ timeBmp2 = ImageTrack.DrawTimeTrack(fullDuration, cs.RecordingStartDate, bmp1.Width, TrackHeight);
}
if (cs.FreqScale == null)
@@ -857,9 +869,8 @@ public static Image DrawGreyscaleSpectrogramOfIndex(string key, double[,] matrix
var freqScale = new FrequencyScale(11025, 512, 1000);
SpectrogramTools.DrawGridLinesOnImage((Image)bmp, TimeSpan.Zero, fullDuration, xAxisPixelDuration, freqScale);
- const int trackHeight = 20;
var recordingStartDate = default(DateTimeOffset);
- var timeBmp = ImageTrack.DrawTimeTrack(fullDuration, recordingStartDate, bmp.Width, trackHeight);
+ var timeBmp = ImageTrack.DrawTimeTrack(fullDuration, recordingStartDate, bmp.Width, TrackHeight);
var array = new Image[2];
array[0] = bmp;
array[1] = timeBmp;
@@ -1102,7 +1113,6 @@ public static Image DrawColourScale(int maxScaleLength, int ht)
/// Optionally specify details about the site where the audio was recorded.
/// This is only available for locations near Brisbane, Austalia.
/// Note that these segment errors were derived from previous analysis of the summary indices.
- /// If true, this method generates and returns separate chromeless images used for tiling website images.
public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
DirectoryInfo inputDirectory,
DirectoryInfo outputDirectory,
@@ -1116,11 +1126,13 @@ public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
Dictionary indexStatistics = null,
SiteDescription siteDescription = null,
FileInfo sunriseDataFile = null,
- List segmentErrors = null,
- ImageChrome imageChrome = ImageChrome.With)
+ List segmentErrors = null)
{
var config = ldSpectrogramConfig;
+ ImageChrome imageChrome = ldSpectrogramConfig.ImageChrome.ToImageChrome();
+ Log.Debug($"FCS image will be rendered {imageChrome} chrome");
+
// These parameters manipulate the color map and appearance of the false-color spectrogram
string colorMap1 = config.ColorMap1 ?? DefaultColorMap1; // assigns indices to RGB
string colorMap2 = config.ColorMap2 ?? DefaultColorMap2; // assigns indices to RGB
@@ -1150,10 +1162,7 @@ public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
{
DateTimeOffset dto = (DateTimeOffset)indexGenerationData.RecordingStartDate;
cs1.RecordingStartDate = dto;
- if (dto != null)
- {
- cs1.StartOffset = dto.TimeOfDay + cs1.StartOffset;
- }
+ cs1.StartOffset = dto.TimeOfDay + cs1.StartOffset;
}
// Get and set the dictionary of index properties
@@ -1205,7 +1214,7 @@ public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
// draw gray scale spectrogram for each index.
var keys = SpectralIndexValues.Keys;
- cs1.DrawGreyScaleSpectrograms(outputDirectory, fileStem, keys);
+ cs1.DrawGreyScaleSpectrograms(outputDirectory, fileStem, keys, imageChrome);
// create and save first false-color spectrogram image
var image1NoChrome = cs1.DrawFalseColorSpectrogramChromeless(cs1.ColorMode, colorMap1, blueEnhanceParameter);
@@ -1216,9 +1225,11 @@ public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
}
else
{
- image1 = SpectrogramFraming(cs1, (Image)image1NoChrome.Clone());
- var outputPath1 = FilenameHelpers.AnalysisResultPath(outputDirectory, cs1.FileName, colorMap1, "png");
- image1.Save(outputPath1);
+ image1 = imageChrome is ImageChrome.With ? SpectrogramFraming(cs1, image1NoChrome.Clone()) : image1NoChrome;
+
+ var outputPath1 = FilenameHelpers.AnalysisResultPath(outputDirectory, cs1.FileName, colorMap1, "png");
+
+ image1.Save(outputPath1);
}
// create and save second false-color spectrogram image
@@ -1231,7 +1242,8 @@ public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
else
{
cs1.ColorMap = colorMap2;
- image2 = SpectrogramFraming(cs1, (Image)image2NoChrome.Clone());
+ image2 = imageChrome is ImageChrome.With ? image2 = SpectrogramFraming(cs1, image2NoChrome.Clone()) : image2NoChrome;
+
var outputPath2 = FilenameHelpers.AnalysisResultPath(outputDirectory, cs1.FileName, colorMap2, "png");
image2.Save(outputPath2);
}
@@ -1292,10 +1304,7 @@ public static Tuple, string>[] DrawSpectrogramsFromSpectralIndices(
ribbon.Save(FilenameHelpers.AnalysisResultPath(outputDirectory, fileStem, colorMap2 + LdSpectrogramRibbons.SpectralRibbonTag, "png"));
}
- // only return images if chromeless
- return imageChrome == ImageChrome.Without
- ? new[] { Tuple.Create(image1NoChrome, colorMap1), Tuple.Create(image2NoChrome, colorMap2) }
- : null;
+ return new[] { Tuple.Create(image1NoChrome, colorMap1), Tuple.Create(image2NoChrome, colorMap2) };
}
///
diff --git a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs
index 0aaf9d6a0..ca27daf9a 100644
--- a/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs
+++ b/src/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramStitching.cs
@@ -113,8 +113,7 @@ public static void DrawSpectralIndexFiles(
indexDistributions,
siteDescription,
sunriseDataFile,
- segmentErrors,
- ImageChrome.With);
+ segmentErrors);
}
}
diff --git a/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGBTests.cs b/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGBTests.cs
index c2bec37c5..06b0c0a8e 100644
--- a/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGBTests.cs
+++ b/tests/Acoustics.Test/AudioAnalysisTools/LongDurationSpectrograms/LDSpectrogramRGBTests.cs
@@ -22,8 +22,7 @@ namespace Acoustics.Test.AudioAnalysisTools.LongDurationSpectrograms
[TestClass]
public class LDSpectrogramRGBTests : OutputDirectoryTest
{
- [TestMethod]
- public void TestChromelessImage()
+ private void GenerateAndTestFakeFCS(LdSpectrogramConfig config, int expectedHeight)
{
var indexPropertiesFile = ConfigFile.Default();
var indexProperties = ConfigFile.Deserialize(indexPropertiesFile);
@@ -42,7 +41,7 @@ public void TestChromelessImage()
var images = LDSpectrogramRGB.DrawSpectrogramsFromSpectralIndices(
inputDirectory: null,
outputDirectory: this.TestOutputDirectory,
- ldSpectrogramConfig: new LdSpectrogramConfig(),
+ ldSpectrogramConfig: config,
indexPropertiesConfigPath: indexPropertiesFile,
indexGenerationData: new IndexGenerationData()
{
@@ -61,16 +60,49 @@ public void TestChromelessImage()
.Select((x) => new SummaryIndexValues(60.0.Seconds(), indexProperties))
.Cast()
.ToArray(),
- indexStatistics: indexStatistics,
- imageChrome: ImageChrome.Without);
+ indexStatistics: indexStatistics);
+
+ Assert.IsNotNull(images);
+ // chromeless images returned
foreach (var (image, key) in images)
{
Assert.That.ImageIsSize(60, 256, image);
- Assert.That.ImageRegionIsColor(Rectangle.FromLTRB(0, 0, 60, 256), Color.Black, (Image)image);
+ Assert.That.ImageRegionIsColor(Rectangle.FromLTRB(0, 0, 60, 256), Color.Black, image);
+ }
+
+ // check images on disk are chromed/chromeless
+ var imagesToCheck = images.Select(item => item.Item2).Concat(keys);
+ foreach (var key in imagesToCheck)
+ {
+ var image = FilenameHelpers.AnalysisResultPath(this.TestOutputDirectory, "RGB_TEST", key, "png");
+ this.TestContext.WriteLine($"Testing {key}, found {image}");
+ var info = Image.Identify(image);
+
+ Assert.AreEqual(60, info.Bounds().Width);
+ Assert.AreEqual(expectedHeight, info.Bounds().Height, $"Image {image} was not expected height {expectedHeight} but was {info.Height}");
}
}
+ [TestMethod]
+ public void TestChromedImage()
+ {
+ var config = new LdSpectrogramConfig();
+ Assert.IsTrue(config.ImageChrome, "Should render chrome by default");
+
+ var expectedHeight = 256 + SpectrogramConstants.HEIGHT_OF_TITLE_BAR + (LDSpectrogramRGB.TrackHeight * 2); // track height, bottom and top
+
+ this.GenerateAndTestFakeFCS(config, expectedHeight);
+ }
+
+ [TestMethod]
+ public void TestChromelessImage()
+ {
+ var config = new LdSpectrogramConfig() { ImageChrome = false };
+
+ this.GenerateAndTestFakeFCS(config, 256);
+ }
+
[TestMethod]
public void TestDrawRgbColorMatrix()
{