Browsing this Thread:   1 Anonymous Users


 Bottom   Previous Topic   Next Topic  Register To Post

(1) 2 »


How to check image is dicom (.dcm) or not in DVTK api's or in .net
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 802
Offline
To view this post, you must login and reply first.

Posted on: 2010/1/7 11:11
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Core Team Member
Joined:
2005/9/15 8:27
From Bangalore, INDIA
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Posts: 117
Level : 9; EXP : 84
HP : 0 / 221
MP : 39 / 5720
Offline

Hi User,

Use DVTkHighLevelInterface dll as reference and implement following code:

public int readDicomFile(string filePath)

try

{
            
DicomFile dcFile = new DicomFile();
            
dcFile.Read(filePath);

}

catch()

{

............

}

}

Through Catch you can see the exception if it's not a DICOM file. Get back to us for any further query.

Regards,

Piyush


Posted on: 2010/1/8 7:41
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Just popping in
Joined:
2010/1/8 15:45
Group:
Registered Users
Posts: 2
Level : 1; EXP : 2
HP : 0 / 0
MP : 0 / 9
Offline
Hi,

I have the same question (how to detect that a file is dicom file).
I developed myself also the suggested solution, but also .gif. exe and even .doc file are read as it was a dicom file .
So this solution is not solid enough.

Anyone another suggestions

Klaasjan

Posted on: 2010/1/8 15:50
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Core Team Member
Joined:
2005/9/15 8:27
From Bangalore, INDIA
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Posts: 117
Level : 9; EXP : 84
HP : 0 / 221
MP : 39 / 5720
Offline

Hi,

Can you pl send me your code? We are already implementing the suggested solution in our tools. i'll analyze the issue.

Regards,

Piyush


Posted on: 2010/1/11 7:35
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Quite a regular
Joined:
2010/1/6 11:51
Group:
Registered Users
Posts: 22
Level : 3; EXP : 41
HP : 0 / 60
MP : 7 / 802
Offline
Hi Piyush,

Thanks for the reply,
Your solution is really work for me.
Now my this problem is solved.

Thanks
Manesh

Posted on: 2010/1/15 14:50
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Quite a regular
Joined:
2010/3/23 15:01
Group:
Registered Users
Posts: 24
Level : 3; EXP : 62
HP : 0 / 65
MP : 8 / 832
Offline
***
i am writing this message to have access to view the first message
***

Posted on: 2010/4/21 9:53
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Quite a regular
Joined:
2010/1/29 15:36
Group:
Registered Users
Posts: 17
Level : 2; EXP : 86
HP : 0 / 46
MP : 5 / 609
Offline
Hi Piyush,
any news/suggestions regarding the issue that "also .gif .exe and even .doc file are read as it was a dicom file"?
In my implementation also DVTK dlls are correctly read!
Thanks in advance.

Posted on: 2010/7/22 9:57
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Webmaster
Joined:
2005/6/21 15:06
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Steering Committee Members
Services Request Listeners
Webinar organisation
Posts: 253
Level : 14; EXP : 87
HP : 0 / 346
MP : 84 / 9212
Offline
Hi Sara,

besides checking for an exception thrown, also look at the following property:

dcFile.FileMetaInformation.DicomPrefix.
This should be the four bytes "DICM" in case of a DICOM file.

Regards,
Marco

Posted on: 2010/7/26 13:49
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Quite a regular
Joined:
2010/1/29 15:36
Group:
Registered Users
Posts: 17
Level : 2; EXP : 86
HP : 0 / 46
MP : 5 / 609
Offline
Hi Marco,
thank you very much for your suggestion.
I tried it, but I'm not sure to have correctly understood.

In fact: I checked the value of dcFile.FileMetaInformation.DicomPrefix when reading both a DICOM file and a DLL file.
In both cases it's a byte array containing the following four byte elements: '68', '73', '67', '77'.

Where am I wrong?

I thank you in advance for your kind help!

Sara.

Posted on: 2010/8/25 11:58
Transfer the post to other applications Transfer


Re: How to check image is dicom (.dcm) or not in DVTK api's or in .net
Webmaster
Joined:
2005/6/21 15:06
Group:
Webmasters
Registered Users
Core Developers
Content Owners
Steering Committee Members
Services Request Listeners
Webinar organisation
Posts: 253
Level : 14; EXP : 87
HP : 0 / 346
MP : 84 / 9212
Offline

Hi Sara,

it seems that the DVTk library is too helpfull in this case by always changing the file prefix to DICM (when you look up the hex values in a ASCII table), also for a dll. When we rewrite part of the file handling, we should of course make the behaviour more transparent.

But this won't help you right now.

What you could also try of course is the following.

According to part 10, a valid DICOM file should always start with the following:

  • File Preamble

A fixed 128 byte field available for Application Profile or

implementation specified use. If not used by an Application

Profile or a specific implementation all bytes shall be set to

00H.

 

File-set Readers or Updaters shall not rely on the content of

this Preamble to determine that this File is or is not a

DICOM File.

  • DICOM Prefix

Four bytes containing the character string "DICM". This

Prefix is intended to be used to recognize that this File is or

not a DICOM File.

 

So if you Open a file using the normal Microsoft .Net classes and you inspect bytes 129-132 if they equal DICM, you can determine whether you're dealing with a DICOM file or not.

 

Please let me know if this solution works for you.

Regards,
Marco

 


Posted on: 2010/9/9 15:22
Transfer the post to other applications Transfer



 Top   Previous Topic   Next Topic
(1) 2 »

 Register To Post


You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]