Class StudyReceiver
A class to wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.
External (unsecure) SQL access to the database is possible if the Application.DatabaseServerName property is specified; further
details are described in com.pixelmed.database.DatabaseInformationModel
; for example:
% java -cp lib/additional/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing --url "jdbc:hsqldb:hsql://localhost/testserverdb"
For how to configure the necessary properties file, see:
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected static class
protected class
protected class
protected class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected File
protected DatabaseInformationModel
protected String
protected String
protected static String
protected String
protected String
protected String
protected String
protected String
protected static int
protected NetworkApplicationInformationFederated
protected NetworkApplicationProperties
protected String
protected Properties
protected static String
protected static String
protected static String
protected File
protected String
protected static int
protected String
protected StoredFilePathStrategy
protected String
protected String
protected String
protected static final AttributeList.ReadTerminationStrategy
-
Constructor Summary
ConstructorsConstructorDescriptionStudyReceiver
(String propertiesFileName) Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Start or restart DICOM storage listener.protected void
doSomethingWithProcessedDicomFile
(String processedFileName) Do something with the processed DICOM file.protected void
doSomethingWithReceivedDicomFile
(String receivedFileName, String sourceApplicationEntityTitle, String transferSyntaxUID, String sopClassUID) Do something with the received DICOM file.protected String
Get the date the package was built.protected File
getCompletedStudiesFolderNameCreatingItIfNecessary
(String completedStudiesFolderName) Return the folder, creating it if necessary.protected void
loadProperties
(String propertiesFileName) Load properties.static void
Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.protected boolean
processStudy
(String studyLocalPrimaryKeyValue) protected boolean
processStudyIfComplete
(String studyLocalPrimaryKeyValue) protected String
renameFileWithHierarchicalPathFromAttributes
(File file, AttributeList list, String hierarchicalFolderName, String duplicatesFolderNamePrefix) Rename a DICOM file into a folder hierarchy based on its attributes that are already available.void
Shutdown DICOM storage listener.protected void
updateStudyMostRecentInsertionTime
(String studyInstanceUID, long insertionTime)
-
Field Details
-
defaultPropertiesFileName
-
propertyName_CompletedStudiesFolderName
-
propertyName_SleepTimeBetweenPassesToProcessReceivedFiles
-
propertyName_IntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy
-
defaultCompletedStudiesFolderName
-
defaultSleepTimeBetweenPassesToProcessReceivedFiles
-
defaultIntervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy
-
sleepTimeBetweenPassesToProcessReceivedFiles
protected static int sleepTimeBetweenPassesToProcessReceivedFiles -
intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy
protected static int intervalAfterLastInstanceReceivedToWaitBeforeProcessingStudy -
properties
-
networkApplicationProperties
-
networkApplicationInformation
-
ourCalledAETitle
-
databaseInformationModel
-
buildDate
-
completedStudiesFolder
-
savedImagesFolder
-
storedFilePathStrategy
-
studyHasBeenProcessedColumnName
-
studyMostRecentInsertionTimeColumnName
-
instanceHasBeenProcessedColumnName
-
studyInstanceUIDColumnName
-
sopClassUIDColumnName
-
instanceLocalFileNameColumnName
-
instanceLocalFileReferenceTypeColumnName
-
instanceLocalPrimaryKeyColumnName
-
seriesLocalPrimaryKeyColumnName
-
terminateAfterRelationshipGroup
-
-
Constructor Details
-
StudyReceiver
public StudyReceiver(String propertiesFileName) throws DicomException, DicomNetworkException, IOException, InterruptedException Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.
- Parameters:
propertiesFileName
-- Throws:
DicomException
DicomNetworkException
IOException
InterruptedException
-
-
Method Details
-
getBuildDate
Get the date the package was built.
- Returns:
- the build date
-
loadProperties
Load properties.
- Throws:
IOException
- thrown if properties file is missing
-
renameFileWithHierarchicalPathFromAttributes
protected String renameFileWithHierarchicalPathFromAttributes(File file, AttributeList list, String hierarchicalFolderName, String duplicatesFolderNamePrefix) throws IOException, DicomException, NoSuchAlgorithmException Rename a DICOM file into a folder hierarchy based on its attributes that are already available.
Called by
processStudy()
for each file that has been received for a completed study.Override this method in a sub-class if you want to override the default folder structure used to store the received files, otherwise creates a folder structure using
com.pixelmed.dicom.MoveDicomFilesIntoHierarchy.renameFileWithHierarchicalPathFromAttributes()
.- Parameters:
file
- the DICOM filelist
- the attributes of the file (already read in)hierarchicalFolderName
- where to store the renamed fileduplicatesFolderNamePrefix
- where to store the renamed file if it is a non-identical duplicate of the existing file- Returns:
- the path to the new file if successful, null if not
- Throws:
IOException
- if an error occurs renaming the filesDicomException
- if there is an error parsing the attribute listNoSuchAlgorithmException
- if there is an error checking duplicate files contain identical content caused by absence of a hash algorithm
-
doSomethingWithProcessedDicomFile
Do something with the processed 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 WatchDatabaseAndProcessCompleteStudies thread.
This method does not define any exceptions and hence must handle any errors locally.
- Parameters:
processedFileName
- the path name to a DICOM file
-
processStudy
protected boolean processStudy(String studyLocalPrimaryKeyValue) throws DicomException, IOException, Exception - Throws:
DicomException
IOException
Exception
-
processStudyIfComplete
protected boolean processStudyIfComplete(String studyLocalPrimaryKeyValue) throws DicomException, IOException, Exception - Throws:
DicomException
IOException
Exception
-
updateStudyMostRecentInsertionTime
protected void updateStudyMostRecentInsertionTime(String studyInstanceUID, long insertionTime) throws DicomException - Throws:
DicomException
-
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 filesourceApplicationEntityTitle
- the Application Entity from which the file was receivedtransferSyntaxUID
- the Transfer Syntax of the Data Set in the DICOM filesopClassUID
- the SOP Class of the Data Set in the DICOM file
-
getCompletedStudiesFolderNameCreatingItIfNecessary
protected File getCompletedStudiesFolderNameCreatingItIfNecessary(String completedStudiesFolderName) 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
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
Wait for incoming composite instance storage operations and process when study is complete based on time since last instance received.
- Parameters:
arg
- none
-