mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 06:36:31 +00:00
30 lines
912 B
C#
30 lines
912 B
C#
using System.IO;
|
|
using Azaion.Common.Database;
|
|
using Azaion.Common.DTO;
|
|
|
|
namespace Azaion.Common.Services;
|
|
|
|
public class AnnotationPathResolver : IAnnotationPathResolver
|
|
{
|
|
private readonly string _labelsDir;
|
|
private readonly string _imagesDir;
|
|
private readonly string _thumbDir;
|
|
|
|
public AnnotationPathResolver(DirectoriesConfig config)
|
|
{
|
|
_labelsDir = config.LabelsDirectory;
|
|
_imagesDir = config.ImagesDirectory;
|
|
_thumbDir = config.ThumbnailsDirectory;
|
|
}
|
|
|
|
public string GetImagePath(Annotation annotation) =>
|
|
Path.Combine(_imagesDir, $"{annotation.Name}{annotation.ImageExtension}");
|
|
|
|
public string GetLabelPath(Annotation annotation) =>
|
|
Path.Combine(_labelsDir, $"{annotation.Name}.txt");
|
|
|
|
public string GetThumbPath(Annotation annotation) =>
|
|
Path.Combine(_thumbDir, $"{annotation.Name}{Constants.THUMBNAIL_PREFIX}.jpg");
|
|
}
|
|
|