Class MultiModalitySimulator

java.lang.Object
com.pixelmed.apps.MultiModalitySimulator

public class MultiModalitySimulator extends Object

This class implements a multi-modality simulator that takes a database of existing studies to provide a source of sample images and DICOM attributes, and for each modality within the database, generates random new patients and studies at random intervals using the current date and time.

For example:

try {
    new MultiModalitySimulator("theirhost",11112,"STORESCP","STORESCU","database");
}
catch (Exception e) {
    slf4jlogger.error("",e);
}
 

From the command line:

java -cp pixelmed.jar:lib/additional/commons-codec-1.3.jar:lib/additional/commons-compress-1.12.jar com.pixelmed.network.MultiModalitySimulator theirhost 11112 STORESCP database
 

The database is a persistent (disk) instance of the DatabaseInformationModel, such as might be created by the RebuildDatabaseFromInstanceFiles class from a set of files, or have been created by an application storing received images in such a databaase.

The Calling AE Title used to send the images for each simulated modality is the modality string value, e.g. "CT" for images with a DICOM Atttibute Modality (0008,0060) of "CT".

The list of modalities simulated is currently limited to CT, MR, DX, CR, US, NM, XA, MG, SR, PR if present in the supplied database. This can be changed in a subclass by overriding the protected variable modalities, as can the corresponding protected variable sleepIntervalForModalityInMinutes, which needs to contain a matching number of entries.

A relatively short and contrived list of patient names is used by default, and can be overridden in a subclass by changing patientNames.

  • Field Details

    • modalities

      protected static String[] modalities
    • sleepIntervalForModalityInMinutes

      protected static int[] sleepIntervalForModalityInMinutes
    • sleepIntervalForModality

      protected Map<String,Integer> sleepIntervalForModality
    • defaultSleepIntervalMultiplier

      protected int defaultSleepIntervalMultiplier
    • sleepIntervalMultiplier

      protected int sleepIntervalMultiplier
    • accessionNumberCounter

      protected static long accessionNumberCounter
    • patientNames

      protected String[] patientNames
    • seriesLocalParentReferenceColumnName

      protected String seriesLocalParentReferenceColumnName
    • localFileNameColumnName

      protected String localFileNameColumnName
    • modalityColumnName

      protected String modalityColumnName
    • databaseInformationModel

      protected DatabaseInformationModel databaseInformationModel
    • hostname

      protected String hostname
    • port

      protected int port
    • calledAETitle

      protected String calledAETitle
  • Constructor Details

    • MultiModalitySimulator

      public MultiModalitySimulator(String hostname, int port, String calledAETitle, String databaseFileName, String sleepIntervalMultiplier) throws DicomException

      Simulate modalities sending to the specified AE.

      Parameters:
      hostname - their hostname
      port - their port
      calledAETitle - their AE Title,
      databaseFileName - the source database file name
      sleepIntervalMultiplier - ms to sleep for one minute
      Throws:
      DicomException
    • MultiModalitySimulator

      public MultiModalitySimulator(String hostname, int port, String calledAETitle, String databaseFileName) throws DicomException

      Simulate modalities sending to the specified AE.

      Parameters:
      hostname - their hostname
      port - their port
      calledAETitle - their AE Title,
      databaseFileName - the source database file name
      Throws:
      DicomException
    • MultiModalitySimulator

      public MultiModalitySimulator(String hostname, int port, String calledAETitle, String databaseFileName, int debugLevel) throws DicomException

      Simulate modalities sending to the specified AE.

      Parameters:
      hostname - their hostname
      port - their port
      calledAETitle - their AE Title,
      databaseFileName - the source database file name
      debugLevel - ignored
      Throws:
      DicomException
  • Method Details

    • getSleepIntervalForModalityInMilliseconds

      protected int getSleepIntervalForModalityInMilliseconds(String modality)
    • findFilesToSend

      protected void findFilesToSend(InformationEntity ie, String localPrimaryKeyValue, List<String> dicomFiles) throws DicomException
      Throws:
      DicomException
    • generateSyntheticStudyFromOriginal

      protected SetOfDicomFiles generateSyntheticStudyFromOriginal(List<String> originalDicomFileNames, String modality, String aeTitleForMetaInformation, String patientName, String patientID, String studyID, String accessionNumber) throws DicomException, IOException
      Throws:
      DicomException
      IOException
    • deleteFiles

      protected static void deleteFiles(SetOfDicomFiles dicomFiles)
    • main

      public static void main(String[] arg)

      Simulate modalities sending to the specified AE.

      Parameters:
      arg - array of four strings - their hostname, their port, their AE Title, the source database name, and optionally a sleep interval multiplier (in ms, defaults to ms in one minute)