From: "rob s." Date: 2011-02-24T06:28:02+09:00 Subject: finding a tag in a binary file Hi I'm a complete non programmer but willing to give it a try. I have a DICOMDIR (medical imaging file) which has various tags in, following a tag ie 0010, 0010 is the "patient name", "study date" 0008,0020 is another. I have several DICOMDIR and I would like to extract just a few bits of information from them to a .txt file, the files average size is about 343 KB as its full of other information as well which I don't need. Each file has amongst other things a list of about 10 names, scan dates etc. So far I've managed to read the file into an array using contentsArray=[] #open new array empty open('1DICOMDIR', 'rb') { |f| f.each_byte { |f| contentsArray.push f } } This gets the info into an array although its a hex file it displays the contents in decimal, but they correspond to the hex codes I've seen in a hex editor... My problem is I don't know how to detect 0010,0010 ? then extract the name. Can anyone help, I've looked all over the web but not finding anything to help me much. Thanks a lot -- Posted via http://www.ruby-forum.com/.