Exemplo n.º 1
0
    public static TCEncapsulatedDocument create(TCReferencedInstance ref) throws Exception {
      Instance instance =
          ((TCQueryLocal) JNDIUtils.lookup(TCQueryLocal.JNDI_NAME))
              .findInstanceByUID(ref.getInstanceUID());

      List<org.dcm4chee.archive.entity.File> files = instance.getFiles();
      DicomObject attrs = instance.getAttributes(false);

      attrs.remove(Tag.EncapsulatedDocument);

      MimeType mimeType = null;
      String mimeTypeStr = attrs.getString(Tag.MIMETypeOfEncapsulatedDocument);
      if (mimeTypeStr != null) {
        mimeType = MimeType.get(mimeTypeStr);
      }
      if (mimeType == null) {
        mimeType = getDocumentMimeTypeFromLabel(attrs.getString(Tag.ContentLabel));
      }

      String fsId = files.get(0).getFileSystem().getDirectoryPath();
      String fileId = files.get(0).getFilePath();
      File file =
          fsId.startsWith("tar:")
              ? TarRetrieveDelegate.getInstance().retrieveFileFromTar(fsId, fileId)
              : FileUtils.resolve(new File(fsId, fileId));

      return new TCEncapsulatedDocument(mimeType, ref, attrs, file);
    }
Exemplo n.º 2
0
    public static TCImageDocument create(TCReferencedInstance ref) throws Exception {
      DicomObject attrs =
          ((TCQueryLocal) JNDIUtils.lookup(TCQueryLocal.JNDI_NAME))
              .findInstanceByUID(ref.getInstanceUID())
              .getAttributes(false);
      attrs.remove(Tag.PixelData);

      return new TCImageDocument(
          checkMimeType(getDocumentMimeTypeFromLabel(attrs.getString(Tag.ContentLabel))),
          ref,
          attrs);
    }