The exception that is thrown when a LEADTOOLS DICOM error occurs.
Syntax
Example
Visual Basic | Copy Code |
---|
<Test> _
Private Sub TestLoadDicomDataset()
Dim dicomFileName As String = LeadtoolsExamples.Common.ImagesPath.Path + "SomeBadFileName.dic"
DicomEngine.Startup()
Dim ds As DicomDataSet = New DicomDataSet()
Using (ds)
Try
ds.Load(dicomFileName, DicomDataSetLoadFlags.None)
Catch ex As DicomException
If ex.Code = DicomExceptionCode.Open Then
MessageBox.Show(String.Format("File {0} can't be opened", dicomFileName))
Else
MessageBox.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 If
Catch ex As Exception
MessageBox.Show(String.Format("Could not load the file {0}.{1}{2}", dicomFileName, Environment.NewLine, ex.Message))
End Try
End Using
DicomEngine.Shutdown()
End Sub |
C# | Copy Code |
---|
void TestLoadDicomDataset() { string dicomFileName = LeadtoolsExamples.Common.ImagesPath.Path + "SomeBadFileName.dic"; //Make sure to initialize the DICOM engine, this needs to be done only once //In the whole application DicomEngine.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 Error MessageBox.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 errors MessageBox.Show(string.Format("Could not load the file {0}.{1}{2}", dicomFileName, Environment.NewLine, ex.Message)); } } DicomEngine.Shutdown(); } |
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also