Package com.pixelmed.apps

# Class SynchronizeFromRemoteSCP

java.lang.Object
com.pixelmed.apps.SynchronizeFromRemoteSCP

public class SynchronizeFromRemoteSCP extends Object

A class for synchronizing the contents of a local database of DICOM objects with a remote SCP.

The class has no public methods other than the constructor and a main method that is useful as a utility. The constructor establishes an association, sends hierarchical C-FIND requests at the STUDY, SERIES and IMAGE levels to determine what is available on the remote AE, then attempts to retrieve anything not present locally at the highest level possible. E.g., if a study is not present, a retrieve of the entire study is requested. Verbosity of logging can be controlled using the SLF4J log level. The default INFO level summarizes major actions, such as which studies, series and instances are fetched and which files are received; it can be suppressed by setting the logging level to a higher level, such as WARN, or enhanced by using DEBUG or TRACE.

The main method is also useful in its own right as a command-line utility. For example:

    java -cp ./pixelmed.jar:./lib/additional/hsqldb.jar -Djava.awt.headless=true \
            -Dorg.slf4j.simpleLogger.log.com.pixelmed.apps.SynchronizeFromRemoteSCP=warn \
            com.pixelmed.apps.SynchronizeFromRemoteSCP \
            /tmp/dicomsync/database /tmp/dicomsync \
            them 104 THEM \
            11112 US

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`SynchronizeFromRemoteSCP.OurReadTerminationStrategy`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final AttributeList.ReadTerminationStrategy`
`terminateAfterRelationshipGroup`

## Constructor Summary

Constructors
Constructor
Description
`SynchronizeFromRemoteSCP(DatabaseInformationModel databaseInformationModel, File savedInstancesFolder, String remoteHost, int remotePort, String remoteAE, int localPort, String localAE, boolean useGet, boolean queryAll, String queryPatternFileName, boolean anyTransferSyntax, boolean retrieveStudy, boolean reuseAssociations)`
Synchronize the contents of a local database of DICOM objects with a remote SCP.
`SynchronizeFromRemoteSCP(DatabaseInformationModel databaseInformationModel, File savedInstancesFolder, String remoteHost, int remotePort, String remoteAE, int localPort, String localAE, boolean useGet, boolean queryAll, String queryPatternFileName, int verbosityLevel, int debugLevel, boolean anyTransferSyntax, boolean retrieveStudy, boolean reuseAssociations)`
Synchronize the contents of a local database of DICOM objects with a remote SCP.

## Method Summary

Modifier and Type
Method
Description
`static void`
`main(String[] arg)`
Synchronize the contents of a local database of DICOM objects with a remote SCP.

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### terminateAfterRelationshipGroup

protected static final AttributeList.ReadTerminationStrategy terminateAfterRelationshipGroup

## Constructor Details

### SynchronizeFromRemoteSCP

public SynchronizeFromRemoteSCP(DatabaseInformationModel databaseInformationModel, File savedInstancesFolder, String remoteHost, int remotePort, String remoteAE, int localPort, String localAE, boolean useGet, boolean queryAll, String queryPatternFileName, boolean anyTransferSyntax, boolean retrieveStudy, boolean reuseAssociations) throws DicomException, DicomNetworkException, IOException, InterruptedException

Synchronize the contents of a local database of DICOM objects with a remote SCP.

Queries the remote SCP for everything it has and retrieves all instances not already present in the specified local database.

Parameters:
  `databaseInformationModel` - the local database (will be created if does not already exist)
  `savedInstancesFolder` - where to save retrieved instances (must already exist)
  `remoteHost` -
  `remotePort` -
  `remoteAE` -
  `localPort` - local port for DICOM listener ... must already be known to remote AE unless C-GET
  `localAE` - local AET for DICOM listener ... must already be known to remote AE unless C-GET
  `useGet` - if true, use C-GET rather than C-MOVE
  `queryAll` - if true query for all patient names at once, rather than selectively by first letter, unless there is a queryPatternFileName
  `queryPatternFileName` - a file containing a list of PatientName query patterns, one per line
  `anyTransferSyntax` - if true, accept any Transfer Syntax, not just uncompressed ones
  `retrieveStudy` - if true, retrieve only at STUDY level, not confirming every instance
  `reuseAssociations` - if true, keep alive and reuse Associations
Throws:
  `DicomException`
  `DicomNetworkException`
  `IOException`
  `InterruptedException`

### SynchronizeFromRemoteSCP

public SynchronizeFromRemoteSCP(DatabaseInformationModel databaseInformationModel, File savedInstancesFolder, String remoteHost, int remotePort, String remoteAE, int localPort, String localAE, boolean useGet, boolean queryAll, String queryPatternFileName, int verbosityLevel, int debugLevel, boolean anyTransferSyntax, boolean retrieveStudy, boolean reuseAssociations) throws DicomException, DicomNetworkException, IOException, InterruptedException

Synchronize the contents of a local database of DICOM objects with a remote SCP.

Queries the remote SCP for everything it has and retrieves all instances not already present in the specified local database.

Parameters:
  `databaseInformationModel` - the local database (will be created if does not already exist)
  `savedInstancesFolder` - where to save retrieved instances (must already exist)
  `remoteHost` -
  `remotePort` -
  `remoteAE` -
  `localPort` - local port for DICOM listener ... must already be known to remote AE unless C-GET
  `localAE` - local AET for DICOM listener ... must already be known to remote AE unless C-GET
  `useGet` - if true, use C-GET rather than C-MOVE
  `queryAll` - if true query for all patient names at once, rather than selectively by first letter, unless there is a queryPatternFileName
  `queryPatternFileName` - a file containing a list of PatientName query patterns, one per line
  `verbosityLevel` - ignored
  `debugLevel` - ignored
  `anyTransferSyntax` - if true, accept any Transfer Syntax, not just uncompressed ones
  `retrieveStudy` - if true, retrieve only at STUDY level, not confirming every instance
  `reuseAssociations` - if true, keep alive and reuse Associations
Throws:
  `DicomException`
  `DicomNetworkException`
  `IOException`
  `InterruptedException`

## Method Details

### main

public static void main(String[] arg)

Synchronize the contents of a local database of DICOM objects with a remote SCP.

Queries the remote SCP for everything it has and retrieves all instances not already present in the specified local database.

Will register the supplied local AE and port with Bonjour if supported (this is specific to the main() method; the constructor of the class itself does not do this).

Parameters:
  `arg` - array of 6 to 12 strings - the fully qualified path of the database file prefix, the fully qualified path of the saved incoming files folder, the remote hostname, remote port, remote AE Title, our port (ignored if GET), our AE Title, optionally GET or MOVE (defaults to MOVE), optionally query by ALL or SELECTIVE patient name (defaults to ALL) or a filename containing a list of PatientName query patterns (one per line), optionally UNCOMPRESSED or ANY (defaults to UNCOMPRESSED) optionally a retrieval level STUDY or INSTANCE (defaults to INSTANCE) optionally REUSE or NEW associations for each query and retrieval (defaults to NEW)