# coding: utf-8 # # Copyright (C) 2014-2020 Enrico Rivarola # # This file is part of DcmDict gem (dcm_dict). # # DcmDict is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # DcmDict is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with DcmDict. If not, see . # # This software has neither been tested nor approved for clinical use # or for incorporation in a medical device. # It is the redistributor's or user's responsibility to comply with any # applicable local, state, national or international regulations. # module XmlSampleSpecHelper def self.xml_tag_sample_standard xml_string=< (0008,0010) Recognition Code Recognition​Code SH 1 RET END data = {tag_ps: '(0008,0010)', tag_str: '(0008,0010)', tag_ary: [0x0008,0x0010], tag_sym: :recognition_code, tag_ndm: '00080010', tag_name: 'Recognition Code', tag_key: 'RecognitionCode', tag_vr: [:SH], tag_vm: ['1'], tag_note: 'RET', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_standard_empty_note xml_string = < (0008,0012) Instance Creation Date Instance​Creation​Date DA 1 END data = {tag_ps: '(0008,0012)', tag_str: '(0008,0012)', tag_ary: [0x0008,0x0012], tag_sym: :instance_creation_date, tag_ndm: '00080012', tag_name: 'Instance Creation Date', tag_key: 'InstanceCreationDate', tag_vr: [:DA], tag_vm: ['1'], tag_note: '', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_multiple_tag xml_string=< (60xx,0040) Overlay Type Overlay​Type CS 1 END data = {tag_ps: '(60XX,0040)', tag_str: '(6022,0040)', tag_ary: [0x6022,0x0040], tag_sym: :overlay_type, tag_ndm: '60220040', tag_name: 'Overlay Type', tag_key: 'OverlayType', tag_vr: [:CS], tag_vm: ['1'], tag_note: '', tag_multiple: true} {xml_string => data} end def self.xml_tag_sample_no_note xml_string=< (0018,1202) DateTime of Last Calibration Date​Time​Of​Last​Calibration DT 1 END data = {tag_ps: '(0018,1202)', tag_str: '(0018,1202)', tag_ary: [0x0018,0x1202], tag_sym: :date_time_of_last_calibration, tag_ndm: '00181202', tag_name: 'DateTime of Last Calibration', tag_key: 'DateTimeOfLastCalibration', tag_vr: [:DT], tag_vm: ['1'], tag_note: '', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_multi_vr_vm xml_string = < (0028,1200) Gray Lookup Table Data Gray​Lookup​Table​Data US or SS or OW 1-n or 1 RET END data = {tag_ps: '(0028,1200)', tag_str: '(0028,1200)', tag_ary: [0x0028,0x1200], tag_sym: :gray_lookup_table_data, tag_ndm: '00281200', tag_name: 'Gray Lookup Table Data', tag_key: 'GrayLookupTableData', tag_vr: [:US, :SS, :OW], tag_vm: ['1-n', '1'], tag_note: 'RET', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_no_vr xml_string = < (FFFE,E000) Item Item See Note 1 END data = {tag_ps: '(FFFE,E000)', tag_str: '(FFFE,E000)', tag_ary: [0xfffe,0xe000], tag_sym: :item, tag_ndm: 'FFFEE000', tag_name: 'Item', tag_key: 'Item', tag_vr: [:"See Note"], tag_vm: ['1'], tag_note: '', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_multi_vr xml_string = < (0014,3050) Dark Current Counts Dark​Current​Counts OB or OW 1 DICONDE END data = {tag_ps: '(0014,3050)', tag_str: '(0014,3050)', tag_ary: [0x0014,0x3050], tag_sym: :dark_current_counts, tag_ndm: '00143050', tag_name: 'Dark Current Counts', tag_key: 'DarkCurrentCounts', tag_vr: [:OB, :OW], tag_vm: ['1'], tag_note: 'DICONDE', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_empty xml_string=< (0018,9445) RET - See Note END data = {tag_ps: '(0018,9445)', tag_str: '(0018,9445)', tag_ary: [0x0018,0x9445], tag_sym: :placeholder_0018_9445, tag_ndm: '00189445', tag_name: 'Placeholder (0018,9445)', tag_key: 'Placeholder_0018_9445', tag_vr: [:UN], tag_vm: ['1'], tag_note: 'RET - See Note', tag_multiple: false} {xml_string => data} end def self.xml_tag_sample_lowercase_tag xml_string = < (0074,100a) Contact URI ContactURI ST 1 END data = {tag_ps: '(0074,100A)', tag_str: '(0074,100A)', tag_ary: [0x0074,0x100a], tag_sym: :contact_uri, tag_ndm: '0074100A', tag_name: 'Contact URI', tag_key: 'ContactURI', tag_vr: [:ST], tag_vm: ['1'], tag_note: '', tag_multiple: false} {xml_string => data} end def self.xml_tag_multiline_note_set xml_string = < (0000,0700) Priority Priority US 1 The priority shall be set to one of the following values: LOW = 0002H MEDIUM = 0000H HIGH = 0001H END note = < data} end def self.xml_tag_complex_note xml_string= < (0000,0900) Status Status US 1 Confirmation status of the operation. See . END data = {tag_ps: '(0000,0900)', tag_str: '(0000,0900)', tag_ary: [0x0000,0x0900], tag_sym: :status, tag_ndm: '00000900', tag_name: 'Status', tag_key: 'Status', tag_vr: [:US], tag_vm: ['1'], tag_note: "Confirmation status of the operation. See .", tag_multiple: false} {xml_string => data} end def self.xml_tag_single_set { }.merge(xml_tag_sample_standard). merge(xml_tag_multiline_note_set). merge(xml_tag_sample_standard_empty_note). merge(xml_tag_complex_note). merge(xml_tag_sample_multiple_tag). merge(xml_tag_sample_no_note). merge(xml_tag_sample_multi_vr_vm). merge(xml_tag_sample_no_vr). merge(xml_tag_sample_multi_vr). merge(xml_tag_sample_empty). merge(xml_tag_sample_lowercase_tag) end def self.uid_single_standard xml_string=< 1.2.840.10008.1.​2 Implicit VR Little Endian: Default Transfer Syntax for DICOM Implicit​VR​Little​Endian Transfer Syntax END data = {uid_value: "1.2.840.10008.1.2", uid_name: "Implicit VR Little Endian: Default Transfer Syntax for DICOM", uid_key: 'ImplicitVRLittleEndian', uid_sym: :implicit_vr_little_endian, uid_type: :transfer_syntax} {xml_string => data} end def self.uid_sample_retired_noname xml_string=< 1.2.840.10008.​5.​1.​4.​1.​1.​12.​77 (Retired) SOP Class (2015c) END data = {uid_value: "1.2.840.10008.5.1.4.1.1.12.77", uid_name: "1.2.840.10008.5.1.4.1.1.12.77 (Retired)", uid_key: 'UID_1_2_840_10008_5_1_4_1_1_12_77', uid_sym: :uid_1_2_840_10008_5_1_4_1_1_12_77, uid_type: :sop_class} {xml_string => data} end def self.uid_standard_sop xml_string=< 1.2.840.10008.1.​1 Verification SOP Class Verification SOP Class END data = {uid_value: "1.2.840.10008.1.1", uid_name: "Verification SOP Class", uid_key: 'Verification', uid_sym: :verification, uid_type: :sop_class} {xml_string => data} end def self.xml_uid_set {}.merge(uid_single_standard). merge(uid_sample_retired_noname). merge(uid_standard_sop) end end