Error from reading with ClearCanvas in DICOM file in C# and how to display the DICOM VCR tag

624 Views Asked by At

I'm receiving an error in runtime using the ClearCanvas libraries. Here is the error

Could not find file 'C:\Users\Don jar\documents\visual studio 2010\Projects\DICOMCA\DICOMCA\bin\Debug\Fluro.dcm'.

The error points to this section of the code:

theFile.Load(DicomReadOptions.Default);

I will be grateful for any help. Thanks

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        string filename = "Fluro.dcm";
        DicomFile theFile = new DicomFile(filename);
        theFile.Load(DicomReadOptions.Default);
        foreach (DicomAttribute attribute in theFile.DataSet)
        {
            Console.WriteLine("Tag: {0}, Value: {1}", attribute.Tag.Name, attribute.ToString());
        }
    }
 }
1

There are 1 best solutions below

1
On BEST ANSWER

The filename parameter to the constructor to DicomFile sets the absolute path of the DicomFile. Just set this to the path to a DICOM file in your "picture" folder, as you mention.

The exception you are seeing is caused by the fact that you gave a relative path to the DICOM file, and its just trying to load it in the directory where your application is located.