Saturday, February 04, 2012
Google Custom Search

ClearCanvas Highlights

Download our  Software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: b3lad
New Today New Today: 6
New Yesterday New Yesterday: 26
User Count Overall: 20479

People Online People Online:
Visitors Visitors: 11
Members Members: 0
Total Total: 11

Online Now Online Now:

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:521
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
Basic Member
Basic Member
Posts:14

--
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:26

--
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 2011 ClearCanvas Inc.