public string LogFileName { get; set; }
A System.String value specifying the log file to be created.
using LeadtoolsExamples.Common;
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Dicom;
using Leadtools.Dicom.Scu.Common;
using Leadtools.ImageProcessing;
using Leadtools.Dicom.AddIn.Common;
using Leadtools.Dicom.Scu;
using Leadtools.Medical.Workstation.Client;
using Leadtools.Medical.Workstation.Client.Local;
using Leadtools.Medical.Workstation.Client.Pacs;
using Leadtools.Medical.Storage.DataAccessLayer;
using Leadtools.Medical.DataAccessLayer;
using Leadtools.Medical.Storage.DataAccessLayer.Configuration;
public void StoreDicom()
{
Leadtools.Examples.Support.SetLicense();
AeInfo clientInfo = new AeInfo();
clientInfo.Address = Dns.GetHostName(); //local machine
clientInfo.AETitle = "TEST_CLIENT";
clientInfo.Port = 1000;
IStorageDataAccessAgent dataAccess = null;
bool fromConfiguration = false;
if (fromConfiguration)
{
//Make sure that the Sotrage Data Access is configured before creating an instance.
dataAccess = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView()).CreateDataAccessAgent<IStorageDataAccessAgent>();
}
else
{
string connectionString = @"Data Source=local;Initial Catalog=DicomStorage;Integrated Security=True;User ID=;Password=;Pooling=True";
//or you can directly create the data access object which works with your database
dataAccess = new StorageSqlDbDataAccessAgent(connectionString);
}
DbQueryClient queryClient = new DbQueryClient(clientInfo, dataAccess);
queryClient.EnableLog = true;
queryClient.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt");
DicomDataSet[] series = queryClient.FindSeries(new FindQuery());
if (series.Length > 0)
{
DicomScp scpInfo = new DicomScp();
scpInfo.AETitle = "LEAD_SERVER";
scpInfo.Port = 104;
scpInfo.Timeout = 30;
bool addressFound;
IPAddress[] addresses;
addressFound = false;
addresses = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress address in addresses)
{
//we need to get an IP V4, won't work with IP V6
if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
addressFound = true;
scpInfo.PeerAddress = address;
break;
}
}
if (!addressFound)
{
throw new ArgumentException("Couldn't resolve a valid host Address. Address must conform to IP version 4");
}
StoreClient client = new StoreClient(clientInfo, scpInfo, Compression.Native, dataAccess);
client.EnableLog = true;
client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt");
client.StoreSeries(series[0].GetValue<string>(DicomTag.StudyInstanceUID, string.Empty),
series[0].GetValue<string>(DicomTag.SeriesInstanceUID, string.Empty));
Console.WriteLine("Series {0} has been stored successfully.", series[0].GetValue<string>(DicomTag.SeriesInstanceUID, string.Empty));
}
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}