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 class
DICOM_Receiver.RunnerThread
Thread 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.Socket
acceptedSocket
Socket used to receive the data.private boolean
cancelled
Flag to indicate if the receive process should be cancelled.private boolean
changed
DOCUMENT ME!private static int
crNum
Used to number XRay image file names so that they are numbered differently.private java.lang.String
defaultStorageDir
DOCUMENT ME!private java.util.Vector
fileNameList
DOCUMENT ME!private java.util.Vector
observerList
DOCUMENT ME!private int
port
Port number used to accept data.private DICOM_Comms.ByteBuffer
pre_and_fullData
DOCUMENT ME!private byte[]
preambleBuffer
DICOM part 10 preample buffer.private java.net.ServerSocket
recSocket
Socket manager.private DICOM_Receiver.RunnerThread
runner
Thread object manager for running receiver.private java.lang.String
storageProperty
A semicolon delimited list of the storage properties to use for this receiverprivate DICOM_Verification
verification
Reference 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 void
addObserver(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 void
addPreambleAndGroupTwoTags(DICOM_Object dco)
Builds buffer of DICOM part 10 preamble and require Part 10 group 2 tags.void
clearChanged()
Marks this object as no longer having been changed.int
countObservers()
Returns the number of the observers of this Observable object.private boolean
createServerSocket()
Creates the initial server socket binded to the given port.void
deleteObserver(Observer o)
Deletes an observer from the set of observers of this object.void
deleteObservers()
Clears the observer list so that this object no longer has any observer.void
finalize()
DOCUMENT ME!java.lang.String
getDefaultStorageDir()
Returns the default storage directory for the received dicom files.boolean
hasChanged()
Test if this object has changed.boolean
isAlive()
Checks to see if the thread controlling the receivers execution is alive.void
mipavReceiver()
Starts the DICOM image receiver.void
notifyObservers(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.void
receiverClient(java.net.Socket socket)
Routine to Process a DICOM Store Request.void
resetPort(int port)
Resets the port and changes where the receiver is listening.void
run()
Run method so that this receiver can execute in its own thread.void
setCancelled(boolean flag)
Turns the cancelled flag on or off.void
setChanged()
Marks this object as having been changed.void
setStop()
Stops the receiver thread.void
start(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:Observable
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.- Specified by:
addObserver
in interfaceObservable
- Parameters:
o
- an observer object.- See Also:
Observable.addObserver(Observer)
-
clearChanged
public void clearChanged()
Description copied from interface:Observable
Marks this object as no longer having been changed.- Specified by:
clearChanged
in interfaceObservable
- See Also:
Observable.clearChanged()
-
countObservers
public int countObservers()
Description copied from interface:Observable
Returns the number of the observers of this Observable object.- Specified by:
countObservers
in 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:Observable
Deletes an observer from the set of observers of this object.- Specified by:
deleteObserver
in interfaceObservable
- Parameters:
o
- an observer object.- See Also:
Observable.deleteObserver(Observer)
-
deleteObservers
public void deleteObservers()
Description copied from interface:Observable
Clears the observer list so that this object no longer has any observer.- Specified by:
deleteObservers
in interfaceObservable
- See Also:
Observable.deleteObservers()
-
finalize
public void finalize()
DOCUMENT ME!- Overrides:
finalize
in 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:Observable
Test if this object has changed.- Specified by:
hasChanged
in 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:Observable
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.- Specified by:
notifyObservers
in 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:
run
in 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:Observable
Marks this object as having been changed.- Specified by:
setChanged
in 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.
-
-