class DicomElement { Tag : DicomTag ; VR : string ; Value : Array < any > = [ ] ; public constructor ( ) { } public SetUInt16 ( index , value ) { this . Value [ index ] = value ; } public GetUInt16 ( index , defaultValue ) { return parseInt ( this . get ( index , defaultValue ) ) ; } public SetString ( index , value ) { this . Value [ index ] = value ; } public GetString ( index , defaultValue ) { return this . get ( index , defaultValue ) + "" ; } public SetValue ( index , value ) { this . Value [ index ] = value ; } public GetValue ( index , defaultValue ) { return this . get ( index , defaultValue ) ; } public toString ( ) { if ( this . Value && this . Value . length > 0 ) { return this . getStringValue ( ) ; } else { return "" ; } } private get ( index , defaultValue ) { if ( this . Value && this . Value . length > 0 ) { if ( index >= this . Value . length ) { throw "Invalid index" ; } return this . Value [ index ] ; } return defaultValue ; } private getStringValue ( ) { if ( this . VR == "PN" ) { var pName = this . Value [ 0 ] ; if ( pName ) { return pName . Alphabetic + "" ; } } return this . Value [ 0 ] . toString ( ) ; } }