You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private static void Anonymize(string source, string name = "Sanitized", string id = "99999")
{
var toAnonymize = Directory.GetFiles(source);
var settings = AnonymizationSettings.Default;
//Change mapping but keep connections
settings.DoAnonymizeUIDs = false;
settings.FirstName = name;
settings.LastName = " ";
settings.Id = id;
//Gets a current list of UIDs so it can create new ones
var queue = EvilDICOM.Anonymization.AnonymizationQueue.BuildQueue(settings, toAnonymize);
for (int i = 0; i < toAnonymize.Length; i++)
{
Console.WriteLine("Anonymizing {0}", toAnonymize[i]);
var dcm = DICOMObject.Read(toAnonymize[i]);
queue.Anonymize(dcm);
//Write back to initial location - though this can be a different place
dcm.Write(toAnonymize[i]);
}
}
When I now execute the function it throws the following execption on queue.Anonymize(dcm);
Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List1.Enumerator.MoveNext() at System.Linq.Enumerable.WhereListIterator1.MoveNext()
at EvilDICOM.Anonymization.Anonymizers.PrivateTagAnonymizer.Anonymize(DICOMObject d)
at EvilDICOM.Anonymization.AnonymizationQueue.Anonymize(DICOMObject dcm)
at DicomSanitzer.Program.Anonymize(String source, String name, String id) in C:\Users[WINDOWSUSER]\source\repos\Toolbox\DicomSanitzer\Program.cs:line 49
The text was updated successfully, but these errors were encountered:
My function is pretty similar to the example from the wiki.
Wiki - Anonymization Operations
When I now execute the function it throws the following execption on queue.Anonymize(dcm);
Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List
1.Enumerator.MoveNext() at System.Linq.Enumerable.WhereListIterator
1.MoveNext()at EvilDICOM.Anonymization.Anonymizers.PrivateTagAnonymizer.Anonymize(DICOMObject d)
at EvilDICOM.Anonymization.AnonymizationQueue.Anonymize(DICOMObject dcm)
at DicomSanitzer.Program.Anonymize(String source, String name, String id) in C:\Users[WINDOWSUSER]\source\repos\Toolbox\DicomSanitzer\Program.cs:line 49
The text was updated successfully, but these errors were encountered: