Esempio n. 1
0
  private static final TCReferencedInstance createReferencedInstance(
      TCObject tc, String cuid, String modality) {
    TCReferencedStudy study = getDocumentStudy(tc);
    if (study == null) {
      study = new TCReferencedStudy(tc.getStudyInstanceUID());
    }
    TCReferencedSeries series = getDocumentSeries(study, modality);
    if (series == null) {
      study.addSeries(
          series = new TCReferencedSeries(UIDUtils.createUID(), study, SERIES_DESCRIPTION));
    }
    Integer instanceNumber = -1;
    if (series != null) {
      try {
        String nr = series.getSeriesValue(Tag.NumberOfSeriesRelatedInstances);
        if (nr != null) {
          instanceNumber = Integer.parseInt(nr) + 1;
        }
      } catch (Exception e) {
      }

      if (instanceNumber < 0) {
        instanceNumber = series.getInstanceCount() + 1;
      }
    }

    if (instanceNumber < 0) {
      instanceNumber = 1;
    }

    return new TCReferencedInstance(series, UIDUtils.createUID(), cuid, instanceNumber);
  }
Esempio n. 2
0
 public static Class<?> getDocumentImplementationClass(TCReferencedInstance ref) {
   String cuid = ref.getClassUID();
   if (UID.MultiFrameTrueColorSecondaryCaptureImageStorage.equals(cuid)) {
     TCReferencedSeries series = ref.getSeries();
     String description = series != null ? series.getSeriesDescription() : null;
     if (description != null && description.equalsIgnoreCase(SERIES_DESCRIPTION)) {
       return TCImageDocument.class;
     }
   } else if (UID.EncapsulatedPDFStorage.equals(cuid)) {
     return TCEncapsulatedDocument.class;
   }
   return null;
 }
Esempio n. 3
0
  private static final TCReferencedSeries getDocumentSeries(
      TCReferencedStudy study, String modality) {
    for (TCReferencedSeries series : study.getSeries()) {
      String series_modality = series.getSeriesValue(Tag.Modality);
      String series_description = series.getSeriesDescription();
      if (series_modality != null
          && series_modality.equalsIgnoreCase(modality)
          && series_description != null
          && series_description.equalsIgnoreCase(SERIES_DESCRIPTION)) {
        return series;
      }
    }

    return null;
  }