From 59126c9c5cb279a2df0b923ac61cfe5ed57e69ac Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod <5160559+rkm@users.noreply.github.com> Date: Thu, 26 Mar 2020 12:32:01 +0000 Subject: [PATCH 01/13] Add obsolete message to CorrectFoDicomVersion --- DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs b/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs index eb7f60d..c6d5748 100644 --- a/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs +++ b/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs @@ -18,6 +18,7 @@ public static class DicomDatasetHelpers /// Checks the correct fo-dicom library is present for the platform at runtime /// /// + [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() { From 0d6ea5b77985bec624e3c791e8c9d45fde8ee29e Mon Sep 17 00:00:00 2001 From: Ruairidh MacLeod <5160559+rkm@users.noreply.github.com> Date: Thu, 26 Mar 2020 12:43:20 +0000 Subject: [PATCH 02/13] Remove RemoveGroupLengths from the public API - only used in tests --- .../JsonDicomConverterTests.cs | 23 ++++++++++++++++--- .../Helpers/DicomDatasetHelpers.cs | 21 +---------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/DicomTypeTranslation.Tests/JsonDicomConverterTests.cs b/DicomTypeTranslation.Tests/JsonDicomConverterTests.cs index 5ebffa1..47481c1 100644 --- a/DicomTypeTranslation.Tests/JsonDicomConverterTests.cs +++ b/DicomTypeTranslation.Tests/JsonDicomConverterTests.cs @@ -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; @@ -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"); @@ -91,7 +90,7 @@ 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)); @@ -99,6 +98,24 @@ private void VerifyJsonTripleTrip(DicomDataset originalDataset, bool expectFail Assert.True(DicomDatasetHelpers.ValueEquals(originalDataset, recoDataset)); } + /// + /// Removes group length elements from the DICOM dataset. These have been retired in the DICOM standard. + /// + /// + /// DICOM dataset + 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()) + foreach (DicomDataset item in sq.Items) + RemoveGroupLengths(item); + } + private static void ValidatePrivateCreatorsExist(DicomDataset dataset) { foreach (DicomItem item in dataset) diff --git a/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs b/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs index c6d5748..8ffe9a4 100644 --- a/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs +++ b/DicomTypeTranslation/Helpers/DicomDatasetHelpers.cs @@ -1,4 +1,4 @@ - + using Dicom; using Dicom.IO.Buffer; using JetBrains.Annotations; @@ -33,25 +33,6 @@ public static bool CorrectFoDicomVersion() } } - /// - /// Removes group length elements from the DICOM dataset. These have been retired in the DICOM standard. - /// - /// - /// DICOM dataset - 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()) - foreach (DicomDataset item in sq.Items) - item.RemoveGroupLengths(); - } - - /// /// Returns true if the elements in are the same set of tags and values as /// From 6e3917165084152fec98e9915e161e70cacd51db Mon Sep 17 00:00:00 2001 From: James A Sutherland Date: Mon, 6 Apr 2020 15:45:57 +0100 Subject: [PATCH 03/13] Dependency updates --- DicomTypeTranslation/DicomTypeTranslation.csproj | 10 +++++----- Packages.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DicomTypeTranslation/DicomTypeTranslation.csproj b/DicomTypeTranslation/DicomTypeTranslation.csproj index 7e8b68e..7d5f90f 100644 --- a/DicomTypeTranslation/DicomTypeTranslation.csproj +++ b/DicomTypeTranslation/DicomTypeTranslation.csproj @@ -17,10 +17,10 @@ - - - - - + + + + + diff --git a/Packages.md b/Packages.md index a982a16..639db8a 100644 --- a/Packages.md +++ b/Packages.md @@ -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 | From 3523d427f6589efe4aa517ba6d37af4eecd324e4 Mon Sep 17 00:00:00 2001 From: James A Sutherland Date: Mon, 6 Apr 2020 15:52:51 +0100 Subject: [PATCH 04/13] Fix ssl-mode to sslmode --- DicomTypeTranslation.Tests/TestDatabases.xml | 2 +- rakefile.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DicomTypeTranslation.Tests/TestDatabases.xml b/DicomTypeTranslation.Tests/TestDatabases.xml index 6cb6321..0071607 100644 --- a/DicomTypeTranslation.Tests/TestDatabases.xml +++ b/DicomTypeTranslation.Tests/TestDatabases.xml @@ -9,7 +9,7 @@ MySql - server=127.0.0.1;Uid=root;Pwd=;Ssl-Mode=None + server=127.0.0.1;Uid=root;Pwd=;sslmode=None