(int tag, String value)
| 802 | } |
| 803 | |
| 804 | String getHeaderInfo(int tag, String value) throws IOException { |
| 805 | if (tag==ITEM_DELIMINATION || tag==SEQUENCE_DELIMINATION) { |
| 806 | inSequence = false; |
| 807 | if (!IJ.debugMode) return null; |
| 808 | } |
| 809 | String key = i2hex(tag); |
| 810 | //while (key.length()<8) |
| 811 | // key = '0' + key; |
| 812 | String id = (String)dictionary.get(key); |
| 813 | if (id!=null) { |
| 814 | if (vr==IMPLICIT_VR && id!=null) |
| 815 | vr = (id.charAt(0)<<8) + id.charAt(1); |
| 816 | id = id.substring(2); |
| 817 | } |
| 818 | if (tag==ITEM) |
| 819 | return id!=null?id+":":null; |
| 820 | if (value!=null) |
| 821 | return id+": "+value; |
| 822 | switch (vr) { |
| 823 | case FD: |
| 824 | if (elementLength==8) |
| 825 | value = Double.toString(getDouble()); |
| 826 | else |
| 827 | for (int i=0; i<elementLength; i++) getByte(); |
| 828 | break; |
| 829 | case FL: |
| 830 | if (elementLength==4) |
| 831 | value = Float.toString(getFloat()); |
| 832 | else |
| 833 | for (int i=0; i<elementLength; i++) getByte(); |
| 834 | break; |
| 835 | //case UT: |
| 836 | //throw new IOException("ImageJ cannot read UT (unlimited text) DICOMs"); |
| 837 | case AE: case AS: case AT: case CS: case DA: case DS: case DT: case IS: case LO: |
| 838 | case LT: case PN: case SH: case ST: case TM: case UI: |
| 839 | value = getString(elementLength); |
| 840 | break; |
| 841 | case UN: |
| 842 | value = getUNString(elementLength); |
| 843 | break; |
| 844 | case US: |
| 845 | if (elementLength==2) |
| 846 | value = Integer.toString(getShort()); |
| 847 | else { |
| 848 | int n = elementLength/2; |
| 849 | StringBuilder sb = new StringBuilder(); |
| 850 | for (int i=0; i<n; i++) { |
| 851 | sb.append(Integer.toString(getShort())); |
| 852 | sb.append(" "); |
| 853 | } |
| 854 | value = sb.toString(); |
| 855 | } |
| 856 | break; |
| 857 | case SS: |
| 858 | if (elementLength==2) |
| 859 | value = Integer.toString(getSShort()); |
| 860 | else { |
| 861 | int n = elementLength/2; |
no test coverage detected