Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DicomFileRunner should process files in parallel #440

Open
rkm opened this issue Feb 2, 2024 · 0 comments
Open

DicomFileRunner should process files in parallel #440

rkm opened this issue Feb 2, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@rkm
Copy link
Member

rkm commented Feb 2, 2024

Should be a straightforward change, but probably requires the report classes to handle concurrent writes if they don't already.

public override int Run()
{
_logger.Info($"Recursing from Directory: {_opts.Directory}");
if (!FileSystem.Directory.Exists(_opts.Directory))
{
_logger.Info($"Cannot Find directory: {_opts.Directory}");
throw new ArgumentException($"Cannot Find directory: {_opts.Directory}");
}
ProcessDirectory(_opts.Directory);
CloseReports();
return errors;
}
private void ProcessDirectory(string root)
{
//deal with files first
foreach (var file in FileSystem.Directory.GetFiles(root, _opts.Pattern))
{
try
{
ValidateDicomFile(FileSystem.FileInfo.New(file));
}
catch (Exception ex)
{
if (ThrowOnError)
{
throw;
}
else
{
_logger.Error(ex, $"Failed to validate {file}");
errors++;
}
}
}

@rkm rkm added the enhancement New feature or request label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant