Example #1
0
  /**
   * Update the indexes for this object. This stage tracks the following data:
   *
   * <ul>
   *   <li>Processing date (today)
   *   <li>PatientID
   *   <li>StudyInstanceUID
   *   <li>SeriesInstanceUID
   *   <li>SOPInstanceUID
   * </ul>
   *
   * It creates table entries for the values in this object. IDs which are not unique may be
   * overwritten by subsequent objects (e.g. duplicates). Thus, the tables contain only records of
   * unique objects that have been processed.
   *
   * @param fileObject the object to process.
   * @return the same FileObject if the result is true; otherwise null.
   */
  public FileObject process(FileObject fileObject) {

    lastFileIn = new File(fileObject.getFile().getAbsolutePath());
    lastTimeIn = System.currentTimeMillis();

    try {
      if (fileObject instanceof DicomObject) {
        DicomObject dob = (DicomObject) fileObject;

        String date = StringUtil.getDate("");
        String patientID = dob.getPatientID();
        String studyInstanceUID = dob.getStudyInstanceUID();
        String seriesInstanceUID = dob.getSeriesInstanceUID();
        String sopInstanceUID = dob.getSOPInstanceUID();

        index(dateIndex, date, patientID);
        index(patientIndex, patientID, studyInstanceUID);
        index(studyIndex, studyInstanceUID, seriesInstanceUID);
        index(seriesIndex, seriesInstanceUID, sopInstanceUID);

        recman.commit();
      }
    } catch (Exception skip) {
      logger.debug("Unable to process " + fileObject.getFile());
    }

    lastFileOut = new File(fileObject.getFile().getAbsolutePath());
    lastTimeOut = System.currentTimeMillis();
    return fileObject;
  }
  /**
   * Check a DicomObject and record any failing lookups in the database.
   *
   * @param fileObject the object to process.
   * @return the same FileObject if the result is true; otherwise null.
   */
  public FileObject process(FileObject fileObject) {
    String cmd;

    lastFileIn = new File(fileObject.getFile().getAbsolutePath());
    lastTimeIn = System.currentTimeMillis();

    if (fileObject instanceof DicomObject) {
      DicomObject dob = (DicomObject) fileObject;
      if (dcmScriptFile != null) {
        DAScript daScript = DAScript.getInstance(dcmScriptFile);
        scriptTable = new ScriptTable(daScript);
        lutProps = LookupTable.getProperties(lutFile);
        synchronized (this) {
          Dataset ds = dob.getDataset();
          charset = ds.getSpecificCharacterSet();
          boolean ok = checkDataset(ds);
          if (!ok) {
            try {
              recman.commit();
            } catch (Exception unable) {
            }
            ;
            if (quarantine != null) quarantine.insert(fileObject);
            return null;
          }
        }
      }
    }
    lastFileOut = new File(fileObject.getFile().getAbsolutePath());
    lastTimeOut = System.currentTimeMillis();
    return fileObject;
  }