Skip to content

Commit

Permalink
Corrected malformed XML. Issue #33
Browse files Browse the repository at this point in the history
  • Loading branch information
anders9ustafsson committed Mar 7, 2017
1 parent 25ca8ac commit bcbd8be
Show file tree
Hide file tree
Showing 15 changed files with 136 additions and 448 deletions.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Provide System.Drawing.Bitmap support for image rendering with .NET Core (#409 #450 #459)
* Added optional parameter for use in extended DicomService (#348 #441)
* Remove warning messages during build (#33 #438)
* Online and NuGet packages API documentation (#28 #459)
* Online and NuGet packages API documentation (#28 #459 #466)

#### v.3.0.1 (3/06/2017)
* Add runtime directives to enable .NET Native builds for UWP (#424 #460)
Expand Down
2 changes: 1 addition & 1 deletion DICOM/DicomTagGenerated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5513,7 +5513,7 @@ public partial class DicomTag
///<summary>(0028,1054) VR=LO VM=1 Rescale Type</summary>
public readonly static DicomTag RescaleType = new DicomTag(0x0028, 0x1054);

///<summary>(0028,1055) VR=LO VM=1-n Window Center & Width Explanation</summary>
///<summary>(0028,1055) VR=LO VM=1-n Window Center &amp; Width Explanation</summary>
public readonly static DicomTag WindowCenterWidthExplanation = new DicomTag(0x0028, 0x1055);

///<summary>(0028,1056) VR=CS VM=1 VOI LUT Function</summary>
Expand Down
3 changes: 2 additions & 1 deletion DICOM/DicomTagGenerated.tt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ namespace Dicom
foreach (var kv in tags)
{
var tag = kv.Value;
var description = ToXmlValidDescription(tag.Item4);
#>
///<summary>(<#= tag.Item1 #>,<#= tag.Item2 #>) VR=<#= tag.Item5 #> VM=<#= tag.Item6 #> <#= tag.Item4 #><#= tag.Item7 ? " (RETIRED)" : "" #></summary>
///<summary>(<#= tag.Item1 #>,<#= tag.Item2 #>) VR=<#= tag.Item5 #> VM=<#= tag.Item6 #> <#= description #><#= tag.Item7 ? " (RETIRED)" : "" #></summary>
public readonly static DicomTag <#= ToTagKeyword(tag.Item3, tag.Item7) #> = new DicomTag(0x<#= ToStrictNumeric(tag.Item1) #>, 0x<#= ToStrictNumeric(tag.Item2) #>);

<#
Expand Down
168 changes: 34 additions & 134 deletions DICOM/IO/Buffer/ByteBufferByteSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ public ByteBufferByteSource(params IByteBuffer[] buffers)

#region PROPERTIES

/// <summary>
/// Gets or sets the endianess.
/// </summary>
/// <inheritdoc />
public Endian Endian
{
get
Expand All @@ -112,81 +110,41 @@ public Endian Endian
}
}

/// <summary>
/// Gets the current read position.
/// </summary>
public long Position
{
get
{
return _position;
}
}
/// <inheritdoc />
public long Position => _position;

/// <summary>
/// Gets the position of the current marker.
/// </summary>
public long Marker
{
get
{
return _marker;
}
}
/// <inheritdoc />
public long Marker => _marker;

/// <summary>
/// Gets whether end-of-source is reached.
/// </summary>
/// <inheritdoc />
public bool IsEOF
{
get
{
lock (_lock)
{
return _fixed && (_position >= _length);
return _fixed && _position >= _length;
}
}
}

/// <summary>
/// Gets whether its possible to rewind the source.
/// </summary>
public bool CanRewind
{
get
{
return true;
}
}
/// <inheritdoc />
public bool CanRewind => true;

/// <summary>
/// Gets the milestone levels count.
/// </summary>
public int MilestonesCount
{
get
{
return this._milestones.Count;
}
}
/// <inheritdoc />
public int MilestonesCount => this._milestones.Count;

#endregion

#region METHODS

/// <summary>
/// Gets one byte from the current position and moves to subsequent position.
/// </summary>
/// <returns>Single byte.</returns>
/// <inheritdoc />
public byte GetUInt8()
{
return NextByte();
}

/// <summary>
/// Gets a signed short (16 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Signed short.</returns>
/// <inheritdoc />
public short GetInt16()
{
if (Endian == Endian.LocalMachine)
Expand All @@ -199,10 +157,7 @@ public short GetInt16()
}
}

/// <summary>
/// Gets an unsigned short (16 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Unsigned short.</returns>
/// <inheritdoc />
public ushort GetUInt16()
{
if (Endian == Endian.LocalMachine)
Expand All @@ -215,10 +170,7 @@ public ushort GetUInt16()
}
}

/// <summary>
/// Gets a signed integer (32 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Signed integer.</returns>
/// <inheritdoc />
public int GetInt32()
{
if (Endian == Endian.LocalMachine)
Expand All @@ -231,10 +183,7 @@ public int GetInt32()
}
}

/// <summary>
/// Gets an unsigned integer (32 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Unsigned integer.</returns>
/// <inheritdoc />
public uint GetUInt32()
{
if (Endian == Endian.LocalMachine)
Expand All @@ -249,55 +198,39 @@ public uint GetUInt32()
}
}

/// <summary>
/// Gets a signed long (64 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Signed long.</returns>
/// <inheritdoc />
public long GetInt64()
{
byte[] b = GetBytes(8);
if (Endian != Endian.LocalMachine) Array.Reverse(b);
return BitConverter.ToInt64(b, 0);
}

/// <summary>
/// Gets an unsigned long (64 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Unsigned long.</returns>
/// <inheritdoc />
public ulong GetUInt64()
{
byte[] b = GetBytes(8);
if (Endian != Endian.LocalMachine) Array.Reverse(b);
return BitConverter.ToUInt64(b, 0);
}

/// <summary>
/// Gets a single precision floating point value (32 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Single precision floating point value.</returns>
/// <inheritdoc />
public float GetSingle()
{
byte[] b = GetBytes(4);
if (Endian != Endian.LocalMachine) Array.Reverse(b);
return BitConverter.ToSingle(b, 0);
}

/// <summary>
/// Gets a double precision floating point value (64 bits) from the current position and moves to subsequent position.
/// </summary>
/// <returns>Double precision floating point value.</returns>
/// <inheritdoc />
public double GetDouble()
{
byte[] b = GetBytes(8);
if (Endian != Endian.LocalMachine) Array.Reverse(b);
return BitConverter.ToDouble(b, 0);
}

/// <summary>
/// Gets a specified number of bytes from the current position and moves to subsequent position.
/// </summary>
/// <param name="count">Number of bytes to read.</param>
/// <returns>Array of bytes.</returns>
/// <inheritdoc />
public byte[] GetBytes(int count)
{
lock (_lock)
Expand All @@ -323,32 +256,21 @@ public byte[] GetBytes(int count)
}
}

/// <summary>
/// Gets a byte buffer of specified length from the current position and moves to subsequent position.
/// </summary>
/// <param name="count">Number of bytes to read.</param>
/// <returns>Byte buffer containing the read bytes.</returns>
/// <inheritdoc />
public IByteBuffer GetBuffer(uint count)
{
return new MemoryByteBuffer(GetBytes((int)count));
}

#if !NET35
/// <summary>
/// Asynchronously gets a byte buffer of specified length from the current position and moves to subsequent position.
/// </summary>
/// <param name="count">Number of bytes to read.</param>
/// <returns>Awaitable byte buffer containing the read bytes.</returns>
/// <inheritdoc />
public Task<IByteBuffer> GetBufferAsync(uint count)
{
return Task.FromResult(this.GetBuffer(count));
}
#endif

/// <summary>
/// Skip position <see cref="count"/> number of bytes.
/// </summary>
/// <param name="count">Number of bytes to skip.</param>
/// <inheritdoc />
public void Skip(int count)
{
lock (_lock)
Expand All @@ -359,9 +281,7 @@ public void Skip(int count)
}
}

/// <summary>
/// Set a mark at the current position.
/// </summary>
/// <inheritdoc />
public void Mark()
{
lock (_lock)
Expand All @@ -376,9 +296,7 @@ public void Mark()
}
}

/// <summary>
/// Rewind byte source to latest <see cref="IByteSource.Marker"/>.
/// </summary>
/// <inheritdoc />
public void Rewind()
{
lock (_lock)
Expand All @@ -388,27 +306,19 @@ public void Rewind()
}
}

/// <summary>
/// Mark the position of a new level of milestone.
/// </summary>
/// <param name="count">Expected distance in bytes from the current position to the milestone.</param>
/// <inheritdoc />
public void PushMilestone(uint count)
{
lock (_lock) _milestones.Push(_position + count);
}

/// <summary>
/// Pop the uppermost level of milestone.
/// </summary>
/// <inheritdoc />
public void PopMilestone()
{
lock (_lock) _milestones.Pop();
}

/// <summary>
/// Checks whether the byte source position is at the uppermost milestone position.
/// </summary>
/// <returns>true if uppermost milestone is reached, false otherwise.</returns>
/// <inheritdoc />
public bool HasReachedMilestone()
{
lock (_lock)
Expand All @@ -418,23 +328,13 @@ public bool HasReachedMilestone()
}
}

/// <summary>
/// Verifies that there is a sufficient number of bytes to read.
/// </summary>
/// <param name="count">Required number of bytes.</param>
/// <returns>true if source contains sufficient number of remaining bytes, false otherwise.</returns>
/// <inheritdoc />
public bool Require(uint count)
{
return Require(count, null, null);
}

/// <summary>
/// Verifies that there is a sufficient number of bytes to read.
/// </summary>
/// <param name="count">Required number of bytes.</param>
/// <param name="callback">Byte source callback.</param>
/// <param name="state">Callback state.</param>
/// <returns>true if source contains sufficient number of remaining bytes, false otherwise.</returns>
/// <inheritdoc />
public bool Require(uint count, ByteSourceCallback callback, object state)
{
lock (_lock)
Expand Down Expand Up @@ -496,7 +396,7 @@ private static void Callback(IAsyncResult result)
{
try
{
ByteSourceCallback cb = (ByteSourceCallback)result.AsyncState;
var cb = (ByteSourceCallback)result.AsyncState;
cb.EndInvoke(result);
}
catch
Expand All @@ -512,9 +412,9 @@ private bool SwapBuffers()
{
lock (_lock)
{
long pos = _position - _expired;
var pos = _position - _expired;

for (int i = 0; i < _buffers.Count; i++)
for (var i = 0; i < _buffers.Count; i++)
{
if (pos < _buffers[i].Size)
{
Expand Down
2 changes: 1 addition & 1 deletion DICOM/IO/Buffer/IBulkDataUriByteBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Dicom.IO.Buffer
public interface IBulkDataUriByteBuffer : IByteBuffer
{
/// <summary>
/// Gets the URI of a bulk data element as defined in <see cref="http://dicom.nema.org/medical/dicom/current/output/chtml/part19/chapter_A.html#table_A.1.5-2">Table A.1.5-2 in PS3.19</see>.
/// Gets the URI of a bulk data element as defined in <see cref="!:http://dicom.nema.org/medical/dicom/current/output/chtml/part19/chapter_A.html#table_A.1.5-2">Table A.1.5-2 in PS3.19</see>.
/// </summary>
string BulkDataUri { get; }
}
Expand Down
Loading

0 comments on commit bcbd8be

Please sign in to comment.