コード例 #1
0
  private Collection getObserverContextItems(String personName) {
    Dataset ds = dof.newDataset();
    ds.putCS(Tags.RelationshipType, "HAS OBS CONTEXT");
    ds.putCS(Tags.ValueType, "CODE");
    DcmElement cnSq = ds.putSQ(Tags.ConceptNameCodeSeq);
    Dataset cnDS = cnSq.addNewItem();
    cnDS.putSH(Tags.CodeValue, "121005");
    cnDS.putSH(Tags.CodingSchemeDesignator, "DCM");
    cnDS.putLO(Tags.CodeMeaning, "ObserverType");
    DcmElement ccSq = ds.putSQ(Tags.ConceptCodeSeq);
    Dataset ccDS = ccSq.addNewItem();
    ccDS.putSH(Tags.CodeValue, "121006");
    ccDS.putSH(Tags.CodingSchemeDesignator, "DCM");
    ccDS.putLO(Tags.CodeMeaning, "Person");

    Dataset ds1 = dof.newDataset();
    ds1.putCS(Tags.RelationshipType, "HAS OBS CONTEXT");
    ds1.putCS(Tags.ValueType, "PNAME");
    DcmElement cnSq1 = ds1.putSQ(Tags.ConceptNameCodeSeq);
    Dataset cnDS1 = cnSq1.addNewItem();
    cnDS1.putSH(Tags.CodeValue, "121008");
    cnDS1.putSH(Tags.CodingSchemeDesignator, "DCM");
    cnDS1.putLO(Tags.CodeMeaning, "Person Observer Name");
    ds1.putPN(Tags.PersonName, personName);
    ArrayList col = new ArrayList();
    col.add(ds);
    col.add(ds1);
    return col;
  }
コード例 #2
0
 /**
  * @param xdsiModel
  * @return
  */
 private Dataset getRootInfo(XDSIModel xdsiModel) {
   Dataset rootInfo = DcmObjectFactory.getInstance().newDataset();
   DcmElement sq = rootInfo.putSQ(Tags.ConceptNameCodeSeq);
   Dataset item = sq.addNewItem();
   CodeItem selectedDocTitle = xdsiModel.selectedDocTitle();
   item.putSH(Tags.CodeValue, selectedDocTitle.getCodeValue());
   item.putSH(Tags.CodingSchemeDesignator, selectedDocTitle.getCodeDesignator());
   item.putLO(Tags.CodeMeaning, selectedDocTitle.getCodeMeaning());
   return rootInfo;
 }
コード例 #3
0
  private Dataset getStudyMgtDataset(StudyLocal study, Map mapSeries) {
    Dataset ds = dof.newDataset();
    ds.putUI(Tags.StudyInstanceUID, study.getStudyIuid());
    ds.putOB(PrivateTags.StudyPk, Convert.toBytes(study.getPk().longValue()));
    ds.putSH(Tags.AccessionNumber, study.getAccessionNumber());
    ds.putLO(Tags.PatientID, study.getPatient().getPatientId());
    ds.putLO(Tags.IssuerOfPatientID, study.getPatient().getIssuerOfPatientId());
    ds.putPN(Tags.PatientName, study.getPatient().getPatientName());

    log.debug("getStudyMgtDataset: studyIUID:" + study.getStudyIuid());
    DcmElement refSeriesSeq = ds.putSQ(Tags.RefSeriesSeq);

    Iterator iter =
        (mapSeries == null) ? study.getSeries().iterator() : mapSeries.keySet().iterator();
    while (iter.hasNext()) {
      SeriesLocal sl = (SeriesLocal) iter.next();
      Dataset dsSer = refSeriesSeq.addNewItem();
      dsSer.putUI(Tags.SeriesInstanceUID, sl.getSeriesIuid());
      Collection instances =
          (mapSeries == null) ? sl.getInstances() : (Collection) mapSeries.get(sl);
      Iterator iter2 = instances.iterator();
      DcmElement refSopSeq = null;
      if (iter2.hasNext()) refSopSeq = dsSer.putSQ(Tags.RefSOPSeq);
      while (iter2.hasNext()) {
        InstanceLocal il = (InstanceLocal) iter2.next();
        Dataset dsInst = refSopSeq.addNewItem();
        dsInst.putUI(Tags.RefSOPClassUID, il.getSopCuid());
        dsInst.putUI(Tags.RefSOPInstanceUID, il.getSopIuid());
        dsInst.putAE(Tags.RetrieveAET, il.getRetrieveAETs());
      }
    }
    if (log.isDebugEnabled()) {
      log.debug("return StgMgtDataset:");
      log.debug(ds);
    }
    return ds;
  }
コード例 #4
0
  public void addWorklistItem(
      Long studyPk, String templateFile, String humanPerformerCode, Long scheduleDate)
      throws Exception {
    String uri =
        FileUtils.resolve(new File(templatePath, templateFile + ".xml")).toURI().toString();
    if (log.isDebugEnabled()) log.debug("load template file: " + uri);
    Dataset ds = DatasetUtils.fromXML(new InputSource(uri));

    ContentManager cm = getContentManager();
    // patient
    Dataset patDS = cm.getPatientForStudy(studyPk.longValue());
    if (log.isDebugEnabled()) {
      log.debug("Patient Dataset:");
      log.debug(patDS);
    }

    ds.putAll(patDS.subSet(PAT_ATTR_TAGS));
    //
    Dataset sopInstRef = cm.getSOPInstanceRefMacro(studyPk.longValue(), false);
    String studyIUID = sopInstRef.getString(Tags.StudyInstanceUID);
    ds.putUI(Tags.SOPInstanceUID, UIDGenerator.getInstance().createUID());
    ds.putUI(Tags.StudyInstanceUID, studyIUID);
    DcmElement inSq = ds.putSQ(Tags.InputInformationSeq);
    inSq.addItem(sopInstRef);

    // Scheduled Human Performer Seq
    DcmElement schedHPSq = ds.putSQ(Tags.ScheduledHumanPerformersSeq);
    Dataset item = schedHPSq.addNewItem();
    DcmElement hpCodeSq = item.putSQ(Tags.HumanPerformerCodeSeq);
    Dataset dsCode = (Dataset) this.humanPerformer.get(humanPerformerCode);
    log.info(dsCode);
    if (dsCode != null) {
      hpCodeSq.addItem(dsCode);
      item.putPN(Tags.HumanPerformerName, dsCode.getString(Tags.CodeMeaning));
    }

    // Scheduled Procedure Step Start Date and Time
    ds.putDT(Tags.SPSStartDateAndTime, new Date(scheduleDate.longValue()));

    if (log.isDebugEnabled()) {
      log.debug("GPSPS Dataset:");
      log.debug(ds);
    }

    addWorklistItem(ds);
  }