Tuesday, September 07, 2010
Google Custom Search

Go to...

Recent Forum Posts

Our Community

Membership Membership:
Latest New User Latest: lh@sysit.com
New Today New Today: 7
New Yesterday New Yesterday: 20
User Count Overall: 10691

People Online People Online:
Visitors Visitors: 6
Members Members: 2
Total Total: 8

Online Now Online Now:
01: mh
02: anto.sab

ClearCanvas Community Forums

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

--
2009-04-17 04:51 PM  

Hi,

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

Thanks,

Sanket

jasper.yeh
Senior Member
Senior Member
Posts:425
Avatar

--
2009-04-17 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,
// Jasper
zlf
New Member
New Member
Posts:9

--
2010-04-16 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

robertvanommen
Basic Member
Basic Member
Posts:24

--
2010-04-16 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
Copyright 2010 ClearCanvas Inc.