Skip to content

Commit

Permalink
Add back second time scale to spectrograms.
Browse files Browse the repository at this point in the history
Issue #278 Add back second time scale to spectrograms. Do this so do not have to fix unit tests!
  • Loading branch information
towsey committed Dec 12, 2019
1 parent 85f32ce commit de70d9b
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/AudioAnalysisTools/StandardSpectrograms/BaseSonogram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ public Image GetImageFullyAnnotated(Image image, string title, int[,] gridLineLo

var titleBar = LDSpectrogramRGB.DrawTitleBarOfGrayScaleSpectrogram(title, image.Width);
var timeBmp = ImageTrack.DrawTimeTrack(this.Duration, image.Width);
//var list = new List<Image> { titleBar, timeBmp, image, timeBmp };
var list = new List<Image> { titleBar, image, timeBmp };
var list = new List<Image> { titleBar, timeBmp, image, timeBmp };
var compositeImage = ImageTools.CombineImagesVertically(list);
return compositeImage;
}
Expand Down Expand Up @@ -717,6 +716,24 @@ public static Image GetImageAnnotatedWithLinearHertzScale(Image image, int sampl
return image;
}

/// <summary>
/// This method draws only top and bottom time scales and adds the title bar.
/// It does NOT include the frequency grid lines.
/// </summary>
public static Image FrameSonogram(
Image sonogramImage,
Image titleBar,
TimeSpan minuteOffset,
TimeSpan xAxisTicInterval,
TimeSpan xAxisPixelDuration,
TimeSpan labelInterval)
{
int imageWidth = sonogramImage.Width;
var timeBmp = ImageTrack.DrawShortTimeTrack(minuteOffset, xAxisPixelDuration, xAxisTicInterval, labelInterval, imageWidth, "Seconds");
Image[] imageArray = { titleBar, timeBmp, sonogramImage, timeBmp };
return ImageTools.CombineImagesVertically(imageArray);
}

/// <summary>
/// This method assumes that the height of the passed sonogram image is half of the original frame size.
/// This assumption allows the frequency scale grid lines to be placed at the correct intervals.
Expand All @@ -741,7 +758,7 @@ public static Image FrameSonogram(

int imageWidth = sonogramImage.Width;
var timeBmp = ImageTrack.DrawShortTimeTrack(minuteOffset, xAxisPixelDuration, xAxisTicInterval, labelInterval, imageWidth, "Seconds");
Image[] imageArray = { titleBar, sonogramImage, timeBmp };
Image[] imageArray = { titleBar, timeBmp, sonogramImage, timeBmp };
return ImageTools.CombineImagesVertically(imageArray);
}

Expand Down

0 comments on commit de70d9b

Please sign in to comment.