Package gov.nih.mipav.model.dicomcomm
Class DICOM_Receiver
- java.lang.Object
-
- gov.nih.mipav.model.dicomcomm.DICOM_Comms
-
- gov.nih.mipav.model.dicomcomm.DICOM_PDUService
-
- gov.nih.mipav.model.dicomcomm.DICOM_Receiver
-
- All Implemented Interfaces:
Observable,java.lang.Runnable
public class DICOM_Receiver extends DICOM_PDUService implements java.lang.Runnable, Observable
This is the DICOM server class that hangs a listener on a given port for incoming image store requests from a remote DICOM client.
This DICOM communication package was originally based on the Java Dicom Package, whose license is below:Java Dicom Package (com.zmed.dicom) Copyright (c) 1996-1997 Z Medical Imaging Systems, Inc. This software is provided, as is, for non-commercial educational purposes only. Use or incorporation of this software or derivative works in commercial applications requires written consent from Z Medical Imaging Systems, Inc. Z MEDICAL IMAGING SYSTEMS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR CONFORMANCE TO ANY SPECIFICATION OR STANDARD. Z MEDICAL IMAGING SYSTEMS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING OR MODIFYING THIS SOFTWARE OR ITS DERIVATIVES. ============================================================================= This software package is implemented similarly to the UC Davis public domain C++ DICOM implementation which contains the following copyright notice: Copyright (C) 1995, University of California, Davis THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND THE UNIVERSITY OF CALIFORNIA DOES NOT MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH THE USER. Copyright of the software and supporting documentation is owned by the University of California, and free access is hereby granted as a license to use this software, copy this software and prepare derivative works based upon this software. However, any distribution of this software source code or supporting documentation or derivative works (source code and supporting documentation) must include this copyright notice. The UC Davis C++ source code is publicly available from the following anonymous ftp site: ftp://imrad.ucdmc.ucdavis.edu/pub/dicom/UCDMC/
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDICOM_Receiver.RunnerThreadThread manager for running the DICOM receiver.-
Nested classes/interfaces inherited from class gov.nih.mipav.model.dicomcomm.DICOM_Comms
DICOM_Comms.ByteBuffer
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.SocketacceptedSocketSocket used to receive the data.private booleancancelledFlag to indicate if the receive process should be cancelled.private booleanchangedDOCUMENT ME!private static intcrNumUsed to number XRay image file names so that they are numbered differently.private java.lang.StringdefaultStorageDirDOCUMENT ME!private java.util.VectorfileNameListDOCUMENT ME!private java.util.VectorobserverListDOCUMENT ME!private intportPort number used to accept data.private DICOM_Comms.ByteBufferpre_and_fullDataDOCUMENT ME!private byte[]preambleBufferDICOM part 10 preample buffer.private java.net.ServerSocketrecSocketSocket manager.private DICOM_Receiver.RunnerThreadrunnerThread object manager for running receiver.private java.lang.StringstoragePropertyA semicolon delimited list of the storage properties to use for this receiverprivate DICOM_VerificationverificationReference to the DICOM verification object.-
Fields inherited from class gov.nih.mipav.model.dicomcomm.DICOM_PDUService
abortRQ, associateAC, associateRJ, associateRQ, compData, dicomMessageDisplayer, findResults, ioBuffer, moveResults, pDataTF, PresentationContexts, proposedAbstractSyntaxs, releaseRQ, releaseRSP, socket
-
Fields inherited from class gov.nih.mipav.model.dicomcomm.DICOM_Comms
BIG_ENDIAN, breakSize, inBuffersLength, incomingBuffers, LITTLE_ENDIAN, MAX_READ_LENGTH, outBuffersLength, outgoingBuffers
-
-
Constructor Summary
Constructors Constructor Description DICOM_Receiver()Constructor that starts the thread.DICOM_Receiver(java.lang.String storageKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(Observer o)Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set.private voidaddPreambleAndGroupTwoTags(DICOM_Object dco)Builds buffer of DICOM part 10 preamble and require Part 10 group 2 tags.voidclearChanged()Marks this object as no longer having been changed.intcountObservers()Returns the number of the observers of this Observable object.private booleancreateServerSocket()Creates the initial server socket binded to the given port.voiddeleteObserver(Observer o)Deletes an observer from the set of observers of this object.voiddeleteObservers()Clears the observer list so that this object no longer has any observer.voidfinalize()DOCUMENT ME!java.lang.StringgetDefaultStorageDir()Returns the default storage directory for the received dicom files.booleanhasChanged()Test if this object has changed.booleanisAlive()Checks to see if the thread controlling the receivers execution is alive.voidmipavReceiver()Starts the DICOM image receiver.voidnotifyObservers(java.lang.Object obj)If this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.voidreceiverClient(java.net.Socket socket)Routine to Process a DICOM Store Request.voidresetPort(int port)Resets the port and changes where the receiver is listening.voidrun()Run method so that this receiver can execute in its own thread.voidsetCancelled(boolean flag)Turns the cancelled flag on or off.voidsetChanged()Marks this object as having been changed.voidsetStop()Stops the receiver thread.voidstart(int priority)Checks to see if a thread is already running on this object, and if not starts it.-
Methods inherited from class gov.nih.mipav.model.dicomcomm.DICOM_PDUService
addAbstractSyntax, addAllSupportedAbstractSyntaxes, addFindResultToList, addJustVerificationAbstractSyntax, close, connectClientToServer, getAAssociateRQ, getImplementationClassUID, getImplementationVersion, getLocalAppTitle, getTransferSyntaxID, handleConnectionFromServer, parseDICOMintoBuffer, parseDICOMIntoRawVR, parseRawVRIntoDICOM, parseServerInfo, readBinary, readDICOMDataObjectFromFile, readInObject, saveImageToFile, sendBinary, setDICOMMessageDisplayer, shouldWeAcceptLocalAppTitle, shouldWeAcceptRemoteAppTitle, showMessage, write, write
-
Methods inherited from class gov.nih.mipav.model.dicomcomm.DICOM_Comms
bufferToInt16, bufferToInt32, flush, flush, getIncomingEndian, getIncomingSize, getOutgoingEndian, getOutgoingSize, int16ToBuffer, int32ToBuffer, peekFirstByte, peekForEndOfSequence, read, read, readByte, readBytes, readFill, readInt32, readShort16, seekToEndOfGroupTwoTags, setIncomingEndianess, setOutgoingEndianess, write, write, writeByte, writeByteIn, writeIn, writeInt32, writeInt32In, writeShort16, writeShort16In
-
-
-
-
Field Detail
-
crNum
private static int crNum
Used to number XRay image file names so that they are numbered differently.
-
acceptedSocket
private java.net.Socket acceptedSocket
Socket used to receive the data.
-
cancelled
private boolean cancelled
Flag to indicate if the receive process should be cancelled. Cancel if true.
-
changed
private boolean changed
DOCUMENT ME!
-
defaultStorageDir
private java.lang.String defaultStorageDir
DOCUMENT ME!
-
storageProperty
private final java.lang.String storageProperty
A semicolon delimited list of the storage properties to use for this receiver
-
fileNameList
private final java.util.Vector fileNameList
DOCUMENT ME!
-
observerList
private final java.util.Vector observerList
DOCUMENT ME!
-
port
private int port
Port number used to accept data.
-
pre_and_fullData
private DICOM_Comms.ByteBuffer pre_and_fullData
DOCUMENT ME!
-
preambleBuffer
private byte[] preambleBuffer
DICOM part 10 preample buffer.
-
recSocket
private java.net.ServerSocket recSocket
Socket manager.
-
runner
private DICOM_Receiver.RunnerThread runner
Thread object manager for running receiver.
-
verification
private final DICOM_Verification verification
Reference to the DICOM verification object.
-
-
Method Detail
-
addObserver
public void addObserver(Observer o)
Description copied from interface:ObservableAdds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set.- Specified by:
addObserverin interfaceObservable- Parameters:
o- an observer object.- See Also:
Observable.addObserver(Observer)
-
clearChanged
public void clearChanged()
Description copied from interface:ObservableMarks this object as no longer having been changed.- Specified by:
clearChangedin interfaceObservable- See Also:
Observable.clearChanged()
-
countObservers
public int countObservers()
Description copied from interface:ObservableReturns the number of the observers of this Observable object.- Specified by:
countObserversin interfaceObservable- Returns:
- the number of the observers of this Observable object.
- See Also:
Observable.countObservers()
-
deleteObserver
public void deleteObserver(Observer o)
Description copied from interface:ObservableDeletes an observer from the set of observers of this object.- Specified by:
deleteObserverin interfaceObservable- Parameters:
o- an observer object.- See Also:
Observable.deleteObserver(Observer)
-
deleteObservers
public void deleteObservers()
Description copied from interface:ObservableClears the observer list so that this object no longer has any observer.- Specified by:
deleteObserversin interfaceObservable- See Also:
Observable.deleteObservers()
-
finalize
public void finalize()
DOCUMENT ME!- Overrides:
finalizein classDICOM_PDUService
-
getDefaultStorageDir
public java.lang.String getDefaultStorageDir()
Returns the default storage directory for the received dicom files.- Returns:
- the default storage directory for the received dicom files.
-
hasChanged
public boolean hasChanged()
Description copied from interface:ObservableTest if this object has changed.- Specified by:
hasChangedin interfaceObservable- Returns:
- true if the object has changed.
- See Also:
Observable.hasChanged()
-
isAlive
public boolean isAlive()
Checks to see if the thread controlling the receivers execution is alive.- Returns:
- flag indicating whether or not the thread is alive
-
mipavReceiver
public void mipavReceiver()
Starts the DICOM image receiver.
-
notifyObservers
public void notifyObservers(java.lang.Object obj)
Description copied from interface:ObservableIf this object has changed, as indicated by the hasChanged method, then notify all of its observers and then call the clearChanged method to indicate that this object has no longer changed.- Specified by:
notifyObserversin interfaceObservable- Parameters:
obj- the argument object- See Also:
Observable.notifyObservers(Object)
-
receiverClient
public void receiverClient(java.net.Socket socket)
Routine to Process a DICOM Store Request.- Parameters:
socket- this is a socket
-
resetPort
public void resetPort(int port)
Resets the port and changes where the receiver is listening.- Parameters:
port- port to listen on
-
run
public void run()
Run method so that this receiver can execute in its own thread.- Specified by:
runin interfacejava.lang.Runnable
-
setCancelled
public void setCancelled(boolean flag)
Turns the cancelled flag on or off.- Parameters:
flag- indicator flag
-
setChanged
public void setChanged()
Description copied from interface:ObservableMarks this object as having been changed.- Specified by:
setChangedin interfaceObservable- See Also:
Observable.setChanged()
-
setStop
public void setStop()
Stops the receiver thread.
-
start
public void start(int priority)
Checks to see if a thread is already running on this object, and if not starts it.- Parameters:
priority- thread priority
-
createServerSocket
private boolean createServerSocket()
Creates the initial server socket binded to the given port. If unable to be created, will return without having started the dicom receiver.- Parameters:
port-
-
addPreambleAndGroupTwoTags
private void addPreambleAndGroupTwoTags(DICOM_Object dco)
Builds buffer of DICOM part 10 preamble and require Part 10 group 2 tags.- Parameters:
dco- DICOM_Object DICOM command object needed to extract UID information to be included in the preample.
-
-