Skip to content

Commit

Permalink
Merge pull request #503 from QutEcoacoustics/fcs-no-chrome
Browse files Browse the repository at this point in the history
Exposes ImageChrome option for FCS to users
  • Loading branch information
atruskie authored Jul 5, 2021
2 parents 255f184 + 5464a20 commit e26127a
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 59 deletions.
6 changes: 4 additions & 2 deletions AudioAnalysis.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/AnalysisConfigFiles/ConfigFiles.projitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>17df521a-7cc1-48d9-be0d-32f6fa13bb8a</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>ConfigFiles</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Include="**/*.*" />
<None Remove="*.projitems*" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions src/AnalysisConfigFiles/ConfigFiles.shproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>17df521a-7cc1-48d9-be0d-32f6fa13bb8a</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="ConfigFiles.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion src/AnalysisConfigFiles/Ecosounds.AED.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ SaveIntermediateCsvFiles: false
SaveSonogramImages: Never

IndexPropertiesConfig: ".\\IndexPropertiesConfig.yml"
...
...
Original file line number Diff line number Diff line change
Expand Up @@ -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'
...
6 changes: 6 additions & 0 deletions src/AnalysisConfigFiles/SpectrogramFalseColourConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
...
1 change: 1 addition & 0 deletions src/AnalysisConfigFiles/SpectrogramZoomingConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ LdSpectrogramConfig:
XAxisTicIntervalSeconds: 3600
# Hertz
YAxisTicInterval: 1000
ImageChrome: false
IndexPropertiesConfig: './IndexPropertiesConfig.Zooming.yml'
...
6 changes: 6 additions & 0 deletions src/AnalysisConfigFiles/Towsey.Acoustic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
...

1 change: 1 addition & 0 deletions src/AnalysisConfigFiles/Towsey.ContentDescription.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ LdSpectrogramConfig:
XAxisTicIntervalSeconds: 3600
FreqScale: "Linear"
YAxisTicInterval: 1000
ImageChrome: true
...

10 changes: 7 additions & 3 deletions src/AnalysisPrograms/AcousticIndices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class AcousticIndicesConfig : IndexCalculateConfig
/// <summary>
/// Gets or sets the LDFC spectrogram configuration.
/// </summary>
public LdSpectrogramConfig LdSpectrogramConfig { get; protected set; } = new LdSpectrogramConfig();
public LdSpectrogramConfig LdSpectrogramConfig { get; set; } = new LdSpectrogramConfig();

public bool TileOutput { get; private set; } = false;

Expand Down Expand Up @@ -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<Image<Rgb24>, string>[] images =
LDSpectrogramRGB.DrawSpectrogramsFromSpectralIndices(
Expand All @@ -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)
{
Expand Down
6 changes: 2 additions & 4 deletions src/AnalysisPrograms/ConcatenateIndexFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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())
{
Expand Down
3 changes: 1 addition & 2 deletions src/AnalysisPrograms/DrawLongDurationSpectrograms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public LdSpectrogramConfig()
/// </summary>
public double? BlueEnhanceParameter { get; set; }

/// <summary>
/// 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.
/// </summary>
/// <value>If <c>true</c> will render image chrome.</value>
public bool ImageChrome { get; set; } = true;

/// <summary>
/// Gets or sets the default XAxisTicInterval.
/// The default assumes one minute spectra i.e. 60 per hour
Expand Down
Loading

0 comments on commit e26127a

Please sign in to comment.