Class DICOM_VR

java.lang.Object
gov.nih.mipav.model.dicomcomm.DICOM_VR

public class DICOM_VR extends Object
DICOM Value Representation. A VR is composed of 1. group 2. element 3. data
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 Summary

    Fields
    Modifier and Type
    Field
    Description
    byte[]
    Actual data array of the the VR.
    private int
    Inital DICOM type.
    int
    Represents the DICOM element number.
    int
    Represents the DICOM group number.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    DICOM_VR(int group, int element, byte[] data, int DDType)
    Creates a new DICOM_VR object.
    DICOM_VR(int group, int element, int val, int size)
    Creates a new DICOM_VR object.
    DICOM_VR(int group, int element, String strData, int DDType)
    Creates a new DICOM_VR object.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a deep copy the VR.
    private static String
    dataToString(DICOM_VR vr, int typeCode)
    Build a string reprsentation of the Data based on the VR type.
    final int
    Gets the index for this VR.
    final int
    Gets the type code for this VR.
    void
    initVR(int group, int element, byte[] data, int DDType)
    Initializes the VR.
    private static boolean
    isAlpha(byte ch)
    Determines if a byte is an alpha character.
    private static boolean
    isDataAlpha(byte[] data)
    Determines if data byte array is a string of characters.
    private void
    makeDataEven(byte[] _data)
    Make the length of the data buffer even by adding a space or null.
    static DICOM_VR
    readData(int group, int element, int length, DICOM_Comms vrBuffer)
    Reads a VR from a Buffer (network socket).
    Creates a string representation of this VR.
    static final long
    unsignedInt(int value)
    Converts value to an unsigned integer and returns it as a long.
    static final int
    unsignedShort(int value)
    Converts value to an unsigned short and returns it as an integer.
    static final void
    Writes a VR to a DICOM_Comms (network socket).
    static final void
    writeDataIn(DICOM_VR vr, DICOM_Comms vrBuffer, DICOM_FileIO ioBuffer)
    Writes a VR to a DICOM_Comms (network socket).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • data

      public byte[] data
      Actual data array of the the VR.
    • element

      public int element
      Represents the DICOM element number.
    • group

      public int group
      Represents the DICOM group number.
    • ddType

      private int ddType
      Inital DICOM type.
  • Constructor Details

    • DICOM_VR

      public DICOM_VR()
      Default constructor.
    • DICOM_VR

      public DICOM_VR(int group, int element, byte[] data, int DDType)
      Creates a new DICOM_VR object.
      Parameters:
      group - DICOM group number.
      element - DICOM element number.
      data - Actual data array of the the VR.
      DDType - DOCUMENT ME!
    • DICOM_VR

      public DICOM_VR(int group, int element, String strData, int DDType)
      Creates a new DICOM_VR object.
      Parameters:
      group - DICOM group number.
      element - DICOM element number.
      strData - String representation of the VR.
      DDType - Type of group, element tag
    • DICOM_VR

      public DICOM_VR(int group, int element, int val, int size)
      Creates a new DICOM_VR object.
      Parameters:
      group - DICOM group number.
      element - DICOM element number.
      val - Value of the VR.
      size - DOCUMENT ME!
  • Method Details

    • readData

      public static DICOM_VR readData(int group, int element, int length, DICOM_Comms vrBuffer) throws DICOM_Exception
      Reads a VR from a Buffer (network socket).
      Parameters:
      group - the group number
      element - the element number
      length - the length of the data to read
      vrBuffer - the DICOM_Comms to read from
      Returns:
      a created VR with the data inside
      Throws:
      DICOM_Exception - DOCUMENT ME!
    • unsignedInt

      public static final long unsignedInt(int value)
      Converts value to an unsigned integer and returns it as a long.
      Parameters:
      value - value to be converted to an unsigned short
      Returns:
      DOCUMENT ME!
    • unsignedShort

      public static final int unsignedShort(int value)
      Converts value to an unsigned short and returns it as an integer.
      Parameters:
      value - value to be converted to an unsigned short
      Returns:
      DOCUMENT ME!
    • writeData

      public static final void writeData(DICOM_VR vr, DICOM_Comms vrBuffer)
      Writes a VR to a DICOM_Comms (network socket).
      Parameters:
      vr - the VR to write
      vrBuffer - the DICOM_Comms to write to
    • writeDataIn

      public static final void writeDataIn(DICOM_VR vr, DICOM_Comms vrBuffer, DICOM_FileIO ioBuffer)
      Writes a VR to a DICOM_Comms (network socket).
      Parameters:
      vr - the VR to write
      vrBuffer - the DICOM_Comms to write to
      ioBuffer -
    • copy

      public DICOM_VR copy()
      Returns a deep copy the VR.
      Returns:
      DOCUMENT ME!
    • getDDType

      public final int getDDType()
      Gets the index for this VR.
      Returns:
      the index
    • getTypeCode

      public final int getTypeCode()
      Gets the type code for this VR.
      Returns:
      the type code
    • initVR

      public void initVR(int group, int element, byte[] data, int DDType)
      Initializes the VR.
      Parameters:
      group - DICOM group number.
      element - DICOM element number.
      data - the data associated with this VR
      DDType - DOCUMENT ME!
    • toString

      public String toString(String str)
      Creates a string representation of this VR.
      Parameters:
      str - VR information is concatenated to this string
      Returns:
      the debug string
    • dataToString

      private static String dataToString(DICOM_VR vr, int typeCode)
      Build a string reprsentation of the Data based on the VR type. Only used by the "toString" of this class.
      Parameters:
      vr - the data to converted into a string in this the value representation object
      typeCode - type of VR
      Returns:
      the string representation
    • isAlpha

      private static boolean isAlpha(byte ch)
      Determines if a byte is an alpha character.
      Parameters:
      ch - character to be tested
      Returns:
      true if byte is an alpha character else false
    • isDataAlpha

      private static boolean isDataAlpha(byte[] data)
      Determines if data byte array is a string of characters.
      Parameters:
      data - array of bytes
      Returns:
      if all bytes in data are alpha characters return true.
    • makeDataEven

      private void makeDataEven(byte[] _data)
      Make the length of the data buffer even by adding a space or null.
      Parameters:
      _data - Array that will be made to have an even length.