[C#]
using Leadtools.Dicom.AddIn;
using Leadtools.Dicom.AddIn.Attributes;
using System.IO;
[C#]
public class Module : ModuleInit
{
private static string _ImageDirectory = string.Empty;
public static string ImageDirectory
{
get
{
return _ImageDirectory;
}
}
public override void Load(string ServiceDirectory, string DisplayName)
{
string dir = ServiceDirectory + @"\Images\";
if(!Directory.Exists(dir))
Directory.CreateDirectory(dir);
_ImageDirectory = dir;
}
}
When this add-in loads, the Load function is called by the LEADTOOLS PACS Framework. This class checks for the Images directory. If the directory does not exist it is created by the addin.
[C#]
using Leadtools.Dicom;
using Leadtools.Dicom.AddIn;
using Leadtools.Dicom.AddIn.Interfaces;
using Microsoft.Practices.Unity;
[C#]
public class CStoreAddIn : IProcessCStore
{
}
[C#]
[DicomAddInAttribute("CStore","1.0.0.0",Description="DICOM Storage",Author="")]
public class CStoreAddIn : IProcessCStore
{
#region IProcessCStore Members
public DicomCommandStatusType OnStore(DicomClient Client, byte PresentationId, int MessageId, string AffectedClass, string Instance, DicomCommandPriorityType Priority, string MoveAE, int MoveMessageId, DicomDataSet Request)
{
throw new NotImplementedException();
}
#endregion
#region IProcessBreak Members
public void Break(BreakType type)
{
throw new NotImplementedException();
}
#endregion
}
[C#]
[PresentationContext(DicomUidType.CTImageStorage,
DicomUidType.ImplicitVRLittleEndian,
DicomUidType.JPEG2000,
DicomUidType.JPEG2000LosslessOnly,
DicomUidType.JPEGBaseline1,
DicomUidType.JPEGExtended2_4,
DicomUidType.ExplicitVRBigEndian,
DicomUidType.ExplicitVRLittleEndian,
DicomUidType.JPEGLosslessNonhier14,
DicomUidType.JPEGLosslessNonhier14B)]
public DicomCommandStatusType OnStore(DicomClient Client, byte PresentationId, int MessageId, string AffectedClass, string Instance, DicomCommandPriorityType Priority, string MoveAE, int MoveMessageId, DicomDataSet Request)
This makes it possible to store CT images with the above transfer syntaxes.
[C#]
public DicomCommandStatusType OnStore(DicomClient Client, byte PresentationId, int MessageId, string AffectedClass, string Instance, DicomCommandPriorityType Priority, string MoveAE, int MoveMessageId, DicomDataSet Request)
{
DicomCommandStatusType status = DicomCommandStatusType.Success;
try
{
if(Request!=null)
{
string sop = Request.GetValue(DicomTag.SOPInstanceUID, string.Empty);
if(string.IsNullOrEmpty(sop))
status = DicomCommandStatusType.ProcessingFailure;
else
{
string file = string.Format("{0}{1}.dic", Module.ImageDirectory,sop);
Request.Save(file, DicomDataSetSaveFlags.None);
}
}
}
catch(Exception e)
{
status = DicomCommandStatusType.ProcessingFailure;
}
return status;
}