Class DICOM_Receiver

All Implemented Interfaces:
Observable, Runnable

public class DICOM_Receiver extends DICOM_PDUService implements 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 Details

    • crNum

      private static int crNum
      Used to number XRay image file names so that they are numbered differently.
    • acceptedSocket

      private 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 String defaultStorageDir
      DOCUMENT ME!
    • storageProperty

      private final String storageProperty
      A semicolon delimited list of the storage properties to use for this receiver
    • fileNameList

      private final Vector fileNameList
      DOCUMENT ME!
    • observerList

      private final 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 ServerSocket recSocket
      Socket manager.
    • runner

      Thread object manager for running receiver.
    • verification

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

    • DICOM_Receiver

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

      public DICOM_Receiver(String storageKey)
  • Method Details

    • 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:
    • clearChanged

      public void clearChanged()
      Description copied from interface: Observable
      Marks this object as no longer having been changed.
      Specified by:
      clearChanged in interface Observable
      See Also:
    • 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:
    • 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 interface Observable
      Parameters:
      o - an observer object.
      See Also:
    • 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 interface Observable
      See Also:
    • finalize

      public void finalize()
      DOCUMENT ME!
      Overrides:
      finalize in class DICOM_PDUService
    • getDefaultStorageDir

      public 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 interface Observable
      Returns:
      true if the object has changed.
      See Also:
    • 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(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:
    • receiverClient

      public void receiverClient(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 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 interface Observable
      See Also:
    • 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.