dicom / ruby-dicom

Library for reading, editing and writing DICOM files, as well as handling DICOM network communication. Written in the Ruby language.
http://dicom.rubyforge.org/
GNU General Public License v3.0
178 stars 68 forks source link

Fail to see image data on OsiriX after annonymization #69

Closed champierre closed 5 years ago

champierre commented 7 years ago

I use OsiriX(http://www.osirix-viewer.com/) to see DICOM files. After I did simple annonymization described in tutorials to a DICOM file, image data does not appear on OsiriX. I found that it is because "Transfer Syntax UID"(0002,0010) tags are removed, so I could fix the problem by skipping that process by overriding DICOM::Parent#delete_group method like the sample source below. I am new to this medical industry, so not sure if this is a bug or not, but I want to send this feedback, so opened this issue.

require 'dicom'

module DICOM
  class Parent
    def delete_group(group_string)
      group_elements = group(group_string)
      group_elements.each do |element|
        next if element.tag == '0002,0010'
        delete(element.tag)
      end
    end
  end
end

dcm = DICOM::DObject.read('sensitive.dcm')
dcm.anonymize
dcm.write('clean.dcm')
dicom commented 5 years ago

I don't see this behaviour. It is true that in the instance you have just run the anonymize method, the 0002 group is removed, but this group, including the 0002.0010 tag is written to the file when you use the write method.

Best regards, Christoffer