Package com.pixelmed.apps

# Class InstanceReceiver

java.lang.Object
com.pixelmed.apps.InstanceReceiver

Direct Known Subclasses:
  `ProcessReceivedWholeSlideImagesMakeTiledPyramidAndSend`

public class InstanceReceiver extends Object

A class to wait for incoming composite instance storage operations and process each instance as it is received.

The `doSomethingWithReceivedDicomFile()` method may be implemented in a sub-class to actually do something more useful than just storing the files.

It is configured by use of a properties file that resides in the user's home directory in `.com.pixelmed.apps.ProcessReceivedWholeSlideImagesMakeTiledPyramidAndSend.properties`. The properties allow control over the user interface elements that are displayed and record the settings changed by the user when the application closes.

For a description of the network configuration properties, see `NetworkApplicationProperties`.

The properties that are specific to the application, and their default values, are as follows

`Application.SavedImagesFolderName=.com.pixelmed.apps.InstanceReceiver.receivedinstances` - where to store DICOM instances received

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static class`
`InstanceReceiver.OurReadTerminationStrategy`
`protected class`
`InstanceReceiver.OurReceivedObjectHandler`
`protected class`
`InstanceReceiver.ReceivedFileProcessor`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static String`
`defaultPropertiesFileName`
`protected String`
`defaultSavedImagesFolderName`
`protected NetworkApplicationInformationFederated`
`networkApplicationInformation`
`protected NetworkApplicationProperties`
`networkApplicationProperties`
`protected String`
`ourCalledAETitle`
`protected Properties`
`properties`
`protected static String`
`propertyName_SavedImagesFolderName`
`protected File`
`savedImagesFolder`
`protected StoredFilePathStrategy`
`storedFilePathStrategy`
`protected static final AttributeList.ReadTerminationStrategy`
`terminateAfterRelationshipGroup`

## Constructor Summary

Constructors
Constructor
Description
`InstanceReceiver(String propertiesFileName)`
Wait for incoming composite instance storage operations and process each instance as it is received.

## Method Summary

Modifier and Type
Method
Description
`void`
`activateStorageSCP()`
Start or restart DICOM storage listener.
`protected void`
`doSomethingWithReceivedDicomFile(String receivedFileName, String sourceApplicationEntityTitle, String transferSyntaxUID, String sopClassUID)`
Do something with the received DICOM file.
`protected static File`
`getFolderNameCreatingItIfNecessary(String folderName)`
Return the folder, creating it if necessary.
`protected void`
`loadProperties(String propertiesFileName)`
Load properties.
`static void`
`main(String[] arg)`
Wait for incoming composite instance storage operations and process each instance as it is received.
`void`
`shutdownStorageSCP()`
Shutdown DICOM storage listener.

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

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

## Field Details

### defaultPropertiesFileName

protected static String defaultPropertiesFileName

### propertyName_SavedImagesFolderName

protected static String propertyName_SavedImagesFolderName

### defaultSavedImagesFolderName

protected String defaultSavedImagesFolderName

### properties

protected Properties properties

### networkApplicationProperties

protected NetworkApplicationProperties networkApplicationProperties

### networkApplicationInformation

protected NetworkApplicationInformationFederated networkApplicationInformation

### ourCalledAETitle

protected String ourCalledAETitle

### savedImagesFolder

protected File savedImagesFolder

### storedFilePathStrategy

protected StoredFilePathStrategy storedFilePathStrategy

### terminateAfterRelationshipGroup

protected static final AttributeList.ReadTerminationStrategy terminateAfterRelationshipGroup

## Constructor Details

### InstanceReceiver

public InstanceReceiver(String propertiesFileName) throws DicomException, DicomNetworkException, IOException, InterruptedException

Wait for incoming composite instance storage operations and process each instance as it is received.

Parameters:
  `propertiesFileName` -
Throws:
  `DicomException`
  `DicomNetworkException`
  `IOException`
  `InterruptedException`

## Method Details

### loadProperties

protected void loadProperties(String propertiesFileName) throws IOException

Load properties.

Throws:
  `IOException` - thrown if properties file is missing

### doSomethingWithReceivedDicomFile

protected void doSomethingWithReceivedDicomFile(String receivedFileName, String sourceApplicationEntityTitle, String transferSyntaxUID, String sopClassUID)

Do something with the received DICOM file.

This method may be implemented in a sub-class to do something useful even if it is only logging to the user interface.

The default method does nothing.

This method is called on the ReceivedFileProcessor thread.

This method does not define any exceptions and hence must handle any errors locally.

Parameters:
  `receivedFileName` - the path name to a DICOM file
  `sourceApplicationEntityTitle` - the Application Entity from which the file was received
  `transferSyntaxUID` - the Transfer Syntax of the Data Set in the DICOM file
  `sopClassUID` - the SOP Class of the Data Set in the DICOM file

### getFolderNameCreatingItIfNecessary

protected static File getFolderNameCreatingItIfNecessary(String folderName) throws IOException

Return the folder, creating it if necessary.

If not an absolute path, will be sought or created relative to the current user's home directory.

Returns:
  the folder
Throws:
  `IOException`

### activateStorageSCP

public void activateStorageSCP() throws DicomException, IOException

Start or restart DICOM storage listener.

Shuts down existing listener, if any, so may be used to restart after configuration change.

Throws:
  `DicomException`
  `IOException`

### shutdownStorageSCP

public void shutdownStorageSCP()

Shutdown DICOM storage listener.

### main

public static void main(String[] arg)

Wait for incoming composite instance storage operations and process each instance as it is received.

Parameters:
  `arg` - none