Example #1
0
        public static T CreateObject <T>(this DicomDataset ds, Func <T> factory)
        {
            T obj = factory();

            ds.FillObject(obj);

            List <ValidationResult> results = new List <ValidationResult>();

            if (!Validator.TryValidateObject(obj, new ValidationContext(obj), results, true))
            {
                _logger.Error("Failed to create dicom object from a dataset: {@results}");
                return(default(T));
            }

            return(obj);
        }