public static int[] bytesLE2ushorts(byte[] b) { if (b == null) return null; if ((b.length & 0x1) != 0) throw new IllegalArgumentException("byte[" + b.length + "]"); int[] val = new int[b.length >> 1]; for (int i = 0; i < val.length; i++) val[i] = bytesLE2ushort(b, i << 1); return val; }
@Override public int toInt(byte[] val, boolean bigEndian) { if (val == null || val.length == 0) return 0; return bigEndian ? ByteUtils.bytesBE2ushort(val, 0) : ByteUtils.bytesLE2ushort(val, 0); }
@Override public int toInt(byte[] val, boolean bigEndian) { if (val == null || val.length == 0) return 0; return bigEndian ? ByteUtils.bytesBE2ushort(val, 0) : ByteUtils.bytesLE2ushort(val, 0); }
val, i) : ByteUtils.bytesLE2ushort(val, i)); int sl = s.length(); s.getChars(0, sl, cbuf, clen);
/** Gets a pixel value from the given field - the field can be a regular integer * or it can be ob data. * @param ds * @param tag * @return */ public static Integer getIntPixelValue(DicomObject ds, int tag, boolean signed, int stored) { DicomElement de = ds.get(tag); if( de==null ) return null; VR vr = de.vr(); if( vr==VR.OB || vr==VR.OW ) { int ret = ByteUtils.bytesLE2ushort(de.getBytes(),0); if( signed ) { if( (ret & (1 << (stored-1))) !=0 ) { int andmask = (1 << stored) - 1; int ormask = ~andmask; ret |= ormask; } } return ret; } return de.getInt(true); }
: ByteUtils.bytesLE2ushort(header, 6); if (vr == VR.UN_SIEMENS) { if (log.isInfoEnabled()) {