Skip to content

Commit

Permalink
added ArtifactTypeEnum
Browse files Browse the repository at this point in the history
Signed-off-by: Lillie Dae <[email protected]>
  • Loading branch information
lillie-dae committed Oct 11, 2023
1 parent e54294c commit 5609c11
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,5 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

*/.idea/*
2 changes: 1 addition & 1 deletion src/Messaging/Common/Artifact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Monai.Deploy.Messaging.Common
{
public class Artifact
{
public string Type { get; set; } = string.Empty;
public ArtifactTypeEnum Type { get; set; } = ArtifactTypeEnum.Unset;
public string Path { get; set; } = string.Empty;
}
}
85 changes: 85 additions & 0 deletions src/Messaging/Common/ArtifactTypeEnum.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2022-2023 MONAI Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

namespace Monai.Deploy.Messaging.Common
{
public enum ArtifactTypeEnum
{
Unset, //Unset
AR, //Autorefraction
ASMT, //Content Assessment Results
AU, //Audio
BDUS, //Bone Densitometry (ultrasound)
BI, //Biomagnetic imaging
BMD, //Bone Densitometry (X-Ray)
CR, //Computed Radiography
CT, //Computed Tomography
DG, //Diaphanography
DOC, //Document
DX, //Digital Radiography
ECG, //Electrocardiography
EPS, //Cardiac Electrophysiology
ES, //Endoscopy
FID, //Fiducials
GM, //General Microscopy
HC, //Hard Copy
HD, //Hemodynamic Waveform
IO, //Intra-Oral Radiography
IOL, //Intraocular Lens Data
IVOCT, //Intravascular Optical Coherence Tomography
IVUS, //Intravascular Ultrasound
KER, //Keratometry
KO, //Key Object Selection
LEN, //Lensometry
LS, //Laser surface scan
MG, //Mammography
MR, //Magnetic Resonance
NM, //Nuclear Medicine
OAM, //Ophthalmic Axial Measurements
OCT, //Optical Coherence Tomography (non-Ophthalmic)
OP, //Ophthalmic Photography
OPM, //Ophthalmic Mapping
OPT, //Ophthalmic Tomography
OPV, //Ophthalmic Visual Field
OSS, //Optical Surface Scan
OT, //Other
PLAN, //Plan
PR, //Presentation State
PT, //Positron emission tomography (PET)
PX, //Panoramic X-Ray
REG, //Registration
RESP, //Respiratory Waveform
RF, //Radio Fluoroscopy
RG, //Radiographic imaging (conventional film/screen)
RTDOSE, //Radiotherapy Dose
RTIMAGE, //Radiotherapy Image
RTPLAN, //Radiotherapy Plan
RTRECORD, //RT Treatment Record
RTSTRUCT, //Radiotherapy Structure Set
RWV, //Real World Value Map
SEG, //Segmentation
SM, //Slide Microscopy
SMR, //Stereometric Relationship
SR, //SR Document
SRF, //Subjective Refraction
STAIN, //Automated Slide Stainer
TG, //Thermography
US, //Ultrasound
VA, //Visual Acuity
XA, //X-Ray Angiography
XC, //External-camera Photography
};
}
79 changes: 79 additions & 0 deletions src/Messaging/Common/ArtifactTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
namespace Monai.Deploy.Messaging.Common
{
public static class ArtifactTypes
{
private static readonly Dictionary<ArtifactTypeEnum, string> ListOfModularity = new()
{
{ ArtifactTypeEnum.Unset, "Unset" },
{ ArtifactTypeEnum.AR, "Autorefract (ArtifactType.ion" },
{ ArtifactTypeEnum.ASMT, "Content Assessment Results" },
{ ArtifactTypeEnum.AU, "Audio" },
{ ArtifactTypeEnum.BDUS, "Bone Densitometry (ultrasound)" },
{ ArtifactTypeEnum.BI, "Biomagnetic imaging" },
{ ArtifactTypeEnum.BMD, "Bone Densitometry (X-Ray)" },
{ ArtifactTypeEnum.CR, "Computed Radiography" },
{ ArtifactTypeEnum.CT, "Computed Tomography" },
{ ArtifactTypeEnum.DG, "Diaphanography" },
{ ArtifactTypeEnum.DOC, "Document" },
{ ArtifactTypeEnum.DX, "Digital Radiography" },
{ ArtifactTypeEnum.ECG, "Electrocardiography" },
{ ArtifactTypeEnum.EPS, "Cardiac Electrophysiology" },
{ ArtifactTypeEnum.ES, "Endoscopy" },
{ ArtifactTypeEnum.FID, "Fiducials" },
{ ArtifactTypeEnum.GM, "General Microscopy" },
{ ArtifactTypeEnum.HC, "Hard Copy" },
{ ArtifactTypeEnum.HD, "Hemodynamic Waveform" },
{ ArtifactTypeEnum.IO, "Intra-Oral Radiography" },
{ ArtifactTypeEnum.IOL, "Intraocular Lens Data" },
{ ArtifactTypeEnum.IVOCT, "Intravascular Optical Coherence Tomography" },
{ ArtifactTypeEnum.IVUS, "Intravascular Ultrasound" },
{ ArtifactTypeEnum.KER, "Keratometry" },
{ ArtifactTypeEnum.KO, "Key Object Selection" },
{ ArtifactTypeEnum.LEN, "Lensometry" },
{ ArtifactTypeEnum.LS, "Laser surface scan" },
{ ArtifactTypeEnum.MG, "Mammography" },
{ ArtifactTypeEnum.MR, "Magnetic Resonance" },
{ ArtifactTypeEnum.NM, "Nuclear Medicine" },
{ ArtifactTypeEnum.OAM, "Ophthalmic Axial Measurements" },
{ ArtifactTypeEnum.OCT, "Optical Coherence Tomography (non-Ophthalmic)" },
{ ArtifactTypeEnum.OP, "Ophthalmic Photography" },
{ ArtifactTypeEnum.OPM, "Ophthalmic Mapping" },
{ ArtifactTypeEnum.OPT, "Ophthalmic Tomography" },
{ ArtifactTypeEnum.OPV, "Ophthalmic Visual Field" },
{ ArtifactTypeEnum.OSS, "Optical Surface Scan" },
{ ArtifactTypeEnum.OT, "Other" },
{ ArtifactTypeEnum.PLAN, "Plan" },
{ ArtifactTypeEnum.PR, "Presentation State" },
{ ArtifactTypeEnum.PT, "Positron emission tomography (PET)" },
{ ArtifactTypeEnum.PX, "Panoramic X-Ray" },
{ ArtifactTypeEnum.REG, "Registration" },
{ ArtifactTypeEnum.RESP, "Respiratory Waveform" },
{ ArtifactTypeEnum.RF, "Radio Fluoroscopy" },
{ ArtifactTypeEnum.RG, "Radiographic imaging (conventional film/screen)" },
{ ArtifactTypeEnum.RTDOSE, "Radiotherapy Dose" },
{ ArtifactTypeEnum.RTIMAGE, "Radiotherapy Image" },
{ ArtifactTypeEnum.RTPLAN, "Radiotherapy Plan" },
{ ArtifactTypeEnum.RTRECORD, "RT Treatment Record" },
{ ArtifactTypeEnum.RTSTRUCT, "Radiotherapy Structure Set" },
{ ArtifactTypeEnum.RWV, "Real World Value Map" },
{ ArtifactTypeEnum.SEG, "Segmentation" },
{ ArtifactTypeEnum.SM, "Slide Microscopy" },
{ ArtifactTypeEnum.SMR, "Stereometric Relationship" },
{ ArtifactTypeEnum.SR, "SR Document" },
{ ArtifactTypeEnum.SRF, "Subjective Refraction" },
{ ArtifactTypeEnum.STAIN, "Automated Slide Stainer" },
{ ArtifactTypeEnum.TG, "Thermography" },
{ ArtifactTypeEnum.US, "Ultrasound" },
{ ArtifactTypeEnum.VA, "Visual Acuity" },
{ ArtifactTypeEnum.XA, "X-Ray Angiography" },
{ ArtifactTypeEnum.XC, "External-camera Photography" },
};

public static bool Validate(string artifactType)
{
return ListOfModularity.Any(x =>
Enum.TryParse<ArtifactTypeEnum>(artifactType, out var artifact)
&& x.Key == artifact);
}
}
}
20 changes: 20 additions & 0 deletions src/Messaging/Tests/Common/ArtifactTypesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Monai.Deploy.Messaging.Common;
using Xunit;

namespace Monai.Deploy.Messaging.Tests.Common
{
public class ArtifactTypesTests
{
[Fact]
public void ArtifactTypeValid_ShouldReturnTrue()
{
Assert.True(ArtifactTypes.Validate("CR"));
}

[Fact]
public void ArtifactTypeInvalid_ShouldReturnFalse()
{
Assert.False(ArtifactTypes.Validate("false"));
}
}
}

0 comments on commit 5609c11

Please sign in to comment.