Class GetSOPClassSCU


  • public class GetSOPClassSCU
    extends SOPClass

    This class implements the SCU role of C-GET SOP Classes.

    The class has no methods other than the constructor (and a main method for testing). The constructor establishes an association, sends the C-GET request, and releases the association. Any identifiers received are handled by the supplied IdentifierHandler. Any objects received are handled by the supplied ReceivedObjectHandler.

    Note the need to supply a list of supported Storage SOP Classes to be negotiated during association establishment - if the list is known a priori it should be supplied, otherwise a list of all known SOP Classes can be supplied; however, since the latter is rather large it can easily exceed the maximum number of presentation contexts allowed by the standard (128), hence considerable control is provided over the number of transfer syntaxes proposed, should it be necessary; when in doubt allow the SCP to choose from a list of multiple transfer syntaxes for each abstract syntax which consumes only a single presentation context.

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

    The main method is also useful in its own right as a command-line utility, which will store requested files in a specified directory.

    For example, to have GETSCU command GETSCP to get a single image instance of unknown SOP Class to GETSCU using the transfer syntax of the SCP's choice:

    try {
        AttributeList identifier = new AttributeList();
        { AttributeTag t = TagFromName.QueryRetrieveLevel; Attribute a = new CodeStringAttribute(t); a.addValue("IMAGE"); identifier.put(t,a); }
        { AttributeTag t = TagFromName.StudyInstanceUID; Attribute a = new UniqueIdentifierAttribute(t); a.addValue("1.3.6.1.4.1.5962.1.2.0.1064923879.2077.3232235877"); identifier.put(t,a); }
        { AttributeTag t = TagFromName.SeriesInstanceUID; Attribute a = new UniqueIdentifierAttribute(t); a.addValue("1.3.6.1.4.1.5962.1.3.0.0.1064923879.2077.3232235877"); identifier.put(t,a); }
        { AttributeTag t = TagFromName.SOPInstanceUID; Attribute a = new UniqueIdentifierAttribute(t); a.addValue("1.3.6.1.4.1.5962.1.1.0.0.0.1064923879.2077.3232235877"); identifier.put(t,a); }
        new GetSOPClassSCU("theirhost","104","GETSCP","GETSCU",SOPClass.StudyRootQueryRetrieveInformationModelGet,identifier,new IdentifierHandler(),"/tmp",new OurReceivedObjectHandler(),SOPClass.getSetOfStorageSOPClasses(),true,false,false,1);
    }
    catch (Exception e) {
        slf4jlogger.error("",e);
    }
     
    See Also:
    IdentifierHandler, ReceivedObjectHandler, PresentationContextListFactory
    • Constructor Detail

      • GetSOPClassSCU

        public GetSOPClassSCU​(java.lang.String hostname,
                              int port,
                              java.lang.String calledAETitle,
                              java.lang.String callingAETitle,
                              java.lang.String affectedSOPClass,
                              AttributeList identifier,
                              IdentifierHandler identifierHandler,
                              java.io.File savedImagesFolder,
                              StoredFilePathStrategy storedFilePathStrategy,
                              ReceivedObjectHandler receivedObjectHandler,
                              java.util.Set setOfStorageSOPClasses,
                              boolean theirChoice,
                              boolean ourChoice,
                              boolean asEncoded,
                              int debugLevel)
                       throws DicomNetworkException,
                              DicomException,
                              java.io.IOException

        Perform a C-GET.

        Parameters:
        hostname - their hostname or IP address
        port - their port
        calledAETitle - their AE Title
        callingAETitle - our AE Title
        affectedSOPClass - the SOP Class defining which query model, e.g. SOPClass.StudyRootQueryRetrieveInformationModelGet
        identifier - the list of unique keys and move level
        identifierHandler - the handler to use for each returned identifier
        savedImagesFolder - the folder in which to store received data sets (may be null, to ignore received data for testing)
        storedFilePathStrategy - the strategy to use for naming received files and folders
        receivedObjectHandler - the handler to call after each data set has been received and stored
        setOfStorageSOPClasses - the Set of Storage SOP Class UIDs (as String) that are acceptable
        theirChoice - propose a single presentation context with all transfer syntaxes to allow them to choose
        ourChoice - propose separate presentation contexts for each transfer syntax to allow us to choose
        asEncoded - propose a separate presentation context for the specified transfer syntax in which the data set is known to be encoded
        debugLevel - ignored
        Throws:
        java.io.IOException
        DicomException
        DicomNetworkException
      • GetSOPClassSCU

        public GetSOPClassSCU​(java.lang.String hostname,
                              int port,
                              java.lang.String calledAETitle,
                              java.lang.String callingAETitle,
                              java.lang.String affectedSOPClass,
                              AttributeList identifier,
                              IdentifierHandler identifierHandler,
                              java.io.File savedImagesFolder,
                              StoredFilePathStrategy storedFilePathStrategy,
                              ReceivedObjectHandler receivedObjectHandler,
                              java.util.Set setOfStorageSOPClasses,
                              int compressionLevel,
                              boolean theirChoice,
                              boolean ourChoice,
                              boolean asEncoded)
                       throws DicomNetworkException,
                              DicomException,
                              java.io.IOException

        Perform a C-GET.

        Parameters:
        hostname - their hostname or IP address
        port - their port
        calledAETitle - their AE Title
        callingAETitle - our AE Title
        affectedSOPClass - the SOP Class defining which query model, e.g. SOPClass.StudyRootQueryRetrieveInformationModelGet
        identifier - the list of unique keys and move level
        identifierHandler - the handler to use for each returned identifier
        savedImagesFolder - the folder in which to store received data sets (may be null, to ignore received data for testing)
        storedFilePathStrategy - the strategy to use for naming received files and folders
        receivedObjectHandler - the handler to call after each data set has been received and stored
        setOfStorageSOPClasses - the Set of Storage SOP Class UIDs (as String) that are acceptable
        compressionLevel - 0=none,1=propose deflate,2=propose deflate and bzip2,3=propose all known lossless,4-all propose all known lossless and lossy
        theirChoice - propose a single presentation context with all transfer syntaxes to allow them to choose
        ourChoice - propose separate presentation contexts for each transfer syntax to allow us to choose
        asEncoded - propose a separate presentation context for the specified transfer syntax in which the data set is known to be encoded
        Throws:
        java.io.IOException
        DicomException
        DicomNetworkException
      • GetSOPClassSCU

        public GetSOPClassSCU​(java.lang.String hostname,
                              int port,
                              java.lang.String calledAETitle,
                              java.lang.String callingAETitle,
                              java.lang.String affectedSOPClass,
                              AttributeList identifier,
                              IdentifierHandler identifierHandler,
                              java.io.File savedImagesFolder,
                              StoredFilePathStrategy storedFilePathStrategy,
                              ReceivedObjectHandler receivedObjectHandler,
                              java.util.Set setOfStorageSOPClasses,
                              boolean theirChoice,
                              boolean ourChoice,
                              boolean asEncoded)
                       throws DicomNetworkException,
                              DicomException,
                              java.io.IOException

        Perform a C-GET.

        Uses compressionLevel of 0 for generation of Presentation Contexts (i.e., propose only standard uncompressed Transfer Syntaxes)

        Parameters:
        hostname - their hostname or IP address
        port - their port
        calledAETitle - their AE Title
        callingAETitle - our AE Title
        affectedSOPClass - the SOP Class defining which query model, e.g. SOPClass.StudyRootQueryRetrieveInformationModelGet
        identifier - the list of unique keys and move level
        identifierHandler - the handler to use for each returned identifier
        savedImagesFolder - the folder in which to store received data sets (may be null, to ignore received data for testing)
        storedFilePathStrategy - the strategy to use for naming received files and folders
        receivedObjectHandler - the handler to call after each data set has been received and stored
        setOfStorageSOPClasses - the Set of Storage SOP Class UIDs (as String) that are acceptable
        theirChoice - propose a single presentation context with all transfer syntaxes to allow them to choose
        ourChoice - propose separate presentation contexts for each transfer syntax to allow us to choose
        asEncoded - propose a separate presentation context for the specified transfer syntax in which the data set is known to be encoded
        Throws:
        java.io.IOException
        DicomException
        DicomNetworkException
    • Method Detail

      • main

        public static void main​(java.lang.String[] arg)

        For testing, establish an association to the specified AE and perform a retrieve using a C-GET request.

        Parameters:
        arg - array of seven, eight or nine strings - their hostname, their port, their AE Title, our AE Title, the directory in which to store the incoming files, the retrieve level (STUDY, SERIES or IMAGE), then the Study Instance UID, optionally the Series Instance UID (if SERIES) and optionally the SOP Instance UID (if IMAGE)