Do you have a question?

First Name:
Surname:
Email:
Phone:
Message:
Get Audio Code

Check if valid DICOM file
Last Post 16 Apr 2010 02:39 AM by . 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Resolved
SanketUser is Offline
New Member
New Member
Posts:5

--
17 Apr 2009 04:51 PM  

Hi,

Is there any function to check if Input file name is valid DICOM file ?

Thanks,

Sanket

JasperUser is Offline
Advanced Member
Advanced Member
Posts:525

--
17 Apr 2009 05:30 PM Accepted Answer  
Hi Sanket,

You can try to load the file as a ClearCanvas.Dicom.DicomFile, and if it doesn't throw exceptions then the file is at least in DICOM part 10 format (there's not much validation available for whether or not the contents of the file is valid for a particular given SOP class - this is typically done by the code consuming the file).

If you're not going to be consuming pixel data, this following snippet should work; otherwise, take out that option to the Load method.


bool isValid = true;
try
{
DicomFile dcf = new DicomFile(path);
dcf.Load(DicomReadOptions.DoNotStorePixelDataInDataSet);
}
catch (DicomException)
{
isValid = false;
}


Hope this helps,
zlfUser is Offline
New Member
New Member
Posts:23

--
16 Apr 2010 01:18 AM  

It is too time-consuming. Checking one file takes around 900 ms in my machine. Is there more efficient way to check a given file is a dicom file or not?

Thanks

superZZ

RobertUser is Offline
New Member
New Member
Posts:26

--
16 Apr 2010 02:39 AM  

try checking more dicom files. The loading of the clearcanvas dll's takes allot of time for the first file, after that its much quicker.

You are not authorized to post a reply.

Active Forums 4.1