org.dcm4che3.data.Attributes.bigEndian()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.dcm4che3.data.Attributes.bigEndian()方法的一些代码示例,展示了Attributes.bigEndian()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.bigEndian()方法的具体详情如下:
包路径:org.dcm4che3.data.Attributes
类名称:Attributes
方法名:bigEndian

Attributes.bigEndian介绍

暂无

代码示例

代码示例来源:origin: dcm4che/dcm4che

public ContentHandlerAdapter(Attributes attrs) {
  if (attrs == null)
    throw new NullPointerException();
  items.add(attrs);
  bigEndian = attrs.bigEndian();
}

代码示例来源:origin: dcm4che/dcm4che

public boolean bigEndian() {
    return getAttributes().bigEndian();
  }
}

代码示例来源:origin: dcm4che/dcm4che

private void setParent(Collection<? extends Attributes> c) {
  boolean bigEndian = parent.bigEndian();
  for (Attributes attrs : c) {
    if (attrs.bigEndian() != bigEndian)
      throw new IllegalArgumentException(
        "Endian of Item must match Endian of parent Data Set");
    if (!attrs.isRoot())
      throw new IllegalArgumentException(
        "Item already contained by Sequence");
  }
  for (Attributes attrs : c)
    attrs.setParent(parent);
}

代码示例来源:origin: dcm4che/dcm4che

private void bulkData(String uuid, String uri) {
  bulkData = new BulkData(uuid, uri, items.getLast().bigEndian());
}

代码示例来源:origin: dcm4che/dcm4che

private LookupTable createLUT(StoredValue inBits, Attributes attrs) {
  if (attrs == null)
    return null;
  return createLUT(inBits, attrs.getInts(Tag.LUTDescriptor),
      attrs.getSafeBytes(Tag.LUTData), attrs.bigEndian());
}

代码示例来源:origin: org.dcm4che/dcm4che-image

private LookupTable createLUT(StoredValue inBits, Attributes attrs) {
  if (attrs == null)
    return null;
  return createLUT(inBits, attrs.getInts(Tag.LUTDescriptor),
      attrs.getSafeBytes(Tag.LUTData), attrs.bigEndian());
}

代码示例来源:origin: dcm4che/dcm4che

public void writeDataset(Attributes fmi, Attributes dataset)
    throws IOException {
  if (fmi != null)
    writeFileMetaInformation(fmi);
  if (dataset.bigEndian() != bigEndian
      || encOpts.groupLength
      || !encOpts.undefSequenceLength
      || !encOpts.undefItemLength)
    dataset = new Attributes(dataset, bigEndian);
  if (encOpts.groupLength)
    dataset.calcLength(encOpts, explicitVR);
  dataset.writeTo(this);
}

代码示例来源:origin: dcm4che/dcm4che

private byte[] lutData(Attributes ds, int[] desc, int dataTag, int segmTag) {
  int len = desc[0] == 0 ? 0x10000 : desc[0];
  int bits = desc[2];
  byte[] data = ds.getSafeBytes(dataTag);
  if (data == null) {
    int[] segm = ds.getInts(segmTag);
    if (segm == null) {
      throw new IllegalArgumentException("Missing LUT Data!");
    }
    if (bits == 8) {
      throw new IllegalArgumentException(
          "Segmented LUT Data with LUT Descriptor: bits=8");
    }
    data = new byte[len];
    inflateSegmentedLut(segm, data);
  } else if (bits == 16 || data.length != len) {
    if (data.length != len << 1)
      lutLengthMismatch(data.length, len);
    int hilo = ds.bigEndian() ? 0 : 1;
    if (bits == 8)
      hilo = 1 - hilo; // padded high bits -> use low bits
    data = LookupTableFactory.halfLength(data, hilo);
  }
  return data;
}

代码示例来源:origin: dcm4che/dcm4che

private void writeAttribute(int tag, VR vr, Object value,
    SpecificCharacterSet cs, Attributes attrs) throws SAXException {
  if (TagUtils.isGroupLength(tag) || TagUtils.isPrivateCreator(tag))
    return;
  String privateCreator = attrs.getPrivateCreator(tag);
  addAttributes(tag, vr, privateCreator);
  startElement("DicomAttribute");
  if (value instanceof Value)
    writeAttribute((Value) value, attrs.bigEndian());
  else if (!vr.isInlineBinary()) {
    writeValues(vr, value, attrs.bigEndian(),
        attrs.getSpecificCharacterSet(vr));
  } else if (value instanceof byte[]) {
    writeInlineBinary(attrs.bigEndian()
        ? vr.toggleEndian((byte[]) value, true)
        : (byte[]) value);
  } else
    throw new IllegalArgumentException("vr: " + vr + ", value class: "
        + value.getClass());
  endElement("DicomAttribute");
}

代码示例来源:origin: dcm4che/dcm4che

private void writeAttribute(int tag, VR vr, Object value,
    SpecificCharacterSet cs, Attributes attrs) {
  if (TagUtils.isGroupLength(tag))
    return;
  gen.writeStartObject(TagUtils.toHexString(tag));
  gen.write("vr", vr.name());
  if (value instanceof Value)
    writeValue((Value) value, attrs.bigEndian());
  else
    writeValue(vr, value, attrs.bigEndian(),
        attrs.getSpecificCharacterSet(vr), true);
  gen.writeEnd();
}

代码示例来源:origin: dcm4che/dcm4che

sb.append(" [");
vr.vr.prompt(value,
    attrs.bigEndian(), 
    attrs.getSpecificCharacterSet(vr.vr), 200, sb);
sb.append(']');

代码示例来源:origin: org.dcm4che/dcm4che-image

private byte[] lutData(Attributes ds, int[] desc, int dataTag, int segmTag) {
  int len = desc[0] == 0 ? 0x10000 : desc[0];
  int bits = desc[2];
  byte[] data = ds.getSafeBytes(dataTag);
  if (data == null) {
    int[] segm = ds.getInts(segmTag);
    if (segm == null) {
      throw new IllegalArgumentException("Missing LUT Data!");
    }
    if (bits == 8) {
      throw new IllegalArgumentException(
          "Segmented LUT Data with LUT Descriptor: bits=8");
    }
    data = new byte[len];
    inflateSegmentedLut(segm, data);
  } else if (bits == 16 || data.length != len) {
    if (data.length != len << 1)
      lutLengthMismatch(data.length, len);
    int hilo = ds.bigEndian() ? 0 : 1;
    if (bits == 8)
      hilo = 1 - hilo; // padded high bits -> use low bits
    data = LookupTableFactory.halfLength(data, hilo);
  }
  return data;
}

代码示例来源:origin: dcm4che/dcm4che

@Override
public void readValue(DicomInputStream dis, Sequence seq)
    throws IOException {
  checkIsThis(dis);
  if (length == 0) {
    seq.add(new Attributes(seq.getParent().bigEndian(), 0));
    return;
  }
  Attributes attrs = new Attributes(seq.getParent().bigEndian());
  seq.add(attrs);
  readAttributes(attrs, length, Tag.ItemDelimitationItem);
  attrs.trimToSize();
}

代码示例来源:origin: nroduit/Weasis

byteBuffer.order(dcm.bigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);

代码示例来源:origin: nroduit/Weasis

audioFormat = new AudioFormat("AB".equals(spInterpretation) ? Encoding.ALAW : Encoding.ULAW, //$NON-NLS-1$
    (float) sampleRate, bitsPerSample, numChannels, frameSize, (float) sampleRate,
    attributes.bigEndian());
} else {
  boolean signed =
    "UB".equals(spInterpretation) || "US".equals(spInterpretation) ? false : true; //$NON-NLS-1$ //$NON-NLS-2$
  audioFormat = new AudioFormat((float) sampleRate, bitsPerSample, numChannels, signed,
    attributes.bigEndian());

代码示例来源:origin: dcm4che/dcm4che

public void setPresentationLUT(Attributes attrs) {
  Attributes pLUT = attrs.getNestedDataset(Tag.PresentationLUTSequence);
  if (pLUT != null) {
    int[] desc = pLUT.getInts(Tag.LUTDescriptor);
    if (desc != null && desc.length == 3) {
      int len = desc[0] == 0 ? 0x10000 : desc[0];
      presentationLUT = createLUT(new StoredValue.Unsigned(log2(len)), 
          resetOffset(desc), 
          pLUT.getSafeBytes(Tag.LUTData), pLUT.bigEndian());
    }
  } else {
    String pShape = attrs.getString(Tag.PresentationLUTShape);
    inverse = (pShape != null 
      ? "INVERSE".equals(pShape)
      : "MONOCHROME1".equals(
          attrs.getString(Tag.PhotometricInterpretation)));
  }
}

代码示例来源:origin: org.dcm4che/dcm4che-image

public void setPresentationLUT(Attributes attrs) {
  Attributes pLUT = attrs.getNestedDataset(Tag.PresentationLUTSequence);
  if (pLUT != null) {
    int[] desc = pLUT.getInts(Tag.LUTDescriptor);
    if (desc != null && desc.length == 3) {
      int len = desc[0] == 0 ? 0x10000 : desc[0];
      presentationLUT = createLUT(new StoredValue.Unsigned(log2(len)), 
          resetOffset(desc), 
          pLUT.getSafeBytes(Tag.LUTData), pLUT.bigEndian());
    }
  } else {
    String pShape = attrs.getString(Tag.PresentationLUTShape);
    inverse = (pShape != null 
      ? "INVERSE".equals(pShape)
      : "MONOCHROME1".equals(
          attrs.getString(Tag.PhotometricInterpretation)));
  }
}

代码示例来源:origin: dcm4che/dcm4che

private void readFragments(Attributes attrs, int fragsTag, VR vr)
    throws IOException {
  Fragments frags = new Fragments(vr, attrs.bigEndian(), 10);
  String privateCreator = attrs.getPrivateCreator(fragsTag);
  for (int i = 0; readItemHeader(); ++i) {
    addItemPointer(fragsTag, privateCreator, i);
    handler.readValue(this, frags);
    removeItemPointer();
  }
  if (frags.isEmpty())
    attrs.setNull(fragsTag, vr);
  else {
    frags.trimToSize();
    attrs.setValue(fragsTag, vr, frags);
  }
}

代码示例来源:origin: nroduit/Weasis

bigendian = ds.bigEndian();
iis.setByteOrder(ds.bigEndian() ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
this.pixeldata = (BulkData) pixdata;

代码示例来源:origin: dcm4che/dcm4che

@Override
public void readValue(DicomInputStream dis, Attributes attrs)
    throws IOException {
  checkIsThis(dis);
  if (excludeBulkData) {
    skipFully(length);
  } else if (length == 0) {
    attrs.setNull(tag, vr);
  } else if (vr == VR.SQ) {
    readSequence(length, attrs, tag);
  } else if (length == -1) {
    readFragments(attrs, tag, vr);
  } else if (length == BulkData.MAGIC_LEN
      && super.in instanceof ObjectInputStream) {
    attrs.setValue(tag, vr, BulkData.deserializeFrom(
        (ObjectInputStream) super.in));
  } else if (includeBulkDataURI) {
    attrs.setValue(tag, vr, bulkDataCreator.createBulkData(this));
  } else {
    byte[] b = readValue();
    if (!TagUtils.isGroupLength(tag)) {
      if (bigEndian != attrs.bigEndian())
        vr.toggleEndian(b, false);
      attrs.setBytes(tag, vr, b);
    } else if (tag == Tag.FileMetaInformationGroupLength)
      setFileMetaInformationGroupLength(b);
  }
}

相关文章

微信公众号

最新文章

更多