Leadtools.Dicom Requires Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
DicomException Class
See Also  Members   Example 
Leadtools.Dicom Namespace : DicomException Class




The exception that is thrown when a LEADTOOLS DICOM error occurs.

Syntax

Visual Basic (Declaration) 
Public Class DicomException 
   Inherits LeadtoolsException
Visual Basic (Usage)Copy Code
Dim instance As DicomException
C# 
public class DicomException : LeadtoolsException 
Managed Extensions for C++ 
public __gc class DicomException : public LeadtoolsException 
C++/CLI 
public ref class DicomException : public LeadtoolsException 

Example

Visual BasicCopy Code
<Test> _
Private Sub TestLoadDicomDataset()
  Dim dicomFileName As String = "C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 14.5\Images\SomeBadFileName.dic"
  'Make sure to initialize the DICOM engine, this needs to be done only once
  'In the whole application
  DicomEngine.Startup()
  Dim ds As DicomDataSet = New DicomDataSet()
    Using (ds)
       Try
          ds.Load(dicomFileName, DicomDataSetLoadFlags.None)
       Catch ex As DicomException
          'LEADTOOLS Dicom Error (the file can�t be opened)
          If ex.Code = DicomExceptionCode.Open Then
             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))
          End If
       Catch ex As Exception
          ' Other errors
          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 = @"C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 14.5\Images\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

System.Object
   System.Exception
      Leadtools.LeadtoolsException
         Leadtools.Dicom.DicomException

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Dicom requires a Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features