C#
VB
Java
WinRT C#
C++
The exception that is thrown when a LEADTOOLS DICOM error occurs.
public class DicomException : LeadtoolsException Public Class DicomExceptionInherits Leadtools.LeadtoolsExceptionImplements System.Runtime.InteropServices._Exception, System.Runtime.Serialization.ISerializable
public sealed class DicomException  public class DicomException extends LeadtoolsException function Leadtools.Dicom.DicomException() public ref class DicomException : public Leadtools.LeadtoolsException, System.Runtime.InteropServices._Exception, System.Runtime.Serialization.ISerializable   
using Leadtools;using Leadtools.Dicom;public void TestLoadDicomDataset(){string dicomFileName = Path.Combine(LEAD_VARS.ImagesDir, "SomeBadFileName.dcm");//Make sure to initialize the DICOM engine, this needs to be done only once//In the whole applicationDicomEngine.Startup();using (DicomDataSet ds = new DicomDataSet()){try{ds.Load(dicomFileName, DicomDataSetLoadFlags.None);}catch (DicomException ex){//LEADTOOLS Dicom Error (the file can't be opened)if (ex.Code == DicomExceptionCode.Open)MessageBox.Show(string.Format("File {0} can't be opened", dicomFileName));else{//Some other LEADTOOLS Dicom ErrorMessageBox.Show(string.Format("Could not load the file {0}.{1}Dicom error code: {2}{1}Message: {3}", dicomFileName, Environment.NewLine, ex.Code, ex.Message));}}catch (Exception ex){// Other errorsMessageBox.Show(string.Format("Could not load the file {0}.{1}{2}", dicomFileName, Environment.NewLine, ex.Message));}}DicomEngine.Shutdown();}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.DicomPrivate Sub TestLoadDicomDataset()Dim dicomFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "SomeBadFileName.dcm")'Make sure to initialize the DICOM engine, this needs to be done only once'In the whole applicationDicomEngine.Startup()Dim ds As DicomDataSet = New DicomDataSet()Using (ds)Tryds.Load(dicomFileName, DicomDataSetLoadFlags.None)Catch ex As DicomException'LEADTOOLS Dicom Error (the file can't be opened)If ex.Code = DicomExceptionCode.Open ThenMessageBox.Show(String.Format("File {0} can't be opened", dicomFileName))Else'Some other LEADTOOLS Dicom ErrorMessageBox.Show(String.Format("Could not load the file {0}.{1}Dicom error code: {2}{1}Message: {3}", dicomFileName,Environment.NewLine, ex.Code, ex.Message))End IfCatch ex As Exception' Other errorsMessageBox.Show(String.Format("Could not load the file {0}.{1}{2}", dicomFileName, Environment.NewLine, ex.Message))End TryEnd UsingDicomEngine.Shutdown()End SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Dicom;using Leadtools.Examples;public void TestLoadDicomDataset(Stream stream){//Make sure to initialize the DICOM engine, this needs to be done only once//In the whole applicationDicomEngine.Startup();using (DicomDataSet ds = new DicomDataSet()){try{ds.Load(stream, DicomDataSetLoadFlags.None);}catch (DicomException ex){//LEADTOOLS Dicom Error (the file can't be opened)if (ex.Code == DicomExceptionCode.Open)MessageBox.Show(string.Format("Stream can't be opened"));else{//Some other LEADTOOLS Dicom ErrorMessageBox.Show(string.Format("Could not load the stream{0}Dicom error code: {1}{0}Message: {2}", Environment.NewLine, ex.Code, ex.Message));}}catch (Exception ex){// Other errorsMessageBox.Show(string.Format("Could not load the stream.{0}{1}", Environment.NewLine, ex.Message));}}DicomEngine.Shutdown();}
Imports LeadtoolsImports Leadtools.DicomPublic Sub TestLoadDicomDataset(ByVal stream As Stream)'Make sure to initialize the DICOM engine, this needs to be done only once'In the whole applicationDicomEngine.Startup()Using ds As DicomDataSet = New DicomDataSet()Tryds.Load(stream, DicomDataSetLoadFlags.None)Catch ex As DicomException'LEADTOOLS Dicom Error (the file can't be opened)If ex.Code = DicomExceptionCode.Open ThenMessageBox.Show(String.Format("Stream can't be opened"))Else'Some other LEADTOOLS Dicom ErrorMessageBox.Show(String.Format("Could not load the stream{0}Dicom error code: {1}{0}Message: {2}",Environment.NewLine, ex.Code, ex.Message))End IfCatch ex As Exception' Other errorsMessageBox.Show(String.Format("Could not load the stream.{0}{1}", Environment.NewLine, ex.Message))End TryEnd UsingDicomEngine.Shutdown()End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
