public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory) { _AdvancedSettings = advancedSettings; _Settings = Settings; Module.InitializeLicense(); DicomEngine.Startup(); DicomNet.Startup(); Module.InitializeFailureDirectory(ServerDirectory); Module.ServiceName = Settings.ServiceName; Module.ServiceDirectory = ServerDirectory; try { if (Settings != null) { Module.ServiceName = Settings.ServiceName; } Module.ServiceDirectory = ServerDirectory; Module.ConfigureRuleProcessor(_AdvancedSettings); _dlgConfigure = new ConfigureDialog(); _dlgConfigure.FormClosing += new FormClosingEventHandler(_dlgConfigure_FormClosing); _Presenter = new RuleEditorPresenter(Module._Options, ServerDirectory); _Presenter.RunView(_dlgConfigure, advancedSettings); } catch (Exception e) { Logger.Global.Exception(Module.Source, e); } }
private void MainForm_Load(object sender, EventArgs e) { DicomEngine.Startup(); DicomDataSet DummyDS = new DicomDataSet(); m_J2KOptions = DummyDS.Jpeg2000Options; AddUID(DicomUidType.ImplicitVRLittleEndian, "Implicit VR Little Endian (1.2.840.10008.1.2)"); AddUID(DicomUidType.ExplicitVRLittleEndian, "Explicit VR Little Endian (1.2.840.10008.1.2.1)"); AddUID(DicomUidType.ExplicitVRBigEndian, "Explicit VR Big Endian (1.2.840.10008.1.2.2)"); AddUID(DicomUidType.RLELossless, "RLE Lossless (1.2.840.10008.1.2.5)"); AddUID(DicomUidType.JPEGBaseline1, "JPEG Baseline (Process 1) (1.2.840.10008.1.2.4.50)"); AddUID(DicomUidType.JPEGExtended2_4, "JPEG Extended (Process 2 & 4) (1.2.840.10008.1.2.4.51)"); AddUID(DicomUidType.JPEGLosslessNonhier14, "JPEG Lossless, Non-Hierarchical (Process 14) (1.2.840.10008.1.2.4.57)"); AddUID(DicomUidType.JPEGLosslessNonhier14B, "JPEG Lossless, Non-Hierarchical,First-Order Prediction (1.2.840.10008.1.2.4.70)"); #if LEADTOOLS_V175_OR_LATER AddUID(DicomUidType.JPEGLSLossless, "JPEG-LS Lossless (1.2.840.10008.1.2.4.80)"); AddUID(DicomUidType.JPEGLSLossy, "JPEG-LS Lossy (1.2.840.10008.1.2.4.81)"); #endif AddUID(DicomUidType.JPEG2000LosslessOnly, "JPEG 2000 Lossless Only (1.2.840.10008.1.2.4.90)"); AddUID(DicomUidType.JPEG2000, "JPEG 2000 (1.2.840.10008.1.2.4.91)"); #if LEADTOOLS_V19_OR_LATER AddUID(DicomUidType.JPEG2000Part2MultiComponentImageCompressionLosslessOnly, "JPEG 2000 Part2, Multi Component Image Compression Lossless Only (1.2.840.10008.1.2.4.92)"); AddUID(DicomUidType.JPEG2000Part2MultiComponentImageCompression, "JPEG 2000 Part2, Multi Component Image Compression (1.2.840.10008.1.2.4.93)"); #endif cmbTransferSyntax.SelectedIndex = 0; J2kOptionsBtn.Enabled = false; txtQFactor.Enabled = false; txtQFactor.Text = "2"; }
public override void Dispose(bool bUnmanaged) { base.Dispose(); DicomNet.Shutdown(); DicomEngine.Shutdown(); }
private void InitClass() { DicomEngine.Startup(); Messager.Caption = "LEADTOOLS for .NET C# DICOM Overlay"; Text = Messager.Caption; _DataSet = new DicomDataSet(); }
private static void DicomShutdown() { try { DicomNet.Shutdown(); DicomEngine.Shutdown(); } catch (Exception) { } }
private void MainForm_Load(object sender, EventArgs e) { //Set our LEADTOOLS License and Developer Key RasterSupport.SetLicense(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC.KEY")); //Create a RasterCodecs Instance _codecs = new RasterCodecs(); //Startup our DICOM Engine DicomEngine.Startup(); }
public MainForm() { InitializeComponent(); // Setup the caption for this demo Messager.Caption = "C# Dicom Digital Signature Demo"; // Create Signature Dialog m_CreateSignatureDlg = new CreateSignature(); DicomEngine.Startup(); }
static void Main() { try { if (IsWindowsVista() && !IsAdmin()) { RestartElevated(); return; } #if (LEADTOOLS_V20_OR_LATER) if (DemosGlobal.IsDotNet45OrLaterInstalled() == false) { MessageBox.Show("To run this application, you must first install Microsoft .NET Framework 4.5 or later.", "Microsoft .NET Framework 4.5 or later Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } #endif Messager.Caption = ConfigurationData.ApplicationName; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DicomEngine.Startup(); if (!InitializeLicense()) { return; } Form mainForm = GetMainForm(); if (mainForm == null) { return; } Application.Run(mainForm); } catch (Exception exception) { MessageBox.Show("An error has occured. The program will be terminated.\n" + exception.Message, Messager.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { DicomEngine.Shutdown(); } }
static void Main() { if (!Support.SetLicense()) { return; } DicomEngine.Startup(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); DicomEngine.Shutdown(); }
public void Configure(IWin32Window Parent, ServerSettings Settings, string ServiceDirectory) { #if LEADTOOLS_V19_OR_LATER // do nothing #elif LEADTOOLS_V175_OR_LATER Support.SetLicense(); #else Support.Unlock(false); #endif DicomEngine.Startup(); ConfigureDialog configure = new ConfigureDialog(); Module.SetServerInfo(ServiceDirectory); configure.Text = Settings.AETitle + " Database Manager"; //SetupOwnerWindow(new HandleRef(this,Parent.Handle), new HandleRef(this,configure.Handle)); configure.ShowDialog(); DicomEngine.Shutdown(); }
public void RunView(IRulesConfigurationDialog view, AdvancedSettings settings) { DicomEngine.Startup(); _View = view; _Settings = settings; _View.SaveRule += new EventHandler <SaveRuleEventArgs>(View_SaveRule); _View.GetStoreFailures += new EventHandler <GetFailuresEventArgs <StoreFailure> >(View_GetStoreFailures); _View.GetMoveFailures += new EventHandler <GetFailuresEventArgs <MoveServer> >(View_GetMoveFailures); _View.SaveOptions += new EventHandler(_View_SaveOptions); LoadRules(); if (_Options != null) { _View.AETitle = _Options.AETitle; } _FailureDirectory = Path.Combine(_ServerDirectory, @"AddIns\rules\Failures\"); }
private void MainForm_Load(object sender, System.EventArgs e) { // Initialize the viewer object. DicomEngine.Startup(); _viewer = new MyAutomationImageViewer(); _viewer.BackColor = SystemColors.Control; _viewer.KeyDown += new KeyEventHandler(_viewer_KeyDown); _viewer.Dock = DockStyle.Fill; this._splitContainer.Panel2.Controls.Add(_viewer); _automationInteractiveMode = new AutomationInteractiveMode(); _automationInteractiveMode.IdleCursor = Cursors.Arrow; _automationInteractiveMode.WorkingCursor = Cursors.Cross; _viewer.InteractiveModes.BeginUpdate(); _viewer.InteractiveModes.Add(_automationInteractiveMode); _viewer.InteractiveModes.EndUpdate(); _dsImage = new DicomDataSet(); if (_dsImage == null) { Messager.ShowError(this, "Can't create dicom object. Quitting app."); Application.Exit(); return; } BringToFront(); InitAutomationManager(); _presentation = new DicomPresentationStateInformation(); _presentation.InstanceNumber = 1; _presentation.PresentationLabel = "LABEL"; _presentationStateDialog = new PresentationStateAttributesDialog(); _dicomAnnotationsUtilities = new DicomAnnotationsUtilities(); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); LoadImage(true); }
public void Initialize() { DicomEngine.Startup(); // LoadScriptList(); listViewAnonymizeScripts.Items.Clear(); // Select SelectActiveScript(); AnonymizeScript selectedScript = listViewAnonymizeScripts.GetSelectedScript(); UpdateScriptDataGrid(selectedScript); listViewAnonymizeScripts.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); listViewAnonymizeScripts.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); _isDirty = false; }
static void Main() { #if LEADTOOLS_V175_OR_LATER if (!Support.SetLicense()) { return; } #else Support.Unlock(false); #endif // #if LEADTOOLS_V175_OR_LATER if (RasterSupport.IsLocked(RasterSupportType.Medical)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.Medical.ToString()), "Warning"); return; } DicomEngine.Startup(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); DicomEngine.Shutdown(); }
private static void Unlock() { RasterSupport.Unlock(RasterSupportType.Dicom, "y47S3rZv6U"); RasterSupport.Unlock(RasterSupportType.Document, "HbQR9NSXQ3"); RasterSupport.Unlock(RasterSupportType.DocumentWriters, "BhaNezSEBB"); RasterSupport.Unlock(RasterSupportType.DocumentWritersPdf, "3b39Q3YMdX"); RasterSupport.Unlock(RasterSupportType.ExtGray, "bpTmxSfx8R"); RasterSupport.Unlock(RasterSupportType.Forms, "GpC33ZK78k"); RasterSupport.Unlock(RasterSupportType.IcrPlus, "9vdKEtBhFy"); RasterSupport.Unlock(RasterSupportType.IcrProfessional, "3p2UAxjTy5"); RasterSupport.Unlock(RasterSupportType.J2k, "Hvu2PRAr3z"); RasterSupport.Unlock(RasterSupportType.Jbig2, "43WiSV4YNB"); RasterSupport.Unlock(RasterSupportType.Jpip, "YbGG7wWiVJ"); RasterSupport.Unlock(RasterSupportType.Pro, ""); RasterSupport.Unlock(RasterSupportType.LeadOmr, "J3vh828GC8"); RasterSupport.Unlock(RasterSupportType.MediaWriter, "TpjDw2kJD2"); RasterSupport.Unlock(RasterSupportType.Medical, "ZhyFRnk3sY"); RasterSupport.Unlock(RasterSupportType.Medical3d, "DvuzH3ePeu"); RasterSupport.Unlock(RasterSupportType.MedicalNet, "b4nBinY7tv"); RasterSupport.Unlock(RasterSupportType.MedicalServer, "QbXwuZxA3h"); RasterSupport.Unlock(RasterSupportType.Mobile, ""); RasterSupport.Unlock(RasterSupportType.Nitf, "G37rmw5dTr"); DicomEngine.Startup(); }
static void Startup() { try { SupportLock.Unlock(); DicomEngine.Startup(); DicomNet.Startup(); //chance for any override ServiceUtils.RegisterInterfaces(); LoadTimeStamp(); //Debug.WriteLine("lt: " + (_timeStamp.HasValue? _timeStamp.ToString():"none")); //PACS client settings { //the client AE/IP/port used for connecting to remote PACS for query _clientConnection.AETitle = ConfigurationManager.AppSettings.Get("ClientAe"); if (string.IsNullOrEmpty(_clientConnection.AETitle)) { _clientConnection.AETitle = "LTCLIENT19"; } _clientConnection.IPAddress = ConfigurationManager.AppSettings.Get("ClientIP"); if (string.IsNullOrEmpty(_clientConnection.IPAddress)) { _clientConnection.IPAddress = ServiceUtils.GetLocalIPAddressesV4(); } _clientConnection.Port = ServiceUtils.ToInt(ConfigurationManager.AppSettings.Get("ClientPort"), ServiceUtils.GetFreeIPPort()); } //Storage server settings { //the path for the local storage server service, used by the store add-in to read the server configuration _storageServerServicePath = ConfigurationManager.AppSettings.Get("storageServerServicePath"); _storageServerServicePath = ServiceUtils.MapConfigPath(_storageServerServicePath); _storageServerConnection.AETitle = ConfigurationManager.AppSettings.Get("ServerAe"); _storageServerConnection.IPAddress = ConfigurationManager.AppSettings.Get("ServerIP"); _storageServerConnection.Port = ServiceUtils.ToInt(ConfigurationManager.AppSettings.Get("ServerPort"), -1); //read default storage server dicom connection settings if (!string.IsNullOrEmpty(_storageServerServicePath) && (string.IsNullOrEmpty(_storageServerConnection.AETitle) || string.IsNullOrEmpty(_storageServerConnection.IPAddress) || _storageServerConnection.Port <= 0)) { try { var settingsFile = Path.Combine(_storageServerServicePath, "settings.xml"); var doc = XDocument.Load(settingsFile); { _storageServerConnection.Port = ServiceUtils.ToInt(doc.Descendants("Port").First().Value, -1); _storageServerConnection.IPAddress = doc.Descendants("IpAddress").First().Value; _storageServerConnection.AETitle = doc.Descendants("AETitle").First().Value; } } catch { } } if (string.IsNullOrEmpty(_storageServerConnection.AETitle)) { _storageServerConnection.AETitle = "LTSTORAGESERVER"; } } //read static settings { //the path for storing the annotations files (not used anymore) _annotationsPath = ConfigurationManager.AppSettings.Get("AnnotationsPath"); if (string.IsNullOrEmpty(_annotationsPath)) { _annotationsPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Annotations"); } } //initialize external storage ExternalStorage.Startup(); } catch (Exception ex) { ServiceUtils.Log(ex.ToString()); throw new ServiceException("Failed to startup: " + ex.Message, HttpStatusCode.InternalServerError); } //caching workers LTCachingCtrl.QeueuWorkers(); }
private void button1_Click(object sender, EventArgs e) { _storageScu = new StorageScu(editAE.Text, editAE.Text, editIP.Text, Convert.ToInt16(editPort.Text)); _storageScu.ImageStoreCompleted += new EventHandler <StorageInstance>(storageScu_StoreCompleted); //_storageScu.AddStorageInstance(new StorageInstance("AnotherFile.dcm")); ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { //foreach (string strfile in viewer.getCurrentFiles()) // _storageScu.AddFile(strfile); //先解压缩,然后再发送 //foreach (string strfile in viewer.getCurrentFiles()) // _storageScu.AddFile(strfile); RasterSupport.Unlock(RasterSupportType.Dicom, "y47S3rZv6U"); RasterSupport.Unlock(RasterSupportType.Document, "HbQR9NSXQ3"); RasterSupport.Unlock(RasterSupportType.DocumentWriters, "BhaNezSEBB"); RasterSupport.Unlock(RasterSupportType.DocumentWritersPdf, "3b39Q3YMdX"); RasterSupport.Unlock(RasterSupportType.ExtGray, "bpTmxSfx8R"); RasterSupport.Unlock(RasterSupportType.Forms, "GpC33ZK78k"); RasterSupport.Unlock(RasterSupportType.IcrPlus, "9vdKEtBhFy"); RasterSupport.Unlock(RasterSupportType.IcrProfessional, "3p2UAxjTy5"); RasterSupport.Unlock(RasterSupportType.J2k, "Hvu2PRAr3z"); RasterSupport.Unlock(RasterSupportType.Jbig2, "43WiSV4YNB"); RasterSupport.Unlock(RasterSupportType.Jpip, "YbGG7wWiVJ"); RasterSupport.Unlock(RasterSupportType.Pro, ""); RasterSupport.Unlock(RasterSupportType.LeadOmr, "J3vh828GC8"); RasterSupport.Unlock(RasterSupportType.MediaWriter, "TpjDw2kJD2"); RasterSupport.Unlock(RasterSupportType.Medical, "ZhyFRnk3sY"); RasterSupport.Unlock(RasterSupportType.Medical3d, "DvuzH3ePeu"); RasterSupport.Unlock(RasterSupportType.MedicalNet, "b4nBinY7tv"); RasterSupport.Unlock(RasterSupportType.MedicalServer, "QbXwuZxA3h"); RasterSupport.Unlock(RasterSupportType.Mobile, ""); RasterSupport.Unlock(RasterSupportType.Nitf, "G37rmw5dTr"); DicomEngine.Startup(); foreach (string strfile in viewer.getCurrentFiles()) { DicomDataSet ds = new DicomDataSet(); try { ds.Load(strfile, DicomDataSetLoadFlags.None); ds.ChangeTransferSyntax(DicomUidType.ImplicitVRLittleEndian, 2, ChangeTransferSyntaxFlags.None); ds.Save(strfile + "1", DicomDataSetSaveFlags.None); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); } _storageScu.AddFile(strfile + "1"); } } else { System.Windows.Forms.MessageBox.Show("没有合适的图像。。。"); } IAsyncResult asyncResult = _storageScu.BeginSend(new AsyncCallback(SendComplete), _storageScu); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { //Shutdown our DICOM Engine DicomEngine.Shutdown(); }
public DICOMJob(DICOMJobSettings js) { Settings = js; DicomEngine.Startup(); DicomNet.Startup(); }
protected DICOMJob() { Settings = null; DicomEngine.Startup(); DicomNet.Startup(); }
static int Main(string[] args) { if (!DicomDemoSettingsManager.Is64Process()) { _demoName = "LEADTOOLS PACS Configuration Demo (32 bit)"; } else { _demoName = "LEADTOOLS PACS Configuration Demo (64 bit)"; } if (DemosGlobal.MustRestartElevated()) { DemosGlobal.TryRestartElevated(args); return(0); } ReadCommandLine(args); MySettings mySettings = new MySettings(); if (_bInitialize) { #if !FOR_DOTNET4 if (false == DemosGlobal.IsDotNet35Installed()) { return(0); } #endif MyUtils.RemoveConfigurationFiles(); MyUtils.RemoveGlobalPacsConfig(); mySettings.Save(); return(0); } bool showUI = !_bUninstall && !_bInitialize; #if !FOR_DOTNET4 bool dotNet35Installed = DemosGlobal.IsDotNet35Installed(); if (showUI && !dotNet35Installed) { Messager.ShowWarning(null, ".NET Framework 3.5 could not be found on this machine.\n\nPlease install the .NET Framework 3.5 runtime and try again. This program will now exit."); } if (!dotNet35Installed) { return(0); } #endif mySettings.Load(); #if LEADTOOLS_V19_OR_LATER if (showUI) { if (!Support.SetLicense()) { return(-1); } } #endif // If calling with the /uninstall flag, do not display the nag message if (_bUninstall == false) { if (RasterSupport.KernelExpired) { return(-1); } } #if LEADTOOLS_V175_OR_LATER if (showUI) { if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.DicomCommunication.ToString()), "Warning"); return(-1); } } #else if (RasterSupport.IsLocked(RasterSupportType.MedicalNet)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.MedicalNet.ToString()), "Warning"); return(-1); } if (RasterSupport.IsLocked(RasterSupportType.MedicalServer)) { MessageBox.Show(String.Format("{0} Support is locked!", RasterSupportType.MedicalServer.ToString()), "Warning"); return(-1); } #endif //_admin = new ServiceAdministrator(_baseDir); //_admin.Unlock(Support.MedicalServerKey); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if (LEADTOOLS_V20_OR_LATER) if (DemosGlobal.IsDotNet45OrLaterInstalled() == false) { MessageBox.Show("To run this application, you must first install Microsoft .NET Framework 4.5 or later.", "Microsoft .NET Framework 4.5 or later Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(-1); } #endif //Utils.EngineStartup(); DicomEngine.Startup(); if (_bUninstall) { try { using (ServiceAdministrator serviceAdmin = CreateServiceAdministrator()) { MyUtils.UninstallAllDicomServersSilent(serviceAdmin); MyUtils.RemoveConfigurationFiles(); } } catch (Exception) { } } else { string missingDbComponents; DialogResult result = DialogResult.Yes; Messager.Caption = _demoName; string platform = "32-bit"; if (DicomDemoSettingsManager.Is64Process()) { platform = "64-bit"; } string [] productsToCheck = new string[] { DicomDemoSettingsManager.ProductNameDemoServer, DicomDemoSettingsManager.ProductNameWorkstation, DicomDemoSettingsManager.ProductNameStorageServer }; bool isDbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out missingDbComponents); if (!isDbConfigured) // databases not configured { string message = "The following databases are not configured:\n\n{0}\nRun the {1} CSPacsDatabaseConfigurationDemo to configure the missing databases then run this demo again.\n\nDo you want to run the {2} CSPacsDatabaseConfigurationDemo wizard now?"; message = string.Format(message, missingDbComponents, platform, platform); result = Messager.ShowQuestion(null, message, MessageBoxButtons.YesNo); if (DialogResult.Yes == result) { RunDatabaseConfigurationDemo(); } } mySettings._settings.FirstRun = false; mySettings.Save(); // Add event handler for handling UI thread exceptions to the event Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); // Set the unhandled exception mode to force all Windows Forms errors to go through our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); try { Application.Run(new MainForm()); } catch (FileNotFoundException ex) { MessageBox.Show("File not found exception.\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } DicomEngine.Shutdown(); return(0); }
//called once for the lifetime of the app domain protected void Application_Start() { AppDomainException = null; GlobalConfiguration.Configure(WebApiConfig.Register); //allow xml serialization //GlobalConfiguration.Configuration.Formatters.XmlFormatter.UseXmlSerializer = true; // ServicePointManager setup ServicePointManager.UseNagleAlgorithm = false; ServicePointManager.Expect100Continue = false; ServicePointManager.DefaultConnectionLimit = int.MaxValue; ServicePointManager.EnableDnsRoundRobin = true; //ServicePointManager.ReusePort = true; try { //initialize SupportLock.SetLicense(); DicomEngine.Startup(); DicomNet.Startup(); //Unity dependency injection container var unity = new UnityContainer(); //register types //controllers that should be injectable unity.RegisterType <AuthController>(); unity.RegisterType <AuditController>(); unity.RegisterType <TemplateController>(); unity.RegisterType <StoreController>(); unity.RegisterType <PatientController>(); unity.RegisterType <PatientAccessRightsController>(); unity.RegisterType <PACSRetrieveController>(); unity.RegisterType <PacsQueryController>(); unity.RegisterType <OptionsController>(); unity.RegisterType <MonitorCalibrationController>(); unity.RegisterType <ExportController>(); unity.RegisterType <RetrieveController>(); unity.RegisterType <QueryController>(); unity.RegisterType <ThreeDController>(); unity.RegisterType <AutoController>(); //injectable types unity.RegisterType <AddinsFactory>(); //injectable types/base unity.RegisterType <IAuthHandler, AuthHandler>(); unity.RegisterType <IAuditHandler, AuditHandler>(); unity.RegisterType <ITemplateHandler, TemplateHandler>(); unity.RegisterType <IStoreHandler, StoreHandler>(); unity.RegisterType <IPatientHandler, PatientHandler>(); unity.RegisterType <IPatientAccessRightsHandler, PatientAccessRightsHandler>(); unity.RegisterType <IOptionsHandler, OptionsHandler>(); unity.RegisterType <IMonitorCalibrationHandler, MonitorCalibrationHandler>(); //unity.RegisterType<IStreamExportHandler, StreamExportHandler>(); unity.RegisterType <IHashingProvider, HashingProvider>(); unity.RegisterType <IExportHandler, ExportHandler>(); unity.RegisterType <IRetrieveHandler, RetrieveHandler>("local"); unity.RegisterType <IRetrieveHandler, WadoRetrieveHandler>("wado"); unity.RegisterType <IQueryHandler, QueryHandler>("local"); unity.RegisterType <IQueryHandler, WadoQueryHandler>("wado"); unity.RegisterType <IThreeDHandler, ThreeDHandler>(); unity.RegisterType <IPacsQueryHandler, PacsQueryHandler>("pacsquery"); unity.RegisterType <IPacsQueryHandler, WadoAsPacsQueryHandler>("wadoaspacsquery"); unity.RegisterType <IPacsRetrieveHandler, PacsRetrieveHandler>("pacsretrieve"); unity.RegisterType <IPacsRetrieveHandler, WadoAsPacsRetrieveHandler>("wadoaspacsretrieve"); unity.RegisterType <IAutoHandler, AutoHandler>(); { //register singletons CreateSingletons(); unity.RegisterInstance <Lazy <IMessagesBus> >(_messageBus, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IStorageDataAccessAgent3> >(_storageAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <ILoggingDataAccessAgent> >(_loggingAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IUserManagementDataAccessAgent4> >(_userManagementDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IPermissionManagementDataAccessAgent2> >(_permissionManagementDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IOptionsDataAccessAgent> >(_optionsDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IPatientRightsDataAccessAgent> >(_patientRightsDataAccess, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IDownloadJobsDataAccessAgent> >(_downloadJobsDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IAuthorizedStorageDataAccessAgent2> >(_authorizedStorageDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IMonitorCalibrationDataAccessAgent> >(_monitorCalibrationDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <ITemplateDataAccessAgent> >(_templateDataAccessAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <IExternalStoreDataAccessAgent> >(_externalStoreAgent, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <Leadtools.Dicom.Imaging.IDataCacheProvider> >(_dataCache, new ExternallyControlledLifetimeManager()); unity.RegisterInstance <Lazy <ConnectionSettings> >(_connectionSettings, new ExternallyControlledLifetimeManager()); } //set default dependency resolver to Unity (with the wrapper) GlobalConfiguration.Configuration.DependencyResolver = new IoCContainer(unity); //caching workers LTCachingCtrl.QeueuWorkers(); } catch (ServiceSetupException ex) { AppDomainException = ex; //handle on first request } catch (Exception) { HttpRuntime.UnloadAppDomain(); throw; } }
static int Main(string[] args) { #if LEADTOOLS_V19_OR_LATER if (!Support.SetLicense()) { return(0); } #else Support.SetLicense(); if (RasterSupport.KernelExpired) { return(0); } #endif Mutex m; if (DemosGlobal.MustRestartElevated()) { DemosGlobal.TryRestartElevated(args); return(0); } #if !FOR_DOTNET4 bool dotNet35Installed = DemosGlobal.IsDotNet35Installed(); if (!dotNet35Installed) { return(0); } #endif bool ok; #if LEADTOOLS_V175_OR_LATER m = new Mutex(true, "LEADTOOLS_V175_OR_LATER", out ok); if (!ok) { return(1); } #else SingleInstanceController controller; #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if LEADTOOLS_V175_OR_LATER if (RasterSupport.IsLocked(RasterSupportType.DicomCommunication)) #else if (RasterSupport.IsLocked(RasterSupportType.MedicalNet)) #endif { MessageBox.Show("Support for LEADTOOLS PACS Module is locked!\nServer Manager cannot run!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(-1); } #if (LEADTOOLS_V20_OR_LATER) if (DemosGlobal.IsDotNet45OrLaterInstalled() == false) { MessageBox.Show("To run this application, you must first install Microsoft .NET Framework 4.5 or later.", "Microsoft .NET Framework 4.5 or later Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(-1); } #endif { string message = string.Empty; string[] productsToCheck = new string[] { DicomDemoSettingsManager.ProductNameStorageServer }; bool dbConfigured = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out message); if (!dbConfigured && !RequestUserToConfigureDbSucess(message)) { return(-1); } if (!GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameDemoServer) && !RequestUserToUpgradeDbSucess()) { return(-1); } if (!ok) { return(-1); } } BaseDir = Path.GetFullPath(GetWorkingDirectory()).ToLower(); DicomEngine.Startup(); DicomNet.Startup(); #if !LEADTOOLS_V175_OR_LATER controller = new SingleInstanceController(); controller.Run(Environment.GetCommandLineArgs()); #else try { Application.Run(new MainForm()); } catch (FileNotFoundException ex) { MessageBox.Show("File not found exception.\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endif DicomNet.Shutdown(); DicomEngine.Shutdown(); #if LEADTOOLS_V175_OR_LATER GC.KeepAlive(m); #endif return(0); }
public static void EngineShutdown( ) { DicomEngine.Shutdown(); }
public static void EngineStartup( ) { DicomEngine.Startup(); }
static Program() { DicomEngine.Startup(); }
static void Main(string[] args) { try { if (IsWindowsVista() && !IsAdmin()) { RestartElevated(); return; } #if (LEADTOOLS_V20_OR_LATER) if (DemosGlobal.IsDotNet45OrLaterInstalled() == false) { MessageBox.Show("To run this application, you must first install Microsoft .NET Framework 4.5 or later.", "Microsoft .NET Framework 4.5 or later Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } #endif Messager.Caption = ConfigurationData.ApplicationName; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DicomEngine.Startup(); if (!InitializeLicense()) { return; } bool success = false; if (args.Length > 0) { // Redirect console output to parent process -- must be before any calls to Console.WriteLine() AttachConsole(ATTACH_PARENT_PROCESS); Console.WriteLine(); if (ReadCommandLine(args)) { if (_commandLineOptions.IsValid() == false) { MessageBox.Show("Invalid CommandLine Options"); return; } success = SilentConfigure(); } } else { _mainForm = GetMainForm(); if (_mainForm == null) { return; } Application.Run(_mainForm); } } catch (Exception exception) { Program.MyShowError("An error has occured. The program will be terminated.\n" + exception.Message); } finally { DicomEngine.Shutdown(); Program.MyShowInformation("Finished."); } }
public Form1() { RasterSupport.SetLicense(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY")); InitializeComponent(); RasterCodecs _codecs = new RasterCodecs(); RasterImage _image; string dicomFileName = @"C:\Users\Public\Documents\LEADTOOLS Images\IMAGE3.dcm"; // Create the medical viewer and adjust the size and the location. _medicalViewer = new MedicalViewer(1, 1); _medicalViewer.Location = new Point(0, 0); _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); // Load an image and then add it to the control. _image = _codecs.Load(dicomFileName); DicomEngine.Startup(); using (DicomDataSet ds = new DicomDataSet()) { MedicalViewerMultiCell cell = new MedicalViewerMultiCell(_image, true, 1, 1); ds.Load(dicomFileName, DicomDataSetLoadFlags.None); string dpatientID = GetDicomTag(ds, DicomTag.PatientID); string dpatientName = GetDicomTag(ds, DicomTag.PatientName); string dpatientAge = GetDicomTag(ds, DicomTag.PatientAge); string dpatientBirthDate = GetDicomTag(ds, DicomTag.PatientBirthDate); string dpatientSex = GetDicomTag(ds, DicomTag.PatientSex); // add some actions that will be used to change the properties of the images inside the control. cell.AddAction(MedicalViewerActionType.WindowLevel); cell.AddAction(MedicalViewerActionType.Offset); cell.AddAction(MedicalViewerActionType.Stack); // assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated. cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active); cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active); cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active); // assign the added actions to a keyboard keys that will work like the mouse. MedicalViewerKeys medicalKeys = new MedicalViewerKeys(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None); cell.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys); medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl; cell.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys); medicalKeys.MouseDown = Keys.PageDown; medicalKeys.MouseUp = Keys.PageUp; cell.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys); medicalKeys.MouseDown = Keys.Subtract; medicalKeys.MouseUp = Keys.Add; cell.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys); _medicalViewer.Cells.Add(cell); // adjust some properties of the cell and add some tags. cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Name: " + dpatientName); cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "ID: " + dpatientID); cell.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB: " + dpatientBirthDate); cell.SetTag(4, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Age: " + dpatientAge); cell.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Sex: " + dpatientSex); cell.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame); cell.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale); cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData); cell.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView); cell.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit); cell.Rows = 1; cell.Columns = 1; cell.Frozen = false; cell.DisplayRulers = MedicalViewerRulers.Both; cell.ApplyOnIndividualSubCell = false; cell.ApplyActionOnMove = true; cell.FitImageToCell = true; cell.Selected = true; cell.ShowTags = true; } string GetDicomTag(DicomDataSet ds, long tag) { DicomElement patientElement = ds.FindFirstElement(null, tag, true); if (patientElement != null) { return(ds.GetConvertValue(patientElement)); } return(null); } Controls.Add(_medicalViewer); _medicalViewer.Dock = DockStyle.Fill; }
static void Application_ApplicationExit(object sender, EventArgs e) { DicomEngine.Shutdown(); }
private void Change_Click(object sender, EventArgs e) { // Some sanity checks ! if (txtInFile.Text.Length == 0) { MessageBox.Show("Please enter a valid input file name "); return; } if (!System.IO.File.Exists(txtInFile.Text)) { MessageBox.Show("Please enter a valid input file name "); return; } if (txtOutFile.Text.Length == 0) { MessageBox.Show("Please enter a valid output file name "); return; } if (txtInFile.Text == txtOutFile.Text) { MessageBox.Show("Input and output file names can't be the same!"); return; } DicomDataSetSaveFlags saveFlags = (DicomDataSetSaveFlags.MetaHeaderPresent | DicomDataSetSaveFlags.GroupLengths); // Get desired transfer syntax string uid = ((MyTransferSyntax)cmbTransferSyntax.Items[cmbTransferSyntax.SelectedIndex]).szUID; int nQFactor; if (IsUidUsingQFactor(uid)) { nQFactor = Convert.ToInt16(txtQFactor.Text); if ((nQFactor < 2 || nQFactor > 255) && (nQFactor != 0)) { string message = "Please enter a valid quality factor:\r\n" + "\t 0 (lossless)\r\n" + "\t 2 (lossy highest quality) to 255 (lossy most compression)"; MessageBox.Show(message, "Please enter a valid quality factor."); return; } } else { nQFactor = 0; } //Load input dataset #if !(LEADTOOLS_V17_OR_LATER) RasterCodecs.Startup(); #endif DicomEngine.Startup(); DicomDataSet DicomDs = new DicomDataSet(); DicomDs.Reset(); try { DicomDs.Load(txtInFile.Text, 0); } catch (Exception ex) { MessageBox.Show(ex.Message, "Failed to load the Dataset!"); return; } if (IsUidJpeg2000(uid)) { // Setting JPEG 2000 options DicomDs.Jpeg2000Options = m_J2KOptions; } // Ensure that the DICOM File Meta Information is added CheckFileMetaInfo(DicomDs); //Change dataset to desired transfer syntax try { ChangeTransferSyntaxFlags flags = ChangeTransferSyntaxFlags.None; #if LEADTOOLS_V175_OR_LATER if (checkBoxYbrFull.Checked) { flags |= ChangeTransferSyntaxFlags.YbrFull; } #endif #if LEADTOOLS_V19_OR_LATER DicomDs.ChangeTransferSyntax(txtOutFile.Text, uid, nQFactor, flags, saveFlags); #else DicomDs.ChangeTransferSyntax(uid, nQFactor, flags); #endif } catch (Exception ex) { string errorString = ex.Message.ToLower(); if (errorString.Contains("parameter")) { const string strErr = "Failed to change dataset transfer syntax.\nPossible cause:\" Bits Allocated\" for source dataset doesn't match desired \"Transfer Syntax\"."; MessageBox.Show(strErr, "Failed to change dataset transfer syntax.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show(ex.Message, "LEAD Error"); } return; } #if !LEADTOOLS_V19_OR_LATER // Save dataset! try { DicomDs.Save(txtOutFile.Text, saveFlags); } catch (Exception ex) { MessageBox.Show(ex.Message, "Failed to save dataset"); return; } #endif // #if !LEADTOOLS_V19_OR_LATER DicomEngine.Shutdown(); #if !LEADTOOLS_V17_OR_LATER RasterCodecs.Shutdown(); #endif MessageBox.Show("Conversion Succeeded", "SUCCESS"); //this.Cursor = Cursors.WaitCursor; //this.Cursor = Cursors.Arrow; }