Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the Core functions #53

Merged
merged 3 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ jobs:
path: |
bin/net${{ matrix.dotnet-version }}/${{ matrix.configuration }}
!bin/**/DICOM Dictionary.xml
!bin/**/Private Dictionary.xml
!bin/**/Private Dictionary.xml
!bin/**/*.pdb
8 changes: 7 additions & 1 deletion DicomGrep.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DicomGrep", "DicomGrep\DicomGrep.csproj", "{70E8E894-278C-4A40-9CC8-56573A5F96DF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DicomGrepTests", "DicomGrepTests\DicomGrepTests.csproj", "{C26AA249-3A83-4B9A-9672-633AFE3081E4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DicomGrepTests", "DicomGrepTests\DicomGrepTests.csproj", "{C26AA249-3A83-4B9A-9672-633AFE3081E4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DicomGrepCore", "DicomGrepCore\DicomGrepCore.csproj", "{572F835B-6298-4075-A1E3-50675927CCF1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -21,6 +23,10 @@ Global
{C26AA249-3A83-4B9A-9672-633AFE3081E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C26AA249-3A83-4B9A-9672-633AFE3081E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C26AA249-3A83-4B9A-9672-633AFE3081E4}.Release|Any CPU.Build.0 = Release|Any CPU
{572F835B-6298-4075-A1E3-50675927CCF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{572F835B-6298-4075-A1E3-50675927CCF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{572F835B-6298-4075-A1E3-50675927CCF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{572F835B-6298-4075-A1E3-50675927CCF1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 4 additions & 0 deletions DicomGrep/DicomGrep.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@
<PackageReference Include="WinCopies.WindowsAPICodePack.Shell" Version="2.12.0.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DicomGrepCore\DicomGrepCore.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="Views\Images\logo_128.png" />
<Resource Include="Views\Images\logo_16.png" />
Expand Down
3 changes: 2 additions & 1 deletion DicomGrep/Models/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using DicomGrepCore.Entities;
using System;
using System.Collections.Generic;
using System.Text;

Expand Down
1 change: 1 addition & 0 deletions DicomGrep/Services/ConfigurationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.IO;
using System.Text;
using System.Text.Json;
using DicomGrepCore.Entities;

namespace DicomGrep.Services
{
Expand Down
1 change: 1 addition & 0 deletions DicomGrep/Services/ExportService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DicomGrep.Models;
using DicomGrepCore.Entities;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
Expand Down
1 change: 1 addition & 0 deletions DicomGrep/Services/TagValueDetailService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DicomGrep.Models;
using DicomGrep.ViewModels;
using DicomGrep.Views;
using DicomGrepCore.Entities;
using FellowOakDicom;
using System;
using System.Collections.Generic;
Expand Down
10 changes: 6 additions & 4 deletions DicomGrep/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using DicomGrep.Services;
using DicomGrep.Utils;
using DicomGrep.Views;
using DicomGrepCore.Entities;
using DicomGrepCore.Services;
using FellowOakDicom;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -339,20 +341,20 @@ private IEnumerable<int> GetCPULogicCoresList()
}
}

private void SearchService_FileListCompleted(object sender, Services.EventArgs.ListFileCompletedEventArgs e)
private void SearchService_FileListCompleted(object sender, DicomGrepCore.Services.EventArgs.ListFileCompletedEventArgs e)
{
this.TotalFileCount = e.Count;
}

private void SearchService_OnLoadDicomFile(object sender, Services.EventArgs.OnLoadDicomFileEventArgs e)
private void SearchService_OnLoadDicomFile(object sender, DicomGrepCore.Services.EventArgs.OnLoadDicomFileEventArgs e)
{
lock (obj)
{
CurrentFile = e.Filename;
}
}

private void SearchService_OnCompletDicomFile(object sender, Services.EventArgs.OnCompleteDicomFileEventArgs e)
private void SearchService_OnCompletDicomFile(object sender, DicomGrepCore.Services.EventArgs.OnCompleteDicomFileEventArgs e)
{
lock (obj2)
{
Expand All @@ -365,7 +367,7 @@ private void SearchService_OnCompletDicomFile(object sender, Services.EventArgs.
}
}

private void SearchService_OnSearchComplete(object sender, Services.EventArgs.OnSearchCompleteEventArgs e)
private void SearchService_OnSearchComplete(object sender, DicomGrepCore.Services.EventArgs.OnSearchCompleteEventArgs e)
{
this.CanSearch = true;
this.CanCancel = false;
Expand Down
1 change: 1 addition & 0 deletions DicomGrep/ViewModels/TagValueDetailViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DicomGrep.Models;
using DicomGrepCore.Entities;
using FellowOakDicom;
using System;
using System.Collections.Generic;
Expand Down
14 changes: 14 additions & 0 deletions DicomGrepCore/DicomGrepCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="fo-dicom" Version="5.1.2" />
<PackageReference Include="NLog" Version="5.2.8" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
using System.IO;
using System.Text;

namespace DicomGrep.Models
namespace DicomGrepCore.Entities
{
public class ResultDicomFile
{
public string FullFilename { get; private set; }
public string Filename => Path.GetFileName(FullFilename);
public string DirectoryName => Path.GetDirectoryName(FullFilename);

Check warning on line 12 in DicomGrepCore/Entities/ResultDicomFile.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Possible null reference return.

Check warning on line 12 in DicomGrepCore/Entities/ResultDicomFile.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Possible null reference return.

public string SOPClassName { get; private set; }
public string SOPClassUID { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using DicomGrep.Enums;
using DicomGrepCore.Enums;
using System;
using System.Collections.Generic;
using System.Text;
using FellowOakDicom;

namespace DicomGrep.Models
namespace DicomGrepCore.Entities
{
public class ResultDicomItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
using System.Text;
using System.Text.Json.Serialization;

namespace DicomGrep.Models
namespace DicomGrepCore.Entities
{
public class SearchCriteria
{
public string SearchPath { get; set; }

Check warning on line 11 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'SearchPath' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 11 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'SearchPath' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
public string SearchSopClassUid { get; set; }

Check warning on line 12 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'SearchSopClassUid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 12 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'SearchSopClassUid' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

private string _searchTag;

Check warning on line 14 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable field '_searchTag' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 14 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable field '_searchTag' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

public string SearchTag
{
Expand All @@ -30,13 +30,13 @@
}
}

private DicomTag _dicomSearchTag;

Check warning on line 33 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable field '_dicomSearchTag' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 33 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable field '_dicomSearchTag' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
[JsonIgnore]
public DicomTag DicomSearchTag => _dicomSearchTag;

public string FileTypes { get; set; }

Check warning on line 37 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'FileTypes' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 37 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'FileTypes' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public string SearchText { get; set; }

Check warning on line 39 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'SearchText' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 39 in DicomGrepCore/Entities/SearchCriteria.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Non-nullable property 'SearchText' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

public bool CaseSensitive { get; set; }
public bool WholeWord { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace DicomGrep.Enums
namespace DicomGrepCore.Enums
{
public enum CompleteReasonEnum
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace DicomGrep.Extensions
namespace DicomGrepCore.Extensions
{
public static class StringExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace DicomGrep.Services.EventArgs
namespace DicomGrepCore.Services.EventArgs
{
public class ListFileCompletedEventArgs : System.EventArgs
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using DicomGrep.Models;
using DicomGrepCore.Entities;
using System;
using System.Collections.Generic;
using System.Text;

namespace DicomGrep.Services.EventArgs
namespace DicomGrepCore.Services.EventArgs
{
public class OnCompleteDicomFileEventArgs : System.EventArgs
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace DicomGrep.Services.EventArgs
namespace DicomGrepCore.Services.EventArgs
{
public class OnLoadDicomFileEventArgs : System.EventArgs
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using DicomGrep.Enums;
using DicomGrepCore.Enums;
using System;
using System.Collections.Generic;
using System.Text;

namespace DicomGrep.Services.EventArgs
namespace DicomGrepCore.Services.EventArgs
{
public class OnSearchCompleteEventArgs : System.EventArgs
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using DicomGrep.Extensions;
using DicomGrep.Models;
using DicomGrep.Services.EventArgs;
using DicomGrepCore.Extensions;
using DicomGrepCore.Entities;
using DicomGrepCore.Services.EventArgs;
using System;
using System.Collections.Generic;
using System.IO;
Expand All @@ -10,7 +10,7 @@
using System.Threading.Tasks;
using FellowOakDicom;

namespace DicomGrep.Services
namespace DicomGrepCore.Services
{
/// <summary>
/// The core logic of the search function
Expand Down Expand Up @@ -140,7 +140,7 @@

private void SearchInDicomFile(string filePath)
{
ResultDicomFile resultDicomFile = null;

Check warning on line 143 in DicomGrepCore/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Converting null literal or possible null value to non-nullable type.

Check warning on line 143 in DicomGrepCore/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Converting null literal or possible null value to non-nullable type.
bool anyMatch = false;
try
{
Expand All @@ -148,12 +148,12 @@

DicomFile dicomFile = DicomFile.Open(filePath, FileReadOption.ReadLargeOnDemand, 16 * 1024);

IList<ResultDicomItem> resultDicomItems = null;

Check warning on line 151 in DicomGrepCore/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Converting null literal or possible null value to non-nullable type.

Check warning on line 151 in DicomGrepCore/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Converting null literal or possible null value to non-nullable type.
//new DicomDatasetWalker(dicomFile.Dataset).Walk(new DatasetWalker());

string patientName = string.Empty;
string sopClassName = string.Empty;
DicomUID sopClassUID = null;

Check warning on line 156 in DicomGrepCore/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Converting null literal or possible null value to non-nullable type.

Check warning on line 156 in DicomGrepCore/Services/SearchService.cs

View workflow job for this annotation

GitHub Actions / build (Debug, 6.0.x)

Converting null literal or possible null value to non-nullable type.


if (dicomFile.Dataset.TryGetSingleValue<DicomUID>(DicomTag.SOPClassUID, out sopClassUID))
Expand Down