Package gov.nih.mipav.model.dicomcomm
Class DICOM_VR
java.lang.Object
gov.nih.mipav.model.dicomcomm.DICOM_VR
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:
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a deep copy the VR.private static StringdataToString(DICOM_VR vr, int typeCode) Build a string reprsentation of the Data based on the VR type.final intGets the index for this VR.final intGets the type code for this VR.voidinitVR(int group, int element, byte[] data, int DDType) Initializes the VR.private static booleanisAlpha(byte ch) Determines if a byte is an alpha character.private static booleanisDataAlpha(byte[] data) Determines if data byte array is a string of characters.private voidmakeDataEven(byte[] _data) Make the length of the data buffer even by adding a space or null.static DICOM_VRreadData(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 longunsignedInt(int value) Converts value to an unsigned integer and returns it as a long.static final intunsignedShort(int value) Converts value to an unsigned short and returns it as an integer.static final voidwriteData(DICOM_VR vr, DICOM_Comms vrBuffer) Writes a VR to a DICOM_Comms (network socket).static final voidwriteDataIn(DICOM_VR vr, DICOM_Comms vrBuffer, DICOM_FileIO ioBuffer) Writes a VR to a DICOM_Comms (network socket).
-
Field Details
-
data
public byte[] dataActual data array of the the VR. -
element
public int elementRepresents the DICOM element number. -
group
public int groupRepresents the DICOM group number. -
ddType
private int ddTypeInital 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
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 numberelement- the element numberlength- the length of the data to readvrBuffer- 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
Writes a VR to a DICOM_Comms (network socket).- Parameters:
vr- the VR to writevrBuffer- the DICOM_Comms to write to
-
writeDataIn
Writes a VR to a DICOM_Comms (network socket).- Parameters:
vr- the VR to writevrBuffer- the DICOM_Comms to write toioBuffer-
-
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 VRDDType- DOCUMENT ME!
-
toString
Creates a string representation of this VR.- Parameters:
str- VR information is concatenated to this string- Returns:
- the debug string
-
dataToString
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 objecttypeCode- 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.
-