Skip to content

Commit

Permalink
Merge branch 'master' into release/2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jas88 committed Apr 7, 2020
2 parents 855354a + a1945bd commit 7b28bbb
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 52 deletions.
25 changes: 20 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
language: csharp
language: generic
mono: none
dotnet: 2.2.100
dist: bionic
os: linux

addons:
postgresql: "10"
apt:
packages:
- postgresql-10
- postgresql-client-10
sources:
- sourceline: 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main'
key_url: 'https://packages.microsoft.com/keys/microsoft.asc'
- sourceline: 'deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial main'

services:
- postgresql
- mysql
- postgresql
- mysql
env:
global:
- MSSQL_SA_PASSWORD="YourStrong!Passw0rd"
- ACCEPT_EULA=Y
- MSSQL_PID='developer'
cache:
directories:
- $HOME/.local/share/NuGet/
- $HOME/.nuget

before_script:
- sudo docker run --name=mssql-server-linux-latest -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=YourStrong!Passw0rd' -p 1433:1433 -d microsoft/mssql-server-linux:2017-latest
- sudo apt-get install -y --no-install-recommends mssql-tools mssql-server dotnet-runtime-2.2 dotnet-sdk-3.1
- sudo /opt/mssql/bin/mssql-conf -n setup accept-eula

script:
- dotnet restore
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@

- [Thomas Nind](https://github.com/tznind)
- [Leandro Tramma](https://github.com/Tallmaris)
- [James A Sutherland](https://github.com/jas88)
13 changes: 7 additions & 6 deletions DicomTypeTranslation.Tests/DicomTypeTranslation.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{877FAE0D-9EA7-4CA9-ADBB-B47913428ADE}</ProjectGuid>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AssemblyTitle>DicomTypeTranslation.Tests</AssemblyTitle>
<Product>DicomTypeTranslation.Tests</Product>
<Copyright>Copyright © 2018</Copyright>
Expand Down Expand Up @@ -57,10 +56,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="fo-dicom.Json" Version="[4.0.4]" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="NunitXml.TestLogger" Version="2.1.36" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NunitXml.TestLogger" Version="2.1.41" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DicomTypeTranslation\DicomTypeTranslation.csproj" />
Expand Down
23 changes: 20 additions & 3 deletions DicomTypeTranslation.Tests/JsonDicomConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Dicom.Serialization;
using DicomTypeTranslation.Converters;
using DicomTypeTranslation.Helpers;
using DicomTypeTranslation.Tests.ElevationTests;
using DicomTypeTranslation.Tests.Helpers;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand All @@ -24,7 +23,7 @@ public class JsonDicomConverterTests

private readonly JsonConverter _jsonDicomConverter;

private static readonly string _dcmDir = Path.Combine(TestContext.CurrentContext.TestDirectory , "TestDicomFiles");
private static readonly string _dcmDir = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestDicomFiles");

private readonly string _srDcmPath = Path.Combine(_dcmDir, "report01.dcm");
private readonly string _imDcmPath = Path.Combine(_dcmDir, "image11.dcm");
Expand Down Expand Up @@ -91,14 +90,32 @@ private void VerifyJsonTripleTrip(DicomDataset originalDataset, bool expectFail

// NOTE: Group length elements have been retired from the standard, and have never been included in any JSON conversion.
// Remove them here to allow comparison between datasets.
originalDataset.RemoveGroupLengths();
RemoveGroupLengths(originalDataset);

if (expectFail)
Assert.False(DicomDatasetHelpers.ValueEquals(originalDataset, recoDataset));
else
Assert.True(DicomDatasetHelpers.ValueEquals(originalDataset, recoDataset));
}

/// <summary>
/// Removes group length elements from the DICOM dataset. These have been retired in the DICOM standard.
/// </summary>
/// <remarks><see href="http://dicom.nema.org/medical/dicom/current/output/html/part05.html#sect_7.2"/></remarks>
/// <param name="dataset">DICOM dataset</param>
private static void RemoveGroupLengths(DicomDataset dataset)
{
if (dataset == null)
return;

dataset.Remove(x => x.Tag.Element == 0x0000);

// Handle sequences
foreach (DicomSequence sq in dataset.Where(x => x.ValueRepresentation == DicomVR.SQ).Cast<DicomSequence>())
foreach (DicomDataset item in sq.Items)
RemoveGroupLengths(item);
}

private static void ValidatePrivateCreatorsExist(DicomDataset dataset)
{
foreach (DicomItem item in dataset)
Expand Down
2 changes: 1 addition & 1 deletion DicomTypeTranslation.Tests/TestDatabases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</TestDatabase>
<TestDatabase>
<DatabaseType>MySql</DatabaseType>
<ConnectionString>server=127.0.0.1;Uid=root;Pwd=;Ssl-Mode=None</ConnectionString>
<ConnectionString>server=127.0.0.1;Uid=root;Pwd=;sslmode=None</ConnectionString>
</TestDatabase>
<!--
<TestDatabase>
Expand Down
10 changes: 5 additions & 5 deletions DicomTypeTranslation/DicomTypeTranslation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="fo-dicom.NetCore" Version="[4.0.4]" />
<PackageReference Include="HIC.FAnsiSql" Version="[0.10.12]" />
<PackageReference Include="MongoDB.Driver" Version="[2.8.1]" />
<PackageReference Include="Newtonsoft.Json" Version="[12.0.2]" />
<PackageReference Include="NLog" Version="[4.6.3]" />
<PackageReference Include="YamlDotNet" Version="[6.0.0]" />
<PackageReference Include="HIC.FAnsiSql" Version="0.11.1" />
<PackageReference Include="MongoDB.Driver" Version="2.10.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog" Version="4.7.0" />
<PackageReference Include="YamlDotNet" Version="8.1.0" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions DicomTypeTranslation/HIC.DicomTypeTranslation.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<tags>Dicom,ETL,SQL</tags>
<dependencies>
<dependency id="fo-dicom.NetCore" version="4.0.4" />
<dependency id="HIC.FAnsiSql" version="0.10.12" />
<dependency id="MongoDB.Driver" version="2.8.1" />
<dependency id="Newtonsoft.Json" version="12.0.2" />
<dependency id="NLog" version="4.6.3" />
<dependency id="YamlDotNet" version="6.0.0" />
<dependency id="HIC.FAnsiSql" version="0.11.1" />
<dependency id="MongoDB.Driver" version="2.10.2" />
<dependency id="Newtonsoft.Json" version="12.0.3" />
<dependency id="NLog" version="4.7.0" />
<dependency id="YamlDotNet" version="8.1.0" />
</dependencies>
</metadata>
<files>
Expand Down
22 changes: 2 additions & 20 deletions DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


using Dicom;
using Dicom.IO.Buffer;
using JetBrains.Annotations;
Expand All @@ -18,6 +18,7 @@ public static class DicomDatasetHelpers
/// Checks the correct fo-dicom library is present for the platform at runtime
/// </summary>
/// <returns></returns>
[Obsolete("This is likely no longer needed since we explicitly build (and fo-dicom provides) packages for both Windows & Linux")]
[UsedImplicitly]
public static bool CorrectFoDicomVersion()
{
Expand All @@ -32,25 +33,6 @@ public static bool CorrectFoDicomVersion()
}
}

/// <summary>
/// Removes group length elements from the DICOM dataset. These have been retired in the DICOM standard.
/// </summary>
/// <remarks><see href="http://dicom.nema.org/medical/dicom/current/output/html/part05.html#sect_7.2"/></remarks>
/// <param name="dataset">DICOM dataset</param>
public static void RemoveGroupLengths(this DicomDataset dataset)
{
if (dataset == null)
return;

dataset.Remove(x => x.Tag.Element == 0x0000);

// Handle sequences
foreach (DicomSequence sq in dataset.Where(x => x.ValueRepresentation == DicomVR.SQ).Cast<DicomSequence>())
foreach (DicomDataset item in sq.Items)
item.RemoveGroupLengths();
}


/// <summary>
/// Returns true if the elements in <paramref name="a"/> are the same set of tags and values as <paramref name="b"/>
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public bool Accepts(Type type)

public object ReadYaml(IParser parser, Type type)
{
var scalar = parser.Expect<Scalar>();
var scalar = parser.Consume<Scalar>();
return Type.GetType(scalar.Value);
}

Expand Down
10 changes: 5 additions & 5 deletions Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

| Package | Source Code | Version | License | Purpose | Additional Risk Assessment |
| ------- | ------------| --------| ------- | ------- | -------------------------- |
| HIC.FAnsiSql |[GitHub](https://github.com/HicServices/FAnsiSql) | [0.10.12](https://www.nuget.org/packages/HIC.FansiSql/0.10.12) | [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.html) | Handles assigning translating database types and DBMS interactions|
|[MongoDB.Driver](https://docs.mongodb.com/ecosystem/drivers/csharp/)| [GitHub](https://github.com/mongodb/mongo-csharp-driver) |[2.8.1](https://www.nuget.org/packages/MongoDB.Driver/2.8.1)| [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) | Types for writting dicom tags into MongoDb databases|
| HIC.FAnsiSql |[GitHub](https://github.com/HicServices/FAnsiSql) | [0.11.1](https://www.nuget.org/packages/HIC.FansiSql/0.11.1) | [GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.html) | Handles assigning translating database types and DBMS interactions|
|[MongoDB.Driver](https://docs.mongodb.com/ecosystem/drivers/csharp/)| [GitHub](https://github.com/mongodb/mongo-csharp-driver) |[2.10.2](https://www.nuget.org/packages/MongoDB.Driver/2.10.2)| [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) | Types for writting dicom tags into MongoDb databases|
| fo-dicom.NetCore | [GitHub](https://github.com/fo-dicom/fo-dicom) |[4.0.4](https://www.nuget.org/packages/fo-dicom.NetCore/4.0.4)|[MS-PL](https://opensource.org/licenses/MS-PL) | Handles reading/writing dicom tags from dicom datasets | |
| fo-dicom.Json | [GitHub](https://github.com/fo-dicom/fo-dicom) |[4.0.4](https://www.nuget.org/packages/fo-dicom.Json/4.0.4)|[MS-PL](https://opensource.org/licenses/MS-PL) | Handles serializing dicom datasets | |
| YamlDotNet | [GitHub](https://github.com/aaubry/YamlDotNet) | [6.0.0](https://www.nuget.org/packages/YamlDotNet/6.0.0) | [MIT](https://opensource.org/licenses/MIT) |Loading configuration files|
| [NLog](https://nlog-project.org/) | [GitHub](https://github.com/NLog/NLog) | [4.6.3](https://www.nuget.org/packages/NLog/4.6.3) | [BSD 3-Clause](https://github.com/NLog/NLog/blob/dev/LICENSE.txt) | Flexible user configurable logging | |
| [Newtonsoft.Json](https://www.newtonsoft.com/json) | [GitHub](https://github.com/JamesNK/Newtonsoft.Json) | [12.0.2](https://www.nuget.org/packages/Newtonsoft.Json/12.0.2) | [MIT](https://opensource.org/licenses/MIT) | Serialization of objects for sharing/transmission |
| YamlDotNet | [GitHub](https://github.com/aaubry/YamlDotNet) | [8.1.0](https://www.nuget.org/packages/YamlDotNet/8.1.0) | [MIT](https://opensource.org/licenses/MIT) |Loading configuration files|
| [NLog](https://nlog-project.org/) | [GitHub](https://github.com/NLog/NLog) | [4.7.0](https://www.nuget.org/packages/NLog/4.7.0) | [BSD 3-Clause](https://github.com/NLog/NLog/blob/dev/LICENSE.txt) | Flexible user configurable logging | |
| [Newtonsoft.Json](https://www.newtonsoft.com/json) | [GitHub](https://github.com/JamesNK/Newtonsoft.Json) | [12.0.3](https://www.nuget.org/packages/Newtonsoft.Json/12.0.3) | [MIT](https://opensource.org/licenses/MIT) | Serialization of objects for sharing/transmission |
| [Nunit](https://nunit.org/) |[GitHub](https://github.com/nunit/nunit) | [3.11.0](https://www.nuget.org/packages/NUnit/3.11.0) | [MIT](https://opensource.org/licenses/MIT) | Unit testing |
| NUnit3TestAdapter | [GitHub](https://github.com/nunit/nunit3-vs-adapter)| [3.13.0](https://www.nuget.org/packages/NUnit3TestAdapter/3.13.0) | [MIT](https://opensource.org/licenses/MIT) | Run unit tests from within Visual Studio |
2 changes: 1 addition & 1 deletion rakefile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</TestDatabase>
<TestDatabase>
<DatabaseType>MySql</DatabaseType>
<ConnectionString>Server=#{MYSQLDB};Uid=#{MYSQLUSR};Pwd=#{MYSQLPASS};Ssl-Mode=Required</ConnectionString>
<ConnectionString>Server=#{MYSQLDB};Uid=#{MYSQLUSR};Pwd=#{MYSQLPASS};sslmode=Required</ConnectionString>
</TestDatabase>
<!--<TestDatabase>
<DatabaseType>Oracle</DatabaseType>
Expand Down

0 comments on commit 7b28bbb

Please sign in to comment.