Class StorageSOPClassSCU

java.lang.Object
com.pixelmed.dicom.SOPClass
com.pixelmed.network.StorageSOPClassSCU
Direct Known Subclasses:
StorageSOPClassSCUPerformanceTest, TestSendingCommandAndDataInOnePDU

public class StorageSOPClassSCU extends SOPClass

This class implements the SCU role of SOP Classes of the Storage Service Class.

The class has no methods other than the constructor (and a main method for testing). The constructor establishes an association, sends the C-STORE request, and releases the association.

Debugging messages with a varying degree of verbosity can be activated.

For example:

try {
    new StorageSOPClassSCU("theirhost",11112,"STORESCP","STORESCU","/tmp/testfile.dcm","1.2.840.10008.5.1.4.1.1.7","1.3.6.1.4.1.5962.1.1.0.0.0.1064923879.2077.3232235877",0,0);
}
catch (Exception e) {
    slf4jlogger.error("",e);
}
 

From the command line, sending multiple files:

find /tmp -name '*.dcm' | java -cp pixelmed.jar:lib/additional/commons-codec-1.3.jar:lib/additional/commons-compress-1.12.jar com.pixelmed.network.StorageSOPClassSCU theirhost 11112 STORESCP STORESCU -
 
  • Field Details

    • trappedExceptions

      protected boolean trappedExceptions
  • Constructor Details

    • StorageSOPClassSCU

      protected StorageSOPClassSCU() throws DicomNetworkException, DicomException, IOException

      Dummy constructor allows testing subclasses to use different constructor.

      Throws:
      DicomNetworkException
      DicomException
      IOException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, String fileName, String affectedSOPClass, String affectedSOPInstance, int compressionLevel, int debugLevel) throws DicomNetworkException, DicomException, IOException

      Establish an association to the specified AE, send the instance contained in the file, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      fileName - the name of the file containing the data set to send
      affectedSOPClass - must be the same as the SOP Class UID contained within the data set, may be null if file has a meta information header
      affectedSOPInstance - must be the same as the SOP Instance UID contained within the data set, may be null if file has a meta information header
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      debugLevel - ignored
      Throws:
      IOException
      DicomException
      DicomNetworkException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, String fileName, String affectedSOPClass, String affectedSOPInstance, int compressionLevel) throws DicomNetworkException, DicomException, IOException

      Establish an association to the specified AE, send the instance contained in the file, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      fileName - the name of the file containing the data set to send
      affectedSOPClass - must be the same as the SOP Class UID contained within the data set, may be null if file has a meta information header
      affectedSOPInstance - must be the same as the SOP Instance UID contained within the data set, may be null if file has a meta information header
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      Throws:
      IOException
      DicomException
      DicomNetworkException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, String fileName, String affectedSOPClass, String affectedSOPInstance, int compressionLevel, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID, int debugLevel) throws DicomNetworkException, DicomException, IOException

      Establish an association to the specified AE, send the instance contained in the file, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      fileName - the name of the file containing the data set to send
      affectedSOPClass - must be the same as the SOP Class UID contained within the data set, may be null if file has a meta information header
      affectedSOPInstance - must be the same as the SOP Instance UID contained within the data set, may be null if file has a meta information header
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      debugLevel - ignored
      Throws:
      IOException
      DicomException
      DicomNetworkException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, String fileName, String affectedSOPClass, String affectedSOPInstance, int compressionLevel, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID) throws DicomNetworkException, DicomException, IOException

      Establish an association to the specified AE, send the instance contained in the file, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      fileName - the name of the file containing the data set to send
      affectedSOPClass - must be the same as the SOP Class UID contained within the data set, may be null if file has a meta information header
      affectedSOPInstance - must be the same as the SOP Instance UID contained within the data set, may be null if file has a meta information header
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      Throws:
      IOException
      DicomException
      DicomNetworkException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, int ourMaximumLengthReceived, int socketReceiveBufferSize, int socketSendBufferSize, String fileName, String affectedSOPClass, String affectedSOPInstance, int compressionLevel) throws DicomNetworkException, DicomException, IOException

      Establish an association to the specified AE, send the instance contained in the file, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      ourMaximumLengthReceived - the maximum PDU length that we will offer to receive
      socketReceiveBufferSize - the TCP socket receive buffer size to set (if possible), 0 means leave at the default
      socketSendBufferSize - the TCP socket send buffer size to set (if possible), 0 means leave at the default
      fileName - the name of the file containing the data set to send
      affectedSOPClass - must be the same as the SOP Class UID contained within the data set, may be null if file has a meta information header
      affectedSOPInstance - must be the same as the SOP Instance UID contained within the data set, may be null if file has a meta information header
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      Throws:
      IOException
      DicomException
      DicomNetworkException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, int ourMaximumLengthReceived, int socketReceiveBufferSize, int socketSendBufferSize, String fileName, String affectedSOPClass, String affectedSOPInstance, int compressionLevel, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID) throws DicomNetworkException, DicomException, IOException

      Establish an association to the specified AE, send the instance contained in the file, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      ourMaximumLengthReceived - the maximum PDU length that we will offer to receive
      socketReceiveBufferSize - the TCP socket receive buffer size to set (if possible), 0 means leave at the default
      socketSendBufferSize - the TCP socket send buffer size to set (if possible), 0 means leave at the default
      fileName - the name of the file containing the data set to send
      affectedSOPClass - must be the same as the SOP Class UID contained within the data set, may be null if file has a meta information header
      affectedSOPInstance - must be the same as the SOP Instance UID contained within the data set, may be null if file has a meta information header
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      Throws:
      IOException
      DicomException
      DicomNetworkException
    • StorageSOPClassSCU

      public StorageSOPClassSCU(Association association, SetOfDicomFiles dicomFiles, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, int debugLevel)

      Send the specified instances contained in the files over an existing association.

      Parameters:
      association - already existing association to SCP
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      multipleInstanceTransferStatusHandler -
      debugLevel - ignored
    • StorageSOPClassSCU

      public StorageSOPClassSCU(Association association, SetOfDicomFiles dicomFiles, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler)

      Send the specified instances contained in the files over an existing association.

      Parameters:
      association - already existing association to SCP
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      multipleInstanceTransferStatusHandler -
    • StorageSOPClassSCU

      public StorageSOPClassSCU(Association association, SetOfDicomFiles dicomFiles, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID, int debugLevel)

      Send the specified instances contained in the files over an existing association.

      Parameters:
      association - already existing association to SCP
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      debugLevel - ignored
    • StorageSOPClassSCU

      public StorageSOPClassSCU(Association association, SetOfDicomFiles dicomFiles, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID)

      Send the specified instances contained in the files over an existing association.

      Parameters:
      association - already existing association to SCP
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, SetOfDicomFiles dicomFiles, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, int debugLevel)

      Establish an association to the specified AE, send the instances contained in the files, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
      debugLevel - ignored
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, SetOfDicomFiles dicomFiles, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler)

      Establish an association to the specified AE, send the instances contained in the files, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, int ourMaximumLengthReceived, int socketReceiveBufferSize, int socketSendBufferSize, SetOfDicomFiles dicomFiles, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler)

      Establish an association to the specified AE, send the instances contained in the files, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      ourMaximumLengthReceived - the maximum PDU length that we will offer to receive
      socketReceiveBufferSize - the TCP socket receive buffer size to set (if possible), 0 means leave at the default
      socketSendBufferSize - the TCP socket send buffer size to set (if possible), 0 means leave at the default
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, SetOfDicomFiles dicomFiles, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID, int debugLevel)

      Establish an association to the specified AE, send the instances contained in the files, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      debugLevel - ignored
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, SetOfDicomFiles dicomFiles, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID)

      Establish an association to the specified AE, send the instances contained in the files, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, int ourMaximumLengthReceived, int socketReceiveBufferSize, int socketSendBufferSize, SetOfDicomFiles dicomFiles, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID)

      Establish an association to the specified AE, send the instances contained in the files, and release the association.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      ourMaximumLengthReceived - the maximum PDU length that we will offer to receive
      socketReceiveBufferSize - the TCP socket receive buffer size to set (if possible), 0 means leave at the default
      socketSendBufferSize - the TCP socket send buffer size to set (if possible), 0 means leave at the default
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
    • StorageSOPClassSCU

      public StorageSOPClassSCU(String hostname, int port, String calledAETitle, String callingAETitle, Set setOfSOPClassUIDs, AttributeList[] lists, int compressionLevel, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID, int debugLevel)

      Establish an association to the specified AE, send the instances contained in the attribute lists, and release the association.

      Deprecated because establishing presentation contexts based on the set of SOP Classes without knowledge of the encoded Transfer Syntax may lead to failure during C-STORE because of inability to convert; also SLF4J is now used instead of debugLevel parameters to control debugging.

      Parameters:
      hostname - their hostname or IP address
      port - their port
      calledAETitle - their AE Title
      callingAETitle - our AE Title
      setOfSOPClassUIDs - the set of SOP Classes contained in the attribute lists
      lists - the attribute lists to send
      compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2
      multipleInstanceTransferStatusHandler - transfer handler for reporting pending status (may be null if not required)
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      debugLevel - ignored
  • Method Details

    • encounteredTrappedExceptions

      public boolean encounteredTrappedExceptions()
      Returns:
      true if in multiple instance constructors exceptions were trapped, e.g., connection or association failure before transfers attempted
    • sendOneSOPInstance

      protected boolean sendOneSOPInstance(Association association, String affectedSOPClass, String affectedSOPInstance, String inputTransferSyntaxUID, DicomInputStream din, byte presentationContextID, String outputTransferSyntaxUID) throws AReleaseException, DicomNetworkException, DicomException, IOException
      Parameters:
      association -
      affectedSOPClass -
      affectedSOPInstance -
      inputTransferSyntaxUID -
      din -
      presentationContextID -
      outputTransferSyntaxUID -
      Throws:
      IOException
      DicomException
      DicomNetworkException
      AReleaseException
    • sendOneSOPInstance

      protected boolean sendOneSOPInstance(Association association, String affectedSOPClass, String affectedSOPInstance, String inputTransferSyntaxUID, DicomInputStream din, byte presentationContextID, String outputTransferSyntaxUID, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID) throws AReleaseException, DicomNetworkException, DicomException, IOException
      Parameters:
      association -
      affectedSOPClass -
      affectedSOPInstance -
      inputTransferSyntaxUID -
      din -
      presentationContextID -
      outputTransferSyntaxUID -
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      Throws:
      IOException
      DicomException
      DicomNetworkException
      AReleaseException
    • sendOneSOPInstance

      protected boolean sendOneSOPInstance(Association association, String affectedSOPClass, String affectedSOPInstance, AttributeList list, byte presentationContextID, String outputTransferSyntaxUID, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID) throws AReleaseException, DicomNetworkException, DicomException, IOException
      Parameters:
      association -
      affectedSOPClass -
      affectedSOPInstance -
      list -
      presentationContextID -
      outputTransferSyntaxUID -
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      Throws:
      IOException
      DicomException
      DicomNetworkException
      AReleaseException
    • sendMultipleSOPInstances

      protected void sendMultipleSOPInstances(Association association, SetOfDicomFiles dicomFiles, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID) throws AReleaseException, DicomNetworkException, IOException

      Send the specified instances contained in the files over an existing association.

      Parameters:
      association - already existing association to SCP
      dicomFiles - the set of DICOM files containing names, SOP Class UIDs, SOP Instance UIDs and optionally Transfer Syntaxes
      multipleInstanceTransferStatusHandler - handler called after each transfer (may be null if not required)
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      Throws:
      AReleaseException
      DicomNetworkException
      IOException
    • sendMultipleSOPInstances

      protected void sendMultipleSOPInstances(Association association, AttributeList[] lists, MultipleInstanceTransferStatusHandler multipleInstanceTransferStatusHandler, String moveOriginatorApplicationEntityTitle, int moveOriginatorMessageID) throws AReleaseException, DicomNetworkException, IOException

      Send the specified instances contained in the attribute lists over an existing association.

      Parameters:
      association - already existing association to SCP
      lists - the array of attribute lists to send
      multipleInstanceTransferStatusHandler - handler called after each transfer (may be null if not required)
      moveOriginatorApplicationEntityTitle - the AET of the C-MOVE that originated this C-STORE, or null if none
      moveOriginatorMessageID - the MessageID of the C-MOVE that originated this C-STORE, or -1 if none
      Throws:
      AReleaseException
      DicomNetworkException
      IOException
    • main

      public static void main(String[] arg)

      For testing, establish an association to the specified AE and send one or more DICOM instances (C-STORE requests).

      Parameters:
      arg - array of five, six, seven or eight strings - their hostname, their port, their AE Title, our AE Title, the filename containing the instance to send (or a hyphen '-' if a list of one or more filenames is to be read from stdin) optionally the SOP Class and the SOP Instance (otherwise will be read from the file(s); if multiple files use an empty string for the SOP Instance), the compression level (0=none,1=propose deflate,2=propose deflate and bzip2)