Class 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/
     
    • 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.
      • preambleBuffer

        private byte[] preambleBuffer
        DICOM part 10 preample buffer.
      • recSocket

        private java.net.ServerSocket recSocket
        Socket manager.
      • verification

        private final DICOM_Verification verification
        Reference to the DICOM verification object.
    • Constructor Detail

      • DICOM_Receiver

        public DICOM_Receiver()
        Constructor that starts the thread.
      • DICOM_Receiver

        public DICOM_Receiver​(java.lang.String storageKey)
    • 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 interface Observable
        Parameters:
        o - an observer object.
        See Also:
        Observable.addObserver(Observer)
      • countObservers

        public int countObservers()
        Description copied from interface: Observable
        Returns the number of the observers of this Observable object.
        Specified by:
        countObservers in interface Observable
        Returns:
        the number of the observers of this Observable object.
        See Also:
        Observable.countObservers()
      • 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.
      • 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 interface Observable
        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 interface java.lang.Runnable
      • setCancelled

        public void setCancelled​(boolean flag)
        Turns the cancelled flag on or off.
        Parameters:
        flag - indicator flag
      • 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.