Class MultiModalitySimulator


  • public class MultiModalitySimulator
    extends java.lang.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 Detail

      • modalities

        protected static java.lang.String[] modalities
      • sleepIntervalForModalityInMinutes

        protected static int[] sleepIntervalForModalityInMinutes
      • sleepIntervalForModality

        protected java.util.Map<java.lang.String,​java.lang.Integer> sleepIntervalForModality
      • defaultSleepIntervalMultiplier

        protected int defaultSleepIntervalMultiplier
      • sleepIntervalMultiplier

        protected int sleepIntervalMultiplier
      • accessionNumberCounter

        protected static long accessionNumberCounter
      • patientNames

        protected java.lang.String[] patientNames
      • seriesLocalParentReferenceColumnName

        protected java.lang.String seriesLocalParentReferenceColumnName
      • localFileNameColumnName

        protected java.lang.String localFileNameColumnName
      • modalityColumnName

        protected java.lang.String modalityColumnName
      • hostname

        protected java.lang.String hostname
      • port

        protected int port
      • calledAETitle

        protected java.lang.String calledAETitle
    • Constructor Detail

      • MultiModalitySimulator

        public MultiModalitySimulator​(java.lang.String hostname,
                                      int port,
                                      java.lang.String calledAETitle,
                                      java.lang.String databaseFileName,
                                      java.lang.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​(java.lang.String hostname,
                                      int port,
                                      java.lang.String calledAETitle,
                                      java.lang.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​(java.lang.String hostname,
                                      int port,
                                      java.lang.String calledAETitle,
                                      java.lang.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 Detail

      • getSleepIntervalForModalityInMilliseconds

        protected int getSleepIntervalForModalityInMilliseconds​(java.lang.String modality)
      • generateSyntheticStudyFromOriginal

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

        protected static void deleteFiles​(SetOfDicomFiles dicomFiles)
      • main

        public static void main​(java.lang.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)