Add(DicomTag.PixelData, pixels);
DicomVR vr = null;
if (values != null) vr = entry.ValueRepresentations.FirstOrDefault(x => x.ValueType == typeof(T));
if (vr == null) vr = entry.ValueRepresentations.First();
typeof(T)
UInt16 while OW value type is UInt16[] so the first line ends with vr=null then the second line puts in the default which is OB.Add(DicomTag.PixelData, new []{pixels});
if (vr == DicomVR.OW)
{
if (values == null) return DoAdd(new DicomOtherWord(tag, EmptyBuffer.Value), allowUpdate);
if (typeof(T) == typeof(ushort)) return DoAdd(new DicomOtherWord(tag, values.Cast<ushort>().ToArray()), allowUpdate);
if (typeof(T) == typeof(IByteBuffer) && values.Count == 1)
{
return DoAdd(new DicomOtherWord(tag, (IByteBuffer)values[0]), allowUpdate);
}
}
typeof(T) == typeof(ushort)
evaluates as false as T is recognized as UInt16[]
Regards
Anders @ Cureos