/// <summary> /// Implementation of method to load codecs from assembly(ies) at the specified <paramref name="path"/> and /// with the specified <paramref name="search"/> pattern. /// </summary> /// <param name="path">Directory path to codec assemblies.</param> /// <param name="search">Search pattern for codec assemblies.</param> protected override void LoadCodecsImpl(string path, string search) { if (IsLoaded) { return; } Codecs.Clear(); var foundAnyCodecs = false; var assembly = Assembly.GetExecutingAssembly(); var types = assembly.GetTypes(); var codecTypes = types.Where(t => typeof(IDicomCodec).IsAssignableFrom(t) && !t.IsAbstract); var log = LogManager.GetLogger("Efferent.Native.Codec"); foreach (var codecType in codecTypes) { foundAnyCodecs = true; IDicomCodec codec = (IDicomCodec)Activator.CreateInstance(codecType); Codecs[codec.TransferSyntax] = codec; } if (!foundAnyCodecs) { log.Warn("No Dicom codecs were found after searching {path}\\{wildcard}", path, search); } else { IsLoaded = true; var codecNames = string.Join("\n", Codecs.Keys.Select(k => "- " + k.ToString())); System.Diagnostics.Debug.WriteLine($"Codecs found:\n{codecNames}"); } }
/// <summary> /// Implementation of method to load codecs /// </summary> /// <param name="path">Directory path to codec assemblies</param> /// <param name="search">Search pattern for codec assemblies</param> protected override void LoadCodecsImpl(String path, String search) { // Clear all loaded codecs Codecs.Clear(); // Register the JPEG-LS near lossless decoder var jpegLsNearLosslessDecoder = (IDicomCodec)Activator.CreateInstance(typeof(DicomJpegLsNearLosslessDecoder)); Codecs[jpegLsNearLosslessDecoder.TransferSyntax] = jpegLsNearLosslessDecoder; // Register the JPEG-LS lossless decoder var jpegLsLosslessDecoder = (IDicomCodec)Activator.CreateInstance(typeof(DicomJpegLsLosslessDecoder)); Codecs[jpegLsLosslessDecoder.TransferSyntax] = jpegLsLosslessDecoder; }